Expand description
Instructions provided by the ZK ElGamal 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-stateaccount.
In step 1, the zero-knowledge proof can either be included directly as the instruction data or pre-written to an account. The program determines the mode by inspecting the length of the instruction data.
Case A: Proof in a separate account If the instruction data is exactly 5 bytes (1-byte instruction discriminator + 4-byte unsigned integer for offset), the program assumes that the first account provided with the instruction contains the zero-knowledge proof. It then verifies the account data at the offset specified in the instruction.
Case B: Proof in instruction data If two additional accounts are provided (for the context state and its owner), the program interprets this as a request to store the proof’s context data and writes it to the specified context-state account.
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 as part of 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.
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
CloseContextStateinstruction.