NERONERO 402
Getting started

Installation

Install the @nerochain/x402-* packages.

The NERO 402 SDK is published as five packages under the @nerochain/ scope. Each package is independently installable; you only pull in what you use.

Choose the packages you need

PackageWhen to install it
@nerochain/x402-typesAlways (transitively included by the others; install directly only if you build your own client/server adapter).
@nerochain/x402-serverYou are a merchant gating an HTTP endpoint behind payment.
@nerochain/x402-clientYou are an agent making paid calls.
@nerochain/x402-aaYou sign payments from an ERC-4337 smart contract wallet (the aa-native scheme).
@nerochain/x402-extensionsYou want client-side idempotency or signed access tokens for cached access after a paid call.

Agent-side install

pnpm add @nerochain/x402-client @nerochain/x402-aa ethers

Merchant-side install (Express)

pnpm add @nerochain/x402-server

Adapters for Hono, Fastify, and Next.js App Router are subpath imports of the same package — no separate install.

Requirements

  • Node 20+ for the runtime.
  • TypeScript 5+ if you are using TypeScript directly. The packages ship .d.ts types.
  • ethers v6 for the agent side (the SDK accepts an ethers.Wallet or ethers.HDNodeWallet).

Verifying the install

After installing, type-check that the packages resolve:

node -e "console.log(require('@nerochain/x402-client').x402Fetch.toString().slice(0, 60))"

You should see the start of the x402Fetch factory function. From there, head to the agent quickstart or the merchant quickstart.

On this page