Creates ECDH nonce commitment using ephemeral key and output_pubkey
| 232 | |
| 233 | // Creates ECDH nonce commitment using ephemeral key and output_pubkey |
| 234 | uint256 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 | |
| 249 | bool 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 | { |
no test coverage detected