Repository navigation
Conversation
wrapper/x402/nano verifies nano:mainnet payments with scheme exact against a node RPC the operator configures. Standard library only, no key or seed, off unless set as Config.Facilitator. Each 402 carries a fresh order id and a representative account that commits to (order id, payTo, amount); a block must be confirmed, pay the exact amount and carry that commitment. It is claimed in an append-only, locked claims file before the request is served, so a block pays for one order once, across restarts. The wrapper gains an optional Challenger interface so a facilitator can add per-challenge data to the 402 body; facilitators that do not implement it behave as before. NormalizeNetwork maps "nano".
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
XNO is already merged into 14 other projects' code and 26 directories: https://github.com/dhyabi2/the-unowned-rail/blob/main/docs/MERGED-UPSTREAM.md
This adds
wrapper/x402/nano, a self-hosted facilitator that acceptsnano:mainnetpayments with schemeexact. It uses only the standard library, needs no key or seed, and verifies a payment by reading one block from a node RPC URL the operator configures. It is opt-in: nothing changes unless a service sets it asConfig.Facilitator.Changes to the existing wrapper are small: an optional
Challengerinterface lets a facilitator add per-challenge data to the 402 body (the sixwriteChallengecalls go throughchallengeFor; facilitators that do not implement it behave exactly as before), andNormalizeNetworkmapsnano. A short section is added todocs/guides/x402-payments.md.Binding and replay: each 402 carries a fresh order id and a representative account derived from (order id, payTo, amount), and a block is accepted only if it is a confirmed send that pays payTo the exact amount in raw (1 XNO = 10^30 raw, derived, never restated) and carries that representative, so a payment for one request cannot be presented for another. The block hash is claimed in an append-only, file-locked and fsynced claims file before the request is served, so a block pays for one order once, across restarts.
Testing: the new tests (21, plus 7 subtests) pass in isolation with
go test -count=1 -race ./wrapper/x402/...(Go 1.24, in a scratch module holding onlywrapper/x402, since this sandbox has no Go 1.26), alongside the 23 existingwrapper/x402tests;gofmt -landgo vet(linux and windows) are clean. I did not run the full suite locally; this project's CI on this pull request is the check for the integration, and I will fix what it reports.