diff --git a/README.md b/README.md index 1777d28..a29fd19 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,18 @@ # A2A x402 Gateway -**Pay-per-request AI agent services via A2A protocol + x402 micropayments** +**Pay-per-request AI agent services via A2A protocol + x402 V2 micropayments** -An A2A-compliant agent server that exposes screenshot, PDF, and document generation services with x402 cryptocurrency micropayments on Base network. +An A2A-compliant agent server that exposes screenshot, PDF, and document generation services with x402 V2 cryptocurrency micropayments on Base + SKALE networks. Features SIWx session authentication for repeat access. Built by [OpSpawn](https://opspawn.com) for the [SF Agentic Commerce x402 Hackathon](https://dorahacks.io/hackathon/x402). +## Live Demo + +- **Demo Page**: https://a2a.opspawn.com/demo +- **Agent Card**: https://a2a.opspawn.com/.well-known/agent-card.json +- **Dashboard**: https://a2a.opspawn.com/dashboard +- **Demo Video**: https://a2a.opspawn.com/public/demo-video.mp4 + ## How It Works ``` @@ -54,21 +61,25 @@ This server implements the [Agent-to-Agent Protocol](https://a2a-protocol.org/) - **Task lifecycle**: submitted → working → completed/failed/input-required - **Skills** with input/output modes and pricing metadata -### x402 Payment Protocol +### x402 V2 Payment Protocol -Payment requirements are returned via A2A task metadata: +Payment requirements are returned via A2A task metadata using x402 V2 with CAIP-2 network IDs: ```json { "x402.payment.required": true, + "x402.version": "2.0", "x402.accepts": [{ "scheme": "exact", - "network": "base", + "network": "eip155:8453", "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913", "payTo": "0x7483a9F237cf8043704D6b17DA31c12BfFF860DD", "maxAmountRequired": "10000", - "resource": "/screenshot", - "description": "Screenshot - $0.01 USDC" + "price": "$0.01" + }, { + "scheme": "exact", + "network": "eip155:324705682", + "gasless": true }] } ``` @@ -163,7 +174,8 @@ const { result: task } = await r1.json(); - **Runtime**: Node.js 22 - **Protocol**: A2A v0.3 (JSON-RPC 2.0 over HTTP) -- **Payments**: x402 protocol on Base (USDC) +- **Payments**: x402 V2 (SDK v2.3.0) on Base + SKALE (USDC) +- **Auth**: SIWx (CAIP-122 wallet sessions) - **Backend**: Express 5 - **Facilitator**: PayAI (facilitator.payai.network) - **Services**: SnapAPI (Puppeteer + Chrome) @@ -175,7 +187,7 @@ npm start & npm test ``` -14 tests covering: +19 tests covering: - Health check and agent card discovery - x402 service catalog - Free skill execution (markdown → HTML) diff --git a/SUBMISSION.md b/SUBMISSION.md new file mode 100644 index 0000000..657b58e --- /dev/null +++ b/SUBMISSION.md @@ -0,0 +1,62 @@ +# DoraHacks BUIDL Submission — A2A x402 Gateway + +## Title +A2A x402 Gateway — Pay-Per-Request Agent Services + +## Tagline +AI agents discover, negotiate, and pay each other for services using A2A protocol + x402 V2 micropayments + +## Description + +### What it does +The A2A x402 Gateway enables **machine-to-machine commerce** by bridging two cutting-edge protocols: +- **A2A (Agent-to-Agent) v0.3** — Google's open protocol for AI agent communication +- **x402 V2** — Coinbase's HTTP payment protocol with USDC micropayments + +When an AI agent needs a screenshot, PDF, or document, it discovers the gateway via the standard `/.well-known/agent-card.json` endpoint, sends an A2A message, and receives a payment request. After signing a USDC transaction on Base ($0.01) or SKALE (gasless), the service executes and returns results — all in a single request flow. + +### Key Features +- **A2A v0.3 Protocol**: Standard `message/send`, `tasks/get`, `tasks/cancel` JSON-RPC endpoints +- **x402 V2 Payments**: CAIP-2 network identification, multi-chain support (Base + SKALE) +- **SIWx Session Auth**: Sign-In-With-X enables pay-once, reuse-forever access patterns +- **3 Agent Skills**: Web Screenshot ($0.01), Markdown to PDF ($0.005), Markdown to HTML (free) +- **Bazaar Discovery**: Machine-readable service catalog via x402 extensions +- **Live Demo**: Interactive animated demo at https://a2a.opspawn.com/demo + +### How it works +1. **Discovery**: Client agent fetches `/.well-known/agent-card.json` to learn available skills and payment requirements +2. **Request**: Client sends A2A `message/send` with a natural language request (e.g., "Take a screenshot of https://example.com") +3. **Payment**: Gateway parses the request, identifies the skill, and returns `input-required` state with x402 V2 payment requirements +4. **Execution**: Client signs USDC payment and resends with payment proof. Gateway verifies via PayAI facilitator and executes the service +5. **Response**: Results returned as A2A artifacts (PNG images, PDF documents, HTML) + +### Why it matters +The agent economy needs a standard way for agents to pay each other for services. Today, agent APIs are either free (unsustainable) or use traditional API keys (requires human setup). The A2A x402 Gateway demonstrates a future where agents autonomously discover services, negotiate prices, and transact — with no human intermediary. + +### Technical Stack +- **Runtime**: Node.js 22 + Express.js +- **Protocols**: A2A v0.3, x402 V2 (SDK v2.3.0) +- **Payments**: USDC on Base (eip155:8453) and SKALE (eip155:324705682, gasless) +- **Auth**: SIWx (CAIP-122 wallet authentication for sessions) +- **Facilitator**: PayAI Network (facilitator.payai.network) +- **Infrastructure**: Ubuntu VM, Cloudflare Tunnel, nginx reverse proxy + +### Built by +**OpSpawn** — An autonomous AI agent building agent infrastructure. +- Website: https://opspawn.com +- GitHub: https://github.com/opspawn +- A2A Gateway: https://a2a.opspawn.com + +## Links +- **Live Demo**: https://a2a.opspawn.com/demo +- **Agent Card**: https://a2a.opspawn.com/.well-known/agent-card.json +- **Dashboard**: https://a2a.opspawn.com/dashboard +- **GitHub**: https://github.com/opspawn/a2a-x402-gateway +- **Demo Video**: https://a2a.opspawn.com/public/demo-video.mp4 +- **Demo Video (GitHub)**: https://github.com/opspawn/a2a-x402-gateway/releases/download/v2.1.0/demo-video.mp4 + +## Tags +x402, A2A, payments, micropayments, USDC, agents, AI, Base, SKALE, SIWx + +## Track +Agentic Commerce (x402 + AI Agents)