x402-demo-arbitrum is an early-stage TypeScript project in the AI payments / x402 ecosystem, focused on ap2, arbitrum, x402. It currently has 9 GitHub stars and 3 forks, and sits alongside related tools like ledgerflow, awesome-agent-payments-protocol, sardis, Agent402, mono, agentic-payments-bot.
A complete monorepo demonstrating the x402 protocol and AP2 protocol for metered AI inference with on-chain settlement on Arbitrum (Arbitrum One by default; Sepolia supported).
This monorepo contains two integrated services:
Implementation of x402 for HTTP 402 Payment Required responses with:
Complete AP2 protocol implementation with:
NETWORK)Follow these steps in order:
pnpm install
Set up environment variables for both services:
# x402-service configuration
cp x402-service/.env.example x402-service/.env
# ap2-service configuration
cp ap2-service/.env.example ap2-service/.env
Edit the .env files with your wallet private keys and RPC URLs. See individual service READMEs for detailed configuration.
Note: The x402 flow now uses CAIP-2 network IDs and returns requirements in the PAYMENT-RESPONSE header (mirrored to X-PAYMENT-RESPONSE).
This step must be completed before running the services.
Deploy TestUSDC, TestWETH, QuoteRegistry, MockAdapter, and ComposableExecutor contracts to Arbitrum Sepolia (testnet):
pnpm x402:deploy
This creates x402-service/out/addresses.sepolia.json with deployed contract addresses.
If using Arbitrum One (NETWORK=eip155:42161), use the mainnet addresses instead.
Mint test USDC and WETH tokens to your wallet:
pnpm x402:seed
Start the Docker container and pull the AI model:
# Start Ollama container
pnpm ap2:docker:up
# Pull the AI model (first time only)
pnpm ap2:ollama:pull
Verify Ollama is running:
curl http://localhost:11434/api/tags
You have several options:
Run everything together:
pnpm dev:all
Run x402 services only:
pnpm dev:x402
Run AP2 services only:
pnpm dev:ap2
Run services individually:
# x402 services
pnpm x402:facilitator # Custom facilitator on :3002
pnpm x402:service # Quote service on :3001
# AP2 services
pnpm ap2:backend # AP2 backend on :3003
pnpm ap2:frontend # React frontend on :5173
Test the x402 payment flow:
pnpm --filter x402-service pay test-x402
Access the AP2 chat interface at http://localhost:5173
┌─────────────────┐
│ AP2 Service │
│ (Agent Layer) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ x402 Service │
│ (Payment Layer) │
└────────┬────────┘
│
▼
┌─────────────────┐
│ Arbitrum Sepolia│
│ Network │
└─────────────────┘
pnpm x402:deploy - Deploy smart contracts to Arbitrum Sepolia (TestUSDC, TestWETH, etc.)pnpm x402:seed - Mint test tokens to your walletpnpm ap2:docker:up - Start Ollama Docker containerpnpm ap2:docker:down - Stop Ollama Docker containerpnpm ap2:ollama:pull - Pull the AI model (llama3.1:8b)pnpm dev:all - Run all services together (x402 + AP2)pnpm dev:x402 - Run x402 facilitator and quote servicepnpm dev:ap2 - Run AP2 backend and frontendpnpm x402:facilitator - Run x402 facilitator only (port 3002)pnpm x402:service - Run x402 quote service only (port 3001)pnpm ap2:backend - Run AP2 backend only (port 3003)pnpm ap2:frontend - Run AP2 frontend only (port 5173)pnpm --filter x402-service pay test-x402 - Test x402 payment flowpnpm --filter x402-service pay pay --swap ... - Execute a paid swapMake sure you've deployed the contracts:
pnpm x402:deploy
Seed your wallet with test tokens:
pnpm x402:seed
Verify Docker container is running:
docker ps | grep ollama
pnpm ap2:docker:up
Ensure all required services are running in the correct order:
pnpm x402:deploy)pnpm ap2:docker:up)pnpm dev:x402)pnpm dev:ap2)This project is licensed under the MIT License - see the LICENSE file for details.
A chain-agnostic AI-native payment infrastructure, authz layer for x402
🚀 Curated resources for Google's Agent Payments Protocol (AP2), A2A & x402 — blogs, videos, repos & specs. Contributions welcome!
The open authority layer + SDKs for AI-agent payments. Thin Python/TS clients, an MCP server, framework adapters (LangChain/CrewAI/Hermes/OpenClaw/…), and @sardis/reference — a pure policy simulator + AP2/TAP/x402 verifiers showing exactly how Sardis decides if an agent may spend. The hosted engine that moves money is private.
500+ pay-per-call web tools + skill packs for AI agents — every one tested, priced, and settled on-chain. Paid in USDC over x402 on 8 chains, or free via proof-of-work on the pure-CPU tools. Self-hostable, MCP-native, deterministic. Plus the open x402 index (Find / Route / Leaderboard).
Safe bridge between AI agents and Web3 transactions. Open-source React kit + protocol with anti-phishing UI patterns built in.
🤖💵 Agentic Payment Service for Open Agent Skills Ecosystem.
Lucid Agents Commerce SDK. Bootstrap AI agents in 60 seconds that can pay, sell, and participate in agentic commerce supply chains. Our protocol agnostic SDK provides CLI-generated templates and drop-in adapters for Hono, Express, Next.js, and TanStack, giving you instant access to crypto/fiat payment rails (AP2, A2A, x402, ERC8004).
Building blocks for Agentic payments (x402, MPP, AP2) for TypeScript, Rust, Go, Python, Ruby, PHP, Lua, Kotlin and Swift.
Building blocks for Agentic payments (x402, MPP, AP2) for TypeScript, Rust, Go, Python, Ruby, PHP, Lua, Kotlin and Swift.
Skills & plugins for agentic commerce : UCP, ACP, AP2, A2A, WebMCP, Magento 2, BigCommerce, WooCommerce
Trust infrastructure for million-agent economies on Solana - identity, reputation, and validation designed for continuous feedback at scale.
A neutral landscape analysis of AI agent payment protocols (x402, MPP, L402, Google AP2, Visa TAP + ICC, Mastercard Agent Pay, Amex ACE, Google/Shopify UCP, OpenAI ACP, and others). Maintained by Genesis Software Group, Copenhagen. Updated April 2026. CC BY 4.0.