Skip to main content

Attested Compute

Attested Compute evaluates a comparison on an encrypted handle off-chain and returns a covalidator-signed result ("0" or "1") plus an Ed25519 instruction for on-chain verification. Use this when you need a predicate (for example balance > 100) without decrypting the raw value, and optionally want to prove that result on-chain.
Only addresses that have been allowed on the handle can request attested compute. The covalidator checks the on-chain allowance PDA before decrypting.

Import

Basic Usage

How It Works

  1. Your wallet signs ${op}:${lhsHandle}:${rhsPlaintext} to prove control of address
  2. Covalidator verifies the signature and the on-chain allowance for (handle, address)
  3. Covalidator decrypts the handle, runs the comparison, and signs SHA256(handle || result) (same attestation format as Attested Decrypt)
  4. The SDK returns the boolean result and an ed25519Instruction you can prepend to an on-chain verification transaction

Supported Operations

rhsPlaintext is a scalar (bigint or boolean). Booleans are normalized to 1n / 0n.

Example: Credit Check Without Revealing the Score

This is equivalent to evaluating creditScore >= 700 without ever revealing the raw score to the client as a plaintext integer.

React Integration


API Reference

attestedCompute(args, options)

Parameters:
  • args: AttestedComputeArgs
  • options: AttestedComputeOptions
Returns: Promise<AttestedComputeResult>

Types

signMessage can come from a wallet adapter (wallet.signMessage) or, for tests:

Error Handling

Errors


Compute with Allowance Voucher / Session Key

Compute can be performed with a session key instead of the wallet using attestedComputeWithVoucher():
See Allowance Voucher for full details.

When to Use Attested Compute