Umbra SDK Docs

IZkProver

Umbra SDK reference for IZk Prover.

client


Defined in: src/client/interface/zk-prover.ts:81

Abstract base class defining the contract for zero-knowledge proof generation.

Remarks

Implementations of this class must provide cryptographic proof generation capabilities for zero-knowledge operations on the Solana blockchain. All methods are asynchronous to support various proof generation backends (WASM, native libraries, remote services).

This interface supports multiple proof types including:

  • Master viewing key registration proofs
  • SPL token deposit proofs (with hidden and public amounts)
  • Deposit claim proofs with Merkle tree inclusion verification

Example

class WasmZkProver extends IZkProver {
  async generateMasterViewingKeyRegistrationProof(
    masterViewingKey: U128,
    poseidonBlindingFactor: U128,
    sha3BlindingFactor: U128,
    expectedPoseidonCommitment: PoseidonHash,
    expectedSha3Commitment: Sha3Hash
  ): Promise<[Groth16ProofABeBytes, Groth16ProofBBeBytes, Groth16ProofCBeBytes]> {
    // Implementation using WASM circuit
  }
  // ... other methods
}

Extended by

Constructors

Constructor

new IZkProver(): IZkProver

Returns

IZkProver

Methods

generateClaimSplDepositProof()

abstract generateClaimSplDepositProof(randomSecret, nullifier, masterViewingKey, merklePathElements, merklePathIndices, version, commitmentIndex, firstAddressLow, firstAddressHigh, secondAddressLow, secondAddressHigh, blockchainId, amount, year, month, day, hour, minute, seconds, mintPubkeyLow, mintPubkeyHigh, secondAddressBlindingFactor, relayerPubkeyLow, relayerPubkeyHigh, expectedVersion, expectedBlockchainId, expectedFirstAddressLow, expectedFirstAddressHigh, expectedAmount, expectedMintPubkeyLow, expectedMintPubkeyHigh, expectedMerkleRoot, expectedLinkerAddressHash, expectedNullifierHash, expectedSecondAddressKeccakAggregatedHash, expectedRelayerPubkeyLow, expectedRelayerPubkeyHigh): Promise<[BeBytes, BeBytes, BeBytes]>

Defined in: src/client/interface/zk-prover.ts:526

Generates a zero-knowledge proof for claiming an SPL token deposit.

Parameters

randomSecret

U128

Random secret used in the original deposit commitment (128-bit)

nullifier

U128

Nullifier secret to prevent double-spending (128-bit)

masterViewingKey

U128

Master viewing key for compliance linkage (128-bit)

merklePathElements

U256LeBytes[]

Array of sibling node hashes in the Merkle tree path

merklePathIndices

(0 | 1)[]

Array of path direction indices (0=left, 1=right) for each tree level

version

U8

Protocol version identifier

commitmentIndex

U128

Index of the commitment in the Merkle tree

firstAddressLow

U128

Low 128 bits of the first address (destination)

firstAddressHigh

U128

High 128 bits of the first address (destination)

secondAddressLow

U128

Low 128 bits of the second address (sender)

secondAddressHigh

U128

High 128 bits of the second address (sender)

blockchainId

U8

Blockchain/network identifier

amount

U128

Deposit amount (private, not revealed in proof)

year

I32

Transaction year

month

U32

Transaction month

day

U32

Transaction day

hour

U32

Transaction hour

minute

U32

Transaction minute

seconds

U32

Transaction seconds

mintPubkeyLow

U128

Low 128 bits of the SPL token mint public key

mintPubkeyHigh

U128

High 128 bits of the SPL token mint public key

secondAddressBlindingFactor

U128

Blinding factor for second address commitment (128-bit)

relayerPubkeyLow

U128

Low 128 bits of the relayer public key

relayerPubkeyHigh

U128

High 128 bits of the relayer public key

expectedVersion

U8

Expected protocol version for verification

expectedBlockchainId

U8

Expected blockchain identifier for verification

expectedFirstAddressLow

U128

Expected low 128 bits of first address

expectedFirstAddressHigh

U128

Expected high 128 bits of first address

expectedAmount

U128

Expected deposit amount for verification

expectedMintPubkeyLow

U128

Expected low 128 bits of mint public key

expectedMintPubkeyHigh

U128

Expected high 128 bits of mint public key

expectedMerkleRoot

U256LeBytes

Expected Merkle tree root hash

expectedLinkerAddressHash

U256LeBytes

Expected linker address hash commitment

expectedNullifierHash

U256LeBytes

Expected nullifier hash commitment

expectedSecondAddressKeccakAggregatedHash

U256LeBytes

Expected Keccak (SHA-3) aggregated hash for second address

expectedRelayerPubkeyLow

U128

Expected low 128 bits of relayer public key

expectedRelayerPubkeyHigh

U128

Expected high 128 bits of relayer public key

Returns

Promise<[BeBytes, BeBytes, BeBytes]>

A promise resolving to a tuple of Groth16 proof components (A, B, C) in big-endian byte format

Throws

ZkProverError When proof generation fails due to invalid inputs, circuit errors, Merkle path validation failures, or computation errors

Remarks

This proof demonstrates knowledge of a deposit commitment and its inclusion in the Merkle tree. The proof verifies the Merkle path, nullifier, and all expected commitments. The amount remains private in the proof. Used for privacy-preserving deposit claims in the Umbra protocol.

Example

const proof = await prover.generateClaimSplDepositProof(
  randomSecret,
  nullifier,
  masterViewingKey,
  merklePathElements,
  merklePathIndices,
  version,
  commitmentIndex,
  firstAddressLow,
  firstAddressHigh,
  secondAddressLow,
  secondAddressHigh,
  blockchainId,
  amount,
  year, month, day, hour, minute, seconds,
  mintPubkeyLow,
  mintPubkeyHigh,
  secondAddressBlindingFactor,
  relayerPubkeyLow,
  relayerPubkeyHigh,
  expectedVersion,
  expectedBlockchainId,
  expectedFirstAddressLow,
  expectedFirstAddressHigh,
  expectedAmount,
  expectedMintPubkeyLow,
  expectedMintPubkeyHigh,
  expectedMerkleRoot,
  expectedLinkerAddressHash,
  expectedNullifierHash,
  expectedSecondAddressKeccakAggregatedHash,
  expectedRelayerPubkeyLow,
  expectedRelayerPubkeyHigh
);

generateClaimSplDepositWithHiddenAmountProof()

abstract generateClaimSplDepositWithHiddenAmountProof(randomSecret, nullifier, masterViewingKey, merkleSiblingPathElements, merkleSiblingPathIndicies, version, commitmentIndex, destinationAddressLow, destinationAddressHigh, senderAddressLow, senderAddressHigh, blockchainId, amount, year, month, day, hour, minute, second, mintPublicKeyLow, mintPublicKeyHigh, secondAddressBlindingFactor, commissionFeeLowerBound, commissionFeeUpperBound, relayerPubkeyLow, relayerPubkeyHigh, expectedVersion, expectedFirstAddressLow, expectedFirstAddressHigh, expectedBlockchainId, expectedMerkleRoot, expectedLinkerAddressHash, expectedNullifierHash, expectedSecondAddressSha3AggregatedHash, expectedLowerBound, expectedUpperBound, expectedMintPubkeyLow, expectedMintPubkeyHigh, expectedRelayerPubkeyLow, expectedRelayerPubkeyHigh): Promise<[BeBytes, BeBytes, BeBytes]>

Defined in: src/client/interface/zk-prover.ts:396

Generates a zero-knowledge proof for claiming an SPL token deposit with a hidden amount.

Parameters

randomSecret

U128

Random secret used in the original deposit commitment (128-bit)

nullifier

U128

Nullifier secret to prevent double-spending (128-bit)

masterViewingKey

U128

Master viewing key for compliance linkage (128-bit)

merkleSiblingPathElements

U256LeBytes[]

Array of sibling node hashes in the Merkle tree path

merkleSiblingPathIndicies

(0 | 1)[]

Array of path direction indices (0=left, 1=right) for each tree level

version

1

Protocol version identifier (must be 1)

commitmentIndex

U128

Index of the commitment in the Merkle tree

destinationAddressLow

U128

Low 128 bits of the destination address

destinationAddressHigh

U128

High 128 bits of the destination address

senderAddressLow

U128

Low 128 bits of the sender address

senderAddressHigh

U128

High 128 bits of the sender address

blockchainId

1

Blockchain/network identifier (must be 1)

amount

U128

Deposit amount (private, not revealed in proof)

year

I32

Transaction year

month

U32

Transaction month

day

U32

Transaction day

hour

U32

Transaction hour

minute

U32

Transaction minute

second

U32

Transaction second

mintPublicKeyLow

U128

Low 128 bits of the SPL token mint public key

mintPublicKeyHigh

U128

High 128 bits of the SPL token mint public key

secondAddressBlindingFactor

U128

Blinding factor for second address commitment (128-bit)

commissionFeeLowerBound

U128

Lower bound for commission fee

commissionFeeUpperBound

U128

Upper bound for commission fee

relayerPubkeyLow

U128

Low 128 bits of the relayer public key

relayerPubkeyHigh

U128

High 128 bits of the relayer public key

expectedVersion

1

Expected protocol version for verification (must be 1)

expectedFirstAddressLow

U128

Expected low 128 bits of first address

expectedFirstAddressHigh

U128

Expected high 128 bits of first address

expectedBlockchainId

1

Expected blockchain identifier for verification (must be 1)

expectedMerkleRoot

U256LeBytes

Expected Merkle tree root hash

expectedLinkerAddressHash

U256LeBytes

Expected linker address hash commitment

expectedNullifierHash

U256LeBytes

Expected nullifier hash commitment

expectedSecondAddressSha3AggregatedHash

U256LeBytes

Expected SHA-3 aggregated hash for second address

expectedLowerBound

U128

Expected commission fee lower bound

expectedUpperBound

U128

Expected commission fee upper bound

expectedMintPubkeyLow

U128

Expected low 128 bits of mint public key

expectedMintPubkeyHigh

U128

Expected high 128 bits of mint public key

expectedRelayerPubkeyLow

U128

Expected low 128 bits of relayer public key

expectedRelayerPubkeyHigh

U128

Expected high 128 bits of relayer public key

Returns

Promise<[BeBytes, BeBytes, BeBytes]>

A promise resolving to a tuple of Groth16 proof components (A, B, C) in big-endian byte format

Throws

ZkProverError When proof generation fails due to invalid inputs, circuit errors, Merkle path validation failures, or computation errors

Remarks

This proof demonstrates knowledge of a deposit commitment and its inclusion in the Merkle tree without revealing the deposit amount. The proof verifies the Merkle path, nullifier, and all expected commitments. Used for privacy-preserving deposit claims in the Umbra protocol.

Example

const proof = await prover.generateClaimSplDepositWithHiddenAmountProof(
  randomSecret,
  nullifier,
  masterViewingKey,
  merkleSiblingPathElements,
  merkleSiblingPathIndicies,
  1, // version
  commitmentIndex,
  destinationAddressLow,
  destinationAddressHigh,
  senderAddressLow,
  senderAddressHigh,
  1, // blockchainId
  amount,
  year, month, day, hour, minute, second,
  mintPublicKeyLow,
  mintPublicKeyHigh,
  secondAddressBlindingFactor,
  commissionFeeLowerBound,
  commissionFeeUpperBound,
  relayerPubkeyLow,
  relayerPubkeyHigh,
  1, // expectedVersion
  expectedFirstAddressLow,
  expectedFirstAddressHigh,
  1, // expectedBlockchainId
  expectedMerkleRoot,
  expectedLinkerAddressHash,
  expectedNullifierHash,
  expectedSecondAddressSha3AggregatedHash,
  expectedLowerBound,
  expectedUpperBound,
  expectedMintPubkeyLow,
  expectedMintPubkeyHigh,
  expectedRelayerPubkeyLow,
  expectedRelayerPubkeyHigh
);

generateCreateSplDepositWithHiddenAmountProof()

abstract generateCreateSplDepositWithHiddenAmountProof(masterViewingKey, poseidonBlindingFactor, destinationAddressLow, destinationAddressHigh, randomSecret, nullifier, amount, relayerFee, commissionFeeLowBound, commissionFeeHighBound, commissionFeeBps, year, month, day, hour, minute, second, expectedYear, expectedMonth, expectedDay, expectedHour, expectedMinute, expectedSecond, expectedLinkerAddressHash, expectedDepositDataHash, expectedOnChainMvkHash, expectedSha3AggregatedHash, expectedRelayerFee, expectedCommissionFeeLowBound, expectedCommissionFeeHighBound, expectedCommissionFeeBps): Promise<[BeBytes, BeBytes, BeBytes]>

Defined in: src/client/interface/zk-prover.ts:189

Generates a zero-knowledge proof for creating an SPL token deposit with a hidden amount.

Parameters

masterViewingKey

U128

Master viewing key for compliance linkage (128-bit)

poseidonBlindingFactor

U128

Blinding factor for Poseidon commitments (128-bit)

destinationAddressLow

U128

Low 128 bits of the destination address

destinationAddressHigh

U128

High 128 bits of the destination address

randomSecret

U128

Random secret for commitment privacy (128-bit)

nullifier

U128

Nullifier secret to prevent double-spending (128-bit)

amount

U128

Deposit amount (private, not revealed in proof)

relayerFee

U128

Fee paid to the relayer

commissionFeeLowBound

U128

Lower bound for commission fee

commissionFeeHighBound

U128

Upper bound for commission fee

commissionFeeBps

U16

Commission fee in basis points

year

I32

Transaction year

month

U32

Transaction month

day

U32

Transaction day

hour

U32

Transaction hour

minute

U32

Transaction minute

second

U32

Transaction second

expectedYear

I32

Expected year for verification

expectedMonth

U32

Expected month for verification

expectedDay

U32

Expected day for verification

expectedHour

U32

Expected hour for verification

expectedMinute

U32

Expected minute for verification

expectedSecond

U32

Expected second for verification

expectedLinkerAddressHash

U256LeBytes

Expected linker address hash commitment

expectedDepositDataHash

U256LeBytes

Expected deposit data hash commitment

expectedOnChainMvkHash

U256LeBytes

Expected on-chain master viewing key hash

expectedSha3AggregatedHash

U256LeBytes

Expected SHA-3 aggregated hash commitment

expectedRelayerFee

U128

Expected relayer fee for verification

expectedCommissionFeeLowBound

U128

Expected commission fee lower bound

expectedCommissionFeeHighBound

U128

Expected commission fee upper bound

expectedCommissionFeeBps

U16

Expected commission fee in basis points

Returns

Promise<[BeBytes, BeBytes, BeBytes]>

A promise resolving to a tuple of Groth16 proof components (A, B, C) in big-endian byte format

Throws

ZkProverError When proof generation fails due to invalid inputs, circuit errors, or computation failures

Remarks

This proof creates a deposit commitment where the amount is hidden (private). The proof verifies that all expected commitments match while keeping the actual deposit amount private. Used for privacy-preserving token deposits in the Umbra protocol.

Example

const proof = await prover.generateCreateSplDepositWithHiddenAmountProof(
  masterViewingKey,
  poseidonBlindingFactor,
  destinationAddressLow,
  destinationAddressHigh,
  randomSecret,
  nullifier,
  amount,
  relayerFee,
  commissionFeeLowBound,
  commissionFeeHighBound,
  commissionFeeBps,
  year, month, day, hour, minute, second,
  expectedYear, expectedMonth, expectedDay, expectedHour, expectedMinute, expectedSecond,
  expectedLinkerAddressHash,
  expectedDepositDataHash,
  expectedOnChainMvkHash,
  expectedSha3AggregatedHash,
  expectedRelayerFee,
  expectedCommissionFeeLowBound,
  expectedCommissionFeeHighBound,
  expectedCommissionFeeBps
);

generateCreateSplDepositWithPublicAmountProof()

abstract generateCreateSplDepositWithPublicAmountProof(masterViewingKey, poseidonBlindingFactor, destinationAddressLow, destinationAddressHigh, randomSecret, nullifier, amount, year, month, day, hour, minute, second, expectedAmount, expectedYear, expectedMonth, expectedDay, expectedHour, expectedMinute, expectedSecond, expectedLinkerAddressHash, expectedDepositDataHash, expectedOnChainMvkHash): Promise<[BeBytes, BeBytes, BeBytes]>

Defined in: src/client/interface/zk-prover.ts:277

Generates a zero-knowledge proof for creating an SPL token deposit with a public amount.

Parameters

masterViewingKey

U128

Master viewing key for compliance linkage (128-bit)

poseidonBlindingFactor

U128

Blinding factor for Poseidon commitments (128-bit)

destinationAddressLow

U128

Low 128 bits of the destination address

destinationAddressHigh

U128

High 128 bits of the destination address

randomSecret

U128

Random secret for commitment privacy (128-bit)

nullifier

U128

Nullifier secret to prevent double-spending (128-bit)

amount

U128

Deposit amount (public, revealed in proof)

year

I32

Transaction year

month

U32

Transaction month

day

U32

Transaction day

hour

U32

Transaction hour

minute

U32

Transaction minute

second

U32

Transaction second

expectedAmount

U128

Expected deposit amount for verification

expectedYear

I32

Expected year for verification

expectedMonth

U32

Expected month for verification

expectedDay

U32

Expected day for verification

expectedHour

U32

Expected hour for verification

expectedMinute

U32

Expected minute for verification

expectedSecond

U32

Expected second for verification

expectedLinkerAddressHash

U256LeBytes

Expected linker address hash commitment

expectedDepositDataHash

U256LeBytes

Expected deposit data hash commitment

expectedOnChainMvkHash

U256LeBytes

Expected on-chain master viewing key hash

Returns

Promise<[BeBytes, BeBytes, BeBytes]>

A promise resolving to a tuple of Groth16 proof components (A, B, C) in big-endian byte format

Throws

ZkProverError When proof generation fails due to invalid inputs, circuit errors, or computation failures

Remarks

This proof creates a deposit commitment where the amount is public (revealed). The proof verifies that the deposit amount matches the expected value and that all commitments are valid. Used for transparent token deposits where amount visibility is required.

Example

const proof = await prover.generateCreateSplDepositWithPublicAmountProof(
  masterViewingKey,
  poseidonBlindingFactor,
  destinationAddressLow,
  destinationAddressHigh,
  randomSecret,
  nullifier,
  amount,
  year, month, day, hour, minute, second,
  expectedAmount,
  expectedYear, expectedMonth, expectedDay, expectedHour, expectedMinute, expectedSecond,
  expectedLinkerAddressHash,
  expectedDepositDataHash,
  expectedOnChainMvkHash
);

generateMasterViewingKeyRegistrationProof()

abstract generateMasterViewingKeyRegistrationProof(masterViewingKey, poseidonBlindingFactor, sha3BlindingFactor, expectedPoseidonCommitment, expectedSha3Commitment): Promise<[BeBytes, BeBytes, BeBytes]>

Defined in: src/client/interface/zk-prover.ts:111

Generates a zero-knowledge proof for master viewing key registration.

Parameters

masterViewingKey

U128

The master viewing key to register (128-bit unsigned integer)

poseidonBlindingFactor

U128

Blinding factor for Poseidon hash commitment (128-bit)

sha3BlindingFactor

U128

Blinding factor for SHA-3 hash commitment (128-bit)

expectedPoseidonCommitment

U256LeBytes

Expected Poseidon hash commitment to verify against

expectedSha3Commitment

U256LeBytes

Expected SHA-3 hash commitment to verify against

Returns

Promise<[BeBytes, BeBytes, BeBytes]>

A promise resolving to a tuple of Groth16 proof components (A, B, C) in big-endian byte format

Throws

ZkProverError When proof generation fails due to invalid inputs, circuit errors, or computation failures

Remarks

This proof demonstrates knowledge of a master viewing key and its corresponding blinding factors without revealing the actual key. The proof verifies that the commitments match the expected values. Used for privacy-preserving key registration in the Umbra protocol.

Example

const proof = await prover.generateMasterViewingKeyRegistrationProof(
  masterViewingKey,
  poseidonBlindingFactor,
  sha3BlindingFactor,
  expectedPoseidonCommitment,
  expectedSha3Commitment
);
const [proofA, proofB, proofC] = proof;

On this page

RemarksExampleExtended byConstructorsConstructorReturnsMethodsgenerateClaimSplDepositProof()ParametersrandomSecretnullifiermasterViewingKeymerklePathElementsmerklePathIndicesversioncommitmentIndexfirstAddressLowfirstAddressHighsecondAddressLowsecondAddressHighblockchainIdamountyearmonthdayhourminutesecondsmintPubkeyLowmintPubkeyHighsecondAddressBlindingFactorrelayerPubkeyLowrelayerPubkeyHighexpectedVersionexpectedBlockchainIdexpectedFirstAddressLowexpectedFirstAddressHighexpectedAmountexpectedMintPubkeyLowexpectedMintPubkeyHighexpectedMerkleRootexpectedLinkerAddressHashexpectedNullifierHashexpectedSecondAddressKeccakAggregatedHashexpectedRelayerPubkeyLowexpectedRelayerPubkeyHighReturnsThrowsRemarksExamplegenerateClaimSplDepositWithHiddenAmountProof()ParametersrandomSecretnullifiermasterViewingKeymerkleSiblingPathElementsmerkleSiblingPathIndiciesversioncommitmentIndexdestinationAddressLowdestinationAddressHighsenderAddressLowsenderAddressHighblockchainIdamountyearmonthdayhourminutesecondmintPublicKeyLowmintPublicKeyHighsecondAddressBlindingFactorcommissionFeeLowerBoundcommissionFeeUpperBoundrelayerPubkeyLowrelayerPubkeyHighexpectedVersionexpectedFirstAddressLowexpectedFirstAddressHighexpectedBlockchainIdexpectedMerkleRootexpectedLinkerAddressHashexpectedNullifierHashexpectedSecondAddressSha3AggregatedHashexpectedLowerBoundexpectedUpperBoundexpectedMintPubkeyLowexpectedMintPubkeyHighexpectedRelayerPubkeyLowexpectedRelayerPubkeyHighReturnsThrowsRemarksExamplegenerateCreateSplDepositWithHiddenAmountProof()ParametersmasterViewingKeyposeidonBlindingFactordestinationAddressLowdestinationAddressHighrandomSecretnullifieramountrelayerFeecommissionFeeLowBoundcommissionFeeHighBoundcommissionFeeBpsyearmonthdayhourminutesecondexpectedYearexpectedMonthexpectedDayexpectedHourexpectedMinuteexpectedSecondexpectedLinkerAddressHashexpectedDepositDataHashexpectedOnChainMvkHashexpectedSha3AggregatedHashexpectedRelayerFeeexpectedCommissionFeeLowBoundexpectedCommissionFeeHighBoundexpectedCommissionFeeBpsReturnsThrowsRemarksExamplegenerateCreateSplDepositWithPublicAmountProof()ParametersmasterViewingKeyposeidonBlindingFactordestinationAddressLowdestinationAddressHighrandomSecretnullifieramountyearmonthdayhourminutesecondexpectedAmountexpectedYearexpectedMonthexpectedDayexpectedHourexpectedMinuteexpectedSecondexpectedLinkerAddressHashexpectedDepositDataHashexpectedOnChainMvkHashReturnsThrowsRemarksExamplegenerateMasterViewingKeyRegistrationProof()ParametersmasterViewingKeyposeidonBlindingFactorsha3BlindingFactorexpectedPoseidonCommitmentexpectedSha3CommitmentReturnsThrowsRemarksExample