commit()
SIP Protocol API Reference v0.7.0
SIP Protocol API Reference / commit
Function: commit()
Section titled “Function: commit()”commit(
value,blinding?):PedersenCommitment
Defined in: @sip-protocol/sdk/dist/index-BYZbDjal.d.ts:3573
Create a Pedersen commitment to a value
C = vG + rH
Where:
- v = value (the amount being committed)
- r = blinding factor (random, keeps value hidden)
- G = base generator
- H = independent generator (NUMS)
Parameters
Section titled “Parameters”bigint
The value to commit to (must be < curve order)
blinding?
Section titled “blinding?”Uint8Array<ArrayBufferLike>
Optional blinding factor (random 32 bytes if not provided)
Returns
Section titled “Returns”The commitment and blinding factor
Example
Section titled “Example”// Create a commitment to 100 tokensconst { commitment, blinding } = commit(100n)
// Later, prove the commitment contains 100const valid = verifyOpening(commitment, 100n, blinding)