关于 validation
validation 是通过 validation-registry 合约执行 ERC-8004 Agent 验证的命令行技能。它支持只读状态和汇总查询,也支持使用已解锁的钱包在 Stacks 上发起验证请求并提交响应。
主要功能
- 01为 Agent 发起验证请求
- 02提交带评分的验证响应
- 03查询请求状态与 Agent 汇总
- 04列出 Agent 和验证者请求
- 05基于游标的分页
适用场景
- 01请求验证者评估某个 Agent
- 02提交或更新待处理的验证评分
- 03查看 Agent 的验证记录
- 04检查分配给验证者的请求
安装
复制下面的命令,在终端中运行。
npx skills add https:/ / github.com/ aibtcdev/ skills --skill validation安装后在 Claude Code 中输入/validation确认已加载。
附带文件AGENT.mdvalidation.ts
详细介绍
验证技能
使用 validation-registry 合约提供 ERC-8004 链上 Agent 验证操作。读取操作(get-status、get-summary、get-agent-validations、get-validator-requests)无需钱包。写入操作(request、respond)需要已解锁的钱包。
用法
bun run validation/validation.ts <subcommand> [options]
子命令
request
在 ERC-8004 验证注册表中请求验证者验证某个 Agent。请求哈希必须是请求数据的 32 字节 SHA-256 哈希。需要已解锁的钱包。
bun run validation/validation.ts request --validator <address> --agent-id <id> --request-uri <uri> --request-hash <hex> [--fee <fee>] [--sponsored]
选项:
--validator(必填)— 要向其请求验证的验证者 Stacks 地址--agent-id(必填)— 要请求验证的 Agent ID(非负整数)--request-uri(必填)— 指向验证请求数据的 URI--request-hash(必填)— 请求数据的 32 字节 SHA-256 哈希,以十六进制字符串表示--fee(可选)— 费用预设(low、medium、high)或 micro-STX 金额--sponsored(标记)— 以赞助交易形式提交
输出:
{
"success": true,
"txid": "0xabc...",
"message": "Validation requested from SP2... for agent 42.",
"validator": "SP2...",
"agentId": 42,
"requestUri": "ipfs://request...",
"network": "mainnet",
"explorerUrl": "https://explorer.hiro.so/txid/0xabc..."
}
respond
为待处理的验证请求提交验证响应。只有原始请求中指定的验证者才能调用。响应必须是 0 到 100 之间的整数。可以多次调用以逐步更新。需要已解锁的钱包。
bun run validation/validation.ts respond --request-hash <hex> --response <value> --response-uri <uri> --response-hash <hex> [--tag <tag>] [--fee <fee>] [--sponsored]
选项:
--request-hash(必填)— 原始请求的 32 字节 SHA-256 哈希,以十六进制字符串表示--response(必填)— 验证响应分数(0 到 100 之间的整数)--response-uri(必填)— 指向验证响应数据的 URI--response-hash(必填)— 响应数据的 32 字节 SHA-256 哈希,以十六进制字符串表示--tag(可选)— 验证响应的分类标签--fee(可选)— 费用预设(low、medium、high)或 micro-STX 金额--sponsored(标记)— 以赞助交易形式提交
输出:
{
"success": true,
"txid": "0xdef...",
"message": "Validation response 85 submitted for request hash a3f2b1....",
"response": 85,
"responseUri": "ipfs://response...",
"tag": "security",
"network": "mainnet",
"explorerUrl": "https://explorer.hiro.so/txid/0xdef..."
}
get-status
通过 32 字节请求哈希获取验证请求的状态。返回验证者、Agent ID、响应分数、响应哈希、标签、最后更新区块,以及是否已提交响应。无需钱包。
bun run validation/validation.ts get-status --request-hash <hex>
选项:
--request-hash(必填)— 验证请求的 32 字节 SHA-256 哈希,以十六进制字符串表示
输出:
{
"success": true,
"requestHash": "a3f2b1...64hex",
"validator": "SP2...",
"agentId": 42,
"response": 85,
"responseHash": "b4e9c2...64hex",
"tag": "security",
"lastUpdate": 123456,
"hasResponse": true,
"network": "mainnet"
}
get-summary
获取 Agent 的聚合验证摘要。返回验证总数和平均响应分数。无需钱包。
bun run validation/validation.ts get-summary --agent-id <id>
选项:
--agent-id(必填)— 要查询的 Agent ID(非负整数)
输出:
{
"success": true,
"agentId": 42,
"count": 3,
"avgResponse": 88,
"network": "mainnet"
}
get-agent-validations
获取 Agent 验证请求哈希的分页列表。以十六进制字符串形式返回请求哈希。使用基于游标的分页,页面大小为 14。无需钱包。
bun run validation/validation.ts get-agent-validations --agent-id <id> [--cursor <cursor>]
选项:
--agent-id(必填)— 要查询的 Agent ID(非负整数)--cursor(可选)— 分页游标(非负整数,取自上一条响应)
输出:
{
"success": true,
"agentId": 42,
"validations": ["a3f2b1...64hex", "c5d8e4...64hex"],
"cursor": null,
"network": "mainnet"
}
get-validator-requests
获取提交给某验证者的验证请求哈希分页列表。以十六进制字符串形式返回请求哈希。使用基于游标的分页,页面大小为 14。无需钱包。
bun run validation/validation.ts get-validator-requests --validator <address> [--cursor <cursor>]
选项:
--validator(必填)— 要查询的验证者 Stacks 地址--cursor(可选)— 分页游标(非负整数,取自上一条响应)
输出:
{
"success": true,
"validator": "SP2...",
"requests": ["a3f2b1...64hex", "c5d8e4...64hex"],
"cursor": null,
"network": "mainnet"
}
说明
- 读取操作(get-status、get-summary、get-agent-validations、get-validator-requests)无需钱包
- 写入操作需要已解锁的钱包(
bun run wallet/wallet.ts unlock) --request-hash和--response-hash必须恰好为 32 字节(64 个十六进制字符);请使用 SHA-256--response的评分必须是 0 到 100 之间的整数(含边界值)- 只有原始验证请求中指定的验证者才能调用
respond - 可以对同一请求多次调用
respond,以逐步更新 - 分页使用基于游标的导航;将一次响应中的
cursor传入下一次调用 - 验证是 Stacks L2 操作——写入调用后,请使用
stx get-transaction-status检查交易状态