Pay and charge with x402 on Base, refuse a payment before it is signed, and keep a receipt that says what the payment was for.
The chain already shows who paid whom, how much, and when. A Nirium receipt adds what the chain
does not keep: which order a payment was for and who declared it, signed by the payer and bound
to one specific USDC Transfer log. Anyone can check it against Base with a public RPC and
nothing else from us.
This is Nirium on Base. Nirium started on Stellar; this repo brings the
same receipt format and the same pre-sign policy contract to Base and Base Sepolia. The code is
the EVM code of nirium-avalanche with
Base's network table.
| Piece | Base Sepolia | Base mainnet |
|---|---|---|
Receipt verifier (base/verify-evm-receipt.mjs) |
yes, our selftest receipt | yes, our selftest receipt; fixtures from a third-party payment |
Pre-sign policy (base/policy/) |
offline tests | not yet |
Pay and charge library (base/sdk/) |
yes (selftest, 1 Dec 2026) | yes (selftest, 1 Dec 2026) |
x402 market (base/market/) |
offline tests | yes, live at nirium-market-base.fly.dev (selftest sale, 1 Dec 2026) |
A row says "yes" only once a settled payment's hash is in evidence/.
Every payment there is made by the team to test the flow, labeled selftest, and is not usage.
Nothing here has had an external audit.
The USDC contracts do not share an EIP-712 domain name: Base Sepolia USDC signs as USDC,
Base mainnet USDC as USD Coin (both version 2). The name lives in each row of
base/sdk/networks.mjs; with the wrong one every signature is invalid.
| Path | What it does |
|---|---|
docs/payment-binding-v1.md |
The receipt format and what a verifier checks |
docs/decision-receipt-v1.md |
Decision receipts: a payer-signed record of what the pre-sign policy decided, including payments it refused (DENY, WAIT), which leave nothing on-chain |
base/verify-evm-core.mjs |
Checks a receipt against a USDC Transfer log (tx hash + block logIndex), the EIP-3009 AuthorizationUsed nonce and the payer's signature. The CLI, verifyReceipt and a browser run this file |
base/verify-evm-receipt.mjs |
The command line for it |
base/sdk/ |
The library: x402Serve to charge, createX402Fetch to pay (with an optional policy), bindReceipt and verifyReceipt |
base/policy/ |
Pre-sign policy: DENY, WAIT, a timeout and every malformed answer sign nothing |
base/market/ |
x402 market: Base network conditions (fees, block fill, block time) for $0.01 per query |
base/demo/ |
Reference x402 exact payment with PayAI as facilitator, then the receipt |
scripts/ |
Base Sepolia key setup |
evidence/ |
The team's test payments, each with its receipt and explorer link |
import { x402Serve, createX402Fetch, settlementOf, bindReceipt, createRulesPolicy } from "nirium-base";
app.use(x402Serve({ payTo: "0x...", network: "eip155:84532", routes: { "GET /data": "$0.01" } }));
const pay = createX402Fetch({ signer: account, network: "eip155:84532", maxAmountPerPayment: "10000",
policy: createRulesPolicy({ maxAmount: "10000" }) });
const res = await pay("https://seller.example/data");
const receipt = await bindReceipt({ tx: settlementOf(res).transaction, network: "eip155:84532", ref: "order-42", signer: account });x402Serve runs on your server: Nirium runs nothing in the middle and receives nothing.
| Suite | Command | Network |
|---|---|---|
Verifier core (hash against node:crypto, EIP-191, the full check on recorded RPC answers, altered fields) |
cd base && npm ci && npm run test:verify |
none |
| Verifier, 10 cases against a real third-party Base mainnet payment | cd base && npm ci && bash run-tests.sh |
public Base RPC |
| Pre-sign policy, 19 tests | cd base && npm ci && npm run test:policy |
none |
| Library | cd base && npm ci && npm run test:sdk |
one test reads the public Base Sepolia RPC |
| Market | cd base && npm ci && cd market && npm ci && npm test |
none |
CI runs all of them on every pull request. The verifier fixtures point at a third-party payment and are labeled as such: they test the verifier, they are not usage of this project.
- Non-custodial: every key belongs to whoever pays or receives. Nirium never holds one.
- Mainnet payments need an explicit opt-in on the client (
NIRIUM_ALLOW_MAINNET=1orallowMainnet: true). - Settlement is done by PayAI, an independent facilitator. Nirium runs no facilitator.
- Receipts are tamper-evident, not tamper-proof: an edited receipt no longer matches its hash or its signature. A receipt does not prove that goods or a service were delivered.
- Keys never go in this repo. The key script writes outside it and refuses to run inside it.
See SECURITY.md. Please report vulnerabilities privately, not in a public issue.