Overview
Grouped ciphertext validity functions create instructions to verify that grouped ElGamal ciphertexts are well-formed. These proofs ensure that a ciphertext encrypted to multiple public keys (handles) is correctly constructed, which is essential for confidential transfers involving multiple parties.Available Functions
verifyGroupedCiphertext2HandlesValidity
Verifies that a grouped ElGamal ciphertext with 2 handles is well-formed.verifyGroupedCiphertext3HandlesValidity
Verifies that a grouped ElGamal ciphertext with 3 handles is well-formed.Parameters
Both functions share the same parameter structure:Solana RPC client with rent exemption API support
Transaction signer that will pay for the account creation fees
The grouped ciphertext validity proof data. Can be either:
Uint8Array- Raw proof bytes for ephemeral verification{ account: Address; offset: number }- Reference to proof data stored in a record account
Optional context state configuration for storing the verified proof on-chain:
contextAccount: KeyPairSigner- New account to store the proofauthority: Address- Authority that can close the context account
ZK ElGamal Proof program address. Defaults to
ZK_ELGAMAL_PROOF_PROGRAM_ADDRESSReturns
Promise<Instruction[]> - Array of instructions to execute:
- Create context account instruction (if
contextStateis provided) - Verify grouped ciphertext validity proof instruction
Usage Examples
Verify 2-Handle Grouped Ciphertext
Verify a ciphertext encrypted to two public keys:Verify 3-Handle Grouped Ciphertext
Verify a ciphertext encrypted to three public keys:With Context State Storage
Store the verified proof on-chain:Notes
Grouped CiphertextsA grouped ciphertext encrypts the same value to multiple public keys simultaneously. This allows different parties to independently decrypt the same encrypted value, which is essential for confidential multi-party transactions.
Handle Count
- 2 handles: Typically used for source and destination in transfers
- 3 handles: Adds an auditor or third party that can also decrypt the value
Use Cases
- Verifying confidential transfer ciphertexts in token programs
- Ensuring encrypted amounts are accessible to all required parties
- Supporting auditable confidential transactions with multiple decryptors
- Implementing multi-party confidential protocols
Related Functions
verifyBatchedGroupedCiphertext2HandlesValidity- Verify multiple 2-handle grouped ciphertextsverifyBatchedGroupedCiphertext3HandlesValidity- Verify multiple 3-handle grouped ciphertextscloseContextStateProof- Close a context state account