---
eip: 8510
title: Inference Receipts
description: Signed receipts for paid model calls, listed per UTC day under a Merkle root published on chain
author: Kuro Sato (@kurokawasato)
discussions-to: https://ethereum-magicians.org/t/erc-8510-inference-receipts/30464
status: Draft
type: Standards Track
category: ERC
created: 2026-11-21
requires: 20, 55, 191
---
## Abstract
This proposal defines a receipt that a paid model endpoint signs for each call it charges: hashes of the request and
the response, the model, the tokens counted, the price in an [ERC-20](./eip-20.md) asset, the payer and the payment
that settled it. The receipt is a JSON object with a fixed member order, signed by the endpoint's key as an
[ERC-191](./eip-191.md) message.
The endpoint serves each UTC day's receipts as a day list, in a fixed order, with a Merkle root over their hashes.
Within a day after the day closes, it publishes that root in a log on chain. A payer holding a receipt can then show
that the endpoint counted the call that day, and a receipt the published root does not cover is evidence the endpoint
left a call out.
## Motivation
Agents buy model calls from endpoints they do not run, and pay per call or per token, often over HTTP payment schemes
such as x402. The payment settles on chain; what was bought does not. Each endpoint reports usage in its own format, if
at all, and nothing ties a charge to the request it answered.
A buyer needs three things after the fact: proof of what a given charge was for, a way to check that the endpoint's
account of a day matches the calls the buyer made, and a commitment the endpoint cannot revise later. Auditors and
lenders that size an agent's spending need the same records in one format across endpoints.
A signed receipt per call gives the first. A day list under a Merkle root gives the second without publishing anyone's
calls on chain. One record per day on chain gives the third at the cost of one transaction a day, whatever the volume.
## Specification
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT
RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.
### Terms
- **Issuer**: a service that answers model calls for payment and signs receipts for them.
- **Signer**: the address of the key an issuer signs receipts with. One issuer MAY use several signers; each has its own
day lists, records and base URL.
- **Payer**: the address whose payment settled a call.
- **Verifier**: any party that checks a receipt, a day list or a day record, such as a payer, an auditor or a contract.
- **Payment**: the four members `network`, `asset`, `payer` and `nonce` of a receipt. Two receipts are for the same
payment when all four strings are equal.
- **Day**: a UTC calendar date, written `YYYY-MM-DD`. A day closes at `00:00:00.000Z` of the next date. A receipt
belongs to the day its `at` member names; a day list's `day` and a day record's `date` both name a day.
- **Whole number**: a JSON number whose value is an integer from 0 to 2^53 - 1.
- **Day list**: one signer's receipts for one day, in day-list order: ascending `at`, and receipts with equal `at` in
ascending receipt hash, comparing hashes as lowercase hex strings, which is their order as integers.
- **Day root**: the Merkle root over a day list.
- **Day record**: the statement of a closed day's root that the issuer publishes on chain.
- **Publisher**: an account that sends day records for a signer. It MAY differ from the signer.
### Receipt
A receipt is a JSON object with exactly the members below. Their table order is the canonical order; `signature` is
the one member outside the canonical form.
| Member | Type | Meaning |
| --- | --- | --- |
| `v` | number | The version: `1`. |
| `request` | string | Keccak-256 of the request body bytes as the issuer received them, with any content-coding still applied. |
| `response` | string | Keccak-256 of the response body bytes the issuer produced for the call, also when it withheld them. |
| `model` | string | The issuer's identifier for the model the payer asked for. |
| `upstream` | string | The identifier of the model as the party that ran it names it. Equal to `model` when the issuer runs the model itself. |
| `tokensIn` | number | Input tokens counted for the call. |
| `tokensOut` | number | Output tokens counted for the call. |
| `price` | string | Everything charged for the call, in the asset's base units. |
| `fee` | string | The part of `price` that is a fixed charge per call. `"0"` when there is none. |
| `absorbed` | string | Cost of the call the issuer bore and did not charge, in the asset's base units. `"0"` when there is none. |
| `judged` | object or null | `null`, or the verdict when the issuer had the answer evaluated before returning it (below). |
| `asset` | string | The ERC-20 contract the payment was made in. |
| `network` | string | The chain the payment settled on: `eip155:` followed by its chain id in decimal without leading zeros, a [CAIP-2](https://github.com/ChainAgnostic/CAIPs/blob/ebacdb90283ded501350bd0011db4362734f9c4b/CAIPs/caip-2.md) identifier such as `eip155:1`. |
| `payer` | string | The payer. |
| `nonce` | string | The payment's unique identifier for this payer under the payment scheme used: a decimal string for a numeric nonce, or 32 bytes as hex for a `bytes32` nonce. |
| `at` | string | When the receipt was signed, exactly `YYYY-MM-DDTHH:MM:SS.sssZ` in UTC, such as `2026-11-19T12:02:49.376Z`: a valid calendar date, hours 00 to 23, minutes and seconds 00 to 59 (no leap second). |
| `signer` | string | The signer. |
| `signature` | string | The signature, as Canonical form and signature defines it. |
`judged`, when not `null`, has exactly these members, in this order:
| Member | Type | Meaning |
| --- | --- | --- |
| `accepted` | boolean | Whether the evaluation accepted the answer. |
| `passProbability` | number | The evaluator's probability that the answer meets the bar, from 0 to 1. |
| `bar` | number | The probability the answer had to reach, from 0 to 1. |
| `decision` | string | An identifier of where the verdict is recorded, in a form the issuer documents. |
Every member MUST have the type its table gives. Hashes, `nonce` in hex form and `signature` MUST be lowercase hex with
a `0x` prefix. `asset`, `payer` and `signer` MUST be in [ERC-55](./eip-55.md) mixed-case form. `price`, `fee`,
`absorbed` and a decimal `nonce` MUST be decimal strings below 2^256 without leading zeros (`"0"` is zero), so equal
values are equal strings. `v`, `tokensIn` and `tokensOut` MUST be whole numbers. `fee` MUST NOT exceed `price`.
`model`, `upstream` and `decision` MUST be 1 to 256 printable ASCII characters (0x20 to 0x7E). A verifier MUST reject a
receipt with members other than those listed.
An issuer MUST sign a receipt for every call it charges, and only for calls it charged, including a call whose answer
it withholds. A payment that settles after the issuer stopped answering the call is a charge too: the issuer MUST then
sign a receipt for it or return the payment. An issuer MUST NOT sign two receipts for the same payment.
### Canonical form and signature
The canonical form of a receipt is computed from its values, whatever JSON text they arrived in: its members other than
`signature`, in table order, with `judged`'s members in their table order, serialized as
[RFC 8785](https://www.rfc-editor.org/rfc/rfc8785) serializes values, with no whitespace and strings escaped as RFC 8785
requires. Members appear in table order. Whole numbers are written as integers, without a fraction or an exponent.
`passProbability` and `bar` MUST have at most 6 decimals in their shortest round-trip decimal form and are written as
RFC 8785 writes numbers, so 0, 1 and 0.000001 are `0`, `1` and `0.000001`; serializers that write binary floating-point
numbers their own way, such as Python's `json` module, give a different hash. A verifier MUST reject a receipt whose
JSON text repeats a member name in any object.
The receipt hash is Keccak-256 of the UTF-8 bytes of the canonical form.
`signature` is an ERC-191 signature, version `0x45`, by the signer over the 32 bytes of the receipt hash: the signer
signs `keccak256("\x19Ethereum Signed Message:\n32" || receiptHash)`. It is 65 bytes, `r || s || v`, with `s` no
greater than half the secp256k1 group order and `v` 27 or 28. A signer key MUST NOT make ERC-191 version `0x45`
signatures over 32-byte messages for any other purpose.
A receipt is valid when every rule of the Receipt section holds, its signature has the form above, and the address
recovered from `signature` over that digest equals `signer`.
### Delivery
An issuer MUST give the payer the receipt with the response to the call it covers. Over HTTP, an issuer SHOULD return
it in the `Inference-Receipt` response header, as the base64 encoding of the receipt's JSON defined in
[RFC 4648 section 4](https://www.rfc-editor.org/rfc/rfc4648#section-4), on every response it charged for, including one
that withholds the answer.
### Day lists
An issuer MUST keep each signer's receipts per day and MUST serve each day's list at `/v1/receipts/`
as the JSON object below. `` is the base URL the issuer states for that signer, for example in its agent
registration file or its documentation, and serves exactly one signer.
| Member | Type | Meaning |
| --- | --- | --- |
| `day` | string | The day. |
| `signer` | string | The signer, ERC-55. |
| `count` | number | How many receipts `receipts` holds. |
| `root` | string or null | The day root over `receipts` as lowercase hex, or `null` when there are none. |
| `unreadable` | number | How many entries the issuer stored for the day are unreadable, a whole number. |
| `records` | object | Where this signer's day records are published: `network` (`eip155:` and a chain id, as in receipts), `contract` (ERC-55) and `publishers` (a non-empty list of distinct ERC-55 addresses). |
| `receipts` | array | The receipts, in day-list order. |
An entry is unreadable when it is not a valid receipt of that day and signer, including one the issuer cannot read
back. Unreadable entries MUST NOT be listed and are outside `root`. A non-zero `unreadable` tells verifiers the list is
not the whole day.
A day list is valid when its members have the types above, every receipt in it is a valid receipt of that day and
signer, the receipts are in day-list order with no two for the same payment, and `count` and `root` match them.
An issuer MUST answer 404 for a day before the signer's first receipt. It MAY serve the list of a day that has not
closed, which grows as receipts are added; its `root` MUST NOT be published, and verifiers MUST NOT treat such a list as
the whole day. An issuer MUST serve each closed day's list for at least 365 days after the day closes, a day without
receipts as a list with `count` 0.
### Day root
The leaves are the receipt hashes, in day-list order. Each layer above is built from the one below, left to right: two
adjacent nodes `a` and `b` become `keccak256(min(a, b) || max(a, b))`, comparing them as 256-bit unsigned integers. A
node left without a partner at the end of a layer moves up unchanged. The day root is the single node at the top. The
root of a list with one receipt is that receipt's hash.
### Inclusion proofs
A proof for the receipt at index `i` is the list of sibling nodes from its leaf to the root, lowest first, skipping
layers where the node had no partner. This is the form OpenZeppelin's `MerkleProof.verify` takes, so a contract can
check a receipt against a published root. A verifier MUST take the canonical receipt bytes as input, never a leaf, MUST
reject input of exactly 64 bytes, and MUST compute the leaf from those bytes, fold the proof with the pair rule above
and compare the result with the day root.
### Day records
Within 24 hours after a day closes, an issuer MUST publish one day record for each signer that signed a receipt dated
that day. It MUST NOT publish a day's record before the day closes or while the day's `unreadable` is non-zero, and
MUST NOT sign a receipt dated a day it has published. It MAY publish a record with `count` 0 for a day without
receipts.
A well-formed record is a JSON object with at least these members, written as in day lists. It MAY have others.
| Member | Type | Meaning |
| --- | --- | --- |
| `kind` | string | `"receipts"`. |
| `date` | string | The day, `YYYY-MM-DD`. |
| `signer` | string | The signer, ERC-55. |
| `count` | number | The day list's `count`, a whole number. |
| `root` | string | The day list's `root` as lowercase hex, or `0x` followed by 64 zeros when `count` is 0. |
The publisher MUST send the record as the UTF-8 bytes of its JSON in the `data` of the event below, with `kind` set to
`"receipts"`, through the contract named in the signer's `records` on the chain named there. The contract emits the
event with `by` set to the account that called it.
```solidity
event Inscribed(address indexed by, string kind, bytes data);
```
An issuer SHOULD NOT publish a second record for the same signer and day. A verifier finding a day's record MUST take
the chain, contract and publishers from a day list's `records`, MUST consider only that contract's logs on that chain
whose `by` is one of the publishers and whose block timestamp is after the day closed, and MUST ignore a log whose
`kind` argument is not `"receipts"` or whose `data` is not a well-formed record for that signer and day. The day's
record is the earliest remaining log by block number, then log index.
### Verifying a receipt
A verifier checking a receipt MUST:
1. check the receipt is valid;
2. read the day list for the receipt's day and signer and check that it is valid;
3. find the receipt in the list, or compute its proof and check it against `root`;
4. once the day has closed, find the day's record as Day records describes and check its `count` and `root` against the
list.
A valid receipt that no published root covers, or a list whose root differs from the published record, is evidence that
the issuer omitted or revised that day.
## Rationale
- **JSON with a fixed order, signed as ERC-191 bytes.** The signed bytes are the stored and served bytes, so a receipt
needs no second encoding, and any language with a JSON library and Keccak can check one. The ERC-191 prefix keeps a
receipt signature from ever being valid as a transaction signature. Other 32-byte messages stay apart only because the
signer key signs nothing else of that form. Typed structured data would give receipts a domain of their own; whether
version 2 should use it is an open question.
- **RFC 8785 values, table order.** RFC 8785 fixes how strings and numbers are written, which is where JSON serializers
disagree. Its sorted member order would make receipts harder to read, so the table order stays. Identifiers are kept
to printable ASCII and probabilities to six decimals so that no serializer has a choice left to make.
- **Day-list order.** Ordering by `at` and then by hash lets anyone holding a day's receipts rebuild its list and root
without knowing how the issuer stored them.
- **Sorted pairs, carried odd nodes.** Sorted pairs match OpenZeppelin's `MerkleProof`, so a contract can check a
receipt against a root with a library most contracts already use. Hashing an odd node with itself would give a list
and the same list with its last receipt repeated one root; carrying it up keeps them apart. Sorted pairs make a root
blind to the order of two siblings, which day-list order fixes.
- **Leaves without a second hash.** OpenZeppelin recommends hashing leaves twice, because the 64-byte preimage of an
inner node hashes to that node and could otherwise pass as a leaf with a shorter proof. Here the leaf stays the
receipt hash, the value payers already hold and quote, and the guard moves to the verifier's input: a canonical
receipt is always longer than 64 bytes.
- **Stated publishers, no record signature.** Any contract can emit the event and any account can call it, so a
record's authority comes from the contract and accounts the issuer states in every day list, where a verifier already
looks. A signature over the record would let any log carry it, at the cost of a second signature format. Logs from
before the day closed are ignored, so a record cannot be placed ahead of the day it states.
- **`day` and `date`.** Lists and records name the day with different members because records of this form are
already on chain.
- **One list per UTC day.** Settlement, accounting and audits run by day, and a daily record bounds the on-chain cost
to one log per signer per day.
- **One fixed member set.** `upstream`, `absorbed` and `judged` serve issuers that resell models other parties run, or
have answers evaluated before they return them. They stay in version 1 with neutral values (`model`, `"0"`, `null`)
for issuers that do neither, so every receipt has one canonical form whichever members an issuer uses.
### Open questions
- Whether `upstream` should name the provider that ran the model separately from the model's name.
- Whether a version 2 should commit to the payment's settlement transaction, which the issuer learns only after
settling, and name the payee and the payment scheme.
- Whether a version 2 should sign receipts as typed structured data with a domain of their own.
## Backwards Compatibility
This proposal introduces a new format and has no backwards compatibility issues.
## Test Cases
[`vectors.json`](../assets/erc-8510/vectors.json) holds valid and invalid receipts signed by a throwaway key, with their
canonical forms, hashes, day lists, roots, proofs and records, and one public day of a deployment with its record as
published on chain. [`test.mjs`](../assets/erc-8510/test.mjs) checks the reference implementation and its command line
against them.
## Reference Implementation
[`receipts.mjs`](../assets/erc-8510/receipts.mjs) implements the canonical form, the receipt hash, the signature check,
day lists, day roots, inclusion proofs and day records, and finds a day's record over JSON-RPC, with no dependencies.
[`cli.mjs`](../assets/erc-8510/cli.mjs) runs them on files and against an RPC endpoint, and
[`README.md`](../assets/erc-8510/README.md) says how.
A deployment that issues these receipts for calls paid over x402 is described in the README. It returns the receipt
under its own header name, and its records carry two more members, which well-formed records allow.
## Security Considerations
- **What a receipt proves.** A receipt proves what the issuer stated about a call: the hashes, the model, the counts and
the charge. Whether the named model produced the answer, and whether the token counts are right, rests on the issuer;
an issuer that resells a model can only pass on what its upstream reported. A verifier checks the payment against the
payment scheme's own records, such as a token's record of used transfer authorizations or Permit2's nonce bitmap. A
receipt does not name the payee.
- **Self-dealing.** An issuer that pays itself through a payer it controls produces valid receipts. Receipts show what
was charged; whether the payers are independent of the issuer is for the verifier to judge.
- **Omission.** An issuer can leave a call out of a day list. The payer's signed receipt, dated and signed by the same
key, shows it, and so does a missing record for a day the payer holds a receipt of (see Day records). Payers SHOULD
keep their receipts and SHOULD check them against published roots.
- **Revision.** An issuer can serve a different list later, but cannot change a record already on chain. The earliest
record counts, so a second record does not replace it.
- **Unreadable entries.** An issuer can claim entries are unreadable to drop them from a list. The count is public, and
a payer whose receipt is missing has the receipt.
- **Inner nodes as leaves.** The 64-byte preimage of an inner node hashes to that node, so a verifier that accepted a
leaf, or 64 bytes as a receipt, would accept something that is not a receipt. The input rule in Inclusion proofs
closes this.
- **Key reuse.** A signature over a 32-byte value someone else chose could be presented as a receipt signature, which
the rule on the signer key in Canonical form and signature prevents. A key that also settles payments signs
transactions, which the ERC-191 prefix keeps apart.
- **Privacy.** Receipts carry hashes of request and response bodies instead of the bodies. A short or guessable body
can be found from its hash, identical requests share a hash, so a day list shows which payers sent the same body, and
a deterministic answer to a known prompt can be confirmed. Payers that need otherwise SHOULD include something random
in each request. Day lists also show models, token counts and verdicts, and which payers paid, how much and when.
- **Signature malleability.** For each signature a second valid `s` exists. Only the lower one is valid here, so each
receipt has one signature; the signature is outside the leaf and the record either way.
- **Key compromise.** Whoever holds a signer's key can sign receipts in its name, also dated in the past. Issuers SHOULD
rotate to a new signer when a key may be exposed and say from which day the new signer applies. A receipt signed by a
key since revoked is evidence only where a published root covers it.
## Copyright
Copyright and related rights waived via [CC0](../LICENSE.md).