Skip to main content
Attested compute allows to perform a computation on a handle completely off-chain and get the decryption attestation containing decryption result and attestation. Only handles that are allowed with e.allow() or e.reveal() can be used in computation. The attestation can then be verified on-chain to perform certain on-chain actions, avoiding unnecessary transaction.

Getting Started

Take this example contract that holds an encrypted credit score of a user, to determine whether they’re eligible for a loan:
Presume we want to know whether the credit score is greater than or equal 700 without sending an additional transaction. We can do that by calling attestedCompute (similar to Attested Decrypt):
Which is equivalent to:
isGreaterOrEqual also contains a signature from covalidator attesting to the computation, which can be used to submit decryption back on-chain, even if the handle doesn’t exist on chain yet.

Supported operations

  • Scalar binary operation - operation that takes in two operands, one of which is a handle and the second one is a number (aka scalar).

Compute with Allowance Voucher/Session Key

Compute on a handle can be performed with a session key instead of a wallet provider using attestedComputeWithVoucher(), see Allowance Voucher.