Overview
ThecloseContextStateProof function creates an instruction to close a context state account that was created during proof verification. This allows you to reclaim the rent exemption balance stored in the account.
Function Signature
Parameters
Address of the context state account to close
Authority that was specified when creating the context state account. Must sign the transaction.
Address that will receive the reclaimed rent lamports from the closed account
ZK ElGamal Proof program address. Defaults to
ZK_ELGAMAL_PROOF_PROGRAM_ADDRESSReturns
Instruction - Single instruction to close the context state account
Usage Example
Basic Context State Closure
Close a context state account after verification:Closing Multiple Context States
Close multiple context state accounts in a single transaction:Notes
Authority RequirementThe
authority parameter must match the authority that was specified when creating the context state account. This authority must sign the transaction.Rent ReclamationWhen a context state account is closed, all lamports (rent exemption balance) are transferred to the specified
destination address.Use Cases
- Cleaning up context state accounts after proof verification is no longer needed
- Reclaiming rent from temporary proof storage
- Managing on-chain storage costs by closing unused accounts
- Batch closing multiple context states to reduce account clutter
Context State Account Types
Context state accounts can be created by various verification functions:verifyZeroCiphertextverifyCiphertextCiphertextEqualityverifyPubkeyValidityverifyBatchedRangeProofU64/U128/U256
closeContextStateProof.
Related Functions
verifyZeroCiphertext- Create context state for zero-ciphertext proofsverifyCiphertextCiphertextEquality- Create context state for equality proofsverifyPubkeyValidity- Create context state for public key validity proofs