jcp-x402: demonstrate the settlement coupling in the runnable example #25

Merged
dcharlot merged 1 commit from jcp/x402-example-settlement into main 2026-07-18 04:34:26 -04:00

2026-07-18

Transaction Science
jcp-x402: demonstrate the settlement coupling in the runnable example
The example showed ingest, dual-ceiling minting, the money-cap denial, and the
currency refusal — but not `seal_settlement`, which is the crate's most
distinctive contribution. It was tested and undemonstrated.

Adds the settlement step: the host settles on chain, the meter reports what the
paid compute actually consumed (5812 µJ measured, against a 6000 µJ estimate —
so the receipt binds what happened, not what was budgeted), and the two are
sealed together. Then it runs the verification a third party would run: recompute
the coupling id from the settlement record and compare it to the receipt's
payload_hash.

It also shows the negative, which is the property that makes the binding worth
anything: re-pointing at a different transaction yields a different id, so the
receipt cannot be moved to another settlement. Output reads
`coupling verified: true` / `re-point to another tx → id matches: false`.

Example-only; no library change.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
2026-07-18 04:33:05 -04:00