- Protocol
- x402
- Type
- SDK
- Stars
- 292
- License
- Apache-2.0
- Last push
- Jul 13, 2026
About x402-rs
x402-rs is an open-source x402 SDK by x402-rs, written mainly in Rust. Rust libraries to verify, settle and monitor x402 payments. It has 292 GitHub stars and uses the Apache-2.0 license, and its code was last pushed on Jul 13, 2026.
New to x402? Our x402 Protocol guide explains how it works and lists other projects built on it.
At a glance
- Protocol
- x402
- Type
- SDK
- Language
- Rust
- License
- Apache-2.0
- GitHub stars
- 292
- Last push
- Jul 13, 2026
Listed from public GitHub data, checked 2026-11-08. Not scanned by AgenticMart.
Questions about x402-rs
What is x402-rs?
Rust libraries to verify, settle and monitor x402 payments It is listed as a x402 SDK, maintained in the x402-rs/x402-rs repository on GitHub.
How do I install x402-rs?
The README in x402-rs/x402-rs has the setup steps. Clone the repository with git clone https://github.com/x402-rs/x402-rs.git and follow its instructions.
Is x402-rs an official x402 project?
No. It is a community project built on x402, not published by the organisation that runs the protocol.
What license does x402-rs use?
It is published under the Apache-2.0 license. Check the license file in the repository before using it commercially.
Is x402-rs still maintained?
Its code was last pushed on Jul 13, 2026, and it had 292 GitHub stars when we checked on 2026-11-08. Look at recent issues and releases in the repository for a fuller picture.
README
x402-rs
A comprehensive Rust toolkit for the x402 protocol, enabling blockchain payments directly through HTTP using the native
402 Payment Requiredstatus code.
x402-rs is a modular, production-ready implementation of the x402 protocol with support for multiple blockchains (EVM, Solana, Aptos, ..) and protocol versions (V1 and V2).
Core Crates
| Crate | Badges | Description |
|---|---|---|
x402-types | Core protocol types, facilitator traits, and utilities. Foundation for all x402 implementations. | |
x402-axum | Axum middleware for protecting routes with x402 payments. | |
x402-reqwest | Reqwest middleware for transparent x402 payment handling. | |
x402-facilitator-local | Local facilitator implementation for payment verification and settlement. |
Blockchain Support
| Crate | Badges | Description |
|---|---|---|
x402-chain-eip155 | EVM/EIP-155 chain support (Ethereum, Base, Polygon, etc.) | |
x402-chain-solana | Solana blockchain support | |
x402-chain-aptos | ⚠️ Git-only | Aptos blockchain support (requires git dependency) |
Deployment
| Crate | Description |
|---|---|
x402-facilitator | Production-ready facilitator server binary (not published to crates.io) |
About x402
The x402 protocol is a proposed standard for making blockchain payments directly through HTTP using the native 402 Payment Required status code.
How it works:
- Server declares payment requirements for specific routes
- Client sends cryptographically signed payment payloads
- Facilitator verifies and settles payments on-chain
This enables seamless pay-per-use transactions without requiring clients to manage blockchain interactions directly.
Quick Start
Protect Routes (Server)
Use x402-axum to gate your routes behind on-chain payments:
use alloy_primitives::address;
use axum::{Router, routing::get};
use x402_axum::X402Middleware;
use x402_chain_eip155::V2Eip155Exact;
use x402_types::networks::USDC;
let x402 = X402Middleware::new("http://facilitator.example.com");
let app = Router::new().route(
"/paid-content",
get(handler).layer(
x402.with_price_tag(V2Eip155Exact::price_tag(
address!("0xYourAddress"),
USDC::base_sepolia().amount(10u64),
))
),
);
See x402-axum documentation for more details.
Send Payments (Client)
Use x402-reqwest to automatically handle x402 payments:
use x402_reqwest::{ReqwestWithPayments, ReqwestWithPaymentsBuild, X402Client};
use x402_chain_eip155::V2Eip155ExactClient;
use alloy_signer_local::PrivateKeySigner;
use std::sync::Arc;
use reqwest::Client;
let signer: Arc<PrivateKeySigner> = Arc::new("0x...".parse()?);
let x402_client = X402Client::new()
.register(V2Eip155ExactClient::new(signer));
let client = Client::new()
.with_payments(x402_client)
.build();
let res = client
.get("https://example.com/protected")
.send()
.await?;
See x402-reqwest documentation for more details.
Run a Facilitator
Docker
Prebuilt Docker images are available at GitHub Container Registry:
docker run -v $(pwd)/config.json:/app/config.json -p 8080:8080 ghcr.io/x402-rs/x402-facilitator
Build Your Own
For custom facilitator implementations, see the Build Your Own Facilitator guide.
For full facilitator configuration and deployment details, see the x402-facilitator README.
Roadmap
| Milestone | Description | Status |
|---|---|---|
| Facilitator for Base USDC | Payment verification and settlement service, enabling real-time pay-per-use transactions for Base chain. | ✅ Complete |
| Metrics and Tracing | Expose OpenTelemetry metrics and structured tracing for observability, monitoring, and debugging | ✅ Complete |
| Server Middleware | Provide ready-to-use integration for Rust web frameworks such as axum and tower. | ✅ Complete |
| Client Library | Provide a lightweight Rust library for initiating and managing x402 payment flows from Rust clients. | ✅ Complete |
| Solana Support | Support Solana chain. | ✅ Complete |
| Protocol v2 Support | Support x402 protocol version 2 with improved payload structure. | ✅ Complete |
| Multiple chains and multiple tokens | Support various tokens and EVM compatible chains. | ✅ Complete |
| Axum Middleware v2 Support | Full x402 protocol v2 support in x402-axum with multi-chain, multi-scheme architecture. | ✅ Complete |
| Reqwest Client v2 Support | Full x402 protocol v2 support in x402-reqwest with multi-chain, multi-scheme architecture. | ✅ Complete |
| Build your own facilitator hooks | Pre/post hooks for analytics, access control, and auditability. | 🔜 Planned |
| Bazaar Extension | Marketplace integration for discovering and purchasing x402-protected resources. | 🔜 Planned |
| Gasless Approval Flow | Support for Permit2 and ERC20 approvals to enable gasless payment authorization. | 🔜 Planned |
| Upto Scheme | Payment scheme supporting "up to" amount payments with flexible pricing. | 🔜 Planned |
| Deferred Scheme | Payment scheme supporting deferred settlement and payment scheduling. | 🔜 Planned |
Related Resources
Contributions and Feedback
Feel free to open issues or pull requests to improve x402 support in the Rust ecosystem.
License
More x402 projects
All 20 →x402
Reference specification and SDKs for the x402 payments protocol
vapi-network
TypeScript client for paying x402 APIs in USDC on Base
Daydreams
Agent commerce toolkit with x402 pay-per-use model access