@facilitator/demo
v0.4.0
Published
Demo seller and buyer agents for the x402 multi-mechanism facilitator (EIP-7702 + ERC-3009)
Readme
x402 EIP-7702 Demo
Interactive demo showing the x402 payment protocol with EIP-7702 gasless transfers. Includes autonomous buyer/seller agents and a real-time web visualization.
Quick Start
curl -L https://foundry.paradigm.xyz | bashnpx @facilitator/demoNote: You can also use
bunx,yarn dlx, orpnpm dlxif you prefer.
This starts Anvil, deploys contracts, funds accounts, starts agents and web UI, then prints a command to run the facilitator:
npx @facilitator/server --relayer-key 0x... --delegate-address 0x... --rpc-url http://127.0.0.1:8545Run that in a new terminal, then open http://localhost:3030 and click INITIATE.
Topology
+------------------+ +------------------+
| BUYER AGENT | | SELLER AGENT |
| :4000 |---- x402 --->| :4001 |
| (1000 USDT) | | (weather API) |
+------------------+ +--------+---------+
|
+--------v---------+
| FACILITATOR |
| :8080 |
+--------+---------+
|
+--------v---------+
| ANVIL |
| :8545 |
+------------------+
+------------------+
| WEB UI |
| :3030 |
+------------------+| Service | Port | Description | | ------------ | ---- | -------------------------------------- | | Anvil | 8545 | Local EVM chain (chain ID 31337) | | Buyer Agent | 4000 | Autonomous consumer with ERC-20 tokens | | Seller Agent | 4001 | Weather data provider (1 USDT/request) | | Facilitator | 8080 | Payment verification and settlement | | Web UI | 3030 | Real-time protocol visualization |
Web UI
The web UI shows each step of the x402 protocol:
- REQUEST -- Buyer sends
GET /weatherto Seller - 402 RESPONSE -- Seller responds with payment requirements
- SIGN -- Buyer signs EIP-712 intent + EIP-7702 authorization
- RETRY -- Buyer resends with
PAYMENT-SIGNATUREheader - VERIFY + SETTLE -- Facilitator verifies and submits Type 4 tx
- DELIVER -- Seller delivers weather data with tx receipt
Features:
- Auto/Step mode toggle for pacing
- Real-time balance tracking
- Signature and settlement detail panels
- SSE-based log streaming
License
MIT
