- 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.
ebool | euint8 | euint16 | euint32 | euint64 | euint128 | eaddress
required
Ciphertext handle
bool | uint8 | uint16 | uint32 | uint64 | uint128 | address
required
Decrypted value from
decryptForTxbytes
required
Threshold Network signature
publishDecryptResultBatch
Publishes multiple results in a single call. Typed overloads exist for every encrypted type: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.