mcpField
E
erc8004

erc8004

github.com/aibtcdevAgent 工作流11149 次安装2 天前更新
代码仓库

关于 erc8004

用于管理 ERC-8004 链上 Agent 身份、声誉、反馈和验证请求的命令行技能。无需钱包即可读取信息;写入操作需要解锁钱包。

主要功能

  1. 01注册 Agent 身份
  2. 02查询身份详情
  3. 03查询声誉评分
  4. 04提交 Agent 反馈
  5. 05申请及查询验证

适用场景

  1. 01在链上注册 Agent
  2. 02查看 Agent 身份与声誉
  3. 03提交对 Agent 的反馈
  4. 04跟踪第三方验证

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/aibtcdev/skills --skill erc8004

安装后在 Claude Code 中输入/erc8004确认已加载。

附带文件AGENT.mderc8004.ts

详细介绍

ERC-8004 技能

统一的 ERC-8004 链上 Agent 身份技能——注册 Agent 身份、检索身份信息、查询声誉分数、提交反馈,以及请求或检查第三方验证。读取操作无需钱包。写入操作需要已解锁的钱包。

用法

bun run erc8004/erc8004.ts <subcommand> [options]

子命令

register

使用 ERC-8004 身份注册表在链上注册新的 Agent 身份。返回交易 ID。查看交易结果以获取分配的 Agent ID。需要已解锁的钱包。

bun run erc8004/erc8004.ts register [--uri <uri>] [--metadata <json>] [--fee <fee>] [--sponsored]

选项:

  • --uri(可选)— 指向 Agent 元数据的 URI(IPFS、HTTP 等)
  • --metadata(可选)— {"key": "...", "value": "<hex>"} 对象组成的 JSON 数组(值为十六进制编码的缓冲区)
  • --fee(可选)— 费用预设(low、medium、high)或微 STX 金额
  • --sponsored(标志)— 以赞助交易的方式提交

输出:

{
  "success": true,
  "txid": "0xabc...",
  "message": "Identity registration transaction submitted. Check transaction result to get your agent ID.",
  "network": "mainnet",
  "explorerUrl": "https://explorer.hiro.so/txid/0xabc..."
}
get-identity

从 ERC-8004 身份注册表获取 Agent 身份信息。返回所有者地址、URI,以及(如已设置)钱包。无需钱包。

bun run erc8004/erc8004.ts get-identity <address>

参数:

  • <address>(必需)— 要查询的 Agent ID(非负整数)

输出:

{
  "success": true,
  "agentId": 42,
  "owner": "SP1...",
  "uri": "ipfs://...",
  "wallet": "SP2...",
  "network": "mainnet"
}
get-reputation

获取 Agent 的综合声誉分数。返回反馈总数和 WAD 平均摘要值。无需钱包。

bun run erc8004/erc8004.ts get-reputation <address>

参数:

  • <address>(必需)— 要查询的 Agent ID(非负整数)

输出:

{
  "success": true,
  "agentId": 42,
  "totalFeedback": 10,
  "summaryValue": 85,
  "summaryValueDecimals": 0,
  "network": "mainnet"
}
give-feedback

在 ERC-8004 声誉注册表中为 Agent 提交反馈。值为有符号整数。需要已解锁的钱包。

bun run erc8004/erc8004.ts give-feedback <address> <score> <comment> [--fee <fee>] [--sponsored]

参数:

  • <address>(必需)— 要提交反馈的 Agent ID(非负整数)
  • <score>(必需)— 反馈值(有符号整数,例如 5 表示正面反馈,-2 表示负面反馈)
  • <comment>(必需)— 反馈评论或标签(用作 tag1)

选项:

  • --fee(可选)— 费用预设(low、medium、high)或微 STX 金额
  • --sponsored(标志)— 以赞助交易的方式提交

输出:

{
  "success": true,
  "txid": "0xdef...",
  "message": "Feedback submitted for agent 42.",
  "agentId": 42,
  "value": 5,
  "network": "mainnet",
  "explorerUrl": "https://explorer.hiro.so/txid/0xdef..."
}
request-validation

向验证者请求对 Agent 进行第三方验证。需要已解锁的钱包。

bun run erc8004/erc8004.ts request-validation <address> --validator <validator-address> --request-uri <uri> --request-hash <hex> [--fee <fee>] [--sponsored]

参数:

  • <address>(必需)— 要请求验证的 Agent ID(非负整数)

选项:

  • --validator(必需)— 验证者的 Stacks 地址
  • --request-uri(必需)— 指向验证请求数据的 URI
  • --request-hash(必需)— 请求数据的 32 字节 SHA-256 哈希,以十六进制字符串表示
  • --fee(可选)— 费用预设(low、medium、high)或微 STX 金额
  • --sponsored(标志)— 以赞助交易的方式提交

输出:

{
  "success": true,
  "txid": "0xghi...",
  "message": "Validation requested from SP3... for agent 42.",
  "validator": "SP3...",
  "agentId": 42,
  "network": "mainnet",
  "explorerUrl": "https://explorer.hiro.so/txid/0xghi..."
}
validation-status

通过 32 字节请求哈希检查验证请求的状态。无需钱包。

bun run erc8004/erc8004.ts validation-status <request-id>

参数:

  • <request-id>(必需)— 验证请求的 32 字节 SHA-256 哈希,以十六进制字符串表示

输出:

{
  "success": true,
  "requestHash": "abc123...",
  "validator": "SP3...",
  "agentId": 42,
  "response": 90,
  "hasResponse": true,
  "tag": "trusted",
  "lastUpdate": 12345,
  "network": "mainnet"
}

注意事项

  • 读取操作(get-identity、get-reputation、validation-status)无需钱包
  • 写入操作(register、give-feedback、request-validation)需要已解锁的钱包(bun run wallet/wallet.ts unlock)
  • Agent ID 由合约在注册时分配——查看交易结果以找到分配给你的 ID
  • 反馈值为有符号整数;正值会提升声誉,负值会降低声誉
  • 验证响应是由指定验证者提交的 0 到 100 之间的分数

评论

支持 Markdown