ERC-8004
AGENTS

A Trustless Extension of Google’s A2A Protocol for On-chain Agents.

PAYMENT REQUIRED ///HTTP 402 ///STATE CHANNELS ///MICRO-PAYMENTS ///OFF-CHAIN SIGS ///ON-CHAIN SETTLEMENT ///
PAYMENT REQUIRED ///HTTP 402 ///STATE CHANNELS ///MICRO-PAYMENTS ///OFF-CHAIN SIGS ///ON-CHAIN SETTLEMENT ///

The best way to accept digital payments.

Built around the HTTP 402 status code, x402 enables users to pay for resources via API without registration, emails, OAuth, or complex signatures.

No Fees

x402 as a protocol has 0 fees for either the customer or the merchant.

Instant Settlement

Accept payments at the speed of the blockchain. Money in your wallet in 2 seconds, not T+2.

Blockchain Agnostic

x402 is not tied to any specific blockchain or token, its a neutral standard open to integration by all.

Frictionless

As little as 1 line of middleware code. Customers and agents aren't required to create an account.

Security & Trust

Security via an open standard. Anyone can implement or extend x402. Not tied to any centralized provider.

Web Native

Activates the dormant 402 HTTP status code and works with any HTTP stack via headers.

INTERACTIVE DEMO
PROTOCOL HANDSHAKE

Client

Browser / Agent

ERR:402
200 OK

Server

Resource Provider

_waiting...

STREAMING_DEMO

Total Cost
$0.0000
Micro-TXs
0
Gas Fees: $0.00
All 0 transactions occurred off-chain via x402 signatures.
DEVELOPER EXPERIENCE

1 Line of Code

Just add a single line of code in your app, and you can require a USDC payment for each incoming request.

x402 allows any web developer to accept crypto payments without the complexity of having to interact with the blockchain. If a request arrives without payment, the server responds with HTTP 402.

VIEW SDK DOCS
import { paymentMiddleware } from 'x402';// 1. Configure your priceapp.use(paymentMiddleware("0xYourWalletAddress",{"/api/premium": "$0.01"}));// 2. Resulting HeaderHTTP/1.1 402 Payment RequiredX-Price: 0.01 USDC X-Contract: 0x8021...

Powering Next-Gen
Digital Commerce

AI AGENTS

Agents can use the x402 Protocol to pay for API requests in real-time. No human intervention, no credit cards, just autonomous code paying code.

CLOUD STORAGE

Customers can easily access storage services without account creation. Upload, pay per GB, and leave. true "Serverless" usage.

CONTENT CREATORS

x402 unlocks instant transactions, enabling true micropayments for content. Unlock a video for $0.02 without a monthly subscription.

x402 unlocks new monetization models

Offering developers and content creators a frictionless way to earn revenue from small transactions without forcing subscriptions or showing ads.

Protocol Architecture

LAYER 1 (Ethereum)
DepositContract
Locks user funds
SettlementLogic
Verifies final sig & distributes
OFF-CHAIN COMMUNICATON
CRYPTOGRAPHIC
SIGNATURES
LAYER 2 (The App)
Client (Browser)
Signs state updates
Provider (Server)
Verifies & Aggregates Sigs

FAQ

Why not just use L2?

Even L2s cost $0.01-$0.10. For AI inference or API calls costing $0.0001, L2 is too expensive. x402 consolidates thousands of calls into ONE on-chain transaction.

Is it trustless?

Yes. The user locks funds. The provider cannot take more than signed. The user can withdraw funds after a timeout if the provider disappears.