Verify a receipt

A receipt can be checked by anyone, at any time, without trusting the caller, the owner, the operator or the API. All it takes is the receipt's address, its call's address or the signature of the transaction that settled it.

The three checks#

CheckPasses when
SignatureThe enclave's signing key signed this call, this input hash and this output hash.
Attestation recordThe chain recorded that key in an attestation record under the configured attestation program, running software the model's owner allowed.
ExpiryThe record was in force at the slot the call settled.

What each one proves is in Calls and receipts.

Run them#

Open /receipts, paste a receipt address, a call address or a transaction signature and press Verify. The receipt's page at /receipts/<id> shows the receipt and runs the checks in the browser. Each check is a row that turns from pending to passed or failed, and the page ends on Verified or Not verified. Verify again runs them once more.

To verify without relying on the API's own RPC, give the SDK a connection to an RPC you trust: createVoynich({ apiUrl, connection }).

By hand#

The checks need only chain accounts and an Ed25519 verification. With any Solana RPC:

  1. Read the Receipt

    The Receipt of a call is the account at the PDA ["receipt", call] of the voynich program. Confirm it is owned by the program, then read its fields at the offsets in Accounts: Receipt: the call, the model, the enclave, both hashes, the signature and the slot.

  2. Check the signature

    Read the Enclave account the receipt names and take its signing_key. Build the 114-byte message: the UTF-8 text voynich/receipt/v1, the call address, the input hash and the output hash, with nothing between them. Verify the receipt's 64-byte signature over that message with the signing key.

  3. Check the record

    Read the Config at PDA ["config"] for the attestation program and the layout version. Derive the record's address, the PDA ["record", signing_key] of that attestation program, and confirm the Enclave names it and that the record is owned by that program. Decode it with the layout in Enclaves and attestation. Confirm it names the same signing key and that its measurement is in the Model's allowed_measurements.

  4. Check the expiry

    Confirm the record's recorded slot is at or before the receipt's slot and its expiry slot is after it. When the record's recorded slot is later than the receipt's slot, the enclave has attested again since: read the record as it was at the receipt's slot from the attestation program's events in the transaction history of the record's address.

  5. If you hold the envelopes

    A caller who kept the input envelope it sent and the output envelope it received hashes each with SHA-256 and compares them with the receipt's input_hash and output_hash. That ties the receipt to the exact bytes exchanged.

A program can make the first step on chain, in the same transaction that acts on the answer: see Reading a receipt from another program.