Show HN:我构建了一个通过 x402 让 AI Agent 为数据付费的 M2M 支付闭环
英文标题:🔶 Show HN: I built an M2M payment loop where AI Agents pay for data via x402
AgentBridge Atlas 展示了一个面向 AI Agent 的机器对机器(M2M)微支付市场:Agent 可通过 x402 v2 在 Base 链上以 USDC 为中国数据 API 付费。作者称,该系统已完成一次 0.005 USDC 的端到端链上结算,并通过 EIP-3009 的 TransferWithAuthorization 实现无需 Agent 支付 Gas 的授权转账。平台目前提供 96 项资产、12 个 API 路径和 8 个 MCP 工具,其中包括国家统计局数据、政府政策搜索及企业信用信息服务。对开发者而言,该项目展示了将 HTTP 402、链上支付、MCP 工具发现和受合规约束的公共数据服务整合为可编程 Agent 商业闭环的实现方式。
75.6 KB
中文
AgentBridge Atlas - x402 M2M 微支付市场
**AI Agent 在链上签名支付 0.005 USDC,后端完成验证与结算,并成功交付国家统计局 GDP 数据。**M2M(机器对机器)微支付商业闭环已完成落地验证。
| 项目 | 值 |
|---|---|
| API 基础地址 | https://api.060504.shop |
| 支付协议 | x402 v2(EIP-3009,Base 链上的 USDC) |
| 钱包 | 0x1630c8E0833c367F39f0ca909b6b67f5159d7A00 |
| 链 | Base(Chain ID 8453) |
| 已结算交易 | 区块 #49848412,0.005 USDC |
| 资产 | 96 |
| MCP 工具 | 8(4 个免费 + 3 个付费 + 1 个支付工具) |
| API 路径 | 12 |
| 端点 | 方法 | 价格 | 说明 |
|---|---|---|---|
/health |
GET | 免费 | 健康检查 |
/openapi.json |
GET | 免费 | OpenAPI 规范(12 个路径) |
/catalog.json |
GET | 免费 | 96 项资产目录 |
/llms.txt |
GET | 免费 | 面向 LLM 的 API 文档 |
/.well-known/mcp/server-card.json |
GET | 免费 | MCP 服务器身份卡 |
/v1/api/industry |
POST | $0.005 USDC | 中国国家统计局统计数据(GDP、CPI、PPI) |
/v1/api/policy |
POST | $0.005 USDC | 中国政府政策搜索 |
/v1/api/company |
POST | $0.003 USDC | 中国企业信用信息 |
/v1/fetch/dynamic |
POST | $0.008 USDC | 动态网页内容抓取 |
/v1/assets/{id} |
GET | $0.01-$9.99 USDC | 资产交付 |
- Agent 调用
POST /v1/api/industry(不携带支付请求头)。 - 服务器返回
402 Payment Required(x402 v2 支付挑战)。x402Version: 2paymentRequirements: {scheme, network, asset, payTo, maxAmountRequired, ...}
- Agent 签署 EIP-3009
TransferWithAuthorization(无需 Gas)。 - Agent 携带
X-Payment请求头重试。 - 服务器验证签名 → 在链上结算 → 返回
200和数据。 - 链上完成:0.005 USDC 被转入该钱包。
- 交易哈希:
0xef8d49e88cb58651e9bf30465597b50863dcc363f6e1f227779292149818ae28 - 方法:Transfer With Authorization(EIP-3009,无 Gas)
- 金额:0.005 USDC
- 区块:#49848412
- 代币:USDC(
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) - 转出方:
0xc4217BD72b4dea480ed4879fcec530d92637C800 - 接收方:
0x1630c8E0833c367F39f0ca909b6b67f5159d7A00 - 方案:EIP-3009(免 Gas 转账授权)
在 Basescan(Base 主网)验证:
Transaction: https://basescan.org/tx/0xef8d49e88cb58651e9bf30465597b50863dcc363f6e1f227779292149818ae28 Wallet: https://basescan.org/address/0x1630c8E0833c367F39f0ca909b6b67f5159d7A00
MCP Server 为 AI Agent 提供 8 个工具:
-
discover_capabilities- 列出全部 API 端点 -
discover_china_data_apis- 列出中国数据 API 及价格 -
get_capability_info- 获取特定能力的详细信息 -
get_payment_instructions- 获取分步骤 x402 支付指南 -
query_industry_statistics($0.005)- 国家统计局统计数据 -
search_china_policies($0.005)- 政府政策搜索 -
query_company_credit($0.003)- 企业信用信息 -
purchase_capability- 为任意端点发起 x402 支付
1. Discover the API (free)
curl https://api.060504.shop/health curl https://api.060504.shop/openapi.json curl https://api.060504.shop/llms.txt
2. Trigger 402 payment challenge
curl -X POST https://api.060504.shop/v1/api/industry
-H "Content-Type: application/json"
-d '{"keyword":"GDP"}'
Returns 402 with x402 payment requirements
3. Sign EIP-3009 and retry with payment
See examples/agent_client.py for full implementation
See examples/agent_client.py for complete x402 payment client
python examples/agent_client.py
数据来源与合规性
| API | 来源 | 合规措施 |
|---|---|---|
| 行业 | data.stats.gov.cn | 限速为每请求 3 秒,遵守 robots.txt |
| 政策 | sousuo.www.gov.cn | 限速为每请求 3 秒,提供 HTML 回退方案 |
| 企业 | gsxt.gov.cn | 不绕过验证码,仅提供官方链接 |
AI Agent / User │ ├── GitHub Pages (frontend catalog) │ └── API Server (api.060504.shop) │ ├── China Data APIs (3 endpoints) ├── x402 Payment (USDC on Base, EIP-3009) └── MCP Server (8 tools)
-
后端:FastAPI + Uvicorn(Python)
-
服务:Windows NSSM(NETWORK SERVICE 账户)
-
支付:x402 v2 协议,Base 链上的 USDC
-
MCP:Model Context Protocol(SSE 与 stdio)
-
前端:GitHub Pages
-
数据:中国政府公共平台
-
v1.0(2026-08-07):初始部署,76 项资产
-
v2.0(2026-08-16):新增 5 份指南、完成清理,94 项资产
-
v3.0(2026-08-16):上线中国数据 API 与 MCP Server,96 项资产
-
v3.1(2026-08-17):完成 x402 端到端支付验证,结算 0.005 USDC
商业用途。所有数据均来自政府公共平台。
English / 原文
AgentBridge Atlas - x402 M2M Micro-Payment Market
AI Agent 链上签名支付 0.005 USDC,后端验证结算,国家统计局 GDP 数据交付完成。 M2M (Machine to Machine) 微支付商业闭环已落地跑通。
| Item | Value |
|---|---|
| API Base | https://api.060504.shop |
| Payment Protocol | x402 v2 (EIP-3009, USDC on Base) |
| Wallet | 0x1630c8E0833c367F39f0ca909b6b67f5159d7A00 |
| Chain | Base (Chain ID 8453) |
| Settled TX | Block #49848412, 0.005 USDC |
| Assets | 96 |
| MCP Tools | 8 (4 free + 3 paid + 1 payment) |
| API Paths | 12 |
| Endpoint | Method |
| --- | --- |
/health |
GET |
/openapi.json |
GET |
/catalog.json |
GET |
/llms.txt |
GET |
/.well-known/mcp/server-card.json |
GET |
/v1/api/industry |
POST |
/v1/api/policy |
POST |
/v1/api/company |
POST |
/v1/fetch/dynamic |
POST |
/v1/assets/{id} |
GET |
1. Agent calls POST /v1/api/industry (no payment header)
2. Server returns 402 Payment Required (x402 v2 challenge)
- x402Version: 2
- paymentRequirements: {scheme, network, asset, payTo, maxAmountRequired, ...}
3. Agent signs EIP-3009 TransferWithAuthorization (no gas needed)
4. Agent retries with X-Payment header
5. Server verifies signature → settles on-chain → returns 200 + data
6. On-chain: 0.005 USDC transferred to wallet
- Transaction Hash :
0xef8d49e88cb58651e9bf30465597b50863dcc363f6e1f227779292149818ae28 - Method : Transfer With Authorization (EIP-3009, gasless)
- Amount : 0.005 USDC
- Block : #49848412
- Token : USDC (
0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) - From :
0xc4217BD72b4dea480ed4879fcec530d92637C800 - Recipient :
0x1630c8E0833c367F39f0ca909b6b67f5159d7A00 - Scheme : EIP-3009 (gasless transfer authorization)
Verify on Basescan (Base Mainnet):
Transaction: https://basescan.org/tx/0xef8d49e88cb58651e9bf30465597b50863dcc363f6e1f227779292149818ae28
Wallet: https://basescan.org/address/0x1630c8E0833c367F39f0ca909b6b67f5159d7A00
MCP Server provides 8 tools for AI agents:
-
discover_capabilities- List all API endpoints -
discover_china_data_apis- List China Data APIs with pricing -
get_capability_info- Get details for specific capability -
get_payment_instructions- Step-by-step x402 payment guide -
query_industry_statistics($0.005) - NBS statistics -
search_china_policies($0.005) - Government policy search -
query_company_credit($0.003) - Enterprise credit info -
purchase_capability- Initiate x402 payment for any endpoint1. Discover the API (free)
curl https://api.060504.shop/health curl https://api.060504.shop/openapi.json curl https://api.060504.shop/llms.txt
2. Trigger 402 payment challenge
curl -X POST https://api.060504.shop/v1/api/industry
-H "Content-Type: application/json"
-d '{"keyword":"GDP"}'Returns 402 with x402 payment requirements
3. Sign EIP-3009 and retry with payment
See examples/agent_client.py for full implementation
See examples/agent_client.py for complete x402 payment client
python examples/agent_client.py
Data Sources & Compliance
| API | Source | Compliance |
|---|---|---|
| Industry | data.stats.gov.cn | Rate limited 3s/req, respects robots.txt |
| Policy | sousuo.www.gov.cn | Rate limited 3s/req, HTML fallback |
| Company | gsxt.gov.cn | No captcha bypass, provides official links only |
AI Agent / User
│
├── GitHub Pages (frontend catalog)
│
└── API Server (api.060504.shop)
│
├── China Data APIs (3 endpoints)
├── x402 Payment (USDC on Base, EIP-3009)
└── MCP Server (8 tools)
-
Backend : FastAPI + Uvicorn (Python)
-
Service : Windows NSSM (NETWORK SERVICE account)
-
Payment : x402 v2 protocol, USDC on Base
-
MCP : Model Context Protocol (SSE & stdio)
-
Frontend : GitHub Pages
-
Data : Chinese government public platforms
-
v1.0 (2026-08-07): Initial deployment, 76 assets
-
v2.0 (2026-08-16): 5 new guides, cleanup, 94 assets
-
v3.0 (2026-08-16): China Data APIs + MCP Server, 96 assets
-
v3.1 (2026-08-17): x402 end-to-end payment verified, 0.005 USDC settled
Commercial. All data sourced from public government platforms.