/ Protocol · x402 v2
HTTP-native payments for AI agents.
x402 turns the forgotten HTTP 402 status code into a machine-readable payment protocol. An AI agent hits an API, gets a 402 response with payment terms, signs a gasless USDC transfer, retries — and the resource unlocks. No checkout pages, no API keys, no subscriptions.
/ What is x402
A payment layer inside HTTP.
x402 is an open protocol that extends HTTP with payment semantics. When a server returns status 402, it includes a `payment-required` header describing accepted tokens, amounts and networks. The client signs a token transfer off-chain, attaches it as a `payment-signature` header, and replays the request. The server verifies, settles, and serves the resource. No redirects, no iframes, no third-party SDKs.
The x402 handshake
- 01GET /api/resource
- 02402 + payment-required
- 03Sign EIP-3009 / Permit2
- 04Retry + payment-signature
- 05200 OK + payment-response
/ Signing methods
EIP-3009 vs Permit2.
BlockVault supports two signing standards for x402. Each has trade-offs in gas cost, token coverage and chain support.
EIP-3009 (gasless USDC)
Uses `transferWithAuthorization` built into the USDC contract. Zero gas for the payer. Supported on Ethereum, Polygon, Base, Arbitrum, Optimism and BSC.
- Gas cost: zero (meta-tx)
- Tokens: USDC only
- Chains: 6 EVM networks
Permit2 (universal ERC-20)
Uses Uniswap's Permit2 router for any ERC-20 with a one-time allowance. Requires gas for the settlement transaction.
- Gas cost: ~60k gas (settlement tx)
- Tokens: any ERC-20
- Chains: 6 EVM networks
BlockVault prefers EIP-3009 when the token is USDC on a supported chain. It falls back to Permit2 for other tokens or when the facilitator requires it.
/ Reference implementation
BlockVault as x402 client.
BlockVault is the first mobile wallet with native x402 support. The architecture: `x402Fetch` is a drop-in replacement for `fetch()` that intercepts 402 responses, parses the payment-required header, queues approval in the wallet UI, builds the EIP-3009 or Permit2 payload, and retries with the payment-signature attached.
Production endpoint
402.blockvault.ai
402.blockvault.ai — a live x402 server that sells GPU inference (Gemma 4, Llama) per token via USDC on Base.
/ How it compares
x402 wallets at a glance.
| BlockVault | Coinbase x402 | MetaMask | Trust Wallet | Phantom | Binance | |
|---|---|---|---|---|---|---|
| x402 native | ✓ | ✓ | — | — | — | — |
| Gasless (EIP-3009) | ✓ | — | — | — | — | — |
| Multi-chain (6+ EVM) | ✓ | ✓ | ✓ | ✓ | ~ | ✓ |
| AI on-device | ✓ | — | — | — | — | — |
| Self-custody | ✓ | ✓ | ✓ | ✓ | ✓ | — |
| Mobile-first | ✓ | ✓ | ~ | ✓ | ✓ | ✓ |
/ FAQ
Common questions.
- Is x402 a blockchain or a token?
- Neither. x402 is an HTTP protocol that uses existing blockchains (Ethereum, Base, Polygon, etc.) for settlement. No new chain, no new token.
- Do I need ETH for gas to make an x402 payment?
- Not with EIP-3009. USDC transfers via transferWithAuthorization are gasless for the sender. The facilitator (server) pays gas.
- Can my AI agent spend without my approval?
- Only within the policies you set. BlockVault enforces per-domain caps, daily limits and token allow-lists locally before any signature is released.
- Which tokens work with x402?
- USDC on 6 EVM chains via EIP-3009 (gasless). Any ERC-20 via Permit2 (requires gas). Most x402 servers accept USDC.
- How fast is an x402 payment?
- One off-chain signature + one HTTP retry. With EIP-3009 there is no on-chain transaction from the payer, so settlement is as fast as the facilitator confirms (~1-3 seconds).
- Is x402 open source?
- Yes. The protocol is defined at x402-foundation/x402 on GitHub. Anyone can implement a client or server.
- Can I build an x402-protected API?
- Yes. Return HTTP 402 with a payment-required header containing your terms (token, amount, network, receiver). Any x402-compatible wallet can pay.
/ Get started
Your agent's wallet is ready.
Download BlockVault and start paying APIs, inference and data feeds natively over x402. No subscriptions, no middlemen.