An agent that pays a model endpoint per call can prove it paid, since the payment settles on chain. It cannot prove what the payment bought, or check later that the endpoint’s account of a day matches the calls it made. This draft defines a signed receipt per paid call and a daily Merkle root over those receipts, published on chain.
Draft: erc-draft_inference_receipts.md. The pull request to ethereum/ERCs follows as soon as this thread exists, since the draft names it as its discussion.
Each receipt is a JSON object with a fixed member order: hashes of the request and the response, the model, the tokens counted, the price in an ERC-20 asset, the payer and the payment that settled it. The endpoint signs its keccak256 hash as an ERC-191 message. Request and response bodies never leave the endpoint; only their hashes are in the receipt.
The endpoint keeps each UTC day’s receipts in the order it signed them and serves them as a day list with a Merkle root over their hashes, built the way OpenZeppelin’s MerkleProof checks it. Once the day closes, it publishes one record with the date, the count and the root in a log on chain. A payer holding a receipt can show the endpoint counted the call that day, and a signed receipt the published root does not cover is evidence the endpoint left a call out. The cost is one transaction a day, whatever the volume.
Reference code comes with the draft, with no dependencies: canonical form, signature check, day roots, inclusion proofs, test vectors from a test key, and one real receipt whose hash matches the root published for its day.
The payment scheme is out of scope. The receipt names the payment by its nonce, so it works with x402’s exact and upto schemes and with EIP-3009 transfers.
Disclosure: I work on BrainChain, whose inference gateway issues these receipts for calls paid over x402 and publishes each closed day’s root on BrainChain.
Three questions for reviewers:
- The draft names the response header
Inference-Receipt. Is a header the right carrier, or should the receipt travel in the response body? - Readers decide which publisher accounts they accept for a day record. Should the standard require endpoints to declare that account, for example in their ERC-8004 registration?
- The day record is a generic log event. Would a small registry contract with a typed event serve readers better?