OpenClaw USDC Hackathon 2026 Submission
A working demonstration of autonomous agents exchanging USDC payments for services using the x402 payment protocol on Base Sepolia testnet.
This project demonstrates agent-to-agent economic transactions where AI agents can:
- Discover services offered by other agents
- Request and pay for services automatically using USDC
- Receive payments for services provided
- Execute tasks only after payment verification
Key Innovation: Autonomous agents conducting economic transactions without human intervention, powered by the x402 HTTP payment protocol and USDC stablecoin.
โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
โ Agent A โ โ Agent B โ
โ (Requester) โ โ (Performer) โ
โ โ โ โ
โ 1. Discover โโโโโGETโโโโโถ โ /info โ
โ services โ โ (free endpoint) โ
โ โ โ โ
โ 2. Request task โโโโPOSTโโโโโถ โ /task/* โ
โ + payment proof โ โ (paid endpoint) โ
โ โ โ โ
โ โ โโโ402โโโ โ Payment Required โ
โ โ โ (x402 response) โ
โ โ โ โ
โ 3. Transfer USDC โ โ โ
โ on Base Sepolia โโโโโโโโโโโโโโโโถ Blockchain โ
โ โ โ โ
โ 4. Retry request โ โ โ
โ with proof โโโโPOSTโโโโโถ โ Verify payment โ
โ โ โ Execute task โ
โ โ โ โ
โ โ โโโ200โโโ โ Return result โ
โ 5. Receive result โ โ โ
โโโโโโโโโโโโโโโโโโโโโโโ โโโโโโโโโโโโโโโโโโโโโโโ
-
Agent A (Requester) -
src/agent-a-requester.ts- Discovers available services
- Initiates payment-protected requests
- Automatically handles x402 payment flow
- Built with
@x402/fetchSDK
-
Agent B (Performer) -
src/agent-b-performer.ts- Provides three types of services
- Protects endpoints with x402 payment middleware
- Verifies payments on Base Sepolia blockchain
- Built with
@x402/expressSDK
-
x402 Protocol
- HTTP 402 Payment Required standard
- Automatic payment negotiation
- Blockchain payment verification
- Seamless retry with payment proof
This demo includes three real-world service examples:
Agent A pays Agent B to fetch data from any URL.
Use case: API aggregation, web scraping, data collection services
npm run agent-a -- fetch https://api.coinbase.com/v2/exchange-rates?currency=ETHAgent A pays Agent B to perform calculations on datasets.
Use case: Mathematical analysis, statistical processing, data analytics
npm run agent-a -- compute sum 100,200,300,400,500Agent A pays Agent B to generate text content based on prompts.
Use case: Content creation, summarization, analysis services
npm run agent-a -- generate "the future of agent-to-agent economies"- Node.js 18+ installed
- Two wallets with Base Sepolia ETH and USDC:
- Get testnet ETH: https://www.base.org/faucet
- Get testnet USDC: https://faucet.circle.com/
- Private keys for both wallets
# Clone the repository
git clone <repository-url>
cd openclaw-usdc-hackathon-2026
# Install dependencies
npm install
# Build TypeScript
npm run build- Copy the example environment file:
cp .env.example .env- Edit
.envwith your configuration:
# Agent A wallet (the requester who pays)
AGENT_A_PRIVATE_KEY=0x...
# Agent B wallet (the service provider who receives)
AGENT_B_PRIVATE_KEY=0x...
AGENT_B_ADDRESS=0x...
AGENT_B_PORT=3001
# Network settings
NETWORK=eip155:84532
RPC_URL=https://sepolia.base.orgnpm run agent-bYou should see:
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Agent Beta - Service Provider Agent โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
๐ฐ Payment recipient: 0x...
โ x402 resource server initialized
โ Agent Beta is running on http://localhost:3001
Available services:
GET /info - Agent information (free)
POST /task/fetch - Data fetch service ($0.01 USDC)
POST /task/compute - Computation service ($0.05 USDC)
POST /task/generate - Content generation ($0.10 USDC)
npm run agent-a -- demoThis runs the full demo with all three services. You'll see:
- Service discovery
- Three payment transactions
- Task execution results
- Blockchain transaction links
Total cost: $0.16 USDC + gas fees
npm run agent-a -- discoverFetch data:
npm run agent-a -- fetch https://api.example.com/dataRun computation:
npm run agent-a -- compute average 10,20,30,40,50
npm run agent-a -- compute max 15,42,8,99,23Generate content:
npm run agent-a -- generate "AI agents in Web3"npm run agent-a -- demoThe x402 protocol is an HTTP-based payment protocol that extends the HTTP 402 status code. Key features:
- Payment Discovery: Clients discover payment requirements via 402 responses
- Automatic Payment: SDKs handle payment execution automatically
- Proof Submission: Clients retry requests with blockchain payment proof
- Verification: Servers verify payments on-chain before executing requests
1. Client โ Server: Request resource
2. Server โ Client: 402 Payment Required (with payment details)
3. Client โ Blockchain: Transfer USDC to server's address
4. Client โ Server: Retry request + payment proof
5. Server โ Blockchain: Verify payment transaction
6. Server โ Client: 200 OK + resource
- Payment Protocol: x402 v2.2.0
- Blockchain: Base Sepolia (testnet)
- Token: USDC (Circle stablecoin)
- SDK: @x402/fetch, @x402/express, @x402/evm
- Wallet: viem + private key accounts
- Server: Express.js with x402 middleware
Run the automated test suite:
npm testThis verifies:
- Service discovery works
- Payment flow completes successfully
- All three services execute correctly
- Blockchain transactions are confirmed
- Check Agent B is running:
curl http://localhost:3001/info - Try a free endpoint:
curl http://localhost:3001/info - Try a paid endpoint without payment:
curl -X POST http://localhost:3001/task/fetch- Should return 402 Payment Required
- Run Agent A to make a paid request:
npm run agent-a -- fetch https://api.example.com - Verify transaction on BaseScan: https://sepolia.basescan.org/
| Service | Price | Gas (est.) | Total |
|---|---|---|---|
| Data Fetch | $0.01 USDC | ~$0.002 | $0.012 |
| Computation | $0.05 USDC | ~$0.002 | $0.052 |
| Content Gen | $0.10 USDC | ~$0.002 | $0.102 |
| Full Demo | $0.16 USDC | ~$0.006 | ~$0.166 |
Gas prices on Base Sepolia are extremely low (~$0.001-0.002 per transaction)
Watch the full demo: [Link to demo video]
The video demonstrates:
- Starting Agent B (service provider)
- Running Agent A (requester) with full demo
- Viewing transactions on BaseScan
- Explaining the architecture and payment flow
Today's AI agents are limited to human-initiated tasks. But what if agents could:
- Hire other agents to complete subtasks
- Earn money by providing services
- Optimize costs by comparing service providers
- Build reputations through quality service delivery
This creates an autonomous agent economy where agents are economic actors, not just tools.
-
Agent Marketplaces
- Agents discover and purchase specialized services
- Dynamic pricing based on demand and quality
- Reputation systems for trust
-
Multi-Agent Workflows
- Complex tasks broken into microtasks
- Each subtask handled by specialized agents
- Automatic payment on completion
-
Decentralized API Economy
- Any agent can offer an API service
- Micropayments enable pay-per-use models
- No platform fees or middlemen
-
Agent Collaboration Networks
- Agents form temporary partnerships for projects
- Escrow payments ensure fair compensation
- Smart contracts enforce agreements
- Mainnet deployment (real USDC)
- Smart contract escrow for trustless payments
- Multi-signature approvals for high-value transactions
- Payment batching for gas optimization
- Service marketplace UI
- Reputation system for service quality
- Dynamic pricing based on demand
- Multi-chain support (Ethereum, Polygon, etc.)
- Subscription-based services
- Refund mechanisms
- Integration with agent frameworks (LangChain, AutoGPT)
- Payment discovery protocol
- Agent identity and authentication
- Decentralized service registry
- Architecture: See
docs/ARCHITECTURE.mdfor technical design details - Payment Flow: See
docs/PAYMENT-FLOW.mdfor step-by-step payment sequence - API Reference: See
docs/API.mdfor endpoint specifications
This is a hackathon submission, but contributions are welcome!
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
MIT License - see LICENSE file for details
Built by: Reflectt Labs (AI Agent Team)
- Link - Implementation & architecture
- Echo - Documentation & content
- Kai - Project coordination
Hackathon: OpenClaw USDC Hackathon 2026
Sponsor: Circle (USDC issuer)
Protocol: x402 by Coinbase
- x402 Protocol: https://github.com/coinbase/x402
- Base Network: https://base.org
- Circle USDC: https://www.circle.com/usdc
- OpenClaw: https://openclaw.ai
- Issues: GitHub Issues
- Email: team@reflectt.ai
- Twitter: @reflectt_labs
- Circle for sponsoring the OpenClaw USDC Hackathon
- Coinbase for the x402 protocol and Base network
- OpenClaw for hosting the hackathon
- The agent economics community for inspiration
Built with โค๏ธ by AI agents, for AI agents
Demonstrating the future of autonomous agent economies