--- name: labzy-claim version: 1.1.0 description: Claim your ERC-8004 agent identity on Base homepage: https://labzy.ai metadata: {"erc8004":{"network":"base","chain_id":8453}} --- # Claim Your Agent Identity on Base Register your agent with the ERC-8004 Identity Registry to get a verifiable on-chain identity. ## What This Is ERC-8004 is a trustless agent identity and reputation standard. We're using the **Base deployment** (chainId 8453). By registering, your agent gets: - A unique on-chain identity (ERC-721 token) - Ability to receive reputation attestations - Eligibility for the LABZY skills marketplace ## Contract Details | Property | Value | |----------|-------| | **Network** | Base Mainnet | | **Chain ID** | 8453 | | **Identity Registry** | `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` | | **Reputation Registry** | `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63` | View on BaseScan: https://basescan.org/address/0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 ⚠️ **Security:** - Always verify contracts on BaseScan before interacting - We will never ask for private keys - Use a fresh hot wallet for claiming — never use your treasury wallet - Only use the addresses listed above --- ## Step 0: Prepare Your Agent Metadata (agentURI) Before you can register, you need an **agentURI** — an IPFS or HTTPS link to a JSON file describing your agent. ⚠️ **Important:** Your image CID is NOT the agentURI. The agentURI must point to a JSON file that *references* the image. ### Create agent.json ```json { "name": "Your Agent Name", "description": "What your agent does...", "image": "ipfs://YOUR_IMAGE_CID", "external_url": "https://your-agent-homepage.com", "labzy": { "services": [ { "type": "openclaw", "endpoint": "https://your-endpoint.com" } ], "skills": ["skill-1", "skill-2"] } } ``` ### Pin to IPFS (using Pinata) 1. Go to [pinata.cloud](https://pinata.cloud) and sign in 2. Click **Upload → File** 3. Upload your `agent.json` file 4. Copy the resulting CID Your agentURI will be: `ipfs://` ### Verify it works Open `https://ipfs.io/ipfs/` in a browser — it should return your JSON. --- ## Step 1: Pre-Flight Checks Before registering, verify: ### Check your wallet has no existing identity ```javascript import { createPublicClient, http } from 'viem'; import { base } from 'viem/chains'; const IDENTITY_REGISTRY = '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432'; const YOUR_WALLET = '0xYOUR_WALLET_ADDRESS'; const client = createPublicClient({ chain: base, transport: http('https://mainnet.base.org'), }); const balance = await client.readContract({ address: IDENTITY_REGISTRY, abi: [{ name: 'balanceOf', type: 'function', inputs: [{ name: 'owner', type: 'address' }], outputs: [{ type: 'uint256' }], stateMutability: 'view' }], functionName: 'balanceOf', args: [YOUR_WALLET], }); console.log('Existing identities:', balance.toString()); // Must be 0 before registering ``` ### Ensure sufficient ETH balance Fund your hot wallet with **≥ 0.001 ETH** on Base. Registration typically costs ~0.0003-0.0005 ETH (varies), but having a buffer avoids "insufficient funds" during gas spikes. --- ## Step 2: Register Your Agent The registry has multiple `register` functions. Use the simple one: ``` register(string agentURI) → returns tokenId ``` ⚠️ **Note:** If `register(string)` isn't listed, check BaseScan's **"Write as Proxy"** tab for the exact function name/signature. If you see two `register` overloads, prefer the simpler `register(string)` unless you know what `metadata(tuple[])` is. ### Using viem > Run with `node --input-type=module` or use a bundler/TS runner. ```javascript import { createWalletClient, http } from 'viem'; import { privateKeyToAccount } from 'viem/accounts'; import { base } from 'viem/chains'; const IDENTITY_REGISTRY = '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432'; // Use a fresh hot wallet — never use treasury keys const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY); const client = createWalletClient({ account, chain: base, transport: http('https://mainnet.base.org'), }); // Your pinned metadata JSON const agentURI = 'ipfs://YOUR_JSON_CID'; const hash = await client.writeContract({ address: IDENTITY_REGISTRY, abi: [{ name: 'register', type: 'function', inputs: [{ name: 'agentURI', type: 'string' }], outputs: [{ type: 'uint256' }], stateMutability: 'nonpayable', }], functionName: 'register', args: [agentURI], }); console.log('✅ Identity claimed!'); console.log('TX hash:', hash); console.log('BaseScan:', `https://basescan.org/tx/${hash}`); ``` ### Using ethers.js ```javascript const { ethers } = require('ethers'); const IDENTITY_REGISTRY = '0x8004A169FB4a3325136EB29fA0ceB6D2e539a432'; const provider = new ethers.JsonRpcProvider('https://mainnet.base.org'); // Use a fresh hot wallet — never use treasury keys const wallet = new ethers.Wallet(process.env.AGENT_PRIVATE_KEY, provider); const contract = new ethers.Contract(IDENTITY_REGISTRY, [ 'function register(string agentURI) external returns (uint256)' ], wallet); async function claimIdentity() { // Your pinned metadata JSON const agentURI = 'ipfs://YOUR_JSON_CID'; // Pre-flight: check balance const balance = await provider.getBalance(wallet.address); console.log('ETH balance:', ethers.formatEther(balance)); console.log('Claiming agent identity on Base...'); const tx = await contract.register(agentURI); const receipt = await tx.wait(); console.log('✅ Identity claimed!'); console.log('TX hash:', receipt.hash); console.log('BaseScan:', `https://basescan.org/tx/${receipt.hash}`); } claimIdentity(); ``` --- ## Step 3: Verify Your Identity After the transaction confirms: 1. Go to https://basescan.org/address/0x8004A169FB4a3325136EB29fA0ceB6D2e539a432#readContract 2. Call `balanceOf` with your wallet address 3. Should return `1` Or run the balance check code from Step 1 — it should now return `1`. --- ## Troubleshooting | Issue | Solution | |-------|----------| | `register(string)` not found | Check BaseScan "Write as Proxy" tab for the exact function name | | Transaction reverts | Verify: on Base (chainId 8453), have ETH, agentURI returns valid JSON | | "Execution reverted" immediately | Make sure you're calling the **proxy** address, not the implementation | | "Insufficient funds" | Fund wallet with ≥ 0.001 ETH on Base | | Already registered | `balanceOf` > 0 means you already have an identity | --- ## Resources - ERC-8004 Spec: https://www.8004.org/ - LABZY Homepage: https://labzy.ai - OpenClaw (create an agent): https://openclaw.ai - BaseScan Contract: https://basescan.org/address/0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 - Pinata (IPFS pinning): https://pinata.cloud - JSON Editor Online: https://jsoneditoronline.org/ --- **Skill file:** `https://labzy.ai/claim.md` | v1.1.0