Zeru ERC-8004 Identity Registry
Register and manage AI agents on the Zeru Identity Registry. Defaults to Base Mainnet (0.0025 ETH fee). Use --chain 84532 for Base Sepolia testnet.
One-Time Setup
Run once to install dependencies:
CODEBLOCK0
Agent JSON Structure (ERC-8004 registration-v1)
When registering an agent, you provide a JSON file describing the agent. The SDK auto-fills type, registrations, and defaults for x402Support/active/image if omitted.
Minimal JSON (just name + description + one service):
CODEBLOCK1
Full JSON (MCP + A2A + OASF + x402 payments):
CODEBLOCK2
All fields:
| Field | Type | Required | Default | Description |
|---|
| INLINECODE6 | string | Yes | — | Agent name (1–256 chars) |
| INLINECODE7 |
string | Yes | — | What the agent does (max 2048 chars) |
|
image | string | No | placeholder | Avatar URL (HTTPS, IPFS, or Arweave) |
|
services | array | Yes | — | Service endpoints (1–64 items, see below) |
|
x402Support | boolean | No |
false | Supports x402 payment protocol |
|
active | boolean | No |
true | Agent is actively accepting requests |
|
supportedTrust | string[] | No | — | Trust models:
"reputation",
"crypto-economic",
"tee-attestation",
"ERC-8004" |
|
owner | string | No | signer address | Owner 0x address (auto-set from PRIVATE_KEY) |
Service types:
| INLINECODE20 | INLINECODE21 | Extra fields |
|---|
| INLINECODE22 | Website URL | — |
| INLINECODE23 |
MCP server URL |
version,
mcpTools[],
mcpPrompts[],
mcpResources[],
capabilities[] |
|
"A2A" | Agent card URL (
/.well-known/agent-card.json) |
version,
a2aSkills[] |
|
"OASF" | OASF repo URL |
version,
skills[],
domains[] |
|
"agentWallet" | CAIP-10 address (
eip155:{chainId}:{address}) | — |
|
"ENS" | ENS name (e.g.
myagent.eth) | — |
|
"email" | Email address | — |
| custom | Any URL |
description |
Commands
/zscore register --json <file>
Register a new agent using a full JSON file (recommended). Creates hosted agent URI, mints NFT on-chain, and updates URI with the real agentId.
CODEBLOCK3
Steps to register:
- 1. Create a JSON file following the structure above (e.g.
agent.json) - Run: INLINECODE45
The SDK automatically adds type, registrations (with agentId: 0 placeholder), and defaults for missing optional fields. After minting, it updates the document with the real agentId.
/zscore register --name <name> --description <desc> --endpoint <url>
Simple registration (single API endpoint only). For richer agents, use --json instead.
CODEBLOCK4
Requires PRIVATE_KEY env var. Wallet must have fee + gas (e.g. ~0.003 ETH on mainnet).
To run: INLINECODE53
/zscore read <agentId>
Read an agent's on-chain data: owner, URI, wallet, name, services.
CODEBLOCK5
To run: INLINECODE55
/zscore fee
Check current registration fee and whether registration is open.
CODEBLOCK6
To run: INLINECODE57
/zscore set-metadata <agentId> --key <key> --value <value>
Set custom metadata on an agent. Only the owner can call.
CODEBLOCK7
Requires PRIVATE_KEY.
To run: INLINECODE60
/zscore unset-wallet <agentId>
Clear the agent wallet. Only the owner can call.
CODEBLOCK8
Requires PRIVATE_KEY.
To run: INLINECODE63
Setup
Read-Only (no setup needed)
INLINECODE64 and fee work without a private key.
With Wallet (for registration and writes)
Add to your OpenClaw config (~/.openclaw/openclaw.json):
CODEBLOCK9
Optional env:
- -
RPC_URL — override default RPC - INLINECODE68 — override chain (default:
8453 for Base Mainnet, use 84532 for Base Sepolia)
Contract Info
Base Mainnet (default, chainId 8453)
- - Identity Registry: INLINECODE71
- Reputation Registry: INLINECODE72
- Registration Fee: 0.0025 ETH
- RPC: https://mainnet.base.org
Base Sepolia (testnet, chainId 84532)
- - Identity Registry: INLINECODE73
- Reputation Registry: INLINECODE74
- Registration Fee: 0.001 ETH
- RPC: https://sepolia.base.org
How It Works
- 1. register creates a hosted JSON document (ERC-8004 registration-v1 schema) via the Agent URI API, mints an NFT on the Identity Registry (paying the fee), then updates the document with the real agentId.
- read queries the on-chain contract for owner, tokenURI, and agentWallet, then fetches and parses the URI JSON.
- fee reads the current
registrationFee() and registrationEnabled() from the contract. - set-metadata calls
setMetadata(agentId, key, value) on the contract. - unset-wallet calls
unsetAgentWallet(agentId) on the contract.
Zeru ERC-8004 身份注册表
在 Zeru 身份注册表上注册和管理 AI 代理。默认使用 Base 主网(0.0025 ETH 费用)。使用 --chain 84532 切换到 Base Sepolia 测试网。
一次性设置
运行一次以安装依赖:
bash
cd {baseDir} && npm install
代理 JSON 结构(ERC-8004 注册-v1)
注册代理时,您需要提供一个描述代理的 JSON 文件。如果省略,SDK 会自动填充 type、registrations,以及 x402Support/active/image 的默认值。
最小 JSON(仅名称 + 描述 + 一个服务):
json
{
name: 我的 AI 代理,
description: 一个执行 X 任务的有用 AI 代理,
services: [
{ name: web, endpoint: https://myagent.example.com }
]
}
完整 JSON(MCP + A2A + OASF + x402 支付):
json
{
name: 数据分析师 Pro,
description: 企业级区块链数据分析代理。执行链上取证、钱包分析和交易模式检测。,
image: https://cdn.example.com/agents/analyst.png,
services: [
{
name: MCP,
endpoint: https://api.dataanalyst.ai/mcp,
version: 2025-06-18,
mcpTools: [analyzewallet, tracetransactions, detect_anomalies],
capabilities: []
},
{
name: A2A,
endpoint: https://api.dataanalyst.ai/.well-known/agent-card.json,
version: 0.3.0,
a2aSkills: [analyticalskills/dataanalysis/blockchain_analysis]
},
{
name: OASF,
endpoint: https://github.com/agntcy/oasf/,
version: 0.8.0,
skills: [analyticalskills/dataanalysis/blockchain_analysis],
domains: [technology/blockchain]
},
{
name: web,
endpoint: https://dataanalyst.ai
},
{
name: agentWallet,
endpoint: eip155:8453:0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb7
}
],
x402Support: true,
active: true,
supportedTrust: [reputation, ERC-8004]
}
所有字段:
| 字段 | 类型 | 必填 | 默认值 | 描述 |
|---|
| name | 字符串 | 是 | — | 代理名称(1-256 字符) |
| description |
字符串 | 是 | — | 代理功能描述(最多 2048 字符) |
| image | 字符串 | 否 | 占位图 | 头像 URL(HTTPS、IPFS 或 Arweave) |
| services | 数组 | 是 | — | 服务端点(1-64 项,见下文) |
| x402Support | 布尔值 | 否 | false | 支持 x402 支付协议 |
| active | 布尔值 | 否 | true | 代理正在积极接受请求 |
| supportedTrust | 字符串数组 | 否 | — | 信任模型:reputation、crypto-economic、tee-attestation、ERC-8004 |
| owner | 字符串 | 否 | 签名者地址 | 所有者 0x 地址(从 PRIVATE_KEY 自动设置) |
服务类型:
| name | endpoint | 额外字段 |
|---|
| web | 网站 URL | — |
| MCP |
MCP 服务器 URL | version、mcpTools[]、mcpPrompts[]、mcpResources[]、capabilities[] |
| A2A | 代理卡片 URL(/.well-known/agent-card.json) | version、a2aSkills[] |
| OASF | OASF 仓库 URL | version、skills[]、domains[] |
| agentWallet | CAIP-10 地址(eip155:{chainId}:{address}) | — |
| ENS | ENS 名称(例如 myagent.eth) | — |
| email | 电子邮件地址 | — |
| 自定义 | 任意 URL | description |
命令
/zscore register --json <文件>
使用完整 JSON 文件注册新代理(推荐)。创建托管代理 URI,在链上铸造 NFT,并使用真实 agentId 更新 URI。
/zscore register --json agent.json
/zscore register --json agent.json --chain 84532
注册步骤:
- 1. 按照上述结构创建 JSON 文件(例如 agent.json)
- 运行:npx tsx {baseDir}/scripts/zeru.ts register --json agent.json
SDK 会自动添加 type、registrations(使用 agentId: 0 占位符)以及缺失可选字段的默认值。铸造后,它会使用真实 agentId 更新文档。
/zscore register --name <名称> --description <描述> --endpoint
简单注册(仅单个 API 端点)。对于更丰富的代理,请使用 --json。
/zscore register --name 交易机器人 --description AI 驱动的交易代理 --endpoint https://mybot.com/api
/zscore register --name 数据分析器 --description 分析数据集 --endpoint https://analyzer.ai/api --image https://example.com/icon.png
/zscore register --name 测试机器人 --description 测试 --endpoint https://test.com --chain 84532
需要 PRIVATE_KEY 环境变量。钱包必须有足够的费用和 Gas(主网上约 0.003 ETH)。
运行方式:npx tsx {baseDir}/scripts/zeru.ts register --name ... --description ... --endpoint ...
/zscore read
读取代理的链上数据:所有者、URI、钱包、名称、服务。
/zscore read 16
运行方式:npx tsx {baseDir}/scripts/zeru.ts read 16
/zscore fee
检查当前注册费用以及注册是否开放。
/zscore fee
运行方式:npx tsx {baseDir}/scripts/zeru.ts fee
/zscore set-metadata --key <键> --value <值>
在代理上设置自定义元数据。仅所有者可调用。
/zscore set-metadata 16 --key category --value trading
需要 PRIVATE_KEY。
运行方式:npx tsx {baseDir}/scripts/zeru.ts set-metadata 16 --key category --value trading
/zscore unset-wallet
清除代理钱包。仅所有者可调用。
/zscore unset-wallet 16
需要 PRIVATE_KEY。
运行方式:npx tsx {baseDir}/scripts/zeru.ts unset-wallet 16
设置
只读模式(无需设置)
read 和 fee 无需私钥即可工作。
带钱包模式(用于注册和写入操作)
添加到您的 OpenClaw 配置(~/.openclaw/openclaw.json):
json
{
skills: {
entries: {
zscore: {
enabled: true,
env: {
PRIVATE_KEY: 0x您的已充值私钥
}
}
}
}
}
可选环境变量:
- - RPCURL — 覆盖默认 RPC
- CHAINID — 覆盖链(默认:8453 用于 Base 主网,使用 84532 用于 Base Sepolia)
合约信息
Base 主网(默认,chainId 8453)
- - 身份注册表: 0xFfE9395fa761e52DBC077a2e7Fd84f77e8abCc41
- 声誉注册表: 0x187d72a58b3BF4De6432958fc36CE569Fb