mcpField
E
erc-8004

erc-8004

github.com/bankrbotAgent 工作流1.2k229 次安装5 天前更新
代码仓库

关于 erc-8004

erc-8004 提供脚本和指南,用于按 ERC-8004 信任与声誉标准注册 AI Agent。支持通过托管 URL、IPFS 或链上数据 URI 发布资料。

主要功能

  1. 01在 Ethereum 注册 Agent 身份
  2. 02创建和更新 Agent 资料
  3. 03通过 IPFS 或 URL 发布资料
  4. 04将资料注册为链上数据 URI
  5. 05将 ETH 从 Base 桥接至主网

适用场景

  1. 01创建可验证的 Agent 身份
  2. 02发布注册资料
  3. 03更新 Agent 元数据或 URI
  4. 04无需外部托管资料即可注册

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/bankrbot/skills --skill erc-8004

安装后在 Claude Code 中输入/erc-8004确认已加载。

包含的文件

除 SKILL.md 外,安装时一起下载的参考资料和脚本。

catalog.json
references/
erc-8004-spec.md
scripts/
bridge-to-mainnet.sh
create-registration.sh
get-agent.sh
register-http.sh
register-onchain.sh
register.sh
update-profile.sh
upload-to-ipfs.sh

详细介绍

ERC-8004:无需信任的 Agent

在 Ethereum 主网上注册你的 AI Agent,获得可验证的链上身份,让其他人能够发现它,并提供信任信号。

什么是 ERC-8004?

ERC-8004 是一项用于无需信任的 Agent 身份和声誉的 Ethereum 标准:

  • 身份注册表 - 基于 ERC-721 的 Agent ID(你的 Agent 会获得一个 NFT!)
  • 声誉注册表 - 其他 Agent/用户提供的反馈和信任信号
  • 验证注册表 - 第三方对 Agent 工作的验证

网站:https://www.8004.org
规范:https://eips.ethereum.org/EIPS/eip-8004

合约地址

链身份注册表声誉注册表
Ethereum 主网0x8004A169FB4a3325136EB29fA0ceB6D2e539a4320x8004BAa17C55a88189AE136b182e5fdA19dE9b63
Sepolia 测试网0x8004A818BFB912233c491871b3d84c89A494BD9e0x8004B663056A597Dffe9eCcC1965A193B7388713

快速开始

1. 注册你的 Agent
# Full registration (creates profile, uploads to IPFS, registers on-chain)
./scripts/register.sh

# Or with custom values
NAME="My Agent" \
DESCRIPTION="An AI agent that does cool stuff" \
IMAGE="https://example.com/avatar.png" \
./scripts/register.sh
2. 将 ETH 跨链桥接到主网(如有需要)
# Bridge ETH from Base to Ethereum mainnet
./scripts/bridge-to-mainnet.sh 0.01
3. 更新 Agent 资料
# Update your agent's registration file
./scripts/update-profile.sh <agent-id> <new-ipfs-uri>

环境变量

变量描述必需
PINATA_JWT用于上传到 IPFS 的 Pinata API JWT否(仅用于 IPFS)
AGENT_NAMEAgent 显示名称否(默认为钱包 ENS 或地址)
AGENT_DESCRIPTIONAgent 描述否
AGENT_IMAGE头像 URL否

注册选项

选项 1:使用 8004.org 前端(最简单)
访问 https://www.8004.org 并通过 UI 注册 — 自动处理 IPFS。

选项 2:HTTP URL(无需 IPFS)
将注册 JSON 托管在任意 URL:

REGISTRATION_URL="https://myagent.xyz/agent.json" ./scripts/register-http.sh

选项 3:通过 Pinata 使用 IPFS

PINATA_JWT="your-jwt" ./scripts/register.sh

选项 4:Data URI(完全上链)
将注册信息编码为 base64 — 无需外部托管:

./scripts/register-onchain.sh

注册文件格式

你的 Agent 注册文件(存储在 IPFS 上)采用以下结构:

{
  "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
  "name": "My Agent",
  "description": "An AI assistant for various tasks",
  "image": "https://example.com/avatar.png",
  "services": [
    {
      "name": "web",
      "endpoint": "https://myagent.xyz/"
    },
    {
      "name": "A2A",
      "endpoint": "https://myagent.xyz/.well-known/agent-card.json",
      "version": "0.3.0"
    }
  ],
  "x402Support": false,
  "active": true,
  "registrations": [
    {
      "agentId": 123,
      "agentRegistry": "eip155:1:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"
    }
  ],
  "supportedTrust": ["reputation"]
}

工作流

  1. 跨链桥接 ETH(如有需要)- 使用 Bankr 将 ETH 从 Base/L2 桥接到主网
  2. 创建资料 - 生成包含 Agent 信息的注册 JSON 文件
  3. 上传到 IPFS - 通过 Pinata(或其他服务提供商)固定该文件
  4. 链上注册 - 在身份注册表上调用 register(agentURI)
  5. 更新资料 - 根据需要设置元数据、钱包或更新 URI

费用

  • **Gas:**注册约需 100-200k gas(根据 Gas 价格约为 $5-20)
  • **IPFS:**Pinata 提供免费套餐(1GB)

使用 SDK

如需更高级的用法,请安装 Agent0 SDK:

npm install agent0-sdk
import { SDK } from 'agent0-sdk';

const sdk = new SDK({
  chainId: 1, // Ethereum Mainnet
  rpcUrl: process.env.ETH_RPC_URL,
  privateKey: process.env.PRIVATE_KEY,
  ipfs: 'pinata',
  pinataJwt: process.env.PINATA_JWT
});

const agent = sdk.createAgent('My Agent', 'Description', 'https://image.url');
const result = await agent.registerIPFS();
console.log(`Registered: Agent ID ${result.agentId}`);

链接

评论

支持 Markdown