██╗  ██╗ ██╗  ██╗  ██████╗  ██████╗       ██╗  ██╗ ██╗   ██╗ ██████╗
 ╚██╗██╔╝ ██║  ██║ ██╔═████╗ ╚════██╗      ██║  ██║ ██║   ██║ ██╔══██╗
  ╚███╔╝  ███████║ ██║██╔██║  █████╔╝      ███████║ ██║   ██║ ██████╔╝
  ██╔██╗  ╚════██║ ████╔╝██║ ██╔═══╝       ╚════██║ ██║   ██║ ██╔══██╗
 ██╔╝ ██╗      ██║ ╚██████╔╝ ███████╗           ██║ ╚██████╔╝ ██████╔╝
 ╚═╝  ╚═╝      ╚═╝  ╚═════╝  ╚══════╝           ╚═╝  ╚═════╝  ╚═════╝

 ███████╗  █████╗   ██████╗ ██╗ ██╗      ██╗ ████████╗  █████╗  ████████╗  ██████╗  ██████╗
 ██╔════╝ ██╔══██╗ ██╔════╝ ██║ ██║      ██║ ╚══██╔══╝ ██╔══██╗ ╚══██╔══╝ ██╔═══██╗ ██╔══██╗
 █████╗   ███████║ ██║      ██║ ██║      ██║    ██║    ███████║    ██║    ██║   ██║ ██████╔╝
 ██╔══╝   ██╔══██║ ██║      ██║ ██║      ██║    ██║    ██╔══██║    ██║    ██║   ██║ ██╔══██╗
 ██║      ██║  ██║ ╚██████╗ ██║ ███████╗ ██║    ██║    ██║  ██║    ██║    ╚██████╔╝ ██║  ██║
 ╚═╝      ╚═╝  ╚═╝  ╚═════╝ ╚═╝ ╚══════╝ ╚═╝    ╚═╝    ╚═╝  ╚═╝    ╚═╝     ╚═════╝  ╚═╝  ╚═╝
    

🚀 System Status

Enabled Networks 6 networks: ethereum, celo, base, polygon, avalanche, arbitrum
Default Network Ethereum Mainnet (Chain ID: 1)

🌐 Network Configurations

Ethereum Mainnet (Default)
Chain ID: 1 | USDC: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
Celo Mainnet
Chain ID: 42220 | USDC: 0xcebA9300f2b948710d2653dD7B07f33A8B32118C
Base Mainnet
Chain ID: 8453 | USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Polygon Mainnet
Chain ID: 137 | USDC: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359
Avalanche C-Chain
Chain ID: 43114 | USDC: 0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E
Arbitrum One
Chain ID: 42161 | USDC: 0xaf88d065e77c8cC2239327C5EDb3A432268e5831

💾 System Services

Database 🔵 Connected (Supabase)
Deferred Payments 🔵 Enabled (x402 PR #426)
Deep Link Polling 🔵 Enabled
Self Protocol 🔵 Enabled (proof-of-unique-human)

📡 Standard x402 Endpoints

GET/supported
Returns supported payment schemes (exact, deferred)
POST/verify
Verify x402 payment payload
POST/settle
Settle verified payment on-chain (EIP-3009)

💎 Deferred Payment Endpoints x402 PR #426

POST/deferred/verify
Verify and store off-chain voucher (99% gas savings)
POST/deferred/settle
Aggregate and settle vouchers on-chain
GET/deferred/balance/:payee
Get accumulated unsettled balance

🔐 Self Protocol Endpoints

POST/verify-celo
Verify Celo payment + Self proof (tiered pricing)
POST/api/verify
Self QR verification endpoint (deep link callback)
GET/verify-status/:sessionId
Poll verification status (mobile-first flow)

🛠️ System Endpoints

GET/health
Health check with network info (JSON)

🔌 Quick Integration Guide

Connect any API service to this facilitator in 3 simple steps:

📦 Step 1: Install Framework
npm install selfx402-framework
⚙️ Step 2: Configure Facilitator URL
// src/config/x402.ts
export const x402Config = {
  network: "celo",
  facilitatorUrl: "https://facilitator.x402hub.xyz",
  paymentPrice: "0.001", // $0.001 for verified humans
  walletAddress: process.env.PAYMENT_WALLET_ADDRESS
};
🛡️ Step 3: Add Payment Middleware
import { celoPaymentMiddleware } from "selfx402-framework/middleware";

const paymentMiddleware = celoPaymentMiddleware({
  facilitatorUrl: x402Config.facilitatorUrl,
  network: x402Config.network,
  paymentPrice: x402Config.paymentPrice,
  walletAddress: x402Config.walletAddress,
  enableSelfProtocol: true, // Enable proof-of-unique-human
});

// Apply to protected routes
app.get("/api/protected", paymentMiddleware, (req, res) => {
  const tier = req.tier; // "verified_human" | "unverified"
  res.json({ message: "Access granted!", tier });
});
✅ Step 4: Add Service Discovery (Optional but Recommended)
app.get("/.well-known/x402", (req, res) => {
  // Use first enabled network as example
  const exampleNetwork = networkService.getEnabledNetworks()[0] || "base";
  const exampleConfig = networkService.getNetworkConfig(exampleNetwork);

  res.json({
    version: 1,
    facilitatorUrl: "https://facilitator.x402hub.xyz",
    payment: {
      network: exampleNetwork,
      asset: "${exampleConfig.usdcAddress}",
      payTo: x402Config.walletAddress,
    },
    verification: {
      enabled: true,
      requirements: {
        minimumAge: 18,
        excludedCountries: [], // ISO 3166-1 alpha-3
        ofac: false,
      },
      scope: "my-api-v1", // Unique identifier
    },
    pricing: {
      tiers: {
        unverified: { price: "1.00", description: "Bot pricing" },
        verified_human: { price: "0.001", description: "1000x cheaper" }
      }
    }
  });
});
🎉 That's it! Your API now accepts:
  • x402 micropayments (EIP-712 signatures)
  • Self Protocol verification (proof-of-unique-human)
  • Tiered pricing (bots pay 1000x more)
  • Deferred payments (99% gas savings)

Built with ❤️ for the Self ZK Residency (Oct 14-31, 2025)

Self Protocol • x402Hub • Multi-Chain • TypeScript • Express • Supabase