Protocol v2.0 Live

The X402 Payment Rail

A decentralized, high-throughput payment infrastructure enabling instant, low-cost transactions across chains with cryptographic settlement guarantees.

<500ms
Settlement Time
100K+
TPS Capacity
$0.001
Avg. Fee
99.99%
Uptime

What is X402?

X402 is a next-generation payment rail protocol designed for the decentralized economy, combining the speed of traditional payment networks with the security of blockchain settlement.

Built for Scale, Secured by Cryptography

X402 operates as a Layer 2 payment rail that processes transactions off-chain while maintaining cryptographic guarantees through periodic settlement to underlying blockchains. The protocol uses a combination of state channels, hashed timelock contracts (HTLCs), and zero-knowledge proofs to ensure instant finality.

  • Instant Settlement - Sub-second finality through optimistic execution
  • Cross-Chain Native - Seamless interoperability across EVM, Solana, and more
  • Atomic Swaps - Trustless exchanges without intermediaries
  • Programmable Payments - Smart contract-based conditional logic
x402_transaction.rs
// X402 Payment Transaction Structure pub struct X402Transaction { pub id: TxHash, pub sender: Address, pub receiver: Address, pub amount: U256, pub nonce: u64, pub chain_id: ChainId, pub signature: Signature, pub metadata: PaymentMeta, } impl X402Transaction { pub fn verify(&self) -> Result<bool> { // Cryptographic verification self.signature.verify( &self.hash(), &self.sender ) } }

Architecture

X402's layered architecture separates concerns for maximum scalability, security, and developer flexibility.

Application Layer
dApps
Decentralized apps
Wallets
User interfaces
Exchanges
Trading platforms
Merchants
Payment gateways
Protocol Layer
X402 Core
Payment rail logic
Routing Engine
Path optimization
State Channels
Off-chain execution
ZK Prover
Validity proofs
Settlement Layer
Ethereum
L1 settlement
Arbitrum
L2 rollup
Polygon
Sidechain
Solana
High-throughput

Technical Flow

The X402 payment flow: from a simple HTTP request to on-chain settlement, powered by EIP-3009 signed authorizations.

1

Resource Request

A client (agent, CLI, or dApp) sends an HTTP request to a resource server that requires payment.

REQUEST
GET /api/data
Host: api.example.com
2

402 Payment Required

The resource server responds with a 402 status and payment requirements: scheme, network, amount, asset, and recipient address.

RESPONSE
402 Payment Required
accepts: {
  "scheme": "exact/eip155",
  "network": "base-sepolia",
  "amount": "1000000",
  "asset": "0x036cbd...",
  "payTo": "0xfacilitator..."
}
3

EIP-3009 Authorization

The client builds a TransferWithAuthorization typed data object and signs it via MetaMask (or compatible wallet). No gas, no transaction — just a cryptographic signature.

EIP-3009
TransferWithAuthorization {
  from: "0xclient...",
  to: "0xfacilitator...",
  value: 1000000,
  validAfter: 1700000000,
  validBefore: 1700003600,
  nonce: 0xabc...def
}
4

Verification Pipeline

The signed payload is sent to the Facilitator's POST /verify endpoint, which runs a 7-step verification pipeline:

Amount matches requirements
Recipient (payTo) matches
Signature recovers to from
Within time window
Nonce not replayed
Sufficient USDC balance
5

Settlement (Optional)

If settlement is enabled, the Facilitator's POST /settle endpoint broadcasts the transferWithAuthorization call to the USDC contract. The facilitator pays gas; the payer's USDC moves via the signed authorization.

RESPONSE
{
  "success": true,
  "transaction": {
    "hash": "0x7f3a...c29d",
    "network": "base-sepolia"
  },
  "amount": "1000000",
  "payer": "0xclient..."
}

Architecture Overview

Client
Agent / dApp / CLI
Resource Server
Returns 402 + accepts
X402 Facilitator
/verify + /settle
USDC Contract
EIP-3009 on-chain

API Reference

RESTful APIs with WebSocket support for real-time payment events and streaming.

POST /v2/payments

Create and submit a new payment transaction to the X402 network.

{ "amount": "1000000000000000000", "recipient": "0x742d35Cc6634C0532925a3b844Bc9e7595f2bD38", "chain": "eth-mainnet", "memo": "Invoice #1234" }
GET /v2/payments/{id}

Retrieve payment status, settlement proof, and transaction metadata.

{ "id": "0x8f3a...c29d", "status": "settled", "settled_at": "2024-01-15T10:30:00Z", "settlement_tx": "0xabc...def" }
GET /v2/channels

List active state channels, balances, and available liquidity.

{ "channels": [ { "id": "ch_01", "balance": "5.5 ETH", "peer": "0x123...abc", "status": "active" } ] }
POST /v2/swaps

Initiate a cross-chain atomic swap with HTLC guarantees.

{ "from_chain": "ethereum", "to_chain": "polygon", "from_amount": "1.0", "to_amount": "1850.00", "secret_hash": "0x8f3a..." }

Built for Trust

Multiple layers of cryptographic security ensure your payments are safe at every step.

End-to-End Encryption

All payment data is encrypted using AES-256-GCM with keys derived from ECDH key exchange between participants.

Zero-Knowledge Proofs

zk-SNARKs validate transaction correctness without revealing sensitive payment details on-chain.

Multi-Sig Vaults

Funds are secured in threshold signature scheme (TSS) vaults requiring m-of-n signatures for any withdrawal.

Timelock Protection

HTLC timelocks ensure funds are automatically returned if payment conditions aren't met within the specified window.

Audited & Verified

Smart contracts audited by leading security firms. Formal verification of critical protocol components.

Bug Bounty Program

Active bug bounty program with rewards up to $500K for critical vulnerability disclosures.

Integrate in Minutes

Four simple steps to start accepting and sending payments through X402.

1

Install SDK

Install the X402 SDK via npm, cargo, or go get. Supports TypeScript, Rust, and Go.

2

Configure Network

Connect to mainnet or testnet. Configure your node with API keys and chain preferences.

3

Open Channels

Fund state channels with your preferred assets. Channels enable instant off-chain payments.

4

Start Transacting

Send and receive payments programmatically. Monitor events via WebSocket streams.

Ready to Build?

Join thousands of developers building the future of payments with X402.