Private AI with self-destructing data. Get answers, plus on-chain proof we forgot
Enigma AI lets people use AI on sensitive documents and then proves the data is gone.
Hospitals, law firms and banks can't paste patient records or contracts into an AI tool. They can't tell where the data ends up or whether it ever gets deleted. A promise from the provider that it was deleted doesn't count as an audit trail. We wanted something you can check instead of trust.
Here's how a job works. You pick a file and your browser makes a one-time AES-256-GCM key and encrypts the file before it leaves your machine. The encrypted file goes to 0G Storage. You pay for the job from a prepaid USDT balance on Whitechain. The document text is then sent to a model running inside a TEE on 0G Compute, which returns the analysis along with an attestation. Our backend only passes this along and doesn't store or log it.
The browser encrypts the AI's answer with the same key and the backend saves that ciphertext on Arkiv with an expiry timer, anywhere from 5 minutes to 30 days. A receipt goes on-chain on Whitechain with the result hash and the TEE attestation hash. When the timer runs out, the browser wipes the key and Arkiv drops the entity, so whatever is left can never be decrypted.
The backend holds no keys and no plaintext at rest. Everything stored is ciphertext it can't read. One honest caveat is that the plaintext does pass through the backend on its way to the TEE. It is never written to disk, but you do have to trust that hop. We list this in docs/SECURITY.md.
The demo page shows a split screen. One side is what the user sees and the other is what the system holds, so you can watch the data get encrypted, processed and erased.
Built with Next.js, Tailwind, RainbowKit and wagmi on the frontend, client-side PDF, DOCX and XLSX parsing, a Solidity escrow contract tested with Hardhat, and a Node backend. We use 0G for storage and TEE inference, Arkiv for expiring result storage and Whitechain for payments and receipts.
Everything is one Next.js App Router app. The UI and the API live together: the API is route handlers under /api for jobs, infer, history, balance and a cron endpoint. It's styled with Tailwind, with RainbowKit and wagmi for the wallet. A separate Hardhat project holds the Solidity contract.
The encryption happens in the browser with the Web Crypto API. Each job gets a fresh AES-256-GCM key that lives in sessionStorage, and the file is encrypted before it goes anywhere. We parse PDF, DOCX and XLSX on the client so the raw document never has to reach our server to be read. The server only ever receives ciphertext and hashes, apart from the one hop to the TEE described below.
The contract (EnigmaAI.sol, on Whitechain testnet) is an escrow. A company deposits USDT, createJob locks the 0.50 USDT price, and completeJob releases it. completeJob requires an EIP-712 signature from our oracle key, with the chain ID and contract address in the domain so it can't be replayed on another chain. It stores resultHash, attestationHash and fileHash as the compliance receipt. If a job times out, refundJob returns the money. Whitechain has no real USDT on testnet, so we deployed a mock ERC20. Hardhat tests cover the lifecycle, credits and low-balance edge cases.
For inference we call 0G Compute with the 0gm-1.0-35b-a3b model and send the header X-0G-Provider-Trust-Mode: private. That restricts routing to TeeML providers (Intel TDX), and if none is available the request returns a 503 instead of quietly falling back to a non-TEE provider. We hash the returned attestation and put it on-chain. 0G Storage holds the encrypted uploads. There's also a direct mode: if the user's wallet is on the 0G testnet, the browser talks straight to the TEE provider using @0gfoundation/0g-compute-ts-sdk, so the plaintext skips our server completely. Otherwise it falls back to the proxy.
Arkiv is what makes the self-destruct real. The browser encrypts the AI result and our server writes it as an Arkiv entity with an expiry matching the job's TTL. When the entity expires the chain drops it, and the browser wipes the key at the same moment. The demo page shows both: the ciphertext query comes back empty and decryption fails. Having the expiry enforced by the protocol, and not by a cron job we run, is what makes the claim believable.
Hacky and notable things:

