MCPcopy Create free account
hub / github.com/ElementsProject/elements / GenerateOutputRangeproofNonce

Function GenerateOutputRangeproofNonce

src/blind.cpp:234–247  ·  view source on GitHub ↗

Creates ECDH nonce commitment using ephemeral key and output_pubkey

Source from the content-addressed store, hash-verified

232
233// Creates ECDH nonce commitment using ephemeral key and output_pubkey
234uint256 GenerateOutputRangeproofNonce(CTxOut& out, const CPubKey output_pubkey)
235{
236 // Generate ephemeral key for ECDH nonce generation
237 CKey ephemeral_key;
238 ephemeral_key.MakeNewKey(true);
239 CPubKey ephemeral_pubkey = ephemeral_key.GetPubKey();
240 assert(ephemeral_pubkey.size() == CConfidentialNonce::nCommittedSize);
241 out.nNonce.vchCommitment.resize(ephemeral_pubkey.size());
242 memcpy(&out.nNonce.vchCommitment[0], &ephemeral_pubkey[0], ephemeral_pubkey.size());
243 // Generate nonce
244 uint256 nonce = ephemeral_key.ECDH(output_pubkey);
245 CSHA256().Write(nonce.begin(), 32).Finalize(nonce.begin());
246 return nonce;
247}
248
249bool GenerateRangeproof(std::vector<unsigned char>& rangeproof, const std::vector<unsigned char*>& value_blindptrs, const uint256& nonce, const CAmount amount, const CScript& scriptPubKey, const secp256k1_pedersen_commitment& value_commit, const secp256k1_generator& gen, const CAsset& asset, std::vector<const unsigned char*>& asset_blindptrs)
250{

Callers 1

BlindTransactionFunction · 0.85

Calls 9

CSHA256Class · 0.85
MakeNewKeyMethod · 0.80
ECDHMethod · 0.80
GetPubKeyMethod · 0.45
sizeMethod · 0.45
resizeMethod · 0.45
FinalizeMethod · 0.45
WriteMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected