← 返回
开发者工具 中文

8004

ERC-8004 Agent Trust Protocol for AI agent identity, reputation, and validation on Celo. Use when building AI agents that need identity registration, reputat...
ERC‑8004 代理信任协议,用于在 Celo 上进行 AI 代理身份、声誉和验证。适用于需要身份注册、声誉管理的 AI 代理开发。
san-npm
开发者工具 clawhub v1.0.2001 1 版本 100000 Key: 无需
★ 0
Stars
📥 566
下载
💾 6
安装
1
版本
#latest

概述

ERC-8004: Agent Trust Protocol

ERC-8004 establishes trust infrastructure for autonomous AI agents, enabling them to discover, identify, and evaluate other agents across organizational boundaries.

When to Use

  • Registering an AI agent's identity on-chain
  • Building reputation systems for AI agents
  • Verifying agent identity before interactions
  • Querying agent reputation and feedback
  • Implementing trust-based agent interactions

Core Concepts

The Three Registries

RegistryPurposeKey Functions
----------------------------------
Identity RegistryAgent discovery via ERC-721 NFTsregister(), agentURI()
Reputation RegistryFeedback and attestationsgiveFeedback(), getSummary()
Validation RegistryVerification hooksCustom validators

Protocol Stack Position

Application Layer (Agent Apps, Marketplaces)
    ↓
Trust Layer (ERC-8004) ← This skill
    ↓
Payment Layer (x402)
    ↓
Communication Layer (A2A, MCP)

Installation

# JavaScript/TypeScript
npm install @chaoschain/sdk

# Python
pip install chaoschain-sdk

Contract Addresses

Celo Mainnet

ContractAddress
-------------------
Identity RegistryComing Soon (Q1 2026)
Reputation RegistryComing Soon (Q1 2026)

Celo Sepolia (Testnet)

ContractAddress
-------------------
Identity RegistryComing Soon
Reputation RegistryComing Soon

Agent Registration

1. Create Registration File

Create an agent registration file describing endpoints and capabilities:

{
  "type": "Agent",
  "name": "My AI Agent",
  "description": "Description of capabilities",
  "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. Upload to IPFS

import { upload } from "@chaoschain/sdk";

const agentMetadata = {
  type: "Agent",
  name: "My AI Agent",
  description: "AI agent for DeFi operations",
  // ...
};

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

3. Register Agent

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);

// Register and get agent ID
const tx = await registry.register(agentURI);
const agentId = tx.events.Transfer.returnValues.tokenId;

console.log('Agent registered with ID:', agentId);

Reputation System

Give Feedback

import { ReputationRegistry } from '@chaoschain/sdk';

const reputation = new ReputationRegistry(client);

await reputation.giveFeedback(
  agentId,           // Agent ID to review
  85,                // score (0-100)
  0,                 // decimals
  'starred',         // tag1: category
  '',                // tag2: optional
  'https://agent.example.com',  // endpoint used
  'ipfs://QmDetailedFeedback',  // detailed feedback URI
  feedbackHash       // keccak256 of feedback content
);

Common Feedback Tags

TagMeasuresExample
------------------------
starredQuality rating (0-100)87/100
uptimeEndpoint uptime %99.77%
successRateTask success rate %89%
responseTimeResponse time (ms)560ms
reachableEndpoint reachabletrue/false

Query Reputation

// Get all feedback for an agent
const feedback = await reputation.readAllFeedback(agentId);

// Get aggregated summary
const summary = await reputation.getSummary(agentId);
console.log('Average rating:', summary.averageScore);
console.log('Total reviews:', summary.totalFeedback);

Trust Verification Workflow

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

async function verifyAndInteract(targetAgentId, minReputation = 70) {
  // 1. Verify identity
  const identity = await identityRegistry.getAgent(targetAgentId);
  if (!identity) {
    throw new Error('Agent not registered');
  }

  // 2. Check reputation
  const summary = await reputationRegistry.getSummary(targetAgentId);
  if (summary.averageScore < minReputation) {
    throw new Error(`Agent reputation ${summary.averageScore} below threshold ${minReputation}`);
  }

  // 3. Get endpoint
  const agentData = await fetch(identity.agentURI).then(r => r.json());
  const endpoint = agentData.endpoints.find(e => e.type === 'a2a');

  // 4. Interact with verified agent
  const result = await interactWithAgent(endpoint.url);

  // 5. Submit feedback
  await reputationRegistry.giveFeedback(
    targetAgentId,
    result.success ? 90 : 30,
    0,
    result.success ? 'starred' : 'failed',
    '',
    endpoint.url,
    '',
    ''
  );

  return result;
}

Integration with x402 Payments

ERC-8004 and x402 work together for trustworthy paid agent interactions:

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

async function payTrustedAgent(agentId, serviceUrl) {
  // 1. Verify trust
  const summary = await reputationRegistry.getSummary(agentId);
  if (summary.averageScore < 80) {
    throw new Error('Agent not trusted enough for payment');
  }

  // 2. Make paid request
  const fetchWithPayment = wrapFetchWithPayment({
    client,
    account,
    paymentOptions: { maxValue: "1000000" },
  });

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

Use Cases

DeFi Trading Agents

Verify strategy agents before delegating funds:

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);
  }
}

Multi-Agent Workflows

Coordinate trusted agents for complex tasks:

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

// Execute with trust-verified agents
await executeWorkflow(workflow);

Validation Registry

For high-stakes operations, use Validation Registry for additional verification:

ModelMechanismBest For
----------------------------
Reputation-basedClient feedbackLow-stake, frequent
Crypto-economicStake + slashingMedium-stake financial
zkMLZero-knowledge proofsPrivacy-preserving
TEE AttestationHardware isolationHigh-assurance

Celo Network Reference

NetworkChain IDRPC Endpoint
---------------------------------
Celo Mainnet42220https://forno.celo.org
Celo Sepolia11142220https://forno.celo-sepolia.celo-testnet.org

Additional Resources

Related Skills

  • x402 - Payment layer for AI agents
  • celo-rpc - Celo blockchain interaction
  • viem - TypeScript Ethereum library

版本历史

共 1 个版本

  • v1.0.2001 当前
    2026-03-30 22:08 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,784
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 68 📥 180,120
developer-tools

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 668 📥 324,099