NERO 402
AA-native x402 stack
testnet · eip155:689
Pay APIs in stablecoins.
Gas is sponsored.
The first production implementation of the x402 V2 payment protocol with ERC-4337 accounts and paymaster-sponsored gas. Agents pay merchants in stablecoin over HTTP; settlement lands on chain through a single audited contract. The agent never holds NERO native.
x402 V2 wire-protocol compliant
Settled on NERO testnet
5 packages · `npm install` away
How it works
The agent makes a normal HTTP request. Everything else happens in the SDK and on chain.
01
Agent calls a paid API
An LLM, script, or browser tab hits any endpoint with a normal POST. No wallet popup, no gas, no setup.
02
Server returns HTTP 402
The merchant's middleware emits the price + accepted schemes in a PAYMENT-REQUIRED header. Standard x402 V2.
03
Client signs a UserOp
@nerochain/x402-client decodes the price; @nerochain/x402-aa builds a paymaster-sponsored UserOp targeting SettlementContract.settle(...).
04
Settled on chain
Facilitator submits via NERO bundler. Paymaster sponsors gas. The agent gets a 200 with the tx hash. Stablecoin moved; agent paid 0 NERO native.
SDK
Five packages under the @nerochain scope. Server, client, AA helper, optional extensions, and shared types. Use what you need.
@nerochain/x402-types
Wire-format types and Zod schemas matching x402 V2. Shared by every other package.
pnpm add @nerochain/x402-types
@nerochain/x402-server
Drop-in middleware for Express, Hono, Fastify, and Next App Router. Emits 402, forwards to facilitator, attaches PAYMENT-RESPONSE.
pnpm add @nerochain/x402-server
@nerochain/x402-client
fetch-API wrapper that auto-handles 402 → sign-and-retry. Pluggable signers; works with any agent.
pnpm add @nerochain/x402-client
@nerochain/x402-aa
Paymaster-sponsored signer for the aa-native scheme. Builds + sponsors + signs the UserOp under the hood.
pnpm add @nerochain/x402-aa
@nerochain/x402-extensions
Optional V2 extensions: HMAC access tokens for cached re-access, payment-identifier idempotency, paywall HTML adapter, axios client.
pnpm add @nerochain/x402-extensions
Three lines of agent code
import { ethers } from "ethers";
import { x402Fetch } from "@nerochain/x402-client";
import { aaNativeSigner } from "@nerochain/x402-aa";
const wallet = new ethers.Wallet(process.env.AGENT_KEY!);
const f = x402Fetch({
signer: aaNativeSigner({
signer: wallet,
rpcUrl: "https://rpc-testnet.nerochain.io",
bundlerUrl: "https://bundler-testnet.nerochain.io",
paymasterUrl: "https://paymaster-testnet.nerochain.io",
paymasterApiKey: process.env.PAYMASTER_KEY!,
settlementContract: "0x925dbba44570683ac8da99be08bc5ece8cf5a8c6",
}),
});
const res = await f("https://x402.nerochain.io/api/nero-knowledge", {
method: "POST",
body: JSON.stringify({ question: "How does the paymaster work?" }),
});Try it now
Sign in with Web3Auth, mint free DEMO-USDT, and pay any of the eight gated endpoints. Or spawn a delegated agent and watch it work autonomously.