Expand description
Instructions provided by the ZK Token proof
program.
There are two types of instructions in the proof program: proof verification instructions
and the CloseContextState
instruction.
Each proof verification instruction verifies a certain type of zero-knowledge proof. These instructions are processed by the program in two steps:
- The program verifies the zero-knowledge proof.
- The program optionally stores the context component of the zero-knowledge proof to a
dedicated
context-state
account.
In step 1, the zero-knowledge proof can be included directly as the instruction data or pre-written to an account. The program determines whether the proof is provided as instruction data or pre-written to an account by inspecting the length of the data. If the instruction data is exactly 5 bytes (instruction disciminator + unsigned 32-bit integer), then the program assumes that the first account provided with the instruction contains the zero-knowledge proof and verifies the account data at the offset specified in the instruction data. Otherwise, the program assumes that the zero-knowledge proof is provided as part of the instruction data.
In step 2, the program determines whether to create a context-state account by inspecting the number of accounts provided with the instruction. If two additional accounts are provided with the instruction after verifying the zero-knowledge proof, then the program writes the context data to the specified context-state account.
NOTE: A context-state account must be pre-allocated to the exact size of the context data that is expected for a proof type before it is included in a proof verification instruction.
The CloseContextState
instruction closes a context state account. A transaction containing
this instruction must be signed by the context account’s owner. This instruction can be used by
the account owner to reclaim lamports for storage.
Re-exports§
pub use crate::instruction::*;
Structs§
- Context
State Info - Pubkeys associated with a context state account to be used as parameters to functions.
Enums§
Functions§
- close_
context_ state - Create a
CloseContextState
instruction. - verify_
batched_ grouped_ ciphertext_ 3_ handles_ validity - Create a
VerifyBatchedGroupedCiphertext3HandlesValidity
instruction. - verify_
batched_ verify_ range_ proof_ u64 - Create a
VerifyBatchedRangeProofU64
instruction. - verify_
batched_ verify_ range_ proof_ u128 - Create a
VerifyBatchedRangeProofU128
instruction. - verify_
batched_ verify_ range_ proof_ u256 - Create a
VerifyBatchedRangeProofU256
instruction. - verify_
ciphertext_ ciphertext_ equality - Create a
VerifyCiphertextCiphertextEquality
instruction. - verify_
ciphertext_ commitment_ equality - Create a
VerifyCiphertextCommitmentEquality
instruction. - verify_
grouped_ ciphertext_ 3_ handles_ validity - Create a
VerifyGroupedCipehrtext3HandlesValidity
instruction. - verify_
pubkey_ validity - Create a
VerifyPubkeyValidity
instruction. - verify_
range_ proof_ u64 - Create a
VerifyRangeProofU64
instruction. - verify_
transfer - Create a
VerifyTransfer
instruction. - verify_
transfer_ with_ fee - Create a
VerifyTransferWithFee
instruction. - verify_
withdraw - Create a
VerifyWithdraw
instruction. - verify_
zero_ balance - Create a
VerifyZeroBalance
instruction.