validation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseValidation Skill
Validation Skill
Provides ERC-8004 on-chain agent validation operations using the validation-registry contract. Read operations (get-status, get-summary, get-agent-validations, get-validator-requests) work without a wallet. Write operations (request, respond) require an unlocked wallet.
通过validation-registry合约提供ERC-8004链上Agent验证操作。读操作(get-status、get-summary、get-agent-validations、get-validator-requests)无需钱包即可使用。写操作(request、respond)需要解锁的钱包。
Usage
使用方法
bun run validation/validation.ts <subcommand> [options]bun run validation/validation.ts <subcommand> [options]Subcommands
子命令
request
发起验证请求
Request validation from a validator for an agent in the ERC-8004 validation registry. The request hash must be a 32-byte SHA-256 hash of the request data. Requires an unlocked wallet.
bun run validation/validation.ts request --validator <address> --agent-id <id> --request-uri <uri> --request-hash <hex> [--fee <fee>] [--sponsored]Options:
- (required) — Stacks address of the validator to request validation from
--validator - (required) — Agent ID to request validation for (non-negative integer)
--agent-id - (required) — URI pointing to the validation request data
--request-uri - (required) — 32-byte SHA-256 hash of the request data as a hex string
--request-hash - (optional) — Fee preset (
--fee,low,medium) or micro-STX amounthigh - (flag) — Submit as a sponsored transaction
--sponsored
Output:
json
{
"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..."
}向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]选项:
- (必填)—— 要请求验证的验证者的Stacks地址
--validator - (必填)—— 要请求验证的Agent ID(非负整数)
--agent-id - (必填)—— 指向验证请求数据的URI
--request-uri - (必填)—— 请求数据的32字节SHA-256哈希值,以十六进制字符串形式提供
--request-hash - (可选)—— 手续费预设(
--fee、low、medium)或micro-STX金额high - (标志)—— 作为赞助交易提交
--sponsored
输出:
json
{
"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
响应验证请求
Submit a validation response for a pending validation request. Only the validator specified in the original request can call this. Response must be an integer between 0 and 100. Can be called multiple times for progressive updates. Requires an unlocked wallet.
bun run validation/validation.ts respond --request-hash <hex> --response <value> --response-uri <uri> --response-hash <hex> [--tag <tag>] [--fee <fee>] [--sponsored]Options:
- (required) — 32-byte SHA-256 hash of the original request as a hex string
--request-hash - (required) — Validation response score (integer between 0 and 100)
--response - (required) — URI pointing to the validation response data
--response-uri - (required) — 32-byte SHA-256 hash of the response data as a hex string
--response-hash - (optional) — Classification tag for the validation response
--tag - (optional) — Fee preset (
--fee,low,medium) or micro-STX amounthigh - (flag) — Submit as a sponsored transaction
--sponsored
Output:
json
{
"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..."
}为待处理的验证请求提交验证响应。仅原始请求中指定的验证者可调用此命令。响应必须是0到100之间的整数。可多次调用以进行渐进式更新。需要解锁的钱包。
bun run validation/validation.ts respond --request-hash <hex> --response <value> --response-uri <uri> --response-hash <hex> [--tag <tag>] [--fee <fee>] [--sponsored]选项:
- (必填)—— 原始验证请求的32字节SHA-256哈希值,以十六进制字符串形式提供
--request-hash - (必填)—— 验证响应分数(0到100之间的整数)
--response - (必填)—— 指向验证响应数据的URI
--response-uri - (必填)—— 响应数据的32字节SHA-256哈希值,以十六进制字符串形式提供
--response-hash - (可选)—— 验证响应的分类标签
--tag - (可选)—— 手续费预设(
--fee、low、medium)或micro-STX金额high - (标志)—— 作为赞助交易提交
--sponsored
输出:
json
{
"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
查询验证状态
Get the status of a validation request by its 32-byte request hash. Returns validator, agent ID, response score, response hash, tag, last update block, and whether a response has been submitted. Does not require a wallet.
bun run validation/validation.ts get-status --request-hash <hex>Options:
- (required) — 32-byte SHA-256 hash of the validation request as a hex string
--request-hash
Output:
json
{
"success": true,
"requestHash": "a3f2b1...64hex",
"validator": "SP2...",
"agentId": 42,
"response": 85,
"responseHash": "b4e9c2...64hex",
"tag": "security",
"lastUpdate": 123456,
"hasResponse": true,
"network": "mainnet"
}通过32字节的请求哈希查询验证请求的状态。返回验证者、Agent ID、响应分数、响应哈希、标签、最后更新区块以及是否已提交响应。无需钱包。
bun run validation/validation.ts get-status --request-hash <hex>选项:
- (必填)—— 验证请求的32字节SHA-256哈希值,以十六进制字符串形式提供
--request-hash
输出:
json
{
"success": true,
"requestHash": "a3f2b1...64hex",
"validator": "SP2...",
"agentId": 42,
"response": 85,
"responseHash": "b4e9c2...64hex",
"tag": "security",
"lastUpdate": 123456,
"hasResponse": true,
"network": "mainnet"
}get-summary
查询验证汇总
Get the aggregated validation summary for an agent. Returns the total validation count and average response score. Does not require a wallet.
bun run validation/validation.ts get-summary --agent-id <id>Options:
- (required) — Agent ID to query (non-negative integer)
--agent-id
Output:
json
{
"success": true,
"agentId": 42,
"count": 3,
"avgResponse": 88,
"network": "mainnet"
}获取某个Agent的聚合验证汇总信息。返回总验证次数和平均响应分数。无需钱包。
bun run validation/validation.ts get-summary --agent-id <id>选项:
- (必填)—— 要查询的Agent ID(非负整数)
--agent-id
输出:
json
{
"success": true,
"agentId": 42,
"count": 3,
"avgResponse": 88,
"network": "mainnet"
}get-agent-validations
查询Agent的验证列表
Get a paginated list of validation request hashes for an agent. Returns request hashes as hex strings. Cursor-based pagination with page size 14. Does not require a wallet.
bun run validation/validation.ts get-agent-validations --agent-id <id> [--cursor <cursor>]Options:
- (required) — Agent ID to query (non-negative integer)
--agent-id - (optional) — Pagination cursor (non-negative integer, from previous response)
--cursor
Output:
json
{
"success": true,
"agentId": 42,
"validations": ["a3f2b1...64hex", "c5d8e4...64hex"],
"cursor": null,
"network": "mainnet"
}获取某个Agent的验证请求哈希分页列表。返回十六进制字符串格式的请求哈希。采用基于游标的分页,每页大小为14。无需钱包。
bun run validation/validation.ts get-agent-validations --agent-id <id> [--cursor <cursor>]选项:
- (必填)—— 要查询的Agent ID(非负整数)
--agent-id - (可选)—— 分页游标(非负整数,来自上一次响应)
--cursor
输出:
json
{
"success": true,
"agentId": 42,
"validations": ["a3f2b1...64hex", "c5d8e4...64hex"],
"cursor": null,
"network": "mainnet"
}get-validator-requests
查询验证者的请求列表
Get a paginated list of validation request hashes submitted to a validator. Returns request hashes as hex strings. Cursor-based pagination with page size 14. Does not require a wallet.
bun run validation/validation.ts get-validator-requests --validator <address> [--cursor <cursor>]Options:
- (required) — Stacks address of the validator to query
--validator - (optional) — Pagination cursor (non-negative integer, from previous response)
--cursor
Output:
json
{
"success": true,
"validator": "SP2...",
"requests": ["a3f2b1...64hex", "c5d8e4...64hex"],
"cursor": null,
"network": "mainnet"
}获取提交给某个验证者的验证请求哈希分页列表。返回十六进制字符串格式的请求哈希。采用基于游标的分页,每页大小为14。无需钱包。
bun run validation/validation.ts get-validator-requests --validator <address> [--cursor <cursor>]选项:
- (必填)—— 要查询的验证者的Stacks地址
--validator - (可选)—— 分页游标(非负整数,来自上一次响应)
--cursor
输出:
json
{
"success": true,
"validator": "SP2...",
"requests": ["a3f2b1...64hex", "c5d8e4...64hex"],
"cursor": null,
"network": "mainnet"
}Notes
注意事项
- Read operations (get-status, get-summary, get-agent-validations, get-validator-requests) work without a wallet
- Write operations require an unlocked wallet ()
bun run wallet/wallet.ts unlock - and
--request-hashmust be exactly 32 bytes (64 hex characters); use SHA-256--response-hash - score must be an integer between 0 and 100 (inclusive)
--response - can only be called by the validator specified in the original validation request
respond - can be called multiple times on the same request for progressive updates
respond - Pagination uses cursor-based navigation; pass the from one response into the next call
cursor - Validation is a Stacks L2 operation — check transaction status with after write calls
stx get-transaction-status
- 读操作(get-status、get-summary、get-agent-validations、get-validator-requests)无需钱包即可使用
- 写操作需要解锁的钱包(执行)
bun run wallet/wallet.ts unlock - 和
--request-hash必须恰好为32字节(64个十六进制字符);使用SHA-256生成--response-hash - 分数必须是0到100之间的整数(包含边界值)
--response - 只能由原始验证请求中指定的验证者调用
respond - 可以对同一请求多次调用以进行渐进式更新
respond - 分页使用基于游标导航;将上一次响应中的传入下一次调用
cursor - 验证是Stacks L2操作——写操作后使用检查交易状态
stx get-transaction-status