$npx -y skills add basezh/agent-skills-on-base --skill erc-8004Register AI agents on Ethereum mainnet using ERC-8004 (Trustless Agents). Use when the user wants to register their agent identity on-chain, create an agent profile, claim an agent NFT, set up agent reputation, or make their agent discoverable. Handles bridging ETH to mainnet, IP
| 1 | # ERC-8004: Trustless Agents |
| 2 | |
| 3 | Register your AI agent on Ethereum mainnet with a verifiable on-chain identity, making it discoverable and enabling trust signals. |
| 4 | |
| 5 | ## What is ERC-8004? |
| 6 | |
| 7 | ERC-8004 is an Ethereum standard for trustless agent identity and reputation: |
| 8 | |
| 9 | - **Identity Registry** - ERC-721 based agent IDs (your agent gets an NFT!) |
| 10 | - **Reputation Registry** - Feedback and trust signals from other agents/users |
| 11 | - **Validation Registry** - Third-party verification of agent work |
| 12 | |
| 13 | Website: https://www.8004.org |
| 14 | Spec: https://eips.ethereum.org/EIPS/eip-8004 |
| 15 | |
| 16 | ## Contract Addresses |
| 17 | |
| 18 | | Chain | Identity Registry | Reputation Registry | |
| 19 | |-------|-------------------|---------------------| |
| 20 | | Ethereum Mainnet | `0x8004A169FB4a3325136EB29fA0ceB6D2e539a432` | `0x8004BAa17C55a88189AE136b182e5fdA19dE9b63` | |
| 21 | | Sepolia Testnet | `0x8004A818BFB912233c491871b3d84c89A494BD9e` | `0x8004B663056A597Dffe9eCcC1965A193B7388713` | |
| 22 | |
| 23 | ## Quick Start |
| 24 | |
| 25 | ### 1. Register Your Agent |
| 26 | |
| 27 | ```bash |
| 28 | # Full registration (creates profile, uploads to IPFS, registers on-chain) |
| 29 | ./scripts/register.sh |
| 30 | |
| 31 | # Or with custom values |
| 32 | NAME="My Agent" \ |
| 33 | DESCRIPTION="An AI agent that does cool stuff" \ |
| 34 | IMAGE="https://example.com/avatar.png" \ |
| 35 | ./scripts/register.sh |
| 36 | ``` |
| 37 | |
| 38 | ### 2. Bridge ETH to Mainnet (if needed) |
| 39 | |
| 40 | ```bash |
| 41 | # Bridge ETH from Base to Ethereum mainnet |
| 42 | ./scripts/bridge-to-mainnet.sh 0.01 |
| 43 | ``` |
| 44 | |
| 45 | ### 3. Update Agent Profile |
| 46 | |
| 47 | ```bash |
| 48 | # Update your agent's registration file |
| 49 | ./scripts/update-profile.sh <agent-id> <new-ipfs-uri> |
| 50 | ``` |
| 51 | |
| 52 | ## Environment Variables |
| 53 | |
| 54 | | Variable | Description | Required | |
| 55 | |----------|-------------|----------| |
| 56 | | `PINATA_JWT` | Pinata API JWT for IPFS uploads | No (only for IPFS) | |
| 57 | | `AGENT_NAME` | Agent display name | No (defaults to wallet ENS or address) | |
| 58 | | `AGENT_DESCRIPTION` | Agent description | No | |
| 59 | | `AGENT_IMAGE` | Avatar URL | No | |
| 60 | |
| 61 | ## Registration Options |
| 62 | |
| 63 | **Option 1: Use 8004.org frontend (easiest)** |
| 64 | Visit https://www.8004.org and register through the UI — handles IPFS automatically. |
| 65 | |
| 66 | **Option 2: HTTP URL (no IPFS needed)** |
| 67 | Host your registration JSON at any URL: |
| 68 | ```bash |
| 69 | REGISTRATION_URL="https://myagent.xyz/agent.json" ./scripts/register-http.sh |
| 70 | ``` |
| 71 | |
| 72 | **Option 3: IPFS via Pinata** |
| 73 | ```bash |
| 74 | PINATA_JWT="your-jwt" ./scripts/register.sh |
| 75 | ``` |
| 76 | |
| 77 | **Option 4: Data URI (fully on-chain)** |
| 78 | Encode your registration as base64 — no external hosting needed: |
| 79 | ```bash |
| 80 | ./scripts/register-onchain.sh |
| 81 | ``` |
| 82 | |
| 83 | ## Registration File Format |
| 84 | |
| 85 | Your agent's registration file (stored on IPFS) follows this structure: |
| 86 | |
| 87 | ```json |
| 88 | { |
| 89 | "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1", |
| 90 | "name": "My Agent", |
| 91 | "description": "An AI assistant for various tasks", |
| 92 | "image": "https://example.com/avatar.png", |
| 93 | "services": [ |
| 94 | { |
| 95 | "name": "web", |
| 96 | "endpoint": "https://myagent.xyz/" |
| 97 | }, |
| 98 | { |
| 99 | "name": "A2A", |
| 100 | "endpoint": "https://myagent.xyz/.well-known/agent-card.json", |
| 101 | "version": "0.3.0" |
| 102 | } |
| 103 | ], |
| 104 | "x402Support": false, |
| 105 | "active": true, |
| 106 | "registrations": [ |
| 107 | { |
| 108 | "agentId": 123, |
| 109 | "agentRegistry": "eip155:1:0x8004A169FB4a3325136EB29fA0ceB6D2e539a432" |
| 110 | } |
| 111 | ], |
| 112 | "supportedTrust": ["reputation"] |
| 113 | } |
| 114 | ``` |
| 115 | |
| 116 | ## Workflow |
| 117 | |
| 118 | 1. **Bridge ETH** (if needed) - Use Bankr to bridge ETH from Base/L2 to mainnet |
| 119 | 2. **Create Profile** - Generate a registration JSON file with agent info |
| 120 | 3. **Upload to IPFS** - Pin the file via Pinata (or other provider) |
| 121 | 4. **Register On-Chain** - Call `register(agentURI)` on the Identity Registry |
| 122 | 5. **Update Profile** - Set metadata, wallet, or update URI as needed |
| 123 | |
| 124 | ## Costs |
| 125 | |
| 126 | - **Gas:** ~100-200k gas for registration (~$5-20 depending on gas prices) |
| 127 | - **IPFS:** Free tier available on Pinata (1GB) |
| 128 | |
| 129 | ## Using the SDK |
| 130 | |
| 131 | For more advanced usage, install the Agent0 SDK: |
| 132 | |
| 133 | ```bash |
| 134 | npm install agent0-sdk |
| 135 | ``` |
| 136 | |
| 137 | ```typescript |
| 138 | import { SDK } from 'agent0-sdk'; |
| 139 | |
| 140 | const sdk = new SDK({ |
| 141 | chainId: 1, // Ethereum Mainnet |
| 142 | rpcUrl: process.env.ETH_RPC_URL, |
| 143 | privateKey: process.env.PRIVATE_KEY, |
| 144 | ipfs: 'pinata', |
| 145 | pinataJwt: process.env.PINATA_JWT |
| 146 | }); |
| 147 | |
| 148 | const agent = sdk.createAgent('My Agent', 'Description', 'https://image.url'); |
| 149 | const result = await agent.registerIPFS(); |
| 150 | console.log(`Registered: Agent ID ${result.agentId}`); |
| 151 | ``` |
| 152 | |
| 153 | ## Links |
| 154 | |
| 155 | - [ERC-8004 Spec](https://eips.ethereum.org/EIPS/eip-8004) |
| 156 | - [8004.org](https://www.8004.org) |
| 157 | - [Agent0 SDK Docs](https://sdk.ag0.xyz) |
| 158 | - [GitHub: erc-8004-contracts](https://github.com/erc-8004/erc-8004-contracts) |
| 159 | - [GitHub: agent0-ts](https://github.com/agent0lab/agent0-ts) |