erc-8004

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ERC-8004: Trustless Agents

ERC-8004:无需信任的Agent

Register your AI agent on Ethereum mainnet with a verifiable on-chain identity, making it discoverable and enabling trust signals.
在Ethereum主网上注册你的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是一项用于无需信任的Agent身份与声誉的Ethereum标准:
  • 身份注册表 - 基于ERC-721的Agent ID(你的Agent会获得一枚NFT!)
  • 声誉注册表 - 来自其他Agent/用户的反馈与信任信号
  • 验证注册表 - 第三方对Agent工作成果的核验

Contract Addresses

合约地址

ChainIdentity RegistryReputation Registry
Ethereum Mainnet
0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
Sepolia Testnet
0x8004A818BFB912233c491871b3d84c89A494BD9e
0x8004B663056A597Dffe9eCcC1965A193B7388713
身份注册表声誉注册表
Ethereum Mainnet
0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
Sepolia Testnet
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跨链到Ethereum主网

./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
选项1:使用8004.org前端(最简单) 访问https://www.8004.org通过UI完成注册——自动处理IPFS相关操作。
选项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:数据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(根据Gas价格约5-20美元)
  • IPFS费用: Pinata提供免费 tier(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

链接