Overview
TheverifyCiphertextCommitmentEquality function creates instructions to verify that an ElGamal ciphertext and a Pedersen commitment encrypt/encode the same plaintext message. This is useful for proving consistency between different encryption schemes without revealing the underlying value.
Function Signature
Parameters
Solana RPC client with rent exemption API support
Transaction signer that will pay for the account creation fees
The ciphertext-commitment equality 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 ciphertext-commitment equality proof instruction
Usage Examples
Basic Ephemeral Verification
Verify that a ciphertext and commitment encode the same value:With Context State Storage
Store the verified proof on-chain:Using Proof from Record Account
Reference proof data stored in a record account:Notes
Proof RequirementsThe proof must demonstrate that the ElGamal ciphertext and Pedersen commitment encode the same plaintext value. The prover needs:
- The ElGamal secret key
- The ciphertext
- The commitment and its opening
- The plaintext amount
Use Cases
- Proving consistency between ElGamal encryption and Pedersen commitments
- Verifying encrypted values match committed values in hybrid schemes
- Enabling interoperability between different cryptographic primitives
- Supporting confidential transactions that use both encryption types
Related Functions
verifyCiphertextCiphertextEquality- Verify two ciphertexts encrypt the same messageverifyZeroCiphertext- Verify a ciphertext encrypts zerocloseContextStateProof- Close a context state account