agent-receipt-verify 0.0.0-stage → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/CONFORMANCE.md +110 -0
  2. package/LICENSE +201 -0
  3. package/NOTICE +39 -0
  4. package/README.md +256 -2
  5. package/bin/cli.mjs +89 -0
  6. package/examples/receipt-live-base-sepolia-2.json +21 -0
  7. package/examples/receipt-live-base-sepolia-3.json +21 -0
  8. package/examples/receipt-live-base-sepolia.json +21 -0
  9. package/package.json +59 -4
  10. package/profiles/profile.schema.json +115 -0
  11. package/profiles/x402-deployed-ladder-v1.json +178 -0
  12. package/src/eip3009-autorisatie.mjs +195 -0
  13. package/src/inam-countersigned.mjs +162 -0
  14. package/src/mcp-server.mjs +262 -0
  15. package/src/profiel.mjs +145 -0
  16. package/src/x402-conformance-check.mjs +194 -0
  17. package/src/x402-conformance-treden.mjs +246 -0
  18. package/src/x402-discovery-census.mjs +247 -0
  19. package/src/x402-index-liveness.mjs +201 -0
  20. package/src/x402-link-onchain.mjs +280 -0
  21. package/src/x402-metingen-bundel.mjs +96 -0
  22. package/src/x402-offer-receipt.mjs +84 -0
  23. package/src/x402-poortwachters.mjs +241 -0
  24. package/tools/bundel-bouw.mjs +126 -0
  25. package/vectors/inam/BRON-README.md +38 -0
  26. package/vectors/inam/canonical-vectors.json +122 -0
  27. package/vectors/inam/vectors.json +96 -0
  28. package/vectors/kanon/amount-insufficient-001.json +52 -0
  29. package/vectors/kanon/cross-chain-replay-001.json +54 -0
  30. package/vectors/kanon/cross-contract-replay-001.json +54 -0
  31. package/vectors/kanon/domain-name-mismatch-001.json +53 -0
  32. package/vectors/kanon/expired-001.json +51 -0
  33. package/vectors/kanon/network-mismatch-001.json +52 -0
  34. package/vectors/kanon/nonce-replay-001.json +56 -0
  35. package/vectors/kanon/not-yet-valid-001.json +51 -0
  36. package/vectors/kanon/sig-malleable-high-s-001.json +54 -0
  37. package/vectors/kanon/valid-baseline-001.json +52 -0
package/CONFORMANCE.md ADDED
@@ -0,0 +1,110 @@
1
+ # x402 receipt conformance, edition 1
2
+
3
+ Dated 2026-10-17. This file defines a unit of measurement, not a score. If you
4
+ publish a different number for the same population, the useful conversation is
5
+ about which level you laid differently, and that is what this file exists to make
6
+ possible.
7
+
8
+ ## Why a definition comes before a number
9
+
10
+ Measurements of the x402 population are already in circulation: counts of live
11
+ resources, and the observation that none of a sampled set declared the
12
+ offer-receipt extension. None of them says what was counted. Without a stated
13
+ unit, percentages are not comparable, and two honest people measuring the same
14
+ thing will disagree for reasons neither can see.
15
+
16
+ Two specific ways that goes wrong, both of which we walked into before writing
17
+ this down:
18
+
19
+ - **Counting endpoints instead of operators.** One operator with several hundred
20
+ paths then outweighs several hundred operators with one path each. Our own first
21
+ pass produced a headline figure that was almost entirely one party's paths. The
22
+ unit below is the operator, by host.
23
+ - **Treating "works" as one thing.** Returning 402 at all, declaring the receipt
24
+ extension, signing the offer, and actually emitting a linkable receipt are four
25
+ different claims with four different costs. A single pass/fail hides which one
26
+ an implementer still owes.
27
+
28
+ ## The unit
29
+
30
+ **One operator**, identified by the host of its resource URL. Where an operator
31
+ exposes many paths, one is measured and the operator counts once.
32
+
33
+ ## The ladder
34
+
35
+ Each level requires every level below it. A level is recorded as reached, not
36
+ reached, or **not measured**, and the third is not a failure: levels 3 to 5 cannot
37
+ be observed without paying, so an unpaid measurement reports them as unmeasured
38
+ rather than as absent.
39
+
40
+ | Level | Claim | Requirement | Observable without paying |
41
+ |---|---|---|---|
42
+ | 0 | asks for payment the way x402 says | HTTP 402 carrying `accepts[]` with `scheme`, `network`, `payTo` and an amount, in the body or in the `Payment-Required` header | yes |
43
+ | 1 | declares the offer-receipt extension | the 402 carries an `offer-receipt` entry in `extensions` | yes |
44
+ | 2 | signs its offer, and the signature verifies | `extensions["offer-receipt"].info.offers[0]` is a signed artifact whose signature verifies: an `eip712` artifact recovering to an address, or a `jws` with an EdDSA signature over the offer payload whose key resolves from its `kid` | yes |
45
+ | 3 | emits a receipt that verifies | after payment, the settlement response carries a receipt whose signature recovers to the same signer | no |
46
+ | 4 | receipt is version 2, and the salt arrives where §5.6.3 says | `payload.version` is 2 with both commitment fields, and the salt is at `extensions["offer-receipt"].info.authorizationSalt` | no |
47
+ | 5 | the commitment opens against the chain to exactly one settlement | §5.6.4 run against live chain state resolves to exactly one `AuthorizationUsed` nonce | no |
48
+
49
+ Levels 4 and 5 cite sections 5.6 and later of the offer-receipt extension. Those do
50
+ not exist on `main`: they live only in pull request 3827, which is open, pinned here
51
+ to commit `0e492d6`. Both levels are marked as citing a proposal in
52
+ [profiles/x402-deployed-ladder-v1.json](profiles/x402-deployed-ladder-v1.json), and
53
+ the tool repeats that in its output.
54
+
55
+ Level 0 deliberately fails a 402 that carries no requirements. A payment demand
56
+ that does not say what to pay cannot be acted on, and treating it as conforming
57
+ would make the level meaningless.
58
+
59
+ Level 2 requires the signature to verify, not merely to be present. A declaration
60
+ with an unverifiable signature is a claim about a claim.
61
+
62
+ Level 2 accepts either signature form. A signature that cannot be checked because
63
+ this checker does not implement its algorithm is recorded as not measured, never as
64
+ not reached: not supported and not valid are different answers, and only one of them
65
+ is about the operator.
66
+
67
+ ## How to reproduce it
68
+
69
+ ```sh
70
+ node src/x402-conformance-check.mjs <url> [url ...]
71
+ ```
72
+
73
+ Levels 0 to 2 are measured. Levels 3 to 5 are reported as not measured, with the
74
+ reason. Every verdict comes with the evidence it rests on, so a different result
75
+ is traceable to a different observation rather than to a different opinion.
76
+
77
+ Conduct, because this touches other people's endpoints: one request per endpoint,
78
+ the same request an ordinary buyer makes, never a payment, never a repeat to force
79
+ an outcome, a user agent that says who is calling, and a pause between endpoints.
80
+
81
+ ## What this does not measure, on purpose
82
+
83
+ - **Whether an operator is honest.** These are checks on the form of a response.
84
+ - **Whether the paid resource delivered anything.** That is the other half of a
85
+ delivery record and is out of scope here.
86
+ - **Whether a receipt is counted by any consumer.** §5.6.5 says a consumer
87
+ counting settlements may count only opened commitments; whether a given consumer
88
+ does so is its own business and not observable from the seller side.
89
+ - **Levels 3 to 5 without a payment.** An endpoint can be at level 2 here and at
90
+ level 5 in reality. The measurement says what was observed, never what was
91
+ assumed.
92
+
93
+ ## Changing the ladder changes the edition
94
+
95
+ The levels live as data in `src/x402-conformance-treden.mjs`. If a level is added,
96
+ removed or reworded, that is a new edition with a new date, and the old one stays
97
+ readable. A measurement whose unit silently moved is worse than no measurement,
98
+ because it looks comparable and is not.
99
+
100
+ ### 2026-10-17, level 2 widened
101
+
102
+ Level 2 required an `eip712` artifact. Measuring live endpoints found an operator
103
+ that does sign its offer, in `jws` with an EdDSA signature and a `did:web` key, and
104
+ this ladder scored that as a failure. That was a defect in the unit, not in the
105
+ operator: a ladder that does not know a valid form measures that party wrongly and
106
+ would have made a published number false. Level 2 now asks for a signed offer whose
107
+ signature verifies, in either form, and names the forms it cannot check.
108
+
109
+ The results that led to this are in `editions/2026-10-17/`, including the live
110
+ measurement that produced the wrong score before the fix.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
package/NOTICE ADDED
@@ -0,0 +1,39 @@
1
+ agent-receipt-verify
2
+ Copyright 2026 Abdellah Ouadoudi (github.com/holistis)
3
+
4
+ Licensed under the Apache License, Version 2.0. See LICENSE.
5
+
6
+ This repository redistributes test material published by the protocols it verifies,
7
+ so that anyone can reproduce the results without trusting this repository:
8
+
9
+ - vectors/inam/vectors.json and vectors/inam/BRON-README.md
10
+ from inamprotocol/inam-protocol, interop/countersigned, at commit
11
+ d5e5f4555e7fd2ca8dedfa28bbfcddb0e6eb991d. Apache-2.0. Unmodified.
12
+ Those files contain test keys and made-up addresses only, as their own README states.
13
+
14
+ - vectors/inam/canonical-vectors.json
15
+ from inamprotocol/inam-protocol, interop/canonical/vectors.json, at commit
16
+ d4a2940f936af5353a9a9bf89db1097ca91bdd3c. Apache-2.0. Unmodified.
17
+ Key-order and escaping cases with characters beyond U+FFFF and lone surrogates.
18
+ Their maintainer published these after the ones above and pointed us at them, since
19
+ they are where two implementations written from the same text most easily diverge:
20
+ they exposed a real bug in their own Python canonicalizer, which sorted keys by code
21
+ point instead of by UTF-16 code unit.
22
+
23
+ - The worked example in src/x402-offer-receipt.mjs (asset, authorizer, nonce, salt and
24
+ the expected commitment) is quoted from x402-foundation/x402,
25
+ specs/extensions/extension-offer-and-receipt.md section 5.6.2, on the branch
26
+ receipt-authorization-commitment at commit 0e492d6. Apache-2.0.
27
+
28
+ Neither project has reviewed or endorsed this repository. The verifiers here were
29
+ written against the published specifications, not against those projects' source code,
30
+ which is the point: two implementations that have not seen each other agreeing on the
31
+ same vectors is evidence, and one implementation agreeing with itself is not.
32
+
33
+ - vectors/kanon/*.json
34
+ from iamonuwa/kanon, vectors/x402/exact/evm/eip3009/, at commit 0d5a7461e996,
35
+ Apache-2.0, redistributed unmodified. Ten EIP-3009 payment-authorization vectors,
36
+ each carrying its own expected verdict and reason code. src/eip3009-autorisatie.mjs
37
+ is an independent implementation written against those vectors and against EIP-3009
38
+ and EIP-712, never against that project's source. That project has not reviewed or
39
+ endorsed this repository.
package/README.md CHANGED
@@ -1,3 +1,257 @@
1
- # Temporary Holding Version
1
+ # agent-receipt-verify
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Independent verification of payment- and outcome-proof receipts used by AI agents.
4
+
5
+ An agent economy has two kinds of receipt. One says **who was allowed to act**
6
+ (delegation: UCAN, Authproof, Agent Passport). The other says **what was paid for
7
+ and whether the output matches** (settlement and outcome: x402 offer-receipt, INAM
8
+ countersigned receipts, and the proofs ERC-8004 consumers count).
9
+
10
+ `receipt-commons/receipt-interop` covers the first kind. This covers the second.
11
+
12
+ ## Use it from an agent: the MCP server
13
+
14
+ Both checks are also a Model Context Protocol server, so an agent can run them itself
15
+ instead of a person running a command. It speaks MCP over stdio, protocol version
16
+ 2025-11-25. The framing, `initialize`, `tools/list` and `tools/call` are implemented
17
+ directly in `src/mcp-server.mjs`, with no MCP SDK and no required dependency at all.
18
+
19
+ Two tools, for the two moments where an agent actually needs an answer.
20
+
21
+ `check_x402_endpoint`, before paying. Sends one request and reports which levels of the
22
+ ladder in [CONFORMANCE.md](CONFORMANCE.md) the endpoint reaches. Levels that need a real
23
+ settlement come back as not measured, never as failed.
24
+
25
+ `link_receipt_to_settlement`, after paying. Takes the receipt, the authorization salt and
26
+ the asset that was paid, resolves the salted commitment against live chain state, and
27
+ answers linked, not linked, or could not check. Those are three different answers and it
28
+ never collapses them into two.
29
+
30
+ Add it to a client:
31
+
32
+ ```json
33
+ {
34
+ "mcpServers": {
35
+ "agent-receipt-verify": {
36
+ "command": "npx",
37
+ "args": ["-y", "github:holistis/agent-receipt-verify", "mcp"]
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ No account, no API key, nothing published to npm. If you would rather not run Node from a
44
+ git ref, there is a Dockerfile:
45
+
46
+ ```sh
47
+ docker build -t agent-receipt-verify . && docker run -i --rm agent-receipt-verify
48
+ ```
49
+
50
+ The server opens no port and writes nothing to disk. Anything that is not a protocol
51
+ frame goes to stderr, because stdout belongs to the client. `npm test` drives the server
52
+ over real frames in 21 cases, including an unknown tool name, a notification that must
53
+ not get a reply, and a network it does not know, which has to answer could not check
54
+ rather than not linked.
55
+
56
+ `ethers` is an optional dependency, used for one signature check inside
57
+ `check_x402_endpoint`. Without it that single check reports not measured instead of
58
+ passing, and everything else works unchanged.
59
+
60
+ ## Why independent implementations matter
61
+
62
+ A receipt signed by a seller is a statement by an interested party. It only becomes
63
+ evidence when someone who was not the signer can recompute it and reach the same
64
+ conclusion. So every verifier here is written against the published specification,
65
+ never against the reference implementation's source, and is tested against the
66
+ vector files published by the protocol's own authors.
67
+
68
+ If two implementations that have not seen each other's code agree on the same
69
+ vectors, that is interop. One implementation agreeing with itself proves nothing.
70
+
71
+ ## Status
72
+
73
+ | Format | Vectors by | Cases | Our verdicts match |
74
+ |---|---|---|---|
75
+ | INAM countersigned | inamprotocol/inam-protocol @ d5e5f45 | 4 | 4 / 4, identical failed-check sets |
76
+ | x402 offer-receipt (commitment §5.6, proposed in PR 3827) | x402-foundation/x402 @ 0e492d6, not on main | 1 published example plus 6 own edge cases | yes, byte-identical |
77
+ | x402 settlement link (§5.6.4, same proposal) | own tests plus three live settlements | 22 offline, 3 live | yes, each resolves to its own settlement |
78
+
79
+ ```sh
80
+ npm test # all of the above, no network, no keys
81
+ ```
82
+
83
+ Node built-ins only, apart from keccak256. Only the settlement link below touches
84
+ the network, and then only a public read-only RPC.
85
+
86
+ Confirmed from the other side, which matters more than the table: the author of
87
+ the x402 specification ran their own implementation, which shares no code with
88
+ this one, against all three live receipts below and reached the same three
89
+ settlements, starting from the receipt, the salt and the asset as §5.6.4
90
+ requires. Their result and ours are in
91
+ [x402#3827](https://github.com/x402-foundation/x402/pull/3827#issuecomment-6230063003).
92
+
93
+ ## Linking a receipt to its settlement
94
+
95
+ A receipt with an empty `transaction` field can be matched to a payment only by
96
+ payer, payee, amount and time. Two payments with the same terms in the same block
97
+ cannot be told apart at all. Section 5.6 of the x402 offer-receipt extension fixes
98
+ that with a salted commitment to the ERC-3009 nonce: whoever holds the salt can
99
+ recompute the link to exactly one settlement, and everyone else learns nothing.
100
+
101
+ Where section 5.6 lives, because it is not where a reader would assume. Sections 5.6
102
+ through 5.6.5 do not exist in the version of the offer-receipt extension on `main`.
103
+ They exist only in pull request 3827, which is open. Everything here that cites 5.6 is
104
+ therefore measured against a proposal, pinned to commit `0e492d6` on that pull request,
105
+ which is four commits ahead of `main` and fetchable by anyone. The numbering can still
106
+ move before it merges. Levels 4 and 5 of the ladder carry this in the profile, and the
107
+ tool says so in its own output, so a result is never quietly presented as measured
108
+ against published text.
109
+
110
+ Section 5.6.5 is the part that makes this matter in practice. A commitment that
111
+ nobody has opened is still only a statement by the signer: they can issue two
112
+ receipts with different salts for one settlement, or a commitment that opens to
113
+ nothing at all. So a consumer that counts settlements, for a deduplicated or
114
+ Sybil-resistant count, may count only the commitments that someone has opened.
115
+
116
+ Here are three payments with identical terms: same payer, same payee, same
117
+ amount, same resource, minutes apart on Base Sepolia. Without a commitment those
118
+ receipts could not be told apart. Each one still resolves to its own settlement:
119
+
120
+ ```sh
121
+ npm run link-example
122
+ ```
123
+
124
+ ```
125
+ commitment : 0x5c35a61a09a566a9c284fad18a70ac2ddfff34d01d2a3ce776ce94e8d5b38ff8
126
+ candidates : 2 nonce(s) consumed by this payer in that window
127
+ LINKED : yes, to exactly one settlement
128
+ tx : 0xed87b09bfb20a8c8b69908e163fcea6432d193d389640c0465afcb5561dfeb30
129
+
130
+ commitment : 0xfecee93e1aec7d6858a218bf324f23e2a4eed07925d8d4542b9662c5026e3d22
131
+ candidates : 3 nonce(s) consumed by this payer in that window
132
+ LINKED : yes, to exactly one settlement
133
+ tx : 0x2898d0ceb97ddf60af98e19c94fc0adddbdf1e64f9032e62454085e37acfe36b
134
+
135
+ commitment : 0xea8dd34b8beac90f021a4e8d893a689c25249f86947770c8e6647c1cde206008
136
+ candidates : 2 nonce(s) consumed by this payer in that window
137
+ LINKED : yes, to exactly one settlement
138
+ tx : 0x2a9e95d63a5af8210767baa69143b364dad51caffc29a152c77e03bc508d7199
139
+ ```
140
+
141
+ Each window is centred on its own receipt's `issuedAt`, which is why the
142
+ candidate counts differ: the middle receipt's window covers all three payments
143
+ and it still picks out exactly one. That is the ambiguity section 5.6.1
144
+ describes, resolved against live state.
145
+
146
+ Two things in that output move and the verdict does not. The candidate count
147
+ rises as that payer consumes more nonces, and the upper block number is capped
148
+ at the current chain head until the head passes it. The transaction each receipt
149
+ resolves to is fixed.
150
+
151
+ The three files in `examples/` hold exactly what section 5.6.4 says a later verifier
152
+ has: the receipt, its salt, and the asset that was paid. The nonces and the
153
+ transaction hashes are deliberately kept out of them. Those come out of
154
+ `AuthorizationUsed(address,bytes32)` logs on the token contract, and the tool
155
+ accepts an answer only when exactly one candidate opens the commitment. Zero
156
+ matches and more than one match are both reported as not linked, never as a best guess.
157
+
158
+ Point it at your own receipt with `--receipt=<file>`, and add `--salt=` and
159
+ `--asset=` if they are not stored alongside it. All three are required: a receipt
160
+ and a salt without the asset cannot link, which is section 5.6.4's own warning.
161
+
162
+ Those payments went to a live x402 seller that issues version 2 receipts, and it
163
+ publishes these cases itself, with the settlement each one should resolve to, at
164
+ `https://api.tokenizen.nl/api/x402/conformance`. Point your own implementation at
165
+ that and compare, or call its paid route and link a receipt you obtained yourself.
166
+ A fixture cannot tell you whether the salt arrives at the location §5.6.3 names,
167
+ inside a real settlement envelope; only a paid call can.
168
+ Buyer and seller are both us, so this shows the chain closes end to end. It does
169
+ not show that anyone else is using it.
170
+
171
+ ## Honest limits
172
+
173
+ The format checks test the **form** of a receipt: signatures, content addressing,
174
+ and whether the hashes match the bytes a counterparty observed. They do not tell
175
+ you whether an operator is honest, or whether a registry holds a receipt as
176
+ finalized.
177
+
178
+ The settlement link does read live chain state, and these are its real edges:
179
+
180
+ - It searches a window around the receipt's `issuedAt`, not the whole chain,
181
+ because the public Base Sepolia RPC caps `eth_getLogs` at 200 blocks per call
182
+ (measured, not read in documentation). The window it searched is always printed,
183
+ so "not found" reads as "not in this window" and never as "does not exist".
184
+ Widen it with `--window=`.
185
+
186
+ A receipt may be signed before its settlement lands, since the seller holds the
187
+ nonce first, so the window is centred rather than backward-looking. What that
188
+ costs, measured against a live receipt, with the reach derived from the measured
189
+ block time:
190
+
191
+ | `--window` | reach around `issuedAt` | RPC calls | wall clock |
192
+ |---|---|---|---|
193
+ | 50 | 1.7 min | 1 | 0.7s |
194
+ | 200 | 6.7 min | 3 | 0.8s |
195
+ | 400 (default) | 13 min | 5 | 1.3s |
196
+ | 1000 | 33 min | 11 | 1.7s |
197
+ | 2000 | 67 min | 21 | 2.9s |
198
+
199
+ Calls grow linearly with the window and not with the payer's history, which is
200
+ the trade the window buys: an hour of tolerance for 21 requests. Searching a
201
+ payer's full set of consumed nonces instead needs no `issuedAt` at all and
202
+ cannot miss on skew, at a cost that grows with how much that payer has ever
203
+ spent.
204
+ - A refused RPC call raises an error instead of returning an empty result. A search
205
+ that could not run must never be reported as a search that found nothing.
206
+ - Only `eip3009` is implemented, because that is the only method the specification
207
+ currently defines.
208
+ - It confirms that a receipt commits to one settlement. It does not confirm that
209
+ the amount or the payee were the agreed ones; read the matching transaction for
210
+ that.
211
+ - Receipt version 2 is defined in a pull request that is still open, so its
212
+ preimage can still change. The commit it was built against is pinned in the
213
+ source and in the status table above.
214
+
215
+ ## Provenance and license
216
+
217
+ Apache-2.0, the same licence both verified projects use. Their published test material is
218
+ redistributed unmodified with attribution; see NOTICE for the exact commits. Neither
219
+ project has reviewed or endorsed this repository.
220
+
221
+ ## Check your own endpoint, in one command
222
+
223
+ No install, no account, nothing published to npm:
224
+
225
+ ```sh
226
+ npx github:holistis/agent-receipt-verify https://your-endpoint.example/paid
227
+ ```
228
+
229
+ The ladder itself is a versioned file, [profiles/x402-deployed-ladder-v1.json](profiles/x402-deployed-ladder-v1.json),
230
+ which names the clause behind every level, the input each check needs, and what to
231
+ report when a check cannot decide. The tool reads that file rather than carrying the
232
+ rules in code, so a second implementation can measure the same thing without reading
233
+ ours.
234
+
235
+ It measures levels 0 to 2 of the ladder in [CONFORMANCE.md](CONFORMANCE.md) without
236
+ paying. Levels 3 to 5 need a real settlement and come back as not measured, never as
237
+ failed. What it deliberately does not measure is listed in that same file.
238
+
239
+ ## A badge for an endpoint that was measured
240
+
241
+ If an edition covered your endpoint, there is a badge for it:
242
+
243
+ ```md
244
+ [![x402 receipt](https://api.tokenizen.nl/api/x402/badge?url=https%3A%2F%2Fyour-endpoint.example%2Fpaid)](https://github.com/holistis/agent-receipt-verify/blob/main/CONFORMANCE.md)
245
+ ```
246
+
247
+ The same data as JSON is at `/api/x402/badge.json?url=...`.
248
+
249
+ Two things about that badge, because both are deliberate. It never measures live: it
250
+ answers from a dated measurement, so nobody can use that endpoint to probe arbitrary
251
+ hosts, and the number does not change on every hiccup. And the measurement date is
252
+ rendered inside the badge, so a badge that has gone stale is visibly old rather than
253
+ quietly wrong.
254
+
255
+ An endpoint no edition has covered comes back as `measured: false`, not as level 0.
256
+ Those are different claims: one says we looked and found nothing, the other says we
257
+ never looked.