Protocol
x402
Type
SDK
Stars
292
License
Apache-2.0
Last push
Jul 13, 2026

x402-rs x402 SDK

by x402-rs• 292•

Rust libraries to verify, settle and monitor x402 payments

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

Crates.io Docs.rs GHCR

A comprehensive Rust toolkit for the x402 protocol, enabling blockchain payments directly through HTTP using the native 402 Payment Required status 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

CrateBadgesDescription
x402-typesCrates.io Docs.rsCore protocol types, facilitator traits, and utilities. Foundation for all x402 implementations.
x402-axumCrates.io Docs.rsAxum middleware for protecting routes with x402 payments.
x402-reqwestCrates.io Docs.rsReqwest middleware for transparent x402 payment handling.
x402-facilitator-localCrates.io Docs.rsLocal facilitator implementation for payment verification and settlement.

Blockchain Support

CrateBadgesDescription
x402-chain-eip155Crates.io Docs.rsEVM/EIP-155 chain support (Ethereum, Base, Polygon, etc.)
x402-chain-solanaCrates.io Docs.rsSolana blockchain support
x402-chain-aptos⚠️ Git-onlyAptos blockchain support (requires git dependency)

Deployment

CrateDescription
x402-facilitatorProduction-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:

  1. Server declares payment requirements for specific routes
  2. Client sends cryptographically signed payment payloads
  3. 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

MilestoneDescriptionStatus
Facilitator for Base USDCPayment verification and settlement service, enabling real-time pay-per-use transactions for Base chain.✅ Complete
Metrics and TracingExpose OpenTelemetry metrics and structured tracing for observability, monitoring, and debugging✅ Complete
Server MiddlewareProvide ready-to-use integration for Rust web frameworks such as axum and tower.✅ Complete
Client LibraryProvide a lightweight Rust library for initiating and managing x402 payment flows from Rust clients.✅ Complete
Solana SupportSupport Solana chain.✅ Complete
Protocol v2 SupportSupport x402 protocol version 2 with improved payload structure.✅ Complete
Multiple chains and multiple tokensSupport various tokens and EVM compatible chains.✅ Complete
Axum Middleware v2 SupportFull x402 protocol v2 support in x402-axum with multi-chain, multi-scheme architecture.✅ Complete
Reqwest Client v2 SupportFull x402 protocol v2 support in x402-reqwest with multi-chain, multi-scheme architecture.✅ Complete
Build your own facilitator hooksPre/post hooks for analytics, access control, and auditability.🔜 Planned
Bazaar ExtensionMarketplace integration for discovering and purchasing x402-protected resources.🔜 Planned
Gasless Approval FlowSupport for Permit2 and ERC20 approvals to enable gasless payment authorization.🔜 Planned
Upto SchemePayment scheme supporting "up to" amount payments with flexible pricing.🔜 Planned
Deferred SchemePayment 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

Apache-2.0

More x402 projects

All 20 →