Skip to content

commit()

SIP Protocol API Reference v0.7.0


SIP Protocol API Reference / 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)

bigint

The value to commit to (must be < curve order)

Uint8Array<ArrayBufferLike>

Optional blinding factor (random 32 bytes if not provided)

PedersenCommitment

The commitment and blinding factor

// Create a commitment to 100 tokens
const { commitment, blinding } = commit(100n)
// Later, prove the commitment contains 100
const valid = verifyOpening(commitment, 100n, blinding)