Powered by: ChaosChain Β· ERC-8004 Β· x402 Β· Chainlink CRE
ChaosChain-x402 replaces x402's centralized facilitator with a decentralized, BFT-verified runtime on Chainlink CRE.
Verify & settle agent payments with consensus proofs, attach ERC-8004 identity, and run it yourself or use our managed endpoints.
Current Status:
- Managed Facilitator - Production-ready, live on Base Sepolia
- Decentralized Facilitator - Active development using Chainlink CRE
The Goal: Decentralized, trustless payment verification for the agent economy. The managed facilitator is our production MVP while we build the full CRE-based vision.
Managed Facilitator (Production - Available Now):
- β x402 compliant - Works with any x402 client (ChaosChain, PayAI, custom)
- β EIP-3009 gasless - Payers don't need ETH, facilitator sponsors gas
- β No API keys needed - Anyone can use
- β Multi-chain - Base Sepolia (testnet), Base Mainnet (coming soon)
Decentralized Facilitator (In Development - The Vision):
- Byzantine Fault Tolerant consensus - Multiple nodes verify every payment
- Cryptographic proofs - Every operation is verifiable on-chain
- Multi-chain support - Base, Ethereum, 0G, and more
- Chainlink CRE powered - Decentralized execution environment
# No installation needed! Just use the public endpoint:
# https://facilitator.chaoscha.in
# Test with Genesis Studio from https://github.com/ChaosChain/chaoschain-integrations:
export CC_FACILITATOR_URL=https://facilitator.chaoscha.in
python genesis_studio.pygit clone https://github.com/ChaosChain/chaoschain-x402
cd chaoschain-x402/http-bridge
# Install dependencies
npm install
# Configure environment (.env file)
cp .env.example .env
# Add your FACILITATOR_PRIVATE_KEY, RPC URLs, etc.
# Start in managed mode
npm run devThe facilitator runs on :8402 and provides /verify and /settle endpoints for any x402 client.
The Problem with Centralized Facilitators:
- β Single point of failure - If the facilitator goes down, payments stop
- β Trust assumptions - Users must trust the facilitator operator
- β Censorship risk - Centralized operators can block transactions
- β No verifiability - Payment verification happens in a black box
Our Decentralized Solution (CRE-based):
- β Byzantine Fault Tolerant - Multiple nodes reach consensus, no single point of failure
- β Cryptographically Verifiable - Every payment verification produces an on-chain proof
- β Censorship Resistant - Distributed node network, no central authority
- β Trustless - Don't trust us, verify the consensus proofs yourself
OLD (Centralized)
Agent β Resource β [Facilitator Server] β Chain
β’ Single operator
β’ Opaque correctness
β’ Operational bottleneck
NEW (Decentralized with CRE)
Agent β Resource β [Workflow DON (N nodes)] β Chain
β’ BFT consensus on verify/settle
β’ Cryptographic proofs
β’ Run it yourself or use managed endpoints
Why It Matters:
- Removes trust-in-operator: Correctness comes from BFT consensus, not a server you run
- Standardizes payments: x402 API surface, multi-chain by config
- Plugs into identity: ERC-8004 agent IDs + Proof-of-Agency
See diagrams/architecture.txt for detailed flow diagrams.
| Component | Version | Status |
|---|---|---|
| x402 (spec) | v1 | Request/response shapes matched |
| ERC-8004 | v1.0 | Identity attached via ChaosChain SDK |
| CRE | TS SDK 0.0.9-alpha | Simulate mode now; DON deployment later |
| Chains | Base, Ethereum | Sepolia testnets + mainnets ready |
# Clone repo
git clone https://github.com/ChaosChain/chaoschain-x402.git
cd chaoschain-x402
# Start everything with Docker Compose
docker-compose up http-bridge
# In another terminal, run demo
docker-compose --profile demo up ts-demoSee docs/DOCKER.md for full Docker guide.
Prerequisites:
Steps:
# 1. Clone repo
git clone https://github.com/ChaosChain/chaoschain-x402.git
cd chaoschain-x402
# 2. Start HTTP bridge
cd http-bridge && bun install && bun run dev
# 3. Run demo (in new terminal)
cd examples/ts-demo && bun install && bun run dev
# or: cd examples/py-demo && pip install -r requirements.txt && python demo.pyExpected output:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β ChaosChain x402 Decentralized Facilitator Bridge β
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
π Server listening on http://localhost:8402
π CRE Workflow Ready
Test the actual CRE workflow locally:
cd workflows/x402-facilitator && bun install && cd ../..
cre workflow simulate x402-facilitator --target local-simulationNote: The HTTP bridge provides a stable API without requiring CRE CLI.
ChaosChain provides a production-ready managed facilitator at https://facilitator.chaoscha.in that handles all payment verification and settlement complexity.
- Non-custodial settlement: Uses EIP-3009
transferWithAuthorization- we never hold your funds - Gasless for payers: Facilitator sponsors gas, payers only need USDC (no ETH needed)
- No approvals needed: Single EIP-3009 signature - no separate
approve()transaction - Fast settlement: < 1 second (plus blockchain confirmation time)
- Universal compatibility: If it speaks HTTP, it speaks x402
- Built-in identity: Every payment automatically links to your ERC-8004 agent for reputation
All API responses include both human strings (e.g., "1.00" USDC) and base unit strings (e.g., "1000000" for 6-decimal tokens). Use whichever is convenient; settlement logic uses base units.
Example response:
{
"amount": { "human": "1.00", "base": "1000000", "symbol": "USDC", "decimals": 6 },
"fee": { "human": "0.01", "base": "10000", "bps": 100 },
"net": { "human": "0.99", "base": "990000" }
}The ChaosChain facilitator URL is https://facilitator.chaoscha.in.
That's it. No signup, no API keys, no complexity. Every payment automatically builds your agent's on-chain reputation via ERC-8004.
With ChaosChain SDK (Recommended):
import { ChaosChainSDK } from '@chaoschain/sdk';
const sdk = new ChaosChainSDK({
facilitatorUrl: 'https://facilitator.chaoscha.in',
agentId: '8004#123', // Optional: ERC-8004 tokenId for reputation
});
// Payments automatically route through facilitatorWith Raw HTTP:
curl -X POST https://facilitator.chaoscha.in/verify \
-H 'Content-Type: application/json' \
-d '{
"x402Version": 1,
"paymentHeader": {
"sender": "0xPayerAddress",
"nonce": "unique_nonce_123",
"validAfter": "2025-10-29T00:00:00Z",
"validBefore": "2025-10-29T01:00:00Z"
},
"paymentRequirements": {
"scheme": "exact",
"network": "base-sepolia",
"maxAmountRequired": "10.00",
"payTo": "0xMerchantAddress",
"asset": "usdc",
"resource": "/api/service"
}
}'Response:
{
"isValid": true,
"feeAmount": "100000",
"netAmount": "9900000",
"feeBps": 100,
"consensusProof": "0xabc123...",
"timestamp": 1730160000
}Simple flat fee: 1% on all transactions
- Transparent and disclosed before settlement
- Net amount goes directly to merchant
- Fee supports protocol development
- No hidden costs, no surprises
Example: 10 USDC payment
- Merchant receives: 9.90 USDC
- ChaosChain fee: 0.10 USDC
- Total from payer: 10.00 USDC
Want to run your own facilitator? Set these environment variables:
# Facilitator Configuration
FACILITATOR_MODE=managed
DEFAULT_CHAIN=base-sepolia
# Fee Configuration
FEE_BPS_DEFAULT=100 # 1%
TREASURY_ADDRESS=0xYourTreasuryAddress
# RPC Endpoints
BASE_SEPOLIA_RPC_URL=https://sepolia.base.org
ETHEREUM_SEPOLIA_RPC_URL=https://ethereum-sepolia.blockpi.network/v1/rpc/public
# Hot Wallet
FACILITATOR_PRIVATE_KEY=0xYourPrivateKey
# ChaosChain ERC-8004 Integration (automatic when using SDK)
CHAOSCHAIN_ENABLED=true
VALIDATION_REGISTRY_ADDRESS=0xRegistryAddress
# Supabase (for transaction tracking)
SUPABASE_URL=https://your-project.supabase.co
SUPABASE_SERVICE_KEY=your-service-keyCheck facilitator health:
curl https://facilitator.chaoscha.in/health{
"healthy": true,
"checks": {
"supabase": true,
"rpcBaseSepolia": true,
"gasBalance": "0.5",
"gasBalanceHealthy": true,
"usdcBalance": "1000.0",
"rpcLatencyMs": 120,
"blockLag": 2
}
}Status page: https://status.facilitator.chaoscha.in
Want to monetize your AI agent services? See our merchant guide:
β Merchant Guide: Selling Services with x402
Quick overview:
- Return
402 Payment Requiredwith payment requirements - Client signs EIP-3009 authorization (no approval needed, gasless for payer)
- You receive USDC (minus 1% facilitator fee)
- Non-custodial, instant settlement via
transferWithAuthorization
External SDK integration specifications:
- Merchant Guide - Set up your payment-protected API
- Terms of Service - Legal terms and SLA
| Feature | Managed (Production) | Decentralized (Beta) |
|---|---|---|
| Deployment | Hosted by ChaosChain | Self-hosted or CRE DON |
| Settlement | EIP-3009 on-chain | CRE workflow consensus |
| Fees | 1% flat fee | Gas only (if self-hosted) |
| Setup | Zero - just use the URL | Requires CRE deployment |
| Support | Community Discord | Community Discord |
| Identity (ERC-8004) | Automatic when using SDK | Automatic when using SDK |
| Best for | Production apps, merchants | Maximum trust-minimization |
Recommendation: Start with managed (https://facilitator.chaoscha.in) for immediate production use.
chaoschain-x402/
βββ workflows/x402-facilitator/ # CRE workflow (verify + settle handlers)
βββ http-bridge/ # REST API server (Fastify)
βββ clients/
β βββ ts/ # @chaoschain/x402-client (TypeScript)
β βββ py/ # chaoschain-x402-client (Python)
βββ examples/
β βββ ts-demo/ # TypeScript demo
β βββ py-demo/ # Python demo
βββ diagrams/ # Architecture diagrams
βββ project.yaml # CRE project configuration
βββ README.md # This file
The HTTP bridge implements the x402 facilitator API spec with full consensus verification flow.
| Variable | Default | Description |
|---|---|---|
PORT |
8402 |
HTTP bridge port |
CRE_MODE |
simulate |
simulate | remote |
CRE_WORKFLOW_URL |
β | Remote CRE endpoint (required for remote mode) |
LOG_LEVEL |
info |
debug | info | warn | error |
Health check and service information.
Example:
curl -s http://localhost:8402/ | jqResponse:
{
"service": "ChaosChain x402 Decentralized Facilitator",
"version": "0.1.0",
"mode": "simulate",
"endpoints": {
"verify": "POST /verify",
"settle": "POST /settle",
"supported": "GET /supported"
}
}List supported payment schemes and networks (per x402 spec).
Example:
curl -s http://localhost:8402/supported | jqResponse:
{
"kinds": [
{ "scheme": "exact", "network": "base-sepolia" },
{ "scheme": "exact", "network": "ethereum-sepolia" },
{ "scheme": "exact", "network": "base-mainnet" },
{ "scheme": "exact", "network": "ethereum-mainnet" }
]
}Verify an x402 payment via decentralized consensus.
Example:
curl -X POST http://localhost:8402/verify \
-H 'Content-Type: application/json' \
-d '{
"x402Version": 1,
"paymentHeader": "base64_encoded_payment_payload",
"paymentRequirements": {
"scheme": "exact",
"network": "base-sepolia",
"maxAmountRequired": "1000000",
"payTo": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0",
"asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
"resource": "/api/weather"
}
}' | jqResponse:
{
"isValid": true,
"invalidReason": null,
"consensusProof": "0x307837343264333543633636333433303353333233323...",
"reportId": "rep_1730845234567",
"timestamp": 1730845234567
}Settle an x402 payment via decentralized consensus.
Example:
curl -X POST http://localhost:8402/settle \
-H 'Content-Type: application/json' \
-d '{
"x402Version": 1,
"paymentHeader": "base64_encoded_payment_payload",
"paymentRequirements": {
"scheme": "exact",
"network": "base-sepolia",
"maxAmountRequired": "1000000",
"payTo": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0",
"asset": "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
"resource": "/api/weather"
}
}' | jqResponse:
{
"success": true,
"error": null,
"txHash": "0x307837343264333543633636333433303353333233323...",
"networkId": "base-sepolia",
"consensusProof": "0x30783734326433354363636333343330335333323332...",
"timestamp": 1730845234567
}OpenAPI Spec: See docs/openapi.yaml for complete API specification.
Decentralized version currently runs in local development mode:
- β Complete CRE workflow architecture implemented
- β Full BFT consensus verification flow
- β Production-ready API with cryptographic proofs
- β Realistic transaction and consensus hashes
- π Awaiting CRE public beta for DON deployment
This allows public development and testing without requiring access to the CRE private alpha.
When Chainlink CRE becomes publicly available, swap to production mode:
- Deploy the CRE workflow to a Decentralized Oracle Network (DON)
- Enable real EVM interactions (signature verification, on-chain settlement)
- Point the HTTP bridge to the deployed CRE workflow
- No API changes required β clients continue working as-is
See workflows/x402-facilitator/README.md for details on upgrading.
The facilitator is decentralized via Chainlink CRE:
- Multiple independent nodes in a DON execute the same workflow
- Each node verifies payment signatures and settlement conditions
- BFT consensus aggregates results into a single verified output
- Cryptographic proofs provide transparency and verifiability
See diagrams/architecture.txt for the detailed flow.
The facilitator supports multiple chains with different settlement methods:
| Chain | Network ID | Token | Settlement Method | Status |
|---|---|---|---|---|
| Base Sepolia | base-sepolia |
USDC | EIP-3009 (gasless) | β Supported |
| Ethereum Sepolia | ethereum-sepolia |
USDC | EIP-3009 (gasless) | β Supported |
| Base Mainnet | base-mainnet |
USDC | EIP-3009 (gasless) | β Supported |
| Ethereum Mainnet | ethereum-mainnet |
USDC | EIP-3009 (gasless) | β Supported |
| 0G Mainnet | 0g-mainnet |
W0G | Relayer (requires approval) | β Supported |
Settlement Methods:
- EIP-3009 (USDC): Gasless for payer, no approval needed, single signature
- Relayer (W0G): User approves once, facilitator executes transfers
Add new chains by extending the CHAIN_CONFIG and TOKEN_ADDRESSES in settlement.ts.
| Tier | Description | Pricing Model |
|---|---|---|
| Open Source | Self-hosted CRE workflows | Free |
| Managed Facilitator | SLA-backed endpoints hosted by ChaosChain | % per transaction |
| Enterprise Plan | Private facilitator cluster + audit logs | Monthly SaaS |
Protocol fees can be routed to the ChaosChain Treasury for validator rewards and future staking incentives.
# HTTP Bridge
cd http-bridge
bun install
bun run build
# TypeScript Client
cd ../clients/ts
bun install
bun run build
# Python Client
cd ../clients/py
pip install -e .# TypeScript
cd clients/ts
bun run typecheck
# Python
cd clients/py
pytestVision: Build the first truly decentralized x402 facilitator with BFT consensus, replacing centralized payment verification with cryptographic proofs.
- β EIP-3009 compliant payment verification
- β
On-chain settlement via
transferWithAuthorization - β x402 universal compatibility (works with any client)
- β Production-ready HTTP bridge
- β Tested on Base Sepolia
- Public endpoint:
facilitator.chaoscha.in - Revenue generation (1% facilitator fees)
- Multi-chain support (Ethereum, 0G)
- Byzantine Fault Tolerant consensus - Multi-node verification
- Cryptographic proofs - Every payment verifiable on-chain
- Remote CRE DON integration - Live Chainlink network
- Distributed verification - No single point of failure
- Decentralized facilitator on mainnet (Base, Ethereum, 0G)
- ERC-8004 and ChaosChain's Proof-of-Agency integration
- Community validator program
- On-chain governance for facilitator parameters
- CRE Workflow README - How the workflow works
- HTTP Bridge README - API server details
- TypeScript Client README - Using the TS client
- Python Client README - Using the Python client
- Docker Guide - Running with Docker Compose
- OpenAPI Spec - Complete API specification
- x402 Protocol - Coinbase's agent payment standard
- Chainlink CRE
- CRE TypeScript SDK - Public CRE SDK
- ERC-8004 - Agent identity standard
- ChaosChain SDK - Agent identity & payments
We welcome contributions! See CONTRIBUTING.md for details.
Key Areas for Contribution:
- Adding support for new blockchains
- Implementing additional x402 payment schemes (e.g.,
upto) - Improving documentation and examples
- Testing and reporting issues
ChaosChain β builders of the Triple-Verified Stack for trustless AI commerce.
Maintained by the same team behind:
- ERC-8004 - Proof-of-Agency standard
- ChaosChain SDK - Agent identity & reputation
- Integrations on 0G, EigenLayer, and Filecoin
License: MIT
Contact: [email protected]
- Try the SDKs β chaoschain-sdk-ts | chaoschain-sdk-py
- Follow updates β @Ch40sChain
- Read the docs β docs.chaoscha.in
"Decentralizing the economic heartbeat of the agentic web."
Built with support from:
- Coinbase - x402 protocol specification
- Chainlink - CRE platform & private alpha access
- EigenLayer - Verifiable compute infrastructure
- 0G Labs - High-performance blockchain & storage
- Nethermind - Engineering support & ecosystem integration
This project is licensed under the MIT License - see the LICENSE file for details.
Status: π’ Production (Managed) | Active Development (Decentralized)