Menu

Explorer & Settings

Tempo Explorer Submit Project
Back to all projects

openclaw-usdc-hackathon-2026

by reflectt · Updated 5 months ago

OpenClaw USDC Hackathon 2026: Agent-to-Agent Payments via x402 Protocol

In the AI payments ecosystem

openclaw-usdc-hackathon-2026 is an early-stage TypeScript project in the AI payments / x402 ecosystem. It currently has 0 GitHub stars and 0 forks.

README.md View on GitHub →

Agent-to-Agent USDC Payments Demo

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.

License Network Protocol


🎯 Overview

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.


✅ Submission

Everything needed to submit (minus the actual video recording) is packaged in-repo.

Start here (copy/paste submit):

  • SUBMIT-NOW.md — one page with final steps + form fields

Core submission docs:

  • SUBMISSION.md — full submission guide
  • SUBMISSION-CHECKLIST.md — quick checklist
  • RELEASE.md — GitHub Release draft checklist + suggested tag

Assets you still need to produce (human):

  • CODE-WALKTHROUGH-VIDEO-SCRIPT.md — record the walkthrough; paste the link into README + SUBMIT-NOW.md
  • LOCAL-DEMO-SCREENSHOT-PLAN.md — exact screenshot list (place images in assets/screenshots/)

🏗️ Architecture

System Overview

Architecture Overview

Payment Flow

Payment Flow

Sequence Diagram

┌─────────────────────┐              ┌─────────────────────┐
│   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  │              │                     │
└─────────────────────┘              └─────────────────────┘

Components

  1. Agent A (Requester) - src/agent-a-requester.ts

    • Discovers available services
    • Initiates payment-protected requests
    • Automatically handles x402 payment flow
    • Built with @x402/fetch SDK
  2. 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/express SDK
  3. x402 Protocol

    • HTTP 402 Payment Required standard
    • Automatic payment negotiation
    • Blockchain payment verification
    • Seamless retry with payment proof

💡 Use Cases

This demo includes three real-world service examples:

1. Data Fetch Service ($0.01 USDC)

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=ETH

2. Computation Service ($0.05 USDC)

Agent 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,500

3. Content Generation Service ($0.10 USDC)

Agent 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"

🚀 Quick Start

Prerequisites

  1. Node.js 18+ installed
  2. Two wallets with Base Sepolia ETH and USDC:
  3. Private keys for both wallets

Installation

# Clone the repository
git clone <repository-url>
cd openclaw-usdc-hackathon-2026

# Install dependencies
npm install

# Build TypeScript
npm run build

Configuration

  1. Copy the example environment file:
cp .env.example .env
  1. Edit .env with 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.org

Running the Demo

Terminal 1: Start Agent B (Service Provider)

npm run agent-b

You 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)

Terminal 2: Run Agent A (Requester)

npm run agent-a -- demo

This 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


📚 Usage Examples

Discover Available Services

npm run agent-a -- discover

Individual Service Requests

Fetch data:

npm run agent-a -- fetch https://api.example.com/data

Run computation:

npm run agent-a -- compute average 10,20,30,40,50
npm run agent-a -- compute max 15,42,8,99,23

Generate content:

npm run agent-a -- generate "AI agents in Web3"

Run Complete Demo

npm run agent-a -- demo

🔧 Technical Details

x402 Protocol

The x402 protocol is an HTTP-based payment protocol that extends the HTTP 402 status code. Key features:

  1. Payment Discovery: Clients discover payment requirements via 402 responses
  2. Automatic Payment: SDKs handle payment execution automatically
  3. Proof Submission: Clients retry requests with blockchain payment proof
  4. Verification: Servers verify payments on-chain before executing requests

Payment Flow

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

Technologies Used

  • 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

🧪 Testing

End-to-End Test

Run the automated test suite:

npm test

This verifies:

  • Service discovery works
  • Payment flow completes successfully
  • All three services execute correctly
  • Blockchain transactions are confirmed

Manual Testing

  1. Check Agent B is running: curl http://localhost:3001/info
  2. Try a free endpoint: curl http://localhost:3001/info
  3. Try a paid endpoint without payment: curl -X POST http://localhost:3001/task/fetch
    • Should return 402 Payment Required
  4. Run Agent A to make a paid request: npm run agent-a -- fetch https://api.example.com
  5. Verify transaction on BaseScan: https://sepolia.basescan.org/

💰 Cost Breakdown

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)


🎥 Demo Video

  • Code walkthrough video:

The video demonstrates:

  1. Starting Agent B (service provider)
  2. Running Agent A (requester) with full demo
  3. Viewing transactions on BaseScan
  4. Explaining the architecture and payment flow

🏆 Why This Matters

The Vision: Agent Economics

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.

Real-World Applications

  1. Agent Marketplaces

    • Agents discover and purchase specialized services
    • Dynamic pricing based on demand and quality
    • Reputation systems for trust
  2. Multi-Agent Workflows

    • Complex tasks broken into microtasks
    • Each subtask handled by specialized agents
    • Automatic payment on completion
  3. Decentralized API Economy

    • Any agent can offer an API service
    • Micropayments enable pay-per-use models
    • No platform fees or middlemen
  4. Agent Collaboration Networks

    • Agents form temporary partnerships for projects
    • Escrow payments ensure fair compensation
    • Smart contracts enforce agreements

🔮 Future Enhancements

Phase 2: Production Ready

  • Mainnet deployment (real USDC)
  • Smart contract escrow for trustless payments
  • Multi-signature approvals for high-value transactions
  • Payment batching for gas optimization

Phase 3: Advanced Features

  • Service marketplace UI
  • Reputation system for service quality
  • Dynamic pricing based on demand
  • Multi-chain support (Ethereum, Polygon, etc.)
  • Subscription-based services
  • Refund mechanisms

Phase 4: Ecosystem Integration

  • Integration with agent frameworks (LangChain, AutoGPT)
  • Payment discovery protocol
  • Agent identity and authentication
  • Decentralized service registry

📖 Documentation

Core:

  • START-HERE.md — fastest path to run locally
  • QUICK-START-GUIDE.md — step-by-step setup + demo commands
  • docs/ARCHITECTURE.md — technical design
  • docs/PAYMENT-FLOW.md — step-by-step payment sequence

Submission package:

  • SUBMIT-NOW.md — one-page copy/paste submission
  • SUBMISSION.md — full submission guide
  • SUBMISSION-CHECKLIST.md — checklist
  • CODE-WALKTHROUGH-VIDEO-SCRIPT.md — walkthrough script
  • LOCAL-DEMO-SCREENSHOT-PLAN.md — exact screenshot plan

🤝 Contributing

This is a hackathon submission, but contributions are welcome!

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature/amazing-feature
  3. Commit changes: git commit -m 'Add amazing feature'
  4. Push to branch: git push origin feature/amazing-feature
  5. Open a Pull Request

📄 License

MIT License - see LICENSE file for details


👥 Team

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


🔗 Links


📞 Support


🙏 Acknowledgments

  • 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

All USDC projects →