Ephemeral

Healthcare data marketplace where AI trains on hospital data in a TEE

Ephemeral

Created At

ETHGlobal Mumbai

Project Description

Ephemeral is a confidential healthcare data marketplace. AI teams can train models on hospital data without anyone, including us, ever seeing a patient record.

The problem: hospitals hold some of the most valuable training data in the world, but privacy laws (HIPAA, GDPR, India’s DPDP Act) stop them from handing raw records to AI vendors. Meanwhile, AI models are running out of public data to learn from. Today’s answer is a centralized clean room or data broker, and that center is exactly what leaks. Datavant, a leader in health data linking, had a single phished employee mailbox expose names, Social Security numbers and health data, which ended in a $900K class-action settlement. Ephemeral removes the center: the model travels to the data, and the data never travels.

How it works:

A hospital publishes a dataset. The file is encrypted with AES-256-GCM in the browser, and the key is split into Shamir shares. The ciphertext is uploaded to Ethereum Swarm and locked with an Access Control Trie (ACT), so only keys on its grantee list can decrypt it. Buyers only ever see a synthetic preview of the schema. The dataset is then registered with its price on our coordinator contract on Base. An AI company picks a dataset, uploads its model encrypted to Swarm, and pays in USDC. The coordinator’s factory deploys an isolated escrow vault for that job alone, so funds are never pooled. The payment is split on-chain the moment the job is funded: 95% to the hospital, 2.5% Ephemeral fee, and 2.5% storage reserve. The storage reserve is swapped through 1inch Fusion+ to xBZZ on Gnosis to keep the encrypted data paid for on Swarm. Funding the vault emits an event that triggers our Chainlink CRE workflow, which runs inside a TEE (AWS Nitro). The workflow: reads the dataset record from the coordinator over Confidential HTTP, with a secret held in the Vault DON, adds the enclave’s key to the dataset’s ACT so only the TEE can decrypt runs the job in memory and uploads the output encrypted for the builder posts a DON-signed report on-chain On success, the vault pays the hospital. On failure, the builder is refunded, and if the deadline passes the builder can reclaim the funds directly. Nobody approves payouts by hand. Open datasets go through Arkiv instead. Public CSVs are split into 60 KB chunks and stored as Arkiv entities with a catalog entry. The marketplace queries them by owner and rebuilds them for free download, which brings AI teams in at zero cost.

The whole app is censorship-resistant: its files live on Ethereum Swarm and are served through ENS at ephemeralglobal.eth.limo. The coordinator and vault factory are deployed on Base mainnet.

Current status: the CRE workflow runs in simulation with a placeholder preprocessing step and a mock enclave measurement. Next, we’re deploying it to a production DON with real hardware attestation, supporting many concurrent jobs per dataset, and adding verified onboarding for hospitals and AI companies.

Built solo with Solidity (Foundry), Chainlink CRE, Ethereum Swarm (Bee), Arkiv, Base, Gnosis, 1inch Fusion+, React, Astro and wagmi.

How it's Made

Ephemeral is a monorepo of four parts that I built and wired together : Solidity contracts, a TypeScript Ethereum Swarm library, a Chainlink CRE workflow, and an Astro + React frontend.

  1. Smart contracts (Foundry, OpenZeppelin)

EphemeralBaseCoordinator on Base is the registry and lifecycle controller. Hospitals register datasets with their encrypted Swarm reference, ACT grantee list, ACT history ref, synthetic-schema ref, feed manifest and USDC price. When an AI company calls createTrainingJob():

EphemeralBaseVaultFactory deploys an isolated EphemeralBaseJobVault for that job, so funds are never pooled. 97.5% goes into the vault: 95% for the hospital and 2.5% as the mediator fee. The other 2.5% goes to a storage executor that keeps the dataset’s Swarm postage stamp funded.

The coordinator also validates a convergence config on-chain: the model profile (tree_ensemble, deep_vision_monai and others), the target metric (F1, ROC-AUC, accuracy, RMSE), an overfit-gap limit and a maximum of 25 tuning trials.

The only way to settle is onReport(), callable only by the Chainlink CRE forwarder. It decodes an action enum: MarkRunning, Complete, Refund, Finalize or RefundWithActRoot. If CRE never answers, the builder can call reclaimRefund() on their vault after the deadline, even if the coordinator is paused. Failed jobs grant a retry credit, so a second attempt reuses the storage reserve already paid.

Access is split into roles (dataset registrar, CRE forwarder, storage executor, storage oracle, mediator) with Ownable2Step admin, ReentrancyGuard and SafeERC20. The first version ran on Gnosis with native xDAI, next to Swarm; I then moved settlement to Base in USDC.

  1. Ethereum Swarm library (bee-js)

I wrote my own pipeline on top of bee-js:

->AES-256-GCM encryption through WebCrypto with a random 12-byte IV ->My own GF(256) Shamir secret sharing that splits the dataset key 3-of-n ->ECDH so trained output can be re-encrypted to the builder’s public key ->Bee encrypted uploads (64-byte references) paid with postage stamps ->ACT grantee lists to gate decryption Swarm feeds so each dataset has a stable manifest A synthetic preview generator that publishes a 10-row fake sample of the schema, so buyers can evaluate a dataset without seeing real rows

  1. Chainlink CRE workflow (TypeScript, @chainlink/cre-sdk, viem)

The workflow is registered with handlerInTee on AWS Nitro and fires on a log trigger for TrainingJobRequested. It then:

Reads the dataset with EVMClient.callContract at the last finalized block. Calls my Bee node through the ConfidentialHTTPClient. The Bee auth token is a Vault DON secret injected as a {{.SWARM_BEE_AUTHORIZATION}} template, so it never enters workflow memory or the compiled artifact. Sends PATCH /grantee to add the enclave’s compressed secp256k1 key to the dataset’s ACT, which returns a new ACT history ref. Runs the job and uploads the output encrypted. Writes a DON-signed report that finalizes or refunds.

The order of steps is deliberate. The output artifact is uploaded before the ACT is changed, so a failed upload can’t leave a stale ACT root. If the ACT grant succeeded but a later step fails, the refund path uses RefundWithActRoot, so the on-chain ACT root still matches Swarm.

  1. Arkiv (open data)

Public datasets live on Arkiv as typed schemas (ephemeral.public-datasets.v1 and ephemeral.public-dataset-chunks.v1) with indexed fields. A publish script splits each CSV into 60 KB chunks, batches four entity creates per transaction, and stores the columns and preview rows as JSON bytes. The marketplace queries .ownedBy(mediator), fetches the chunks ordered by part and rebuilds the file in the browser. That gives a fully on-chain, queryable data catalog with no backend server.

  1. Frontend and hosting

The frontend is Astro with React islands, wagmi/viem, HashRouter and Tailwind/shadcn. It has three workspaces: Healthcare, Marketplace and AI Company.

The whole built site is deployed to Swarm behind a feed manifest and pointed to from ENS (ephemeralglobal.eth.limo). New deploys just update the feed; the ENS record never changes. That makes the app censorship-resistant, with no server to take down.

How partner tech helped

Chainlink CRE: gave me trustless orchestration. TEE execution, Vault DON secrets and DON-signed reports mean no Ephemeral server ever holds keys, data or the power to pay out. Ethereum Swarm: handled encrypted storage, ACT access control and hosting in one stack. Arkiv: gave me a queryable on-chain database for open data without running an indexer. Base: made USDC escrow cheap. 1inch Fusion+: let me fund Swarm storage on Gnosis from USDC on Base.

Hacky bits worth mentioning

Cross-chain storage funding: a storage-reserve executor watches StorageReserveCommitted on Base. It swaps the 2.5% USDC reserve cross-chain to xBZZ on Gnosis with the 1inch Fusion+ SDK, calls PostageStamp.topUp() on the dataset’s batch, then reports back through a storage oracle with confirmStorageTopUp(). Contract size limit: the coordinator hit Ethereum’s 24,576-byte contract size limit (EIP-170), so I moved vault deployment into a separate factory. That brought the coordinator down to 24,267 bytes. Exposing the Bee node: the CRE DON has to reach my Bee node, so the node is exposed through an ngrok tunnel with a skip-warning header. Key handling: I convert uncompressed secp256k1 keys to compressed form by hand, because Bee’s ACT only accepts compressed keys. Attestation placeholder: until real Nitro attestation is wired in, the attestation hash is keccak(enclave measurement, job tx hash, TEE public key, job ID), recorded on-chain with every job.

What’s still simulated: the CRE workflow currently runs in simulation, with a placeholder preprocessing step (zero rows read) and a mock enclave measurement. Next steps are deploying to a production DON with real hardware attestation, supporting concurrent jobs per dataset, and adding verified onboarding for hospitals and AI companies.

background image mobile

Join the mailing list

Get the latest news and updates