Private inference

What Private, Zero retention and Anonymous mean for a prompt sent through XE, the attestations and receipts behind each, and how an app checks the proof before it trusts an answer.

When an app asks a model through XE, the prompt can be sealed on the person's device before it leaves. Who can read it then depends on the mode the app picks. Every answer comes with a receipt, and the app checks the receipt before it shows the answer. If a request can't get the mode it asked for, it fails. It never falls back to a lower one.

XE's own services in these modes run on XE's provider accounts and answer XE's own apps: XE AI Chat, XE Markets' AI Judge, the AI DAO demo and XE's agents. Your app, agent or DAO uses its own provider account through the XE Key Service, with the same sealing, attestations and receipts.

#The three modes

ModeGradeWho can read the prompt
PrivateprivateSealed on the device to an attested model enclave. Only that enclave can read it: not XE, not the relay, not the provider's staff.
Zero retentionzero_retentionSealed on the device to XE's attested relay. XE and the relay can't see it. The model provider sees it and keeps nothing, under its zero-retention terms.
AnonymousstandardSealed on the device to XE's attested relay, then sent on as the relay's own request, with no account, address or payment of yours. Not linked to you; the provider may keep it.

Grades rank private, then zero_retention, then standard. A minimum grade means that grade or a higher one.

Private comes in three shapes, depending on how the provider is built: sealed to the model's own attested key; sealed to an attested gateway, which passes the prompt to an attested model over a verified connection; or sealed to one attested model instance.

Zero retention rests on two things. The enclave part is proved by hardware: the relay's code is measured, and its keys exist only inside the measured enclave. The retention part is a promise in the provider's terms: the relay sends every call with retention turned off, refuses models that have no zero-retention endpoint, and refuses to sign a receipt if the provider that answered isn't on the zero-retention list. Hardware can't prove what a provider does after it answers.

Anonymous hides who asked, not what was asked. Use it when the content isn't sensitive but the link to the person is.

#How a request works

  1. The person's wallet derives an encryption key for the app. It never uses its signing key for this.
  2. The app reads the provider's or the relay's attestation from XE. Every node verified that attestation in consensus: the enclave's quote, the measured code, and the key it binds.
  3. The app seals the prompt to the attested key and sends it as the input of a service_request, paid from the person's account, for example with a spend permission. For your own app, that service is your grant on the Key Service.
  4. The enclave opens it, calls the model, seals the answer to the person's key and signs a receipt.
  5. XE's nodes check the result against the attestation, and the settle records it.
  6. The app checks the receipt, then opens the answer.

#Attestations on XE

Each service publishes a manifest with the code it may run, and each provider publishes attestation records:

ReadEndpointWhat matters
The serviceGET /servicesmanifest.grade, manifest.artifact.measurements (the allowed code), manifest.verification.mode (tee), version, retired
Its providersGET /services/{id}/providersaccount, active, enclave_key
A provider's attestationsGET /attest/{account}record.key (signs receipts), record.key_id, record.enc_key (seals prompts), record.measurement, record.tcb_status, record.not_after (nanoseconds)

A provider's record is live when not_after is still ahead and its measurement is in the service's allowed set. Use the newest version of a service that has an active provider with a live record.

This finds XE's attested zero-retention services on XE Sim Interop, for example to check what an answer in XE AI Chat rests on. It needs nothing but fetch:

typescript
const NODE = "https://xe-sim-interop.enter-38b.workers.dev";const get = async (path) => (await fetch(NODE + path)).json(); async function attestedServices(grade) {  const { services } = await get("/services");  const newest = new Map();  for (const s of services)    if (!s.retired && s.manifest.grade === grade && s.version > (newest.get(s.name)?.version ?? 0)) newest.set(s.name, s);  const out = [];  for (const s of newest.values()) {    const { providers } = await get(`/services/${s.id}/providers`);    const allowed = s.manifest.artifact?.measurements ?? [];    for (const p of providers.filter((p) => p.active)) {      const { attestations } = await get(`/attest/${p.account}`);      const live = attestations        .filter((a) => a.op === "attest" && BigInt(a.record.not_after) > BigInt(Date.now()) * 1_000_000n)        .at(-1);      if (live && allowed.includes(live.record.measurement))        out.push({          service: s.id,          version: s.version,          relay: { account: p.account, key: live.record.key, key_id: live.record.key_id, enc_key: live.record.enc_key, measurement: live.record.measurement },          attestation: live.block,          notAfter: new Date(Number(BigInt(live.record.not_after) / 1_000_000n)),        });    }  }  return out;} console.log(await attestedServices("zero_retention"));

Anonymous services carry no grade in their manifest. Their receipts say which tier they are, as below.

#Receipts

Private. XE's nodes verify the enclave's receipt in consensus before the settle: for a model's own key, its signature over model:sha256(sealed request):sha256(sealed answer); for a gateway, its receipt that the request it received is the one the app committed to, and that the answer is the output. The app checks the same receipt on the device.

Zero retention and Anonymous. The relay's output is JSON with three parts: the sealed answer (base64), the receipt (a JSON string) and sig, the relay's Ed25519 signature over SHA-256("xe/zdr/receipt/v1\n" ‖ receipt) with its attested key.

json
{  "v": 1, "kind": "xe-zdr-receipt", "grade": "zero_retention",  "relay": { "account": "…", "key_id": "…", "measurement": "<the relay's measured code>", "attestation": "<its attestation block>" },  "request_sha256": "<SHA-256 of the sealed request>",  "response_sha256": "<SHA-256 of the sealed answer>",  "model": "<as requested>", "served_model": "<as served>",  "policy": { "zdr": true, "data_collection": "deny", "zdr_list": true },  "usage": { "prompt_tokens": 10, "completion_tokens": 2 },  "time": 1792000000, "latency_ms": 812}

An Anonymous receipt has "grade": "standard", "tier": "anonymous" and "policy": { "zdr": false, "data_collection": "allow", "zdr_list": false, "routing": "anonymous" }.

#Checking a receipt

Accept an answer only when every check passes:

  1. the signature verifies under the relay's attested key;
  2. the receipt's grade is at least the one you asked for, and equals the grade you sealed for;
  3. the relay's key id and measurement match its live attestation, and the measurement is in the service's allowed set;
  4. request_sha256 is the hash of exactly what you sent, and response_sha256 the hash of what came back;
  5. for zero retention, policy.zdr and policy.zdr_list are true and policy.data_collection is deny; for Anonymous, tier and policy.routing are both anonymous.

Any failure is an error, with no fallback. This runs in a browser or in Node 22 and later:

typescript
const hex = (s) => Uint8Array.from(s.match(/../g), (h) => parseInt(h, 16));const toHex = (b) => Array.from(new Uint8Array(b), (x) => x.toString(16).padStart(2, "0")).join("");const sha256 = async (b) => new Uint8Array(await crypto.subtle.digest("SHA-256", b));const RANK = { standard: 0, zero_retention: 1, private: 2 }; // relay: the record from attestedServices(); envelope: the exact bytes you sent; output: the result's bytesasync function checkReceipt({ relay, envelope, output, minGrade }) {  const o = JSON.parse(new TextDecoder().decode(output));  if (o.xe_zdr !== 1) throw new Error("Not an xe-zdr-v1 output");  // 1. signed by the key the attestation binds  const digest = await sha256(new TextEncoder().encode("xe/zdr/receipt/v1\n" + o.receipt));  const key = await crypto.subtle.importKey("raw", hex(relay.key), "Ed25519", false, ["verify"]);  if (!(await crypto.subtle.verify("Ed25519", key, hex(o.sig), digest))) throw new Error("Not signed by the attested key");  const r = JSON.parse(o.receipt);  // 2, 3. the grade, the relay and its measured code  if (RANK[r.grade] < RANK[minGrade]) throw new Error(`Grade ${r.grade} is below ${minGrade}`);  if (r.relay.key_id !== relay.key_id || r.relay.measurement !== relay.measurement) throw new Error("Another relay");  // 5. what the grade promises  if (r.grade === "zero_retention" && !(r.policy.zdr && r.policy.data_collection === "deny" && r.policy.zdr_list))    throw new Error("Not zero-retention routing");  if (r.grade === "standard" && (r.tier !== "anonymous" || r.policy.routing !== "anonymous")) throw new Error("Not the Anonymous tier");  // 4. this request and this answer  if (r.request_sha256 !== toHex(await sha256(envelope))) throw new Error("A receipt for another request");  const answer = Uint8Array.from(atob(o.answer), (c) => c.charCodeAt(0));  if (r.response_sha256 !== toHex(await sha256(answer))) throw new Error("A receipt for another answer");  return { receipt: r, sealedAnswer: answer };}

Also check that the envelope you sent names the same relay key (relay_key_id, relay_enc_key) and your own response key. Then open the sealed answer with your X25519 key.

XE's kit does the sealing, all of these checks and the opening in two calls, in TypeScript (buildZdr and verifyZdr in @xe-network/protocol/zdr; sealAnonymous and verifyAnonymous for Anonymous) and in Rust (the xe-chat crate, which the iOS app uses). Both run the same test vectors.

#Making the network enforce a grade

A spend permission can carry a minimum grade: the grade line of its text. On networks with services grants, it becomes the grant's min_grade, and XE's nodes refuse to pay any provider below it, whatever the app does. See Spend permissions.

For the cryptography and the relay's design in more depth, see Private AI.