We aim for every AI agent to behave like a self-sovereign business: it owns its identity, reputation, and treasury directly on-chain.
- ERC-8004 keeps shared ledgers for registration, feedback, and validation, making every interaction auditable and portable.
- x402 upgrades HTTP 402 into native, stablecoin-denominated micropayments—buyers stay in the same request flow without manual trust gaps.
- ERC-6551 (next phase) will bind each agent’s NFT to a token-bound account (TBA) so payouts, escrows, staking, and arbitration all live in one asset.
Guiding idea: assemble a self-operating league of agents. Requesters emit jobs; executor and validator agents rely on their own wallets and on-chain reputation to quote, deliver, and audit—no centralized coordinator required.
- Roles:
client(requester),server(executor),validator(quality assurance) run as independent FastAPI services, each with its own key and RPC. - Flow: register on ERC-8004 → launch a task → x402 collects payment → server executes → validator optionally audits → client writes back reputation.
- Server-side: paid routes in
server_serviceandvalidator_serviceuserequire_payment, returning HTTP 402 until the facilitator confirms payment. - Client-side:
client_agentwraps the officialx402_requestsadapter, automating “request → 402 → pay → retry” and storingX-PAYMENT-RESPONSEreceipts. - Defaults: Base Sepolia, 0.1 USDC per call, facilitator receipts cached for future arbitration or refunds.
- EOAs still sign transactions today, but the service/state abstraction isolates agent logic. The next milestone swaps EOAs for TBAs: mint identity NFTs, spawn TBAs, route payments to those accounts, and continue logging trust signals on ERC-8004.
- Client requests a one-off market analysis.
- Server returns HTTP 402 for 0.1 USDC.
- Client retries through x402 with a signed payment header.
- Server verifies, executes, and returns the result; settlement metadata is cached for future dashboards.
- Client commissions a high-cost deliverable (e.g., a 60-second video).
- Funds move into the server’s future TBA or a shared escrow.
- Validator audits and records outcomes on ERC-8004.
- Funds release or refund automatically; arbitration hooks stay on-chain.
- Third-party arbitrator agents can adjudicate directly against escrow.
- Client broadcasts an RFP with budget and SLA.
- Multiple server agents bid based on ERC-8004 reputation and historical performance.
- Client auto-selects the best mix of price and trust, triggers x402 payment, and receives auditable deliverables.
trustless-agent-commerce/
├── contracts/ # ERC-8004 contracts and scripts
├── agents/
│ ├── client_service.py # requester / coordinator
│ ├── server_service.py # task executor
│ ├── validator_service.py # validation specialist
│ └── base_agent.py # shared on-chain utilities
├── payments/x402_client.py # x402 requests client wrapper
├── docs/stage1-backend-design.md
└── README.md
pip install -r requirements.txt
python scripts/deploy.py # deploy ERC-8004 registries
uvicorn agents.server_service:app --port 8001
uvicorn agents.validator_service:app --port 8002
uvicorn agents.client_service:app --port 8000Configure .env, then call POST /tasks to observe the payment + execution loop. A front-end ops panel will follow to visualize timelines, payment flows, and reputation trends.
-
ERC-6551 integration
- Mint identity NFTs and create token-bound accounts for each agent
- Route x402 payouts directly into TBAs to form portable balance sheets
- Extend escrow, staking, and arbitration logic
-
Operations dashboard
- Real-time task streams, reputation charts, payment receipts
- Trigger validation, disputes, and settlement reviews from one UI
-
Marketplace mechanics
- Broadcast tasks → collect bids → auto-select by price and trust
- Incentive design for validators and dispute resolution
This repository tracks the ongoing effort to make agent-to-agent commerce trust-minimized and programmatically enforceable. ERC-6551 wallets, marketplace UI, and arbitration workflows will build on this foundation. Contributions and ideas are welcome.
This project is released under the MIT License.