← Back to Skills Marketplace
squirt11e

Base 8004

by squirt11e · GitHub ↗ · v1.0.0
cross-platform ⚠ suspicious
1283
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install 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.
README (SKILL.md)

Base-8004 Registration

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.

1. What ERC-8004 is

ERC-8004 is an onchain identity and reputation protocol for AI agents.

  • Identity — each registered agent gets an ERC-721 NFT on Base mainnet. This is your permanent, verifiable onchain identity.
  • Reputation Registry — a separate contract tracks reputation scores. Feedback signals (upvotes, downvotes, quality assessments) accumulate into a totalScore and feedbackCount.
  • Verifiable metadata — your registration includes a JSON document (agentURI) with your name, description, and capabilities. Anyone can read it onchain.

Why it matters:

  • Permanent identity — your agent ID persists across platforms, not tied to any single service.
  • Public reputation — your track record is onchain and verifiable by anyone.

2. Set up your wallet

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.

Step 1: Install viem

npm install viem

Step 2: Generate a private key

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.

Step 3: Derive your address

import { privateKeyToAccount } from "viem/accounts";

const account = privateKeyToAccount(privateKey);
console.log("Address:", account.address);

Step 4: Store the private key securely

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

Step 5: Security rules

  • Never leak your private key in logs, commits, or API calls.
  • Never lose it — if you lose the key, you lose the wallet and your onchain identity forever.
  • Never overwrite it without backing up the old one.

Step 6: Configure a wallet client for Base mainnet

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() });

3. Fund your wallet

Your wallet needs ETH on Base to pay for gas.

  • Get ETH on Base — use Coinbase (withdraw directly to Base), bridge from any chain via Relay, or receive from another Base wallet.
  • Gas is cheap — Base L2 gas costs are very low. Registration costs ~$0.02. $1 of ETH is more than enough.
  • Verify balance before proceeding:
const balance = await publicClient.getBalance({ address: account.address });
console.log("Balance:", Number(balance) / 1e18, "ETH");

if (balance \x3C 500000000000000n) {
  console.error("Need at least 0.0005 ETH for registration gas");
  process.exit(1);
}

4. Register onchain

Register your agent on the ERC-8004 Identity Registry. This mints an NFT that represents your permanent onchain identity.

Step 1: Create your registration JSON

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).

Step 2: Encode as a data URI

const uri =
  "data:application/json;base64," + Buffer.from(JSON.stringify(registration)).toString("base64");

Step 3: Call register() on the Identity Registry

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);

Step 4: Parse the Transfer event to get your token ID

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);

Step 5: Save your agent ID

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}

5. Update your registration

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");

const hash = await walletClient.writeContract({
  address: IDENTITY_REGISTRY,
  abi: setAgentUriAbi,
  functionName: "setAgentURI",
  args: [BigInt(process.env.ERC8004_AGENT_ID!), newUri],
});

console.log("URI updated, TX:", hash);

Only the token owner can call setAgentURI.

6. Contract addresses and verification

Contract Address Chain
Identity Registry 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 Base mainnet
Reputation Registry 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63 Base mainnet

Verify on BaseScan:

Onchain query examples (read-only, no gas):

import { createPublicClient, http } from "viem";
import { base } from "viem/chains";

const client = createPublicClient({ chain: base, transport: http() });

// Check who owns a token
const owner = await client.readContract({
  address: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
  abi: [
    {
      inputs: [{ name: "agentId", type: "uint256" }],
      name: "ownerOf",
      outputs: [{ name: "", type: "address" }],
      stateMutability: "view",
      type: "function",
    },
  ],
  functionName: "ownerOf",
  args: [42n],
});

// Read an agent's metadata URI
const uri = await client.readContract({
  address: "0x8004A169FB4a3325136EB29fA0ceB6D2e539a432",
  abi: [
    {
      inputs: [{ name: "tokenId", type: "uint256" }],
      name: "tokenURI",
      outputs: [{ name: "", type: "string" }],
      stateMutability: "view",
      type: "function",
    },
  ],
  functionName: "tokenURI",
  args: [42n],
});

7. Resources

  • 8004.org — ERC-8004 protocol
  • Base — Base L2 chain
  • BaseScan — Base block explorer
  • viem — TypeScript Ethereum library

Summary

  1. Set up wallet — generate a private key, derive address, store securely.
  2. Fund wallet — get ETH on Base (Coinbase, bridge, or transfer). $1 is more than enough.
  3. Register onchain — call register(agentURI) on the Identity Registry with your services. Parse the Transfer event for your token ID.
  4. Update registration — call setAgentURI to change your metadata or add new services.
Usage Guidance
This skill appears to do what it says — register an agent onchain — but take these precautions before following instructions or running any commands: 1) Do NOT print your private key to console or logs. The SKILL.md suggests console.log(privateKey) — avoid that. Generate the key and move it securely (use a hardware wallet or a secure secrets manager if possible). 2) The metadata does not declare AGENT_PRIVATE_KEY even though the instructions use it; treat this as an undocumented required secret. 3) If you run `npm install viem`, consider pinning a known-good version and review the package source before installing. 4) Registration is effectively permanent and public: the NFT, agentURI, and endpoints you publish become public. Only register metadata and endpoints you are comfortable exposing. 5) Fund the wallet with a minimal amount first (as suggested) and verify the Identity Registry contract address independently (do not trust a single document). 6) Prefer using a derived or dedicated key for this agent (so compromise doesn't expose other assets). If you want help making a safer workflow (hardware wallet, secure secret storage, or signed transactions without exposing keys), ask and provide context on your environment.
Capability Analysis
Type: OpenClaw Skill Name: base-8004 Version: 1.0.0 The skill is classified as suspicious due to the instruction to `console.log("Private key:", privateKey)` in `SKILL.md`. While the overall intent is to guide the agent through legitimate ERC-8004 registration and includes advice on secure handling (saving to .env, adding to .gitignore, never leaking), the direct logging of a newly generated private key to the console presents a significant risk of exposure. An AI agent's execution environment or logging infrastructure could inadvertently capture and expose this sensitive credential, even if the subsequent instructions aim for secure storage. This constitutes a risky capability without clear malicious intent.
Capability Assessment
Purpose & Capability
The name and description (ERC-8004 registration on Base) align with the instructions: creating a wallet, funding it, and calling the Identity Registry. Recommended dependencies (viem) and the contract address are consistent with this purpose.
Instruction Scope
Instructions ask the user to generate and immediately console.log the private key and to store it in a .env file. Logging the private key is insecure and increases risk of leakage. The instructions also instruct publishing service endpoint URLs in the onchain registration (expected), which will make agent metadata public. The SKILL.md does not appear to overreach by requesting unrelated system files or other credentials, but the explicit console.log advice and unconditional echo to .gitignore are risky practices.
Install Mechanism
There is no install spec in the registry (instruction-only), which reduces automatic-execution risk. The README recommends running `npm install viem` — a normal package install — but no version pinning is provided, which is a mild supply-chain risk if you run the command blindly.
Credentials
The skill metadata declares no required environment variables, yet the runtime instructions instruct creating AGENT_PRIVATE_KEY in a .env and then reading process.env.AGENT_PRIVATE_KEY. This mismatch (undocumented required secret) is an inconsistency. Requesting a private key is proportional to the task, but it must be handled much more carefully than shown.
Persistence & Privilege
The skill is user-invocable, not always-enabled, and does not request any persistent agent-level privileges or config paths. It does not try to modify other skills or system-wide settings.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install base-8004
  3. After installation, invoke the skill by name or use /base-8004
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Base-8004 skill initial release: - Guides users through setting up an Ethereum-compatible wallet, funding it, and securely managing private keys on Base mainnet. - Explains ERC-8004 protocol for agent onchain identity and reputation, including how to register for a permanent, verifiable ERC-721 agent NFT. - Provides detailed code samples for wallet setup, funding checks, registration, and metadata (agentURI) management. - Includes instructions for updating registration data post-creation, and emphasizes best practices for key security and agent reputation management. - All steps reference the official ERC-8004 registry and compatible tooling.
Metadata
Slug base-8004
Version 1.0.0
License
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is 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. It is an AI Agent Skill for Claude Code / OpenClaw, with 1283 downloads so far.

How do I install Base 8004?

Run "/install base-8004" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Base 8004 free?

Yes, Base 8004 is completely free (open-source). You can download, install and use it at no cost.

Which platforms does Base 8004 support?

Base 8004 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Base 8004?

It is built and maintained by squirt11e (@squirt11e); the current version is v1.0.0.

💬 Comments