# oen-receipt/1: Open Edge Network execution receipts

Version 0.1 · Open Edge Network, by Caelara Labs (https://caelaralabs.com)

An execution receipt lets any party prove, offline and at no cost, that a given answer was served by the network for a given
request at a given time. It needs no account and no on-chain transaction.

## Headers

| Header | Value |
|---|---|
| `X-OEN-Receipt-Hash` | SHA-256, lowercase hex, of the exact response body bytes (after content decoding) |
| `X-OEN-Timestamp` | RFC 3339 UTC time the receipt was made, to the second, for example `2026-11-25T12:00:00Z` |
| `X-OEN-Merkle-Root` | RFC 6962 Merkle tree hash, lowercase hex, over the six leaves below |
| `X-OEN-Signature` | Ed25519 signature, base64url without padding, over the UTF-8 bytes of `oen-receipt/1:` followed by the Merkle root |
| `X-OEN-Key-Id` | `kid` of the signing key in `/.well-known/jwks.json` |
| `X-OEN-Verify` | Where a person can check a receipt in the browser |

All are listed in `Access-Control-Expose-Headers`, so browser programs on any origin can read them.

## Leaves

Six UTF-8 strings, in this order:

1. `oen.v=1`
2. `req=<METHOD> <path and query>`, for example `req=GET /status.json`
3. `status=<HTTP status code>`
4. `type=<Content-Type header, verbatim>`
5. `body=<X-OEN-Receipt-Hash>`
6. `ts=<X-OEN-Timestamp>`

Leaf hash: `SHA-256(0x00 || leaf)`. Node hash: `SHA-256(0x01 || left || right)`. A list of n > 1 leaves splits at k, the
largest power of two smaller than n (RFC 6962, section 2.1).

## Verifying

1. Hash the body you received; it must equal `X-OEN-Receipt-Hash`.
2. Rebuild the six leaves from your own request, the status, the `Content-Type` and the timestamp, and compute the root; it
   must equal `X-OEN-Merkle-Root`.
3. Find the key whose `kid` is `X-OEN-Key-Id` in `/.well-known/jwks.json` (crv `Ed25519`) and verify `X-OEN-Signature` over
   `oen-receipt/1:<root>`.

A receipt is valid only when all three hold. The reference implementation is `/oen-receipt.mjs` (WebCrypto, no
dependencies); the network home page runs it against a live answer.

## Scope

Receipts are attached to successful `GET` answers for machine documents (JSON and its variants, Markdown, plain text) up to
2 MB: discovery files, the key set, status, the registry and these specifications. Pages and static assets carry none. A
receipt is an addition: an answer is never withheld because a receipt could not be made, and when the signing key is not
available the answer carries the hash, root and time and claims no signature.

Paid route answers on the suite hosts carry their own Ed25519 receipt in `X-Caelara-Receipt` and an Edge Gas burn receipt in
`X-Edge-Gas-Receipt`; this document does not change them.
