Decryption in CoFHE is a two-phase process:Documentation Index
Fetch the complete documentation index at: https://cofhe-docs.fhenix.zone/llms.txt
Use this file to discover all available pages before exploring further.
- On-chain: Mark a value as decryptable with
FHE.allowPublic(ctHash) - Off-chain: Client calls
decryptForTx(ctHash)via the SDK to get{ plaintext, signature } - On-chain: Submit the result via
publishDecryptResultorverifyDecryptResult
Publishing Results
publishDecryptResult
Publishes a decrypted result on-chain by verifying the Threshold Network signature. The plaintext is stored and can be read viagetDecryptResultSafe.
Ciphertext handle
Decrypted value from
decryptForTxThreshold Network signature
publishDecryptResultBatch
Publishes multiple results in a single call. Typed overloads exist for every encrypted type:| Handle array type | Result array type |
|---|---|
ebool[] | bool[] |
euint8[] | uint8[] |
euint16[] | uint16[] |
euint32[] | uint32[] |
euint64[] | uint64[] |
euint128[] | uint128[] |
eaddress[] | address[] |
The compiler resolves the overload from the handle array’s element type. There is also a “raw” overload that takes
uint256[] ctHashes if you only have raw handles to hand.Verifying Results
verifyDecryptResult
Verifies a Threshold Network signature without storing the plaintext on-chain. Returnsbool.
verifyDecryptResultSafe
LikeverifyDecryptResult, but returns false instead of reverting on invalid signature.
verifyDecryptResultBatch
Verifies multiple signatures in a single call. Returnstrue only if every entry is valid; reverts if any signature fails to recover (consistent with the single-entry verifyDecryptResult). Typed overloads exist for every encrypted type — same handle/result type table as publishDecryptResultBatch.
verifyDecryptResultBatchSafe
Returns abool[] indicating which entries are valid instead of reverting. Typed overloads cover every encrypted type — same handle/result type table as publishDecryptResultBatch.
The batch verify functions (
verifyDecryptResultBatch, verifyDecryptResultBatchSafe) were added in cofhe-contracts@v0.1.2. Earlier versions only exposed the single-entry verifyDecryptResult / verifyDecryptResultSafe.