receipt-ledger: bill what the work spends — bytes out, a package's work per run and its storage by byte-time, every hop's energy, the output its hop delivered #556

Merged
dcharlot merged 1 commit from wai/ledger-physics into main 2026-10-31 12:26:27 -04:00
Owner

The receipt ledger bills what the work spends. Each item is a rule of the extension with its reason in the text, held by corpus vectors, the Rust reference and receipt_ledger_verify.py.

A job's output is the object its hop delivered (receipt-ledger §5.1). Where a job's route record states what its served attempt delivered (route-record version 2, outputs, by content hash), each output receipt a job source gives must be of one of those objects, once, or the source is refused output_not_delivered. A line bills a job's subpixels from its output receipts, so a receipt of an object the hop did not deliver billed subpixels nobody delivered for that job, and one given twice billed them twice. Holds under tariff versions 3 and 4; under version 4 a route record of version 1, which states no outputs, holds its outputs to none.

Routing figures are never charges (§5.1). A route record's cost, energy, expected_cost, expected_ttfb_ms and its price book's price and failures order the survivors; no line reads them, and a job line bills its billed attempt at the tariff's price. Two controls: a failed hop counted as a job, and a job line at the router's list price.

Jobs routed under the route record's version 2 in the ledger corpus. An encode, a failover whose failed hop was metered, a decode, a hop past the deadline, three hops that failed, and a failover whose failed hop's figure states no class, routed by the route corpus's router under its version-2 price book; routes/vectors.json is unchanged.

A room's bytes out (live-metering §4.1, §4.4, §4.6; receipt-ledger §4.7). A room-session receipt of version 2 states bytes_out, the bytes its hops sent the session's sessions from their ledgers, prices them per 10^9 bytes in its tariff and counts them in each grant's consumption entry and funds. Delivery costs scale with bytes carried, not only time. A hop link's bytes, in no ledger, are carriage between relays and not counted. Tariff version 4 bills them on a room line bytes_out; a receipt that states a tariff states all fourteen prices.

A package's work, per run (§4.7). Packaging is deterministic, so a package made again gives the same receipt from a run that did the work again; every earlier version billed a package once per receipt and refused it. In version 4 a package has a job's shape: the run that made it, a routed job of package.build whose output is the package, is billed once per run, per job and per work unit (the receipt's work_units, the work its figure is expressed against); the package receipt is the product each run cites; a replayed run is refused. The run's energy is its hop's.

A package's storage by byte-time (§4.7). Version 4 prices storage per 10^9 byte-days. A package the previous invoice lists is held through the invoice's whole period and billed ⌊Σ stored_bytes × (end − start) / 1 day⌋; the invoice that first lists it bills no storage, since no record shows when in that period it was written. The period is read from the chain's own invoices.

Every hop's energy (§6.6). Version 4 states the energy of every attempt of a job; the hops not billed (failed, or served past the deadline) in a scope of their own, unbilled_hops, never summed with the billed hops'. The customer is still not billed for them.

Versions: a tariff and invoice of version 4, and a room-session receipt of version 2, because an older reader would misread them. Tariffs of versions 1 to 3 and receipts of version 1 read, verify and bill exactly as before, and their vectors are byte for byte; the one control that named an unknown version now names version 5.

The ledger service (wai/wai-ledger) reads a source by its tariff's version and, under version 4, bills a held package's storage each period and a package made again by a new run.

🤖 Generated with Claude Code

The receipt ledger bills what the work spends. Each item is a rule of the extension with its reason in the text, held by corpus vectors, the Rust reference and `receipt_ledger_verify.py`. **A job's output is the object its hop delivered** (receipt-ledger §5.1). Where a job's route record states what its served attempt delivered (route-record version 2, `outputs`, by content hash), each output receipt a job source gives must be of one of those objects, once, or the source is refused `output_not_delivered`. A line bills a job's subpixels from its output receipts, so a receipt of an object the hop did not deliver billed subpixels nobody delivered for that job, and one given twice billed them twice. Holds under tariff versions 3 and 4; under version 4 a route record of version 1, which states no outputs, holds its outputs to none. **Routing figures are never charges** (§5.1). A route record's `cost`, `energy`, `expected_cost`, `expected_ttfb_ms` and its price book's `price` and `failures` order the survivors; no line reads them, and a job line bills its billed attempt at the tariff's price. Two controls: a failed hop counted as a job, and a job line at the router's list price. **Jobs routed under the route record's version 2 in the ledger corpus.** An encode, a failover whose failed hop was metered, a decode, a hop past the deadline, three hops that failed, and a failover whose failed hop's figure states no class, routed by the route corpus's router under its version-2 price book; `routes/vectors.json` is unchanged. **A room's bytes out** (live-metering §4.1, §4.4, §4.6; receipt-ledger §4.7). A room-session receipt of version 2 states `bytes_out`, the bytes its hops sent the session's sessions from their ledgers, prices them per 10^9 bytes in its tariff and counts them in each grant's consumption entry and funds. Delivery costs scale with bytes carried, not only time. A hop link's bytes, in no ledger, are carriage between relays and not counted. Tariff version 4 bills them on a room line `bytes_out`; a receipt that states a tariff states all fourteen prices. **A package's work, per run** (§4.7). Packaging is deterministic, so a package made again gives the same receipt from a run that did the work again; every earlier version billed a package once per receipt and refused it. In version 4 a package has a job's shape: the run that made it, a routed job of `package.build` whose output is the package, is billed once per run, per job and per work unit (the receipt's `work_units`, the work its figure is expressed against); the package receipt is the product each run cites; a replayed run is refused. The run's energy is its hop's. **A package's storage by byte-time** (§4.7). Version 4 prices storage per 10^9 byte-days. A package the previous invoice lists is held through the invoice's whole period and billed ⌊Σ stored_bytes × (end − start) / 1 day⌋; the invoice that first lists it bills no storage, since no record shows when in that period it was written. The period is read from the chain's own invoices. **Every hop's energy** (§6.6). Version 4 states the energy of every attempt of a job; the hops not billed (failed, or served past the deadline) in a scope of their own, `unbilled_hops`, never summed with the billed hops'. The customer is still not billed for them. Versions: a tariff and invoice of version 4, and a room-session receipt of version 2, because an older reader would misread them. Tariffs of versions 1 to 3 and receipts of version 1 read, verify and bill exactly as before, and their vectors are byte for byte; the one control that named an unknown version now names version 5. The ledger service (`wai/wai-ledger`) reads a source by its tariff's version and, under version 4, bills a held package's storage each period and a package made again by a new run. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
receipt-ledger: bill what the work spends; live-metering: a receipt of version 2 prices bytes out
All checks were successful
WAI energy receipts / energy receipts · linux (pull_request) Successful in 10m39s
WAI examples / WAI examples · portable · linux (pull_request) Successful in 10m36s
WAI Studio / the catalogue's actions, the unit tests and the core · linux (pull_request) Successful in 57s
wai-quantum studio and desktop / studio · browser (pull_request) Successful in 4m20s
wai-app and Create / wai-app · tests, clippy, the line language's verifier (linux) (pull_request) Successful in 30s
WAI conformance / cargo-class corpora · linux (pull_request) Successful in 17m6s
wai-web reach builds / wai-web reach builds · the package of record, every output as recorded (pull_request) Successful in 2m22s
wai-quantum studio and desktop / desktop app · linux (pull_request) Successful in 5m27s
wai-app and Create / wai-app · Create, browser end-to-end (macos) (pull_request) Successful in 12m48s
wai-web wasm32 / wai-web wasm32 build · corpus, menu and writers (pull_request) Successful in 5m45s
WAI conformance / cargo-class corpora · macos (pull_request) Successful in 35m40s
wai-web reach builds / wai-web reach builds · this tree's wai-web, every rung on its engine line (pull_request) Successful in 5m12s
WAI conformance / cargo-class corpora · linux-arm64 (pull_request) Successful in 38m28s
WAI Studio / Studio in WebKit · linux (pull_request) Successful in 11m51s
joule-moq-web browser client / joule-moq-web · browser end-to-end (macos) (pull_request) Successful in 23m16s
wai-quantum docs, course and locales / every command and snippet in the docs · linux (pull_request) Successful in 20m57s
WAI conformance / delivery telemetry · CMCD and CMSD against an independent library (pull_request) Successful in 14s
WAI conformance / cross-arch byte-equality · linux-arm64 (pull_request) Successful in 1m7s
WAI conformance / C2PA manifest emission · signed, read back, validated (pull_request) Successful in 2m46s
WAI conformance / each feature of the independent verifiers' steps compiles alone (pull_request) Successful in 21m31s
WAI energy receipts / energy receipts · linux-arm64 (pull_request) Successful in 15m44s
wai-pack / wai-pack · linux-arm64 (pull_request) Successful in 2m21s
WAI examples / WAI examples · android-app · linux-arm64 (pull_request) Successful in 7m3s
wai-pack / wai-pack · the floor through a media prober (pull_request) Successful in 22s
wai-pack / wai-pack · dependency licences (pull_request) Successful in 1m43s
wai-sink-android native sink library / the JNI layer and the platform-free half on the host JVM · linux-arm64 (pull_request) Successful in 3m27s
joule-moq-remote host agent / joule-moq-remote, every target (linux-arm64) (pull_request) Successful in 1m55s
wai-pack / wai-pack · independent verifier (Python) (pull_request) Successful in 8m53s
joule-moq-room room service / joule-moq-room, every target (pull_request) Successful in 4m22s
WAI conformance / independent verifiers · claims, JWP, key discovery and integer payloads (Python) (pull_request) Successful in 1h23m20s
4972e8510b
A job's output receipt is of an object its served hop states it delivered (route-record
version 2's `outputs`, by content hash), once, or the source is refused
`output_not_delivered`; under tariff version 4 a record of version 1 holds its outputs to
none. Routing figures (cost, expected cost and time, failures) are never charges: a line bills
the billed attempt at the tariff's price.

The room-session receipt's version 2 states `bytes_out`, the bytes its hops sent the session's
sessions from their ledgers, prices them per 10^9 bytes in its tariff and counts them in each
grant's consumption and funds.

Tariff and invoice version 4 bill a room's bytes out, a package's work once per run that made
it (a routed job of `package.build`, per job and per work unit, its receipt the product each
run cites, a replayed run refused), a package's storage by byte-days for each invoice period
it is held through, read from the chain, and state every hop's energy, the hops not billed in
a scope of their own.

The ledger corpus adds jobs routed under the route record's version 2 and version 4's chain
with their controls; the metering corpus adds receipts of version 2; both second
implementations read the new versions and catch every new rule.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
Transaction-Science/open-standards!556
No description provided.