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#
| Check | Passes when |
|---|---|
| Signature | The enclave's signing key signed this call, this input hash and this output hash. |
| Attestation record | The chain recorded that key in an attestation record under the configured attestation program, running software the model's owner allowed. |
| Expiry | The 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.
voynich verify <receipt address | call address | transaction signature>It needs no wallet. It prints verified, the three checks, the receipt and, when the receipt does not hold, the reason. Its exit code is 0 for a verified receipt and 1 otherwise. See CLI: verify.
import voynich from 'voynich'
const check = await voynich.verify(id)
console.log(check.verified, check.signature, check.record, check.expiry, check.reason)See SDK: verify.
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:
- Read the Receipt
The Receipt of a call is the account at the PDA
["receipt", call]of thevoynichprogram. 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. - Check the signature
Read the Enclave account the receipt names and take its
signing_key. Build the 114-byte message: the UTF-8 textvoynich/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. - 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'sallowed_measurements. - 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.
- 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_hashandoutput_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.