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.First component of the Groth16 proof (G1 point)
Second component of the Groth16 proof (G2 point)
Third component of the Groth16 proof (G1 point)
Merkle tree root at the time the proof was generated. Must match a root in the tree’s history to be considered valid.
The public amount being transacted, calculated as
ext_amount + fee. This value is part of the zero-knowledge circuit’s public inputs.Hash of the external data (ExtData) that accompanies this transaction. Used to bind the proof to specific transaction parameters like recipient and fee.
Array of two nullifiers corresponding to the two input notes being spent. Each nullifier can only be used once, preventing double-spending.
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