erc8004-avalanche

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

ERC-8004: Trustless Agents on Avalanche

ERC-8004:Avalanche上的Trustless Agents

Register your AI agent on Avalanche C-Chain with a verifiable on-chain identity, making it discoverable and enabling trust signals through reputation and validation.
在Avalanche C-Chain上为你的AI Agent注册可验证的链上身份,使其可被发现,并通过声誉和验证机制实现信任信号传递。

What is ERC-8004?

什么是ERC-8004?

ERC-8004 is an Ethereum standard for trustless agent identity and reputation, deployed on Avalanche:
  • 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是以太坊的无信任代理身份与声誉标准,已部署在Avalanche上:
  • 身份注册表 - 基于ERC-721的Agent ID(你的Agent将获得一个NFT)
  • 声誉注册表 - 来自其他Agent/用户的反馈和信任信号
  • 验证注册表 - 第三方对Agent工作成果的验证

Contract Addresses

合约地址

ChainIdentity RegistryReputation Registry
Avalanche Mainnet (43114)
0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
Avalanche Fuji (43113)
0x8004A818BFB912233c491871b3d84c89A494BD9e
0x8004B663056A597Dffe9eCcC1965A193B7388713
Explorer links:
网络身份注册表声誉注册表
Avalanche主网(43114)
0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
Avalanche Fuji测试网(43113)
0x8004A818BFB912233c491871b3d84c89A494BD9e
0x8004B663056A597Dffe9eCcC1965A193B7388713
浏览器链接:

Quick Start

快速开始

1. Register Your Agent

1. 注册你的Agent

bash
undefined
bash
undefined

Set environment variables

设置环境变量

export AVALANCHE_RPC_URL="https://api.avax.network/ext/bc/C/rpc" export PRIVATE_KEY="your-private-key"
export AVALANCHE_RPC_URL="https://api.avax.network/ext/bc/C/rpc" export PRIVATE_KEY="your-private-key"

Register with a URI pointing to your agent's registration file

通过指向Agent注册文件的URI进行注册

./scripts/register.sh "https://myagent.xyz/agent.json"
./scripts/register.sh "https://myagent.xyz/agent.json"

Or register with IPFS (requires PINATA_JWT)

或通过IPFS注册(需要PINATA_JWT)

export PINATA_JWT="your-pinata-jwt" ./scripts/register.sh "ipfs"
undefined
export PINATA_JWT="your-pinata-jwt" ./scripts/register.sh "ipfs"
undefined

2. Check Agent Registration

2. 检查Agent注册状态

bash
undefined
bash
undefined

Check if an agent is registered and get its info

检查Agent是否已注册并获取其信息

./scripts/check-agent.sh <agent-id>
undefined
./scripts/check-agent.sh <agent-id>
undefined

3. Give Feedback

3. 提交反馈

bash
undefined
bash
undefined

Give reputation feedback to an agent

为某个Agent提交声誉反馈

./scripts/give-feedback.sh <agent-id> <value> <tag1> <tag2>
undefined
./scripts/give-feedback.sh <agent-id> <value> <tag1> <tag2>
undefined

Registration File Format

注册文件格式

Your agent's registration file (see
assets/templates/registration.json
):
json
{
  "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
  "name": "My Avalanche Agent",
  "description": "An AI agent operating on Avalanche",
  "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" },
    { "name": "MCP", "endpoint": "https://mcp.myagent.xyz/", "version": "2025-06-18" }
  ],
  "x402Support": false,
  "active": true,
  "registrations": [
    {
      "agentId": 1,
      "agentRegistry": "eip155:43114:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"
    }
  ],
  "supportedTrust": ["reputation"]
}
你的Agent注册文件(可参考
assets/templates/registration.json
):
json
{
  "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
  "name": "My Avalanche Agent",
  "description": "An AI agent operating on Avalanche",
  "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" },
    { "name": "MCP", "endpoint": "https://mcp.myagent.xyz/", "version": "2025-06-18" }
  ],
  "x402Support": false,
  "active": true,
  "registrations": [
    {
      "agentId": 1,
      "agentRegistry": "eip155:43114:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432"
    }
  ],
  "supportedTrust": ["reputation"]
}

Key Concepts

核心概念

Agent Identity (ERC-721 NFT)

Agent身份(ERC-721 NFT)

  • Each agent gets a unique
    agentId
    (tokenId) on registration
  • The NFT owner controls the agent's profile and metadata
  • Agents are globally identified by
    eip155:43114:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
    +
    agentId
  • 每个Agent在注册时会获得唯一的
    agentId
    (tokenId)
  • NFT持有者控制Agent的资料和元数据
  • Agent的全局标识格式为
    eip155:43114:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
    +
    agentId

Reputation System

声誉系统

  • Anyone can give feedback (except the agent owner themselves)
  • Feedback includes a value (int128) with decimals (0-18) plus optional tags
  • Common tags:
    starred
    (quality 0-100),
    reachable
    (binary),
    uptime
    (percentage)
  • Feedback can be revoked by the original submitter
  • Agents can append responses to feedback
  • 任何人都可以提交反馈(Agent持有者自身除外)
  • 反馈包含一个数值(int128)及小数位数(0-18),还可附带可选标签
  • 常见标签:
    starred
    (质量评分0-100)、
    reachable
    (二元值)、
    uptime
    (百分比)
  • 反馈可由原提交者撤销
  • Agent可对反馈添加回复

Validation

验证机制

  • Agents request validation from validator contracts
  • Validators respond with a score (0-100)
  • Supports stake-secured re-execution, zkML, TEE attestation
  • Agent可向验证合约请求验证
  • 验证者会返回一个评分(0-100)
  • 支持基于质押担保的重新执行、zkML、TEE证明

Environment Variables

环境变量

VariableDescriptionRequired
AVALANCHE_RPC_URL
Avalanche C-Chain RPC endpointYes (defaults to public RPC)
PRIVATE_KEY
Wallet private key for signing transactionsYes
PINATA_JWT
Pinata API JWT for IPFS uploadsNo (only for IPFS registration)
AGENT_NAME
Agent display nameNo
AGENT_DESCRIPTION
Agent descriptionNo
AGENT_IMAGE
Avatar URLNo
SNOWTRACE_API_KEY
Snowtrace API key for verificationNo
变量名描述是否必填
AVALANCHE_RPC_URL
Avalanche C-Chain的RPC端点是(默认使用公共RPC)
PRIVATE_KEY
用于签署交易的钱包私钥
PINATA_JWT
用于IPFS上传的Pinata API JWT否(仅IPFS注册时需要)
AGENT_NAME
Agent的显示名称
AGENT_DESCRIPTION
Agent的描述信息
AGENT_IMAGE
头像URL
SNOWTRACE_API_KEY
用于验证的Snowtrace API密钥

Avalanche Network Details

Avalanche网络详情

ParameterMainnetFuji Testnet
Chain ID4311443113
RPC URL
https://api.avax.network/ext/bc/C/rpc
https://api.avax-test.network/ext/bc/C/rpc
Explorerhttps://snowtrace.iohttps://testnet.snowtrace.io
CurrencyAVAXAVAX (test)
Faucet-https://faucet.avax.network
参数主网Fuji测试网
链ID4311443113
RPC URL
https://api.avax.network/ext/bc/C/rpc
https://api.avax-test.network/ext/bc/C/rpc
区块浏览器https://snowtrace.iohttps://testnet.snowtrace.io
代币AVAXAVAX(测试代币)
水龙头-https://faucet.avax.network

Workflow

工作流程

  1. Get AVAX - You need AVAX for gas fees (~0.01-0.05 AVAX for registration)
  2. Create Registration File - Generate a JSON following the registration format
  3. Upload to IPFS (optional) - Pin via Pinata or host at any URL
  4. Register On-Chain - Call
    register(agentURI)
    on the Identity Registry
  5. Set Metadata - Optionally set on-chain metadata and agent wallet
  6. Receive Feedback - Other agents/users can give reputation signals
  7. Request Validation - Optionally request third-party verification
  1. 获取AVAX - 你需要AVAX来支付Gas费用(注册约需0.01-0.05 AVAX)
  2. 创建注册文件 - 按照注册格式生成JSON文件
  3. 上传至IPFS(可选) - 通过Pinata固定文件或托管在任意URL
  4. 链上注册 - 调用身份注册表的
    register(agentURI)
    方法
  5. 设置元数据 - 可选:设置链上元数据和Agent钱包
  6. 接收反馈 - 其他Agent/用户可提交声誉信号
  7. 请求验证 - 可选:向第三方请求验证

Using with cast (Foundry)

结合cast(Foundry)使用

bash
undefined
bash
undefined

Register an agent with a URI

通过URI注册Agent

cast send 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
"register(string)" "https://myagent.xyz/agent.json"
--rpc-url https://api.avax.network/ext/bc/C/rpc
--private-key $PRIVATE_KEY
cast send 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
"register(string)" "https://myagent.xyz/agent.json"
--rpc-url https://api.avax.network/ext/bc/C/rpc
--private-key $PRIVATE_KEY

Read agent URI

读取Agent的URI

cast call 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
"tokenURI(uint256)" 1
--rpc-url https://api.avax.network/ext/bc/C/rpc
cast call 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
"tokenURI(uint256)" 1
--rpc-url https://api.avax.network/ext/bc/C/rpc

Give feedback (value=85, decimals=0, tag1="starred")

提交反馈(数值=85,小数位数=0,标签1="starred")

cast send 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
"giveFeedback(uint256,int128,uint8,string,string,string,string,bytes32)"
1 85 0 "starred" "" "" "" 0x0000000000000000000000000000000000000000000000000000000000000000
--rpc-url https://api.avax.network/ext/bc/C/rpc
--private-key $PRIVATE_KEY
cast send 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
"giveFeedback(uint256,int128,uint8,string,string,string,string,bytes32)"
1 85 0 "starred" "" "" "" 0x0000000000000000000000000000000000000000000000000000000000000000
--rpc-url https://api.avax.network/ext/bc/C/rpc
--private-key $PRIVATE_KEY

Get reputation summary

获取声誉汇总

cast call 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
"getSummary(uint256,address[],string,string)"
1 "[0xREVIEWER_ADDRESS]" "starred" ""
--rpc-url https://api.avax.network/ext/bc/C/rpc
undefined
cast call 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
"getSummary(uint256,address[],string,string)"
1 "[0xREVIEWER_ADDRESS]" "starred" ""
--rpc-url https://api.avax.network/ext/bc/C/rpc
undefined

Using with viem/ethers.js

结合viem/ethers.js使用

See
references/api-reference.md
for complete TypeScript examples.
完整的TypeScript示例请参考
references/api-reference.md

Links

相关链接