# erc-8004-registry > Call `newAgent(domain, agentAddress)` with 0.005 ETH. Returns token ID via Transfer event. - Author: Clawd Bot - Repository: BAiSEDagent/openclaw-skills - Version: 20260208142402 - Stars: 0 - Forks: 0 - Last Updated: 2026-02-08 - Source: https://github.com/BAiSEDagent/openclaw-skills - Web: https://mule.run/skillshub/@@BAiSEDagent/openclaw-skills~erc-8004-registry:20260208142402 --- # ERC-8004 Registry ## Description Register and manage on-chain agent identities using the ERC-8004 Trustless Agents Standard on Base ## Instructions # ERC-8004 Agent Registry ## Key Contracts - **Identity Registry**: `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` - **Reputation Registry**: `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63` - **Chain**: Base (8453) - **Registration Fee**: 0.005 ETH ## When to Use - Register a new AI agent with on-chain identity (ERC-721 NFT) - Update agent metadata (capabilities, services, endpoints) - Query registry to discover agents by domain or capabilities - Record or check reputation scores - Resolve cross-chain agent identities ## Core Workflow ### 1. Check Domain Availability ```typescript const available = await publicClient.readContract({ address: IDENTITY_REGISTRY, abi: [{ name: 'isAvailable', type: 'function', stateMutability: 'view', inputs: [{ name: 'domain', type: 'string' }], outputs: [{ name: '', type: 'bool' }] }], functionName: 'isAvailable', args: ['myagent.agent'] }); ``` ### 2. Register Agent Call `newAgent(domain, agentAddress)` with 0.005 ETH. Returns token ID via Transfer event. ```typescript const hash = await walletClient.writeContract({ address: IDENTITY_REGISTRY, abi: registrationAbi, functionName: 'newAgent', args: [domain, agentAddress], value: parseEther('0.005') }); ``` ### 3. Upload Metadata to IPFS/Arweave Standard JSON schema with: `name`, `description`, `type`, `services[]`, `x402Support`, `capabilities[]`, `active`, `registrations[]`. ### 4. Set Token URI ```typescript await walletClient.writeContract({ address: IDENTITY_REGISTRY, abi: setURIAbi, functionName: 'setTokenURI', args: [tokenId, 'ipfs://Qm...'] }); ``` ### 5. Record/Query Reputation ```typescript // Record feedback (rating 1-5) await walletClient.writeContract({ address: REPUTATION_REGISTRY, abi: reputationAbi, functionName: 'recordFeedback', args: [agentTokenId, 5, 'Excellent service'] }); // Query average (returned as integer * 100, e.g., 425 = 4.25) const avg = await publicClient.readContract({ address: REPUTATION_REGISTRY, abi: scoreAbi, functionName: 'getAverageRating', args: [agentTokenId] }); ``` ## Important Rules - **Registration fee is exactly 0.005 ETH** — less reverts, more doesn't refund - **Domain names are case-sensitive** — use lowercase by convention - **Only token owner can setTokenURI** — transferring NFT transfers control - **Registrations are permanent** — no burn/deregister function - **Each address can rate an agent only once** — enforced by contract - **Ratings must be 1-5** — 0 or >5 reverts - **Average rating scaled by 100** — divide by 100 for decimal - **No on-chain metadata validation** — validate off-chain - **No Sybil resistance** — multiple addresses can rate ## Metadata Schema ```json { "name": "Agent Name", "description": "What the agent does", "type": "service|autonomous|assistant", "services": [{ "type": "api", "url": "https://...", "description": "..." }], "x402Support": true, "x402PaymentAddress": "0x...", "capabilities": ["token-swaps", "analysis"], "active": true, "registrations": [{ "chain": "base", "chainId": 8453, "registryAddress": "0x8004...", "tokenId": "42", "domain": "myagent.agent" }] } ``` ## Domain Resolution ```typescript const tokenId = await publicClient.readContract({ address: IDENTITY_REGISTRY, abi: registryAbi, functionName: 'domainToTokenId', args: ['myagent.agent'] }); // tokenId === 0n means not registered ``` ## References Read these on demand for detailed code: - **[references/registration.md](references/registration.md)** — Full registration code, token ID extraction, batch checks - **[references/metadata.md](references/metadata.md)** — IPFS/Arweave upload, metadata validation, versioning patterns - **[references/reputation.md](references/reputation.md)** — Feedback recording, score queries, decay/weighting algorithms - **[references/querying.md](references/querying.md)** — Domain resolution, capability filtering, X402 discovery, cross-chain resolution, caching ## Resources - ERC-8004 Spec: https://eips.ethereum.org/EIPS/eip-8004 - Identity Registry: https://basescan.org/address/0x8004A169FB4a3325136EB29fA0ceB6D2e539a432 - Reputation Registry: https://basescan.org/address/0x8004BAa17C55a88189AE136b182e5fdA19dE9b63 ## Cross-References - **eas-attestations**: Link attestations to agent identities - **agent-protocol**: Communication protocols over registered identities - **smart-wallet**: ERC-4337 wallets as agent owners