Register your AI agent onchain with ERC-8004 on Base. Set up a wallet, fund it, and register on the Identity Registry for permanent, verifiable identity and reputation.
数据来源:ClawHub。 在 ClawSkills 查看
选择你使用的 Agent
方法一:命令行安装(推荐)
推荐(无需提前安装 clawhub)
npx clawhub@latest --dir ~/.claude/skills install base-8004或使用 clawhub CLI(需提前安装)
clawhub --dir ~/.claude/skills install base-8004⚠️ 需要 Node.js 18+,没有 Node?请使用下方方法二直接下载 ZIP。 安装 Node.js →
方法二:手动下载安装(无需 Node)
下载 ZIP,解压后将文件夹放到以下路径,重启 Agent 即可:
安装路径
~/.claude/skills/base-8004/💡解压后将文件夹放到上方路径,重启 Agent 即可生效
--- name: base-8004 description: Register your AI agent onchain with ERC-8004 on Base. Set up a wallet, fund it, and register on the Identity Registry for permanent, verifiable identity and reputation. metadata: { "openclaw": { "homepage": "https://8004.org" } } ---
This skill walks you through setting up your own wallet, funding it, and registering onchain with ERC-8004 on Base mainnet. Once registered, your agent has a permanent, verifiable onchain identity and can accumulate reputation.
ERC-8004 is an onchain identity and reputation protocol for AI agents.
Why it matters:
You need an Ethereum-compatible wallet on Base mainnet. If you already have a wallet with ETH on Base, skip to section 4. These steps are only needed if you're setting up a fresh wallet.
npm install viem
import { generatePrivateKey } from "viem/accounts";
const privateKey = generatePrivateKey();
console.log("Private key:", privateKey);
Save this private key immediately. You will never be able to recover it.
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(privateKey);
console.log("Address:", account.address);
Add it to your .env file:
AGENT_PRIVATE_KEY=0x...your_private_key_here...
Add .env to .gitignore if it isn't already:
echo ".env" >> .gitignore
import { createWalletClient, createPublicClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { base } from "viem/chains";
const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY as `0x${string}`);
const publicClient = createPublicClient({ chain: base, transport: http() });
const walletClient = createWalletClient({ account, chain: base, transport: http() });
Your wallet needs ETH on Base to pay for gas.
const balance = await publicClient.getBalance({ address: account.address });
console.log("Balance:", Number(balance) / 1e18, "ETH");
if (balance < 500000000000000n) {
console.error("Need at least 0.0005 ETH for registration gas");
process.exit(1);
}
Register your agent on the ERC-8004 Identity Registry. This mints an NFT that represents your permanent onchain identity.
Include the services array to declare your agent's capabilities so other agents and services can discover what you do:
const registration = {
type: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
name: "Your Agent Name",
description: "What your agent does",
image: "https://example.com/your-agent-avatar.png",
active: true,
x402Support: false,
services: [
{ name: "A2A", endpoint: "https://your-agent.example.com/a2a", version: "0.3.0" },
{ name: "MCP", endpoint: "https://your-agent.example.com/mcp", version: "0.1.0" },
],
};
image — URL of your agent's avatar or logo, displayed in explorers and directories. Use a square image (256x256 or larger). If you don't have one yet, set it to "" and add one later via setAgentURI.services — declares your agent's capabilities onchain. Each entry has a name (the service identifier), an endpoint, and optionally a version. Common service types include A2A (Agent-to-Agent protocol) and MCP (Model Context Protocol).const uri =
"data:application/json;base64," + Buffer.from(JSON.stringify(registration)).toString("base64");
import { encodeFunctionData } from "viem";
const IDENTITY_REGISTRY = "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432";
const registerAbi = [
{
inputs: [{ name: "agentURI", type: "string" }],
name: "register",
outputs: [{ name: "agentId", type: "uint256" }],
stateMutability: "nonpayable",
type: "function",
},
] as const;
// Estimate gas first
const gas = await publicClient.estimateGas({
account: account.address,
to: IDENTITY_REGISTRY,
data: encodeFunctionData({
abi: registerAbi,
functionName: "register",
args: [uri],
}),
});
console.log("Estimated gas:", gas.toString());
// Send the transaction
const hash = await walletClient.writeContract({
address: IDENTITY_REGISTRY,
abi: registerAbi,
functionName: "register",
args: [uri],
});
console.log("TX hash:", hash);
const receipt = await publicClient.waitForTransactionReceipt({ hash });
// ERC-721 Transfer event topic
const transferTopic = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef";
const transferLog = receipt.logs.find(
(log) =>
log.topics[0] === transferTopic && log.address.toLowerCase() === IDENTITY_REGISTRY.toLowerCase()
);
const erc8004AgentId = transferLog?.topics[3]
? BigInt(transferLog.topics[3]).toString()
: undefined;
console.log("Your ERC-8004 Agent ID:", erc8004AgentId);
Save erc8004AgentId — this is your permanent onchain identity. Add it to your .env:
ERC8004_AGENT_ID=42
You can verify your registration on BaseScan: https://basescan.org/nft/0x8004A169FB4a3325136EB29fA0ceB6D2e539a432/{your_agent_id}
After your initial registration, you can update your agentURI (name, description, services) by calling setAgentURI on the Identity Registry. This lets you add new capabilities or change your metadata without re-registering.
const setAgentUriAbi = [
{
inputs: [
{ name: "agentId", type: "uint256" },
{ name: "agentURI", type: "string" },
],
name: "setAgentURI",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
] as const;
// Build updated registration JSON
const updatedRegistration = {
type: "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
name: "Your Agent Name",
description: "Updated description",
image: "https://example.com/your-agent-avatar.png",
active: true,
x402Support: false,
services: [
{ name: "A2A", endpoint: "https://your-agent.example.com/a2a", version: "0.3.0" },
{ name: "MCP", endpoint: "https://your-agent.example.com/mcp", version: "0.1.0" },
],
};
const newUri =
"data:application/json;base64," +
Buffer.from(JSON.stringify(updatedRegistration)).toString("base64");
...安装 Base 8004 后,可以对 AI 说这些话来触发它
Help me get started with Base 8004
Explains what Base 8004 does, walks through the setup, and runs a quick demo based on your current project
Use Base 8004 to register your AI agent onchain with ERC-8004 on Base
Invokes Base 8004 with the right parameters and returns the result directly in the conversation
What can I do with Base 8004 in my finance & investment workflow?
Lists the top use cases for Base 8004, with example commands for each scenario
将技能文件夹放到 ~/.claude/skills/base-8004/ 目录(个人级,所有项目可用),或 .claude/skills/base-8004/(项目级)。重启 AI 客户端后,用 /base-8004 主动调用,或让 AI 根据上下文自动发现并使用。
Base 8004 支持 Claude、Cursor、OpenClaw,可与这些 AI 平台无缝集成,扩展其能力。
Base 8004 可免费安装使用。请查阅仓库了解许可证信息。
Register your AI agent onchain with ERC-8004 on Base. Set up a wallet, fund it, and register on the Identity Registry for permanent, verifiable identity and reputation.
Base 8004 属于「Finance & Investment」分类,该分类的技能帮助 AI 智能体在此领域执行专业任务。
Automate my finance & investment tasks using Base 8004
Identifies repetitive steps in your workflow and sets up Base 8004 to handle them automatically