Sign inSign up

ukstv/x402-facilitator

By ukstv

•Updated 3 months ago

x402 payments in Rust: verify, settle, and monitor payments over HTTP 402 flows

Image
0

10K+

ukstv/x402-facilitator repository overview

⁠x402 Facilitator

Production-ready x402 payment facilitator in Rust — verify, settle, and monitor blockchain payments over HTTP 402 flows.

This Docker image runs the x402-facilitator binary, a Rust-based server that handles x402 payment verification and on-chain settlement.

⁠✨ Features

  • ✅ Payment Verification — Cryptographically verify x402 payment payloads
  • ✅ On-chain Settlement — Submit verified payments to the blockchain
  • ✅ Multi-Chain Support — EVM (EIP-155), Solana, Aptos networks
  • ✅ Protocol V1 & V2 — Support for both x402 protocol versions
  • ✅ Low Resource Footprint — Efficient Rust implementation
  • ✅ OpenTelemetry Tracing — Built-in observability

⁠🚀 Quickstart

⁠Using GHCR (GitHub Container Registry)
docker pull ghcr.io/x402-rs/x402-facilitator:latest
docker run -v $(pwd)/config.json:/app/config.json -p 8080:8080 ghcr.io/x402-rs/x402-facilitator:latest
⁠Using Docker Hub
docker pull ukstv/x402-facilitator:latest
docker run -v $(pwd)/config.json:/app/config.json -p 8080:8080 ukstv/x402-facilitator:latest

⁠📋 Configuration

The facilitator requires a config.json file. See config.json.example⁠:

{
  "port": 8080,
  "host": "0.0.0.0",
  "chains": {
    "eip155:84532": {
      "eip1559": true,
      "flashblocks": true,
      "signers": ["0xWALLET"],
      "rpc": [
        {
          "http": "https://rpc.com/eip155/84532",
          "rate_limit": 50
        }
      ]
    },
    "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp": {
      "signer": "SOLANA_PRIVATE_KEY",
      "rpc": "https://rpc.com/solana/5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",
      "pubsub": "wss://rpc.com/solana/5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"
    }
  },
  "schemes": [
    {
      "id": "v1-eip155-exact",
      "chains": "eip155:*"
    },
    {
      "id": "v2-eip155-exact",
      "chains": "eip155:*"
    },
    {
      "id": "v1-solana-exact",
      "chains": "solana:*"
    },
    {
      "id": "v2-solana-exact",
      "chains": "solana:*"
    }
  ]
}
⁠Environment Variables

The facilitator supports the following environment variables (defined in the facilitator⁠ crate):

VariableDescriptionDefault
HOSTServer bind address0.0.0.0
PORTServer port8080
CONFIGPath to config fileconfig.json
RUST_LOGLog level (error, warn, info, debug, trace)info
OTEL_EXPORTER_OTLP_ENDPOINTOpenTelemetry collector endpoint—
OTEL_SERVICE_NAMEService name for traces—

Environment variables override values in config.json.

⁠🌐 Supported Networks

EIP-155 (EVM), Solana, and Aptos networks are supported. Configure the networks you need in config.json using CAIP-2⁠ chain IDs.

⁠Common Network Examples
NetworkCAIP-2 ID
Base Sepoliaeip155:84532
Base Mainneteip155:8453
Polygoneip155:137
Solana Devnetsolana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1
Solana Mainnetsolana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
Aptos Testnetaptos:2
Aptos Mainnetaptos:1

⁠📖 API Endpoints

The facilitator exposes the following HTTP endpoints (as defined in the facilitator⁠ crate):

EndpointMethodDescription
/GETServer greeting
/verifyPOSTVerify a payment payload
/settlePOSTSettle a verified payment on-chain
/supportedGETList supported schemes and chains
/healthGETHealth check

⁠🛠️ Building from Source

git clone https://github.com/x402-rs/x402-rs.git
cd x402-rs
docker build . -t x402-facilitator

⁠📄 License

Apache-2.0

⁠🤝 Contributing

Open issues or PRs at https://github.com/x402-rs/x402-rs⁠

Tag summary

Content type

Image

Digest

sha256:4ebe09d82…

Size

41.4 MB

Last updated

3 months ago

docker pull ukstv/x402-facilitator