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

Function CreateBlindValueProof

src/blindpsbt.cpp:125–139  ·  view source on GitHub ↗

Create an explicit value rangeproof which proves that the commitment commits to an explicit value

Source from the content-addressed store, hash-verified

123
124// Create an explicit value rangeproof which proves that the commitment commits to an explicit value
125static bool CreateBlindValueProof(std::vector<unsigned char>& rangeproof, const uint256& value_blinder, const CAmount amount, const secp256k1_pedersen_commitment& value_commit, const secp256k1_generator& gen)
126{
127 // Prep rangeproof
128 size_t rangeproof_len = 5134;
129 rangeproof.resize(rangeproof_len);
130
131 // Generate a new random nonce
132 uint256 nonce;
133 GetStrongRandBytes(nonce.begin(), nonce.size());
134
135 // Make the rangeproof
136 int res = secp256k1_rangeproof_sign(secp256k1_blind_context, rangeproof.data(), &rangeproof_len, /* min_value */ amount, &value_commit, value_blinder.begin(), nonce.begin(), /* exp */ -1, /* min_bits */ 0, amount, /* message */ nullptr, /* message_len */ 0, /* extra_commit */ nullptr, /* extra_commit_len */ 0, &gen);
137 rangeproof.resize(rangeproof_len);
138 return res == 1;
139}
140
141bool CreateBlindValueProof(std::vector<unsigned char>& rangeproof, const uint256& value_blinder, const CAmount amount, const CConfidentialValue& conf_value, const CConfidentialAsset& conf_asset)
142{

Callers 2

BlindPSBTFunction · 0.85
FillPSBTDataMethod · 0.85

Calls 8

GetStrongRandBytesFunction · 0.85
resizeMethod · 0.45
beginMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected