---
eip: 8004
label: ERC-8004
title: Trustless Agents
status: Draft
type: Standards Track
category: ERC
created: 2025-08-13
requires: 155, 712, 721, 1271
official: https://eips.ethereum.org/EIPS/eip-8004
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8004.md
canonical: https://eips.huatuo.xyz/zh/eip-8004/
lang: zh
tldr: 三个链上注册表（身份、声誉、验证），让 AI 智能体无需事先建立关系，就能跨组织被发现和被信任。
tags: [ai-agents, identity, reputation, registry, nft]
---

# ERC-8004: Trustless Agents

> Discover agents and establish trust through reputation and validation

**TL;DR:** 三个链上注册表（身份、声誉、验证），让 AI 智能体无需事先建立关系，就能跨组织被发现和被信任。

## 它解决什么问题？

MCP 和 Agent2Agent（A2A）等智能体协议描述了软件智能体如何暴露工具并相互通信，但没有说明如何*找到*一个从未打过交道的智能体，或如何决定是否信任它。ERC-8004 提出轻量级注册表，可以在每条链上部署为单例，为每个智能体提供可移植的身份，以及关于反馈和独立验证的公开共享记录。

## 它如何运作

**身份注册表（Identity Registry）。** 一个 [ERC-721](/eip-721/) 合约，每个代币就是一个智能体。`agentId` 是代币 ID，`agentURI`（代币 URI）指向一个 JSON **注册文件**，其中包含名称、描述、图片、`services` 列表（A2A 卡片、MCP 端点、ENS 名称、DID、网页、邮箱……）以及它支持的信任模型。智能体通过 `register(...)` 注册，通过 `setAgentURI` 更新，还可以携带额外的键值元数据。保留键 `agentWallet`（智能体收款的地址）只有在新钱包签名（[EIP-712](/eip-712/) 或 [ERC-1271](/eip-1271/)）后才能更改，并且在智能体 NFT 转移时会被清除。

**声誉注册表（Reputation Registry）。** 除智能体所有者或操作者之外的任何客户端都可以调用 `giveFeedback(agentId, value, valueDecimals, tag1, tag2, endpoint, feedbackURI, feedbackHash)`。`value` 是带符号的定点数，标签赋予它含义（`starred`、`uptime`、`responseTime`……）。客户端可以撤销反馈，任何人都可以追加回应。`getSummary` 会汇总评分，但需要传入一个客户端地址列表作为过滤条件，因为未过滤的总数很容易遭受女巫攻击。

**验证注册表（Validation Registry）。** 智能体所有者通过 `validationRequest(validator, agentId, requestURI, requestHash)` 请求验证。被指定的验证者（质押担保的重新执行、zkML 验证器、TEE 预言机……）用 `validationResponse(requestHash, response, …)` 作答，其中 `response` 为 0–100，之后还可以更新。

## 示例代码

在 `agentURI` 处提供的最小注册文件：

```json
{
  "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
  "name": "PriceBot",
  "description": "Returns token prices. Pay per call.",
  "image": "https://example.com/pricebot.png",
  "services": [
    { "name": "MCP", "endpoint": "https://mcp.example.com/", "version": "2025-06-18" },
    { "name": "A2A", "endpoint": "https://example.com/.well-known/agent-card.json", "version": "0.3.0" }
  ],
  "active": true,
  "registrations": [
    { "agentId": 22, "agentRegistry": "eip155:1:<identityRegistryAddress>" }
  ],
  "supportedTrust": ["reputation"]
}
```

留下反馈（ethers v6）：

```ts
import { Contract, ZeroHash } from "ethers";

const reputation = new Contract(reputationRegistry, [
  "function giveFeedback(uint256,int128,uint8,string,string,string,string,bytes32)",
], signer);
await reputation.giveFeedback(22n, 87n, 0, "starred", "", "", "", ZeroHash); // 87/100
```

## 需要注意

- **状态：Draft。** 函数签名和文件格式仍在变化，规范中还有未解决的编辑备注。
- 声誉是公开的，但无法抵御女巫攻击。请决定你信任哪些评价者，不要依赖原始平均值。
- 注册只能证明该文件属于链上的智能体，并不能证明智能体可用或安全。这正是声誉和验证的用途。
- 支付、验证者激励和惩罚（slashing）不在范围内。免 gas 的反馈可以借助 [EIP-7702](/eip-7702/) 的代付来实现。
- 端点的域名控制权可以选择通过 `/.well-known/agent-registration.json` 来证明。


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-8004
