Documentation

How Oath uses Compact

Midnight’s model is public ledger + private witnesses + circuits that prove the public state came from valid private execution. Oath is that model applied to an AI policy.

Three circuits

Device vault to Compact circuits to policy-bound model to public ledger

registerVault hashes a device secret into a subject, then writes ten field commitments. Plaintext is a witness. The ledger sees bytes.

publishPolicy binds an allowed bitmask, a purpose hash, an expiry, and a call cap to that subject.

attest re-derives the subject from the same secret, checks subset, opens only the requested bits, and writes prompt hash + output hash + binding hash. A replayed transcript fails.

Why this is the AI track

Redaction alone is a UI promise. Oath makes the promise a circuit: if the driver tries to feed diagnosis to the model and attest it, Compact throws diagnosis not allowed. The grant officer verifies the attestation without receiving SSN or medical text.

Run it

cd oath
npm install
npm test
npm run demo
npm run dev   # http://127.0.0.1:3040

contracts/oath.compact is the source of truth. src/lib/contract.ts is the Compact JavaScript implementation used for the demo — the same split Midnight’s compiler emits.

Back to the workspace