Public decryption
This document explains how to perform public decryption of FHEVM ciphertexts. Public decryption is required when you want everyone to see the value in a ciphertext, for example the result of private auction. Public decryption can be done using the Relayer HTTP endpoint.
HTTP Public Decrypt
Calling the public decryption endpoint of the Relayer can be done easily using the following code snippet.
// A list of ciphertexts handles to decrypt
const handles = [
'0x830a61b343d2f3de67ec59cb18961fd086085c1c73ff0000000000aa36a70000',
'0x98ee526413903d4613feedb9c8fa44fe3f4ed0dd00ff0000000000aa36a70400',
'0xb837a645c9672e7588d49c5c43f4759a63447ea581ff0000000000aa36a70700',
];
// The list of decrypted values
// results = {
// clearValues: {
// '0x830a61b343d2f3de67ec59cb18961fd086085c1c73ff0000000000aa36a70000': true,
// '0x98ee526413903d4613feedb9c8fa44fe3f4ed0dd00ff0000000000aa36a70400': 242n,
// '0xb837a645c9672e7588d49c5c43f4759a63447ea581ff0000000000aa36a70700': '0xfC4382C084fCA3f4fB07c3BCDA906C01797595a8'
// }
// abiEncodedClearValues: '0x.....'
// decryptionProof: '0x.....'
// }
const results: PublicDecryptResults = instance.publicDecrypt(handles);Onchain Public Decryption Verification
For more details about public decryption and on-chain decryption proof please refer to the on public decryption page.
Last updated