Skip to content

Overview

The x402 Facilitator is a production-ready server that implements the x402 payment protocol for multiple blockchain networks. It acts as a trusted third party that:

  1. Verifies that a payment payload is cryptographically valid and meets the stated requirements.
  2. Settles the payment on-chain by broadcasting the transaction.
  3. Records per-client metrics for billing and observability.

Why a Facilitator?

The x402 protocol uses an HTTP 402 Payment Required flow. When a client hits a protected resource, the server returns payment requirements. The client constructs a signed payment payload and re-sends the request with that payload in the X-Payment header.

The resource server (your API) doesn't need to know how to talk to Base, Solana, or Cosmos - it delegates that complexity to the facilitator:

Client ──► Resource Server ──► Facilitator ──► Blockchain
              (your API)        (this server)

Key Capabilities

CapabilityDetails
VerificationValidates signatures, amounts, timeouts, and chain state
SettlementBroadcasts signed transactions; returns tx hash and block number
Multi-chainEVM (Base), Solana, Cosmos (Osmosis, CosmosHub, Noble)
AuthJWT access + refresh tokens; scoped client API keys
MetricsPer-client daily/monthly/summary roll-ups
Rate limitingConfigurable per-minute request limits
Admin APIUser management, asset registry

Supported Assets

ChainAssetSymbolDecimalsSettlement
BaseUSDCUSDC6ERC-20 transfer
SolanaUSDCUSDC6SPL transfer
OsmosisUSDCUSDC6IBC/native transfer
CosmosHubUSDCUSDC6IBC/native transfer
NobleUSDCUSDC6Native transfer

Architecture

┌──────────────┐    ┌──────────────────┐    ┌───────────────────────┐
│ Client Apps  │    │  Load Balancer   │    │   x402 Facilitator    │
│              │◄──►│  (Nginx/HAProxy) │◄──►│   (Gin + x402-go)    │
│ • Web Apps   │    │  • Rate Limiting │    │   • Verify / Settle   │
│ • AI Agents  │    │  • TLS           │    │   • Client Auth       │
│ • Services   │    └──────────────────┘    │   • Metrics           │
└──────────────┘                            └───────────┬───────────┘

                                         ┌──────────────┼──────────────┐
                                         ▼              ▼              ▼
                                    ┌─────────┐   ┌─────────┐   ┌──────────┐
                                    │Postgres │   │  Redis  │   │x402-go   │
                                    │         │   │  Cache  │   │(chainlib)│
                                    └─────────┘   └─────────┘   └────┬─────┘

                                              ┌───────────────────────┼──────┐
                                              ▼                       ▼      ▼
                                         ┌────────┐           ┌────────┐ ┌───────┐
                                         │  EVM   │           │ Solana │ │Cosmos │
                                         │ (Base) │           │        │ │       │
                                         └────────┘           └────────┘ └───────┘

Tech Stack

  • Language: Go 1.24+
  • Framework: Gin HTTP framework
  • Database: PostgreSQL 14+ (migrations via golang-migrate)
  • Cache: Redis
  • Chain library: x402-go - standalone Go library that handles EVM (EIP-3009), Solana (SPL), and Cosmos (MsgSend) verification and settlement
  • Auth: JWT (access + refresh tokens), HMAC-signed client API keys

What's Next

Released under the MIT License.