返回顶部
8

8004ERC-8004代理信任协议

ERC-8004 Agent Trust Protocol for AI agent identity, reputation, and validation on Celo. Use when building AI agents that need identity registration, reputation tracking, or trust verification across organizational boundaries.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.2001
安全检测
已通过
273
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

8004

ERC-8004:智能体信任协议

ERC-8004 为自主 AI 智能体构建信任基础设施,使其能够跨组织边界发现、识别和评估其他智能体。

使用场景

  • - 在链上注册 AI 智能体的身份
  • 为 AI 智能体构建声誉系统
  • 在交互前验证智能体身份
  • 查询智能体声誉和反馈
  • 实现基于信任的智能体交互

核心概念

三大注册表

注册表用途核心功能
身份注册表通过 ERC-721 NFT 发现智能体register()、agentURI()
声誉注册表
反馈与认证 | giveFeedback()、getSummary() | | 验证注册表 | 验证钩子 | 自定义验证器 |

协议栈位置

应用层(智能体应用、市场)

信任层(ERC-8004)← 本技能

支付层(x402)

通信层(A2A、MCP)

安装

bash

JavaScript/TypeScript


npm install @chaoschain/sdk

Python

pip install chaoschain-sdk

合约地址

Celo 主网

合约地址
身份注册表即将推出(2026 年第一季度)
声誉注册表
即将推出(2026 年第一季度) |

Celo Sepolia(测试网)

合约地址
身份注册表即将推出
声誉注册表
即将推出 |

智能体注册

1. 创建注册文件

创建描述端点和能力的智能体注册文件:

json
{
type: Agent,
name: 我的 AI 智能体,
description: 能力描述,
image: ipfs://Qm...,
endpoints: [
{
type: a2a,
url: https://example.com/.well-known/agent.json
},
{
type: mcp,
url: https://example.com/mcp
},
{
type: wallet,
address: 0x...,
chainId: 42220
}
],
supportedTrust: [reputation, validation, tee]
}

2. 上传至 IPFS

javascript
import { upload } from @chaoschain/sdk;

const agentMetadata = {
type: Agent,
name: 我的 AI 智能体,
description: 用于 DeFi 操作的 AI 智能体,
// ...
};

const agentURI = await upload(agentMetadata);
// 返回:ipfs://QmYourRegistrationFile

3. 注册智能体

javascript
import { IdentityRegistry } from @chaoschain/sdk;
import { createPublicClient, http } from viem;
import { celo } from viem/chains;

const client = createPublicClient({
chain: celo,
transport: http(https://forno.celo.org),
});

const registry = new IdentityRegistry(client);

// 注册并获取智能体 ID
const tx = await registry.register(agentURI);
const agentId = tx.events.Transfer.returnValues.tokenId;

console.log(智能体已注册,ID:, agentId);

声誉系统

提供反馈

javascript
import { ReputationRegistry } from @chaoschain/sdk;

const reputation = new ReputationRegistry(client);

await reputation.giveFeedback(
agentId, // 要评价的智能体 ID
85, // 分数(0-100)
0, // 小数位数
starred, // 标签1:类别
, // 标签2:可选
https://agent.example.com, // 使用的端点
ipfs://QmDetailedFeedback, // 详细反馈 URI
feedbackHash // 反馈内容的 keccak256 哈希值
);

常用反馈标签

标签衡量指标示例
starred质量评分(0-100)87/100
uptime
端点在线率 % | 99.77% | | successRate | 任务成功率 % | 89% | | responseTime | 响应时间(毫秒) | 560ms | | reachable | 端点可达性 | true/false |

查询声誉

javascript
// 获取智能体的所有反馈
const feedback = await reputation.readAllFeedback(agentId);

// 获取聚合摘要
const summary = await reputation.getSummary(agentId);
console.log(平均评分:, summary.averageScore);
console.log(总评价数:, summary.totalFeedback);

信任验证工作流

javascript
import { IdentityRegistry, ReputationRegistry } from @chaoschain/sdk;

async function verifyAndInteract(targetAgentId, minReputation = 70) {
// 1. 验证身份
const identity = await identityRegistry.getAgent(targetAgentId);
if (!identity) {
throw new Error(智能体未注册);
}

// 2. 检查声誉
const summary = await reputationRegistry.getSummary(targetAgentId);
if (summary.averageScore < minReputation) {
throw new Error(智能体声誉 ${summary.averageScore} 低于阈值 ${minReputation});
}

// 3. 获取端点
const agentData = await fetch(identity.agentURI).then(r => r.json());
const endpoint = agentData.endpoints.find(e => e.type === a2a);

// 4. 与已验证的智能体交互
const result = await interactWithAgent(endpoint.url);

// 5. 提交反馈
await reputationRegistry.giveFeedback(
targetAgentId,
result.success ? 90 : 30,
0,
result.success ? starred : failed,
,
endpoint.url,
,

);

return result;
}

与 x402 支付集成

ERC-8004 和 x402 协同工作,实现可信的付费智能体交互:

javascript
import { IdentityRegistry, ReputationRegistry } from @chaoschain/sdk;
import { wrapFetchWithPayment } from thirdweb/x402;

async function payTrustedAgent(agentId, serviceUrl) {
// 1. 验证信任
const summary = await reputationRegistry.getSummary(agentId);
if (summary.averageScore < 80) {
throw new Error(智能体信任度不足以进行支付);
}

// 2. 发起付费请求
const fetchWithPayment = wrapFetchWithPayment({
client,
account,
paymentOptions: { maxValue: 1000000 },
});

const response = await fetchWithPayment(serviceUrl);
return response.json();
}

使用案例

DeFi 交易智能体

在委托资金前验证策略智能体:

javascript
const strategyAgents = await identityRegistry.searchByCapability(defi-trading);
const trustedAgents = [];

for (const agent of strategyAgents) {
const summary = await reputationRegistry.getSummary(agent.id);
if (summary.averageScore >= 85 && summary.totalFeedback >= 100) {
trustedAgents.push(agent);
}
}

多智能体工作流

协调可信智能体完成复杂任务:

javascript
const workflow = {
research: await findTrustedAgent(research, 80),
analysis: await findTrustedAgent(analysis, 85),
execution: await findTrustedAgent(execution, 90),
};

// 使用信任验证的智能体执行
await executeWorkflow(workflow);

验证注册表

对于高风险操作,使用验证注册表进行额外验证:

模型机制最佳适用场景
基于声誉客户端反馈低风险、高频
加密经济
质押 + 罚没 | 中等风险金融 |
| zkML | 零知识证明 | 隐私保护 |
| TEE 认证 | 硬件隔离 | 高保证 |

Celo 网络参考

网络链 IDRPC 端点
Celo 主网42220https://forno.celo.org
Celo Sepolia
11142220 | https://forno.celo-sepolia.celo-testnet.org |

其他资源

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 8004-1776183601 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 8004-1776183601 技能

通过命令行安装

skillhub install 8004-1776183601

下载

⬇ 下载 8004 v1.0.2001(免费)

文件大小: 3.6 KB | 发布时间: 2026-4-15 13:03

v1.0.2001 最新 2026-4-15 13:03
Initial publish

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部