{"id":51151300,"url":"https://github.com/humanbased-ai/codatta-ethereum-agent-demo","last_synced_at":"2026-06-26T06:04:17.773Z","repository":{"id":351683970,"uuid":"1193489255","full_name":"humanbased-ai/codatta-ethereum-agent-demo","owner":"humanbased-ai","description":"The repo showcasing Codatta DID integration with ERC-8004 (Trustless Agents) and ERC-8183 (Agentic Commerce) — three independent agents collaborate via on-chain events to complete the full lifecycle: identity registration, task execution, payment settlement,   validation, and reputation.","archived":false,"fork":false,"pushed_at":"2026-05-08T10:22:20.000Z","size":512,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-01T04:29:34.695Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/humanbased-ai.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-03-27T09:28:06.000Z","updated_at":"2026-05-08T10:22:25.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/humanbased-ai/codatta-ethereum-agent-demo","commit_stats":null,"previous_names":["codatta/codatta-ethereum-agent-demo","humanbased-ai/codatta-ethereum-agent-demo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/humanbased-ai/codatta-ethereum-agent-demo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanbased-ai%2Fcodatta-ethereum-agent-demo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanbased-ai%2Fcodatta-ethereum-agent-demo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanbased-ai%2Fcodatta-ethereum-agent-demo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanbased-ai%2Fcodatta-ethereum-agent-demo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/humanbased-ai","download_url":"https://codeload.github.com/humanbased-ai/codatta-ethereum-agent-demo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/humanbased-ai%2Fcodatta-ethereum-agent-demo/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34805109,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-26T02:00:06.560Z","response_time":106,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-26T06:04:17.073Z","updated_at":"2026-06-26T06:04:17.759Z","avatar_url":"https://github.com/humanbased-ai.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Codatta DID × ERC-8004 × x402 Integration Demo\n\nCodatta DID 与 ERC-8004 (Trustless Agents)、x402 (HTTP-native Payments) 的集成 Demo。以数据标注服务为业务场景，展示 Agent 自动发现、接单、执行、结算的完整工作流。\n\n## 架构\n\n```\nClient Agent                          Provider Agent\n     │                                      │\n     │  1. 从 ERC-8004 发现 Agent            │  注册 Codatta DID\n     │     读取注册文件、信誉                  │  注册 ERC-8004 身份\n     │                                      │  双向关联 DID ↔ ERC-8004\n     │  2. POST /annotate                   │  启动 HTTP 标注服务\n     │ ────────────────────────────────────→ │\n     │                                      │  执行标注（模拟）\n     │  3. 返回标注结果 + feedbackAuth        │  更新链上 Validation\n     │ ←──────────────────────────────────── │\n     │                                      │\n     │  4. 提交 Reputation 评价              │\n     │                                      │\n```\n\n| 标准 | 用途 |\n|------|------|\n| **Codatta DID** | Agent 的独立身份标识 |\n| **ERC-8004** | Agent 发现（Identity Registry）+ 信誉（Reputation）+ 验证（Validation） |\n| **x402** | HTTP 原生支付（当前 demo 为 mock 模式，部署测试网后接入真实 facilitator） |\n\n## 项目结构\n\n```\nsrc/\n├── did/              # Codatta DID 合约（DIDRegistry + DIDRegistrar, UUPS proxy）\n├── erc8004/          # ERC-8004 三大 Registry（Identity, Reputation, Validation）\n└── mock/             # MockERC20\n\nscript/\n├── Deploy.s.sol      # 一键部署\n└── deployment.json   # 部署地址（自动生成）\n\nagent/\n└── src/\n    ├── shared/       # 共享代码（config, ABIs, events, logger, feedback-auth）\n    ├── provider/     # Provider Agent（注册身份 → MCP/HTTP 标注服务）\n    ├── client/       # Client Agent（发现 Agent → MCP 调用 → 提交评价）\n    ├── recruiter/    # Recruiter Agent（A2A 招募外部 Agent）\n    └── query/        # 查询工具（DID、Agent info、Reputation、Validation）\n\nweb/                  # Web Dashboard（React + Vite + wagmi）\n└── src/\n    ├── config/       # 合约地址 + ABI + wagmi 链配置\n    ├── pages/        # Agent 列表/详情、DID 文档、注册页面\n    ├── components/   # Layout、ConnectButton\n    ├── hooks/        # useAgentList、useAgentDetail、useDIDDocument\n    └── lib/          # 工具函数（解析注册文件等）\n\ndesign/               # 设计文档和规范\n```\n\n## 快速开始\n\n### 1. 启动本地链\n\n```bash\nanvil --block-time 1\n```\n\n### 2. 部署合约\n\n```bash\nforge script script/Deploy.s.sol:Deploy --rpc-url http://127.0.0.1:8545 --broadcast\n```\n\n部署地址自动写入 `script/deployment.json`。\n\n### 3. 配置 Agent\n\n```bash\ncd agent\ncp .env.example .env\nnpm install\n```\n\n将 `script/deployment.json` 中的地址填入 `.env`：\n\n```env\nDID_REGISTRY=0x...\nDID_REGISTRAR=0x...\nIDENTITY_REGISTRY=0x...\nREPUTATION_REGISTRY=0x...\nVALIDATION_REGISTRY=0x...\n```\n\n### 4. 启动 Provider（终端 1）\n\n```bash\nnpm run start:provider\n```\n\n等待输出 `Annotation service running on http://localhost:4021`。\n\n### 5. 启动 Client（终端 2）\n\n```bash\nnpm run start:client-annotation\n```\n\nClient 自动完成：发现 Agent → 请求标注 → 接收结果 → 提交评价。\n\n## Demo 输出示例\n\n**Provider:**\n```\n[PROVIDER] Registering Codatta DID\n[PROVIDER] Codatta DID: did:codatta:c038300d50f74a18...\n[PROVIDER] Registering agent in ERC-8004\n[PROVIDER] Agent ID: 328490439698981969...\n[PROVIDER] Linking DID ↔ ERC-8004\n[PROVIDER] ✓ Dual identity established\n[PROVIDER] ✓ Annotation service running on http://localhost:4021\n[PROVIDER] ⚡ Request received — 3 images, task=object-detection\n[PROVIDER] ✓ Annotation complete: 3 images\n[PROVIDER] Validation updated on-chain\n```\n\n**Client:**\n```\n[CLIENT] Discovering agent from ERC-8004\n[CLIENT] Agent name: Codatta Annotation Agent\n[CLIENT] x402 support: true\n[CLIENT] ✓ Service endpoint: http://localhost:4021\n[CLIENT] Submitting 3 images for object detection...\n[CLIENT] ✓ Annotation received: 3 images\n[CLIENT]   street-001.jpg: car(0.95), pedestrian(0.88)\n[CLIENT] ✓ Feedback submitted: score=92\n[CLIENT] Reputation Score: 92\n```\n\n## Stage 2：A2A 招募（生态聚合）\n\nCodatta Recruiter Agent 通过 A2A 协议主动招募外部数据服务 Agent，完成能力评估、质量验证、DID 注册、入池的完整流程。\n\n### 启动 Recruiter（终端 1）\n\n```bash\nnpm run start:recruiter\n```\n\n### 启动 External Agent（终端 2）\n\n```bash\nnpm run start:external\n```\n\nExternal Agent 自动完成招募对话：\n\n```\n[EXTERNAL] Recruiter: Welcome! ... What annotation types do you support?\n[EXTERNAL] Recruiter: Let's verify your quality with a quick test task.\n[EXTERNAL] Test task received: yes\n[EXTERNAL] Submitting 2 annotated images...\n[EXTERNAL] ✓ Test passed! Accuracy: 92%\n[EXTERNAL] Registering Codatta DID\n[EXTERNAL] ✓ Onboarded into Codatta!\n[EXTERNAL] Status: active, Task Pool: annotation\n```\n\n### 查询链上数据\n\n```bash\n# 自动读取 agent-info.json\nnpm run query\n\n# 或指定 agentId\nnpm run query -- \u003cagentId\u003e\n```\n\n## Web Dashboard\n\n可视化展示 Agent 身份、DID 文档、信誉评分、验证记录，支持注册 DID 和 Agent。\n\n### 启动前端\n\n```bash\ncd web\nnpm install\nnpm run dev\n```\n\n浏览器打开 http://localhost:5173\n\n### 页面\n\n| 路径 | 功能 |\n|------|------|\n| `/` | Agent 列表（从链上事件枚举） |\n| `/agent/:id` | Agent 详情（注册文件、services、信誉、验证、DID 关联） |\n| `/did/:hex` | DID 文档查看 |\n| `/register-did` | 一键注册 Codatta DID（需连接钱包） |\n| `/register-agent` | 三步注册 Agent：DID → ERC-8004 → 双向关联（需连接钱包） |\n\n\u003e 需要先运行 Provider + Client 填充链上数据，Dashboard 才有内容展示。连接钱包使用 MetaMask，需添加 Anvil 网络（chainId: 31337, RPC: http://127.0.0.1:8545）。\n\n## 技术栈\n\n- **Solidity** ^0.8.20 + **Foundry** (forge/anvil)\n- **TypeScript** + **ethers.js** v6 + **Express**（Agent 端）\n- **React** + **Vite** + **wagmi** + **viem**（Web Dashboard）\n- **MCP** — @modelcontextprotocol/sdk（服务接口发现与调用）\n- **A2A** — @a2a-js/sdk（Agent 间多轮协作）\n- **OpenZeppelin** Contracts v5 (含 Upgradeable)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanbased-ai%2Fcodatta-ethereum-agent-demo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhumanbased-ai%2Fcodatta-ethereum-agent-demo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhumanbased-ai%2Fcodatta-ethereum-agent-demo/lists"}