微算力 · API 导航与自营网关
API 接入 EN
未登录登录
🆔

链上身份铸造 · CEO 协议准入

8004 Harness For Monad · v1.0.0
专业技能 安全 B 级 作者 fabriziogianni7 公开目录收录
1.2k 下载 0 安装 4k 收藏 6 浏览

简介

基于 EIP-8004 标准的链上身份 NFT 注册工具,为 CEO Protocol 等代理协议提供可信身份凭证,支持 Monad 主网一键部署。

原始描述

Register and manage ERC-8004 Identity NFTs on Monad. Use when the agent needs to mint an on-chain identity for CEO Protocol registration or other ERC-8004–integrated protocols.

通过你的 Agent 添加

点「快速安装」复制一段指令,粘给你正在用的 Agent(Claude Code、Codex、OpenClaw 等),它会自己完成安装。

或者手动安装

Claude Codeunzip -o skill.zip -d ~/.claude/skills/8004-harness-for-monad/
其它 Agent解压到它自己的 skills 目录,目录名用 8004-harness-for-monad

包里是 SKILL.md 加作者附带的文件,解压后目录名就是技能名。 技能申请的权限由作者决定,装之前请确认它能读什么、能执行什么。

中文使用说明 来自收录源

核心用法

ERC-8004 Identity Skill 是一套专为 Monad 区块链设计的链上身份注册与管理工具,基于 EIP-8004「Trustless Agents」标准实现。该技能允许 AI 代理铸造 ERC-721 格式的身份 NFT,作为进入 CEO Protocol 等去中心化代理经济系统的准入凭证。

主要功能流程

  1. 身份注册:调用 register(agentURI) 函数铸造身份 NFT,返回唯一的 agentId(即 token ID)
  2. 元数据管理:支持通过 IPFS 或数据 URI 托管符合 EIP-8004 规范的 JSON 注册信息,包含代理名称、服务终端(A2A/MCP)、信任模型等字段
  3. 链上验证:提供 ownerOf、tokenURI、getAgentWallet 等只读函数验证身份所有权与状态
  4. CEO Protocol 集成:获取的 erc8004Id 是注册 CEOVault 代理的必要参数

显著优点

  • 标准化兼容:严格遵循 EIP-8004 草案,确保与 The CEO Protocol 等生态协议的无缝对接
  • 自动化脚本:内置完整的 Node.js 脚本套件(full-register.mjs 等),实现从注册、构建卡片、上传 IPFS 到设置 URI 的一站式流程
  • 灵活元数据:支持多种注册模式——可携带完整服务配置,也可极简注册仅用于 CEO Protocol
  • 身份持久化:提供标准化身份文件模板(AGENT_IDENTITY.md),便于跨会话状态管理

潜在局限与风险

  • EIP 草案阶段:EIP-8004 尚处于草案阶段,标准可能变更,合约地址与接口存在迁移风险
  • Gas 成本依赖:Monad 主网虽宣称高性能,但实际 Gas 波动与网络稳定性待长期验证
  • IPFS 可用性:元数据托管依赖外部 IPFS 服务(Pinata),网关故障或内容不可达会导致身份解析失败
  • 私钥管理:自动化脚本需暴露 AGENT_PRIVATE_KEY,存在凭证泄露风险,建议在隔离环境中执行

适合人群

  • 需要为 AI 代理获取链上身份的开发者与自动化策略运营者
  • 计划参与 The CEO Protocol 生态的代理注册方
  • 构建去中心化代理网络的协议集成者

常规风险提示

  • 操作前务必确认 viem-local-signer address 与目标钱包一致
  • 注册后需验证链上 ownerOf(agentId) 返回地址匹配预期
  • 建议保留交易哈希以便在 Monadscan 追溯

技能正文


name: 8004-skill description: Register and manage ERC-8004 Identity NFTs on Monad. Use when the agent needs to mint an on-chain identity for CEO Protocol registration or other ERC-8004–integrated protocols.

ERC-8004 Identity Skill

Use this skill when the agent must register on the ERC-8004 Identity Registry to obtain an on-chain identity NFT. This identity is required to register as an agent in The CEO Protocol (CEOVault).

Reference: EIP-8004 Trustless Agents

Contract Address (Monad Mainnet)

Contract Address
ERC-8004 Identity 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432

Interface Summary

The Identity Registry is ERC-721 based. Registering mints an NFT to msg.sender; the token ID is the agent ID.

Write Functions

Function Purpose
register(string agentURI) Register with a URI; mints NFT, returns agentId
register(string agentURI, MetadataEntry[] metadata) Register with URI and on-chain metadata
register() Register with no URI (set later via setAgentURI)
setAgentURI(uint256 agentId, string newURI) Update the agent's URI
setMetadata(uint256 agentId, string metadataKey, bytes metadataValue) Set on-chain metadata

Read Functions (view)

Function Returns Use
ownerOf(uint256 tokenId) address Check who owns an agent NFT
tokenURI(uint256 tokenId) string Get agent URI (same as agentURI)
getAgentWallet(uint256 agentId) address Get wallet linked to agent
getMetadata(uint256 agentId, string metadataKey) bytes Get on-chain metadata

Events

Event Use
Registered(uint256 indexed agentId, string agentURI, address indexed owner) Emitted on mint
URIUpdated(uint256 indexed agentId, string newURI, address indexed updatedBy) Emitted on URI change
MetadataSet(uint256 indexed agentId, string indexed metadataKey, string metadataKey, bytes metadataValue) Emitted on metadata set

Registration Data Template

The agentURI must resolve to a JSON document conforming to EIP-8004 registration. Use this template and replace placeholders before hosting (IPFS or data URI):

{
  "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
  "name": "AGENT_NAME",
  "description": "AGENT_DESCRIPTION",
  "image": "https://example.com/agent-image.png",
  "services": [
    {
      "name": "A2A",
      "endpoint": "https://YOUR_DOMAIN/.well-known/agent-card.json",
      "version": "0.3.0"
    },
    {
      "name": "MCP",
      "endpoint": "https://YOUR_DOMAIN/mcp",
      "version": "2025-06-18"
    }
  ],
  "x402Support": false,
  "active": true,
  "registrations": [],
  "supportedTrust": [
    "reputation"
  ]
}
Field Replace with
AGENT_NAME Agent display name
AGENT_DESCRIPTION Short description of capabilities
image URL to agent avatar/image
YOUR_DOMAIN Your domain for A2A/MCP endpoints (or omit services if not applicable)
supportedTrust Trust models (e.g. ["reputation"] for CEO Protocol)

For a minimal CEO Protocol–only registration, you can omit services or set them to empty; supportedTrust: ["reputation"] is typical.

Automated Scripts (preferred)

The Docker image includes production-ready scripts at:

/opt/erc8004-scripts

Source in workspace:

/root/.openclaw/workspace/skills/8004-skill/scripts

Required env vars for script flow

  • MONAD_RPC_URL
  • MONAD_CHAIN_ID=143 (or pass --chainId)
  • AGENT_PRIVATE_KEY
  • PINATA_JWT
  • PINATA_GATEWAY (recommended for verification fetch)

Script commands

# 1) Register on-chain with empty URI -> returns agentId
node /opt/erc8004-scripts/register.mjs --network monad-mainnet

# 2) Build card JSON with registrations[] embedded
node /opt/erc8004-scripts/build-card.mjs \
  --network monad-mainnet \
  --agentId 42 \
  --template /root/.openclaw/workspace/skills/8004-skill/assets/registration-template.json \
  --name "CEO-1" \
  --description "Autonomous strategist for The CEO Protocol" \
  --out /tmp/agent-42.json

# 3) Upload to Pinata -> returns ipfs://CID
node /opt/erc8004-scripts/upload-pinata.mjs --file /tmp/agent-42.json

# 4) Set token URI on-chain
node /opt/erc8004-scripts/set-agent-uri.mjs \
  --network monad-mainnet \
  --agentId 42 \
  --uri ipfs://CID

# 5) Verify owner, tokenURI, wallet, and registrations[] match
node /opt/erc8004-scripts/verify.mjs --network monad-mainnet --agentId 42

One-shot command

node /opt/erc8004-scripts/full-register.mjs \
  --network monad-mainnet \
  --name "CEO-1" \
  --description "Autonomous strategist for The CEO Protocol" \
  --template /root/.openclaw/workspace/skills/8004-skill/assets/registration-template.json \
  --outCard /tmp/agent-card.json \
  --identityFile /root/.openclaw/workspace/AGENT_IDENTITY.md

This executes all 4 registration steps (register -> build card -> upload -> set URI) and writes identity state for later CEO Protocol onboarding.

Registration Flow

  1. Prerequisites

    • Wallet with MON for gas (use viem-local-signer address to confirm signer).
    • agentURI: a URI pointing to your registration JSON (use the template above). Use IPFS (ipfs://...) or a data URI (data:application/json;base64,...).
  2. Call register(agentURI)

    • Encode calldata with encodeFunctionData.
    • Send via viem-local-signer send-contract.
    • Parse Registered event or return value for agentId.
  3. Store agentId

    • The returned agentId (token ID) is required for CEO Protocol registerAgent(metadataURI, ceoAmount, erc8004Id).
    • Persist it in an identity file (see below).

Identity File Template

After registration, persist the on-chain identity so the agent can reference it for CEO Protocol and other flows. Use this template:

# Agent Identity
- **Address**: `<NOT SET>`
- **Agent ID**: `<NOT SET>`
- **Agent Registry**: `<NOT SET>`
- **Chain ID**: `<NOT SET>`

How to fill it

Field Source Example
Address viem-local-signer address (signer wallet) 0xB4AF3708DA37a485E84b4F09c146eD0A8B7Df5c4
Agent ID Return value from register(agentURI) 42
Agent Registry ERC-8004 Identity contract (Monad: eip155:143:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432) eip155:143:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
Chain ID Monad mainnet 143

How to use it

  1. After registration: Write the identity file to workspace/IDENTITY.md or workspace/AGENT_IDENTITY.md so it is in the agent's context.
  2. Before CEO Protocol registerAgent: Read Agent ID from the file — that is erc8004Id.
  3. Consistency check: Ensure Address matches viem-local-signer address and ownerOf(agentId) on the registry.

Example filled identity:

# Agent Identity
- **Address**: `0xB4AF3708DA37a485E84b4F09c146eD0A8B7Df5c4`
- **Agent ID**: `42`
- **Agent Registry**: `eip155:143:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432`
- **Chain ID**: `143`

ABI (minimal)

[
  {
    "type": "function",
    "name": "register",
    "stateMutability": "nonpayable",
    "inputs": [{ "name": "agentURI", "type": "string" }],
    "outputs": [{ "name": "agentId", "type": "uint256" }]
  },
  {
    "type": "function",
    "name": "register",
    "stateMutability": "nonpayable",
    "inputs": [
      { "name": "agentURI", "type": "string" },
      {
        "name": "metadata",
        "type": "tuple[]",
        "components": [
          { "name": "metadataKey", "type": "string" },
          { "name": "metadataValue", "type": "bytes" }
        ]
      }
    ],
    "outputs": [{ "name": "agentId", "type": "uint256" }]
  },
  {
    "type": "function",
    "name": "register",
    "stateMutability": "nonpayable",
    "inputs": [],
    "outputs": [{ "name": "agentId", "type": "uint256" }]
  },
  {
    "type": "function",
    "name": "setAgentURI",
    "stateMutability": "nonpayable",
    "inputs": [
      { "name": "agentId", "type": "uint256" },
      { "name": "newURI", "type": "string" }
    ],
    "outputs": []
  },
  {
    "type": "function",
    "name": "setMetadata",
    "stateMutability": "nonpayable",
    "inputs": [
      { "name": "agentId", "type": "uint256" },
      { "name": "metadataKey", "type": "string" },
      { "name": "metadataValue", "type": "bytes" }
    ],
    "outputs": []
  },
  {
    "type": "function",
    "name": "ownerOf",
    "stateMutability": "view",
    "inputs": [{ "name": "tokenId", "type": "uint256" }],
    "outputs": [{ "name": "", "type": "address" }]
  },
  {
    "type": "function",
    "name": "tokenURI",
    "stateMutability": "view",
    "inputs": [{ "name": "tokenId", "type": "uint256" }],
    "outputs": [{ "name": "", "type": "string" }]
  },
  {
    "type": "function",
    "name": "getAgentWallet",
    "stateMutability": "view",
    "inputs": [{ "name": "agentId", "type": "uint256" }],
    "outputs": [{ "name": "", "type": "address" }]
  },
  {
    "type": "function",
    "name": "getMetadata",
    "stateMutability": "view",
    "inputs": [
      { "name": "agentId", "type": "uint256" },
      { "name": "metadataKey", "type": "string" }
    ],
    "outputs": [{ "name": "", "type": "bytes" }]
  }
]

Encoding and Sending

Use viem to encode, then viem-local-signer send-contract to broadcast. Example (Node/script):

import { encodeFunctionData } from "viem";

const ERC8004_IDENTITY = "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";

const abi = [
  {
    type: "function",
    name: "register",
    stateMutability: "nonpayable",
    inputs: [{ name: "agentURI", type: "string" }],
    outputs: [{ name: "agentId", type: "uint256" }],
  },
] as const;

const agentURI = "ipfs://Qm..."; // or data:application/json;base64,...
const data = encodeFunctionData({
  abi,
  functionName: "register",
  args: [agentURI],
});

// Then run:
// viem-local-signer send-contract --to 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 --data <hex> --value-wei 0 --wait

Agent Runbook

  1. Confirm signer: viem-local-signer address
  2. Ensure wallet has MON for gas.
  3. Prepare agentURI (IPFS or data URI with registration JSON).
  4. Encode register(agentURI) with viem.
  5. Present tx summary and ask for user confirmation.
  6. Run viem-local-signer send-contract --to 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 --data <calldata> --value-wei 0 --wait
  7. Parse receipt/logs for agentId (or read from Registered event).
  8. Write identity file (workspace/AGENT_IDENTITY.md or workspace/IDENTITY.md) using the template above with Address, Agent ID, Agent Registry, Chain ID.

CEO Protocol Integration

CEOVault requires an ERC-8004 identity before registerAgent:

CEOVault.registerAgent(metadataURI, ceoAmount, erc8004Id)
  • erc8004Id = the token ID from ERC8004Identity.register(...).
  • Caller must own that NFT (ownerOf(erc8004Id) == msg.sender).

Block Explorer

  • Monad: https://monadscan.com/
  • Tx link: https://monadscan.com/tx/<hash>
  • Contract: https://monadscan.com/address/0x8004A169FB4a3325136EB29fA0ceB6D2e539a432

正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。

标签

erc-8004eip-8004identity-nftmonadceo-protocolon-chain-identityagent-registryerc-721trustless-agents

同类 Skill