phdargen 5135fab5e7
Fix extra: null incompatibility between python facilitator and TS zod schema (#1762)
* Fix extra: null incompatibility between Python facilitator and TypeScript Zod schema

* fix optional strings

* fixed outdated eth_account._utils.typed_transactions import
2026-03-23 08:41:51 -07:00
..
2026-02-05 15:31:18 -08:00

x402 Advanced Facilitator Examples (Python)

FastAPI facilitator service demonstrating advanced x402 patterns including all-networks support, bazaar discovery, and lifecycle hooks.

Prerequisites

  • Python 3.10+
  • uv (install via docs.astral.sh/uv)
  • EVM private key with Base Sepolia ETH for transaction fees
  • SVM private key with Solana Devnet SOL for transaction fees

Setup

  1. Copy .env-local to .env:
cp .env-local .env
  1. Fill required environment variables:
  • EVM_PRIVATE_KEY - Ethereum private key
  • SVM_PRIVATE_KEY - Solana private key
  • PORT - Server port (optional, defaults to 4022)
  1. Install dependencies:
uv sync
  1. Run the server:
uv run python all_networks.py   # All supported networks with optional chain configuration
uv run python bazaar.py         # Bazaar discovery extension

Available Examples

Example Command Description
all_networks uv run python all_networks.py All supported networks with optional chain configuration
bazaar uv run python bazaar.py Bazaar discovery extension for cataloging x402 resources

API Endpoints

GET /supported

Returns supported networks and schemes.

POST /verify

Verifies a payment signature.

POST /settle

Settles a verified payment by broadcasting the transaction on-chain.

Network Identifiers

Networks use CAIP-2 format:

  • eip155:84532 — Base Sepolia
  • eip155:8453 — Base Mainnet
  • solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1 — Solana Devnet
  • solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp — Solana Mainnet