Why ZKPoK?
A Zero-Knowledge Proof of Knowledge (ZKPoK) lets a user prove they know the plaintext behind an encrypted input, without revealing that plaintext. ZKPoKs protect against potential malicious vectors, including:- Malleability attacks: Without ZKPoK protection, attackers could transform observed ciphertexts into new valid-looking ones without knowing their contents, for example by combining them with encrypted zeros.
- Chosen ciphertext attacks (CCAs): Attackers submit modified ciphertexts and observe the results, potentially exploiting homomorphic operations to infer sensitive information or even recover the secret key.
Sending encrypted inputs
When providing ciphertexts as an input to a smart contract, users have to generate a ZKPoK and get a verification approval first. The Client SDK (@cofhe/sdk) and FHE.sol handle most of this work; the mechanism is described here end to end (also in the diagram below).
- The user encrypts the inputs and generates a ZK proof of knowledge for them.
- The user sends the ciphertexts and proofs to the ZK Verifier, as one batch.
- The ZK Verifier verifies each proof. If all are valid, it stores the encrypted values in the ciphertext database and signs one message approving the whole batch.
- The ZK Verifier returns the handles and the batch approval to the user.
- The user sends the handles and the approval as inputs to a contract call.
- The contract verifies the batch signature, approving the inputs and emitting
InputVerifiedper input, which anchors a commitment so each input becomes decryptable later. - The contract performs the actual logic.
Trust model
The ZK Verifier runs inside a hardware-attested TEE (Intel TDX). Its signing key is held as Shamir shares by independent partners and released only to the exact attested code image. Neither the operator nor anyone else can sign approvals outside the reviewed program. See Key Management for how shares are created and released. After a successful verification, the service stores the ciphertext bytes in the CT Server and archives the inputs and proofs for auditability. The signed message is verified onchain by the TaskManager usingecrecover; the verifier’s signer address is registered there as verifierSigner.
Signature format
For developers integrating without the SDK, the signature covers a batch digest. Each input is hashed, the hashes are concatenated in input order, and the digest of that concatenation is signed:recid value the service returns (0 or 1) must be adjusted to 27 or 28 for Solidity’s ecrecover.