Skip to content
Prashant Chaudhari
Go back

A bank statement goes in, a risk tier comes out: the trust model of an income oracle on Solana

Edit page

TL;DR: TIO scores a bank statement inside an AWS Nitro enclave, so no one, including me, reads it. It signs a risk tier, and a Solana program stores it. Anyone can check which code ran. The system is only as honest as four things you still trust: AWS Nitro and the enclave code, the Account Aggregator, one admin key, and a sandbox bank. This post lays out the trust model and its limits. The next two posts follow one session from the borrower to the Solana pool, and then look at what breaks first.

This is part 1 of 3 on how TEE Income Oracle works.

  1. A bank statement goes in, a risk tier comes out: the trust model of an income oracle on Solana
  2. My own server carries every byte and still can’t read or forge one: from borrower to Solana pool in six hops
  3. The crypto held, the restarts didn’t: what breaks first in an enclave oracle

A lender in India can read a borrower’s bank statement with the borrower’s consent, through the Account Aggregator (AA) system. The lender scores it and decides. The funder behind that lender sees none of this. They get a loan book and a promise that the income check ran honestly.

I built TEE Income Oracle (TIO) to test one idea: can the income check run somewhere nobody can read the statement, and still leave a receipt anyone can verify?

The “somewhere” is an enclave: a locked-down virtual machine on an AWS server (AWS Nitro). Not even the machine’s owner can read its memory, and it can produce a signed document that says which code it is running. I run mine on Marlin Oyster, a service that deploys and attests enclaves for you.

Scope: this is an MVP on Solana devnet, running against a sandbox bank I wrote, not a live bank. Every claim in this series is about that setup unless I say otherwise.

The question that shapes everything

The enclave that does the scoring runs on a machine I operate. So the first design question is: how does a host that carries every byte still fail to read or forge them?

Every decision in TIO answers that with one of two moves:

  1. A key is created inside the enclave and never leaves it.
  2. A key is compiled into the measured image, so the host can’t swap it.

If a design choice needs a third move, it is a trust assumption, and I list it as one.

The mental model

A bank statement goes into a sealed box. Only a risk tier comes out. Anyone can check that the box ran the published code.

That sentence makes three separate claims, and each one rests on something different:

ClaimWhat makes it trueWhat it doesn’t cover
Provenance: a licensed AA states the data came from the bankThe AA’s signature on the fetch response and on the consent, checked inside the enclave against keys compiled into the imageAccounts the borrower chose not to link. A dishonest AA, which is part of the trust base
Blind computation: nobody, including me, saw the dataThe decryption key and the request-signing key are created inside the enclaveAWS hardware and Marlin’s base image are trusted
Verifiable output: the tier came from this codeNitro remote attestation binds the enclave’s signing key to the image of this repo’s build; Solana stores the signed resultIn the MVP, an admin registers the attested key on chain after checking it off-chain

Here is who is trusted. Everything outside the enclave is treated as hostile, including my own gateway.

Trust zones of TEE Income Oracle Four zones. Untrusted: web app, gateway, Oyster host and verifier. Trusted: the Nitro enclave. External: the sandbox bank. Public on Solana: the oracle program with its enclave registry, the attestation service, and a demo lending pool. The web app talks to the gateway. The gateway sends encrypted and signed bytes through the host to the enclave, sends requests to the bank, and sends the signed result to the oracle program. The oracle writes the attestation to the attestation service, and the pool reads it. The verifier checks the enclave's attestation document against the oracle's registry. UNTRUSTED EXTERNAL TRUSTED PUBLIC: SOLANA requests result encrypted checks reads writes Web app Gateway Oyster host Verifier Sandbox bank + AA Enclave Rust core Demo pool SAS Oracle + registry
ZonePieces
UntrustedThe web app, the gateway (orchestrator and relayer), the Oyster host (a network proxy), and the verifier
ExternalThe sandbox bank (a mock bank and AA)
TrustedThe Nitro enclave and its scoring core, written in Rust
Public (Solana)The oracle program, the Solana Attestation Service (SAS), a standard way to store signed claims on chain, and a demo lending pool

Data flows like this. The web app talks to the gateway. The gateway passes ciphertext and signed bytes through the host to the enclave, and talks to the bank directly. It submits the enclave’s signed result to the oracle program, which creates an attestation in SAS. The pool reads that attestation. The verifier checks the enclave’s attestation document against the oracle’s registry.

The enclave is the only trusted piece, so it is small, public and attested. The gateway can delay, drop or censor a request. It cannot read the data or forge a tier.

The chain of six guarantees

The security argument is a chain. A weak link anywhere breaks the claim, so I name the weak one up front.

LinkGuaranteeMechanism
G1Input is genuineThe enclave verifies the AA signature with pinned keys before it parses anything
G2Only the enclave can decryptThe session key and the request-signing key are generated inside it
G3The code is the published codeThe image id, a fingerprint of the exact docker-compose file and images the enclave runs, is recomputed by the verifier from the compose file at the release tag
G4The signing key belongs to that codeThe Nitro attestation document carries the enclave’s public key
G5The chain accepts only that keyAn on-chain registry maps image id to attester key. This is the weak link: in the MVP an admin sets it
G6Consumers check what they readThe pool checks signer, schema, freshness, that the enclave build is approved and still active, and the policy hash (a fingerprint of the scoring thresholds)

G5 is the honest gap. Someone with the admin key could register a fake enclave. Anyone can re-run the verifier and spot it, because registry changes are public events, but that is detection, not prevention.

What this does not give you

Where to look yourself

The architecture doc is in the repo, and the verifier lets you check an attestation yourself:

Next: part 2 follows one session from the borrower to the Solana pool in six hops, and shows what my own gateway can and can’t do at each one.


Edit page
Share this post on:

Previous Post
My own server carries every byte and still can't read or forge one: from borrower to Solana pool in six hops
Next Post
Don't pass the signed bytes twice: verifying an enclave's signature in a Solana program