Proof struct contains all the components of a Groth16 zero-knowledge proof and the public inputs required to verify a private transaction.
Structure Definition
All public inputs are encoded in big-endian format.[u8; 64]
required
First component of the Groth16 proof (G1 point)
[u8; 128]
required
Second component of the Groth16 proof (G2 point)
[u8; 64]
required
Third component of the Groth16 proof (G1 point)
[u8; 32]
required
Merkle tree root at the time the proof was generated. Must match a root in the tree’s history to be considered valid.
[u8; 32]
required
The public amount being transacted, calculated as
ext_amount + fee. This value is part of the zero-knowledge circuit’s public inputs.[u8; 32]
required
Hash of the external data (ExtData) that accompanies this transaction. Used to bind the proof to specific transaction parameters like recipient and fee.
[[u8; 32]; 2]
required
Array of two nullifiers corresponding to the two input notes being spent. Each nullifier can only be used once, preventing double-spending.
[[u8; 32]; 2]
required
Array of two commitments corresponding to the two output notes being created. These are added to the Merkle tree.
Usage
TheProof struct is used in both transact and transact_spl instructions:
Verification Process
- Root Verification: The
proof.rootmust exist in the Merkle tree’s root history - ExtData Hash: The
proof.ext_data_hashmust match the hash of the provided ExtData - Public Amount: The
proof.public_amountmust equalext_amount + fee - Cryptographic Proof: The Groth16 proof components (
proof_a,proof_b,proof_c) are verified against the circuit’s verifying key - Nullifiers: The
input_nullifiersmust not have been used before (enforced by PDA account creation)
Related Types
- ExtData - External transaction data that is hashed and verified against
ext_data_hash