Decryption
Decrypt info in your smart contract
Smart contracts can trigger a public decryption of any ciphertext it has access to. This flow is asynchronous, the contract issues a request first and receives the decryption result in a callback function in a later block.
Inco will try calling the callback function once and won’t retry if it reverts.
Lets consider the following example where the sender of a confidential transfer decrypts if it has been successful:
The callback will always expect these three arguments:
requestId
: the unique id of the request, useful to track multiple requestsresult
: the result of the decryption (bool
oruint256
)data
: the arbitrary data passed to the callback
e.requestDecryption
returns a unique id for the request, which can be used to track multiple requests. It can be called
over an ebool
or an euint256
that the contract has access to.
Signature of the e.requestDecryption
function:
Was this page helpful?