erc-8004

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ERC-8004: Trustless Agents

ERC-8004: Trustless Agents

Register your AI agent on Ethereum mainnet with a verifiable on-chain identity, making it discoverable and enabling trust signals.
在以太坊主网为你的AI Agent注册可验证的链上身份,使其可被发现并启用信任标识。

What is ERC-8004?

什么是ERC-8004?

ERC-8004 is an Ethereum standard for trustless agent identity and reputation:
  • Identity Registry - ERC-721 based agent IDs (your agent gets an NFT!)
  • Reputation Registry - Feedback and trust signals from other agents/users
  • Validation Registry - Third-party verification of agent work
ERC-8004是以太坊用于无信任代理身份与信誉的标准:
  • 身份注册表 - 基于ERC-721的Agent ID(你的Agent将获得一个NFT!)
  • 信誉注册表 - 来自其他Agent/用户的反馈与信任标识
  • 验证注册表 - 第三方对Agent工作成果的验证

Contract Addresses

合约地址

ChainIdentity RegistryReputation Registry
Ethereum Mainnet
0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
Sepolia Testnet
0x8004A818BFB912233c491871b3d84c89A494BD9e
0x8004B663056A597Dffe9eCcC1965A193B7388713
链名称身份注册表信誉注册表
以太坊主网
0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
Sepolia测试网
0x8004A818BFB912233c491871b3d84c89A494BD9e
0x8004B663056A597Dffe9eCcC1965A193B7388713

Quick Start

快速开始

1. Register Your Agent

1. 注册你的Agent

bash
undefined
bash
undefined

Full registration (creates profile, uploads to IPFS, registers on-chain)

完整注册(创建档案、上传至IPFS、链上注册)

./scripts/register.sh
./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
undefined
NAME="My Agent"
DESCRIPTION="An AI agent that does cool stuff"
IMAGE="https://example.com/avatar.png"
./scripts/register.sh
undefined

2. Bridge ETH to Mainnet (if needed)

2. 将ETH跨链至主网(如需要)

bash
undefined
bash
undefined

Bridge ETH from Base to Ethereum mainnet

将ETH从Base跨链至以太坊主网

./scripts/bridge-to-mainnet.sh 0.01
undefined
./scripts/bridge-to-mainnet.sh 0.01
undefined

3. Update Agent Profile

3. 更新Agent档案

bash
undefined
bash
undefined

Update your agent's registration file

更新你的Agent注册文件

./scripts/update-profile.sh <agent-id> <new-ipfs-uri>
undefined
./scripts/update-profile.sh <agent-id> <new-ipfs-uri>
undefined

Environment Variables

环境变量

VariableDescriptionRequired
PINATA_JWT
Pinata API JWT for IPFS uploadsNo (only for IPFS)
AGENT_NAME
Agent display nameNo (defaults to wallet ENS or address)
AGENT_DESCRIPTION
Agent descriptionNo
AGENT_IMAGE
Avatar URLNo
变量名描述是否必填
PINATA_JWT
用于IPFS上传的Pinata API JWT否(仅IPFS上传需要)
AGENT_NAME
Agent显示名称否(默认使用钱包ENS或地址)
AGENT_DESCRIPTION
Agent描述
AGENT_IMAGE
头像URL

Registration Options

注册选项

Option 1: Use 8004.org frontend (easiest) Visit https://www.8004.org and register through the UI — handles IPFS automatically.
Option 2: HTTP URL (no IPFS needed) Host your registration JSON at any URL:
bash
REGISTRATION_URL="https://myagent.xyz/agent.json" ./scripts/register-http.sh
Option 3: IPFS via Pinata
bash
PINATA_JWT="your-jwt" ./scripts/register.sh
Option 4: Data URI (fully on-chain) Encode your registration as base64 — no external hosting needed:
bash
./scripts/register-onchain.sh
选项2:HTTP URL(无需IPFS) 将你的注册JSON文件托管在任意URL:
bash
REGISTRATION_URL="https://myagent.xyz/agent.json" ./scripts/register-http.sh
选项3:通过Pinata使用IPFS
bash
PINATA_JWT="your-jwt" ./scripts/register.sh
选项4:Data URI(完全链上) 将你的注册信息编码为base64——无需外部托管:
bash
./scripts/register-onchain.sh

Registration File Format

注册文件格式

Your agent's registration file (stored on IPFS) follows this structure:
json
{
  "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"]
}
你的Agent注册文件(存储在IPFS上)遵循以下结构:
json
{
  "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"]
}

Workflow

工作流程

  1. Bridge ETH (if needed) - Use Bankr to bridge ETH from Base/L2 to mainnet
  2. Create Profile - Generate a registration JSON file with agent info
  3. Upload to IPFS - Pin the file via Pinata (or other provider)
  4. Register On-Chain - Call
    register(agentURI)
    on the Identity Registry
  5. Update Profile - Set metadata, wallet, or update URI as needed
  1. 跨链ETH(如需要)- 使用Bankr将ETH从Base/L2跨链至主网
  2. 创建档案 - 生成包含Agent信息的注册JSON文件
  3. 上传至IPFS - 通过Pinata(或其他服务商)固定文件
  4. 链上注册 - 调用身份注册表的
    register(agentURI)
    方法
  5. 更新档案 - 根据需要设置元数据、钱包或更新URI

Costs

成本

  • Gas: 100-200k gas for registration ($5-20 depending on gas prices)
  • IPFS: Free tier available on Pinata (1GB)
  • Gas费用:注册约需100-200k Gas(约5-20美元,取决于Gas价格)
  • IPFS费用:Pinata提供免费套餐(1GB存储空间)

Using the SDK

使用SDK

For more advanced usage, install the Agent0 SDK:
bash
npm install agent0-sdk
typescript
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}`);
如需更高级的用法,安装Agent0 SDK:
bash
npm install agent0-sdk
typescript
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}`);

Links

相关链接