Call a model in five minutes

This page ends with an answer from sketch-32 that the caller alone can read, a receipt on chain, and three checks passed.

What it takes#

  • A Solana wallet that holds the model's price, the fee of one transaction and the rent of one Call account. The price of sketch-32 is in SOL and is shown on its page.
  • For the SDK and the CLI: Node 22 or later.

On the site#

  1. Open the model

    Go to /models/sketch-32. The page shows the model's facts, its ciphertext read from chain, the enclaves that hold it and the call panel.

  2. Connect a wallet

    The panel reads "Connect a wallet" until one is connected, then "Ready".

  3. Draw and call

    Draw one of the 32 things on the drawing surface and press Call. The drawing is encrypted in the browser to the enclave's key ("Encrypting the input").

  4. Sign once

    The wallet shows one transaction: it opens the call and moves the price into escrow ("Awaiting signature", then "Price in escrow").

  5. Read the answer

    The enclave answers ("Enclave answering"). The browser decrypts the answer and runs the three checks on its receipt. The panel reads "Verified" and shows the label, the checks and a link to the receipt at /receipts/<id>.

From code#

Shell
npm install voynich
export VOYNICH_API_URL=https://<api host>
export VOYNICH_KEYPAIR=<path to a Solana keypair file>
TypeScript
import voynich from 'voynich'

const pixels: number[] = new Array(784).fill(0)
const { output, receipt, verified } = await voynich.call('sketch-32', pixels)
console.log(output, receipt.address, verified)

pixels is the 28×28 drawing row by row, 0 for background and 1 for ink. A drawing can also be passed as strokes. Every form is in SDK: call.

What came back#

PartWhat it is
outputlabel, the thing the model saw, and scores, its five most probable labels with their probabilities.
receiptThe record on chain: the call, the model, the enclave, the hash of the encrypted input and of the encrypted output, the enclave's signature, the slot, and what was paid to whom.
verifiedTrue: the enclave's key signed this input and this output, the chain recorded that key under the configured attestation program running software the owner allowed, and the record was in force when the call settled.

The receipt stays. Anyone can check it again from its address: paste it at /receipts/<id> or see Verify a receipt.

When a call does not settle#

A call that the enclave has not settled by its deadline can be refunded in full. The site offers the refund on /account. See Refund a call.

Next#