@reinconsole/x402-rails
v0.1.1
Published
Real x402 rails for Rein — EIP-3009 payer, hosted-facilitator client, and on-chain indexer for Base Sepolia.
Maintainers
Readme
@reinconsole/x402-rails
The real payment rails for Rein — x402 on Base Sepolia. An EIP-3009 payer that signs real USDC payments (gasless for the agent — the facilitator submits the tx), an HTTP client for the hosted x402.org facilitator, a strict x402-v1 in-process vendor, and an on-chain indexer that reconciles USDC transfers back to the exact intents the policy engine allowed.
Status: v0.1 — early open-source infrastructure, live on testnet. Real USDC settled on Base Sepolia through the hosted facilitator — no API key needed. APIs may change before 1.0.
Install
npm install @reinconsole/x402-railsWhat's in it
import {
createX402Payer, // EIP-3009/EIP-712 signer — plugs into @reinconsole/sdk's guard as its `payer`
FacilitatorClient, // verify/settle against the hosted x402.org facilitator
OnchainIndexer, // getLogs polling; reconciles transfers to intents via the nonce memo
createRealVendor, // strict x402-v1 in-process vendor
intentNonce, // keccak256(intent.id) — the on-chain memo
generateWallet, createBaseSepoliaClient, getUsdcBalance, // wallet + chain helpers
} from '@reinconsole/x402-rails';- Gasless for the agent. The payer signs an EIP-3009
transferWithAuthorization; the facilitator submits the transaction and pays gas. A funded USDC balance is all the agent wallet needs (free testnet USDC). - An on-chain memo, no fuzzy matching. The authorization nonce is derived as
keccak256(intent.id); USDC emits it back inAuthorizationUsedon settlement, so the indexer reconciles each transfer to the exact intent the engine allowed — and flags everything else from managed wallets as shadow spend. - The hosted facilitator, for free.
FacilitatorClientspeaks the x402.org dialect (DEFAULT_FACILITATOR_URL, no API key). The same client powers@reinconsole/gate's real-rails settlement viafacilitatorClientRails. - Wire schemas included — payment payloads, verify/settle responses, header codecs; all zod-validated.
Behind a TLS-intercepting proxy or antivirus, point Node at your local root CA (NODE_EXTRA_CA_CERTS) before any live run.
The monorepo's Sepolia demos run this end to end — a guarded $0.01 payment settled on-chain, then a guard-bypassing payment caught by the indexer.
MIT © Rein contributors · Repository · Issues
