A decentralized, high-throughput payment infrastructure enabling instant, low-cost transactions across chains with cryptographic settlement guarantees.
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.
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.
X402's layered architecture separates concerns for maximum scalability, security, and developer flexibility.
The X402 payment flow: from a simple HTTP request to on-chain settlement, powered by EIP-3009 signed authorizations.
A client (agent, CLI, or dApp) sends an HTTP request to a resource server that requires payment.
GET /api/data Host: api.example.com
The resource server responds with a 402 status and payment requirements: scheme, network, amount, asset, and recipient address.
402 Payment Required
accepts: {
"scheme": "exact/eip155",
"network": "base-sepolia",
"amount": "1000000",
"asset": "0x036cbd...",
"payTo": "0xfacilitator..."
}
The client builds a TransferWithAuthorization typed data object and signs it via MetaMask (or compatible wallet). No gas, no transaction — just a cryptographic signature.
TransferWithAuthorization {
from: "0xclient...",
to: "0xfacilitator...",
value: 1000000,
validAfter: 1700000000,
validBefore: 1700003600,
nonce: 0xabc...def
}
The signed payload is sent to the Facilitator's POST /verify endpoint, which runs a 7-step verification pipeline:
fromIf 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.
{
"success": true,
"transaction": {
"hash": "0x7f3a...c29d",
"network": "base-sepolia"
},
"amount": "1000000",
"payer": "0xclient..."
}
RESTful APIs with WebSocket support for real-time payment events and streaming.
Create and submit a new payment transaction to the X402 network.
Retrieve payment status, settlement proof, and transaction metadata.
List active state channels, balances, and available liquidity.
Initiate a cross-chain atomic swap with HTLC guarantees.
Multiple layers of cryptographic security ensure your payments are safe at every step.
All payment data is encrypted using AES-256-GCM with keys derived from ECDH key exchange between participants.
zk-SNARKs validate transaction correctness without revealing sensitive payment details on-chain.
Funds are secured in threshold signature scheme (TSS) vaults requiring m-of-n signatures for any withdrawal.
HTLC timelocks ensure funds are automatically returned if payment conditions aren't met within the specified window.
Smart contracts audited by leading security firms. Formal verification of critical protocol components.
Active bug bounty program with rewards up to $500K for critical vulnerability disclosures.
Four simple steps to start accepting and sending payments through X402.
Install the X402 SDK via npm, cargo, or go get. Supports TypeScript, Rust, and Go.
Connect to mainnet or testnet. Configure your node with API keys and chain preferences.
Fund state channels with your preferred assets. Channels enable instant off-chain payments.
Send and receive payments programmatically. Monitor events via WebSocket streams.
Join thousands of developers building the future of payments with X402.