🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

Basecred ERC-8004 Registration

by @callmedas69

Interactive ERC-8004 agent registration via chat. Guides users through a prefill form, shows draft, confirms, then registers on-chain using agent0-sdk.

Versionv1.0.0
Downloads1,510
TERMINAL
clawhub install basecred-8004-registration

πŸ“– About This Skill


name: basecred-8004-registration description: Interactive ERC-8004 agent registration via chat. Guides users through a prefill form, shows draft, confirms, then registers on-chain using agent0-sdk.

Basecred ERC-8004 Registration

Register AI agents on the ERC-8004 on-chain registry through a guided chat experience.

Registration Flow

Step 1: Auto-Prefill

When the user triggers registration, auto-fill every field you can from:

  • Agent identity files (IDENTITY.md, SOUL.md, USER.md)
  • Environment (.env β€” wallet address derived from private key)
  • Previous context (A2A endpoint, description, image, etc.)
  • Sensible defaults (version: 1.0.0, license: MIT, chain: Base, storage: onchain)
  • Do NOT ask questions one by one. Prefill first, ask later.

    Step 1.5: Explain Config Defaults

    Before showing the draft, briefly explain the config so users understand what's pre-selected and what alternatives exist:

    βš™οΈ Config defaults (you can change these later):

    Chain: Base (8453) β€” where your agent lives on-chain Others: Ethereum, Polygon, BNB, Arbitrum, Celo, Gnosis, Scroll

    Storage: Fully onchain β€” agent data stored directly on-chain Alternative: IPFS β€” data pinned to IPFS, hash stored on-chain

    Trust: Reputation β€” other agents/users rate your agent on-chain Others: Crypto-Economic (staking/slashing guarantees) TEE Attestation (hardware-level trust proof)

    x402: Off β€” no payment protocol On: agent can charge for services via x402 payment protocol

    Active: On β€” agent is discoverable and accepting requests Off: registered but hidden from discovery

    Wallet: Your agent's on-chain identity address Two ways to set it:

    Option A: Paste your wallet address β†’ Just paste your 0x... address β†’ Agent will be linked to this address on-chain

    Option B: Add private key to .env (for signing) β†’ Set PRIVATE_KEY=0x... in your .env file β†’ Wallet auto-detected + can sign transactions β†’ Enables setWallet() via EIP-712 after registration

    πŸ’‘ Option A is easier. Option B is needed if you want the agent to sign transactions on your behalf.

    Show this once at the start, not repeated on every draft.

    Step 2: Show Full Draft with Buttons (Single Message)

    Send the entire draft + buttons as one message using the message tool. This keeps buttons directly below the draft.

    Important: Use message action=send with both message (the draft text) and buttons (inline buttons). Do NOT split into reply + separate button message. After sending, reply with NO_REPLY to avoid duplicate.

    Use βœ… (filled) and ⚠️ (missing/needs attention):

    πŸ“‹ Agent Registration Draft

    ── Basic Info ── βœ… Name: Mr. Tee βœ… Description: AI agent with a CRT monitor... βœ… Image: pbs.twimg.com/... βœ… Version: 1.0.0 βœ… Author: 0xdas βœ… License: MIT

    ── Endpoints ── βœ… A2A: a2a.teeclaw.xyz/a2a ⚠️ MCP: (none)

    ── Skills & Domains ── βœ… Skills (5): natural_language_processing/natural_language_processing, natural_language_processing/natural_language_generation/summarization, natural_language_processing/information_retrieval_synthesis/question_answering, analytical_skills/coding_skills/coding_skills, images_computer_vision/images_computer_vision βœ… Domains (5): technology/blockchain/blockchain, technology/blockchain/defi, technology/technology, technology/software_engineering/software_engineering, technology/software_engineering/devops βœ… Custom: agent_orchestration/agent_coordination, social_media/content_management

    ── Config ── βœ… Chain: Base (8453) βœ… Storage: Fully onchain βœ… Active: true βœ… Trust: reputation βœ… x402: false βœ… Wallet: 0x1348...e41 (auto .env)

    Tap to edit a section or register:

    Buttons (attached to same message):

    Row 1: [✏️ Basic Info] [✏️ Endpoints]
    Row 2: [✏️ Skills & Domains] [✏️ Config]
    Row 3: [βœ… Register] [❌ Cancel]
    

    Step 3: Section Editing (on button tap)

    Instant feedback: When any button is tapped, immediately acknowledge before doing anything else:

    | Button | Instant Feedback | |--------|-----------------| | ✏️ Basic Info | "πŸ“ Editing Basic Info..." | | ✏️ Endpoints | "πŸ”— Editing Endpoints..." | | ✏️ Skills & Domains | "🏷️ Editing Skills & Domains..." | | ✏️ Config | "βš™οΈ Editing Config..." | | βœ… Register | "⏳ Starting registration on Base..." | | ❌ Cancel | "❌ Registration cancelled." | | ↩️ Back to Draft | "πŸ“‹ Back to draft..." |

    Then show the edit form. Always include ↩️ Back to Draft button.

    #### Edit Basic Info

    Current values:
    β€’ Name: Mr. Tee
    β€’ Description: AI agent with a CRT...
    β€’ Image: pbs.twimg.com/...
    β€’ Version: 1.0.0
    β€’ Author: 0xdas
    β€’ License: MIT

    Type field name and new value, e.g. "name: CoolBot" Or type "done" to go back.

    Buttons: [↩️ Back to Draft]

    #### Edit Endpoints

    Current:
    β€’ A2A: https://a2a.teeclaw.xyz/a2a
    β€’ MCP: (none)

    Paste a URL to set, or "clear mcp" / "clear a2a" to remove.

    Buttons: [↩️ Back to Draft]

    #### Edit Skills & Domains Toggleable inline buttons (multi-select). Each button shows a human-readable label but stores the full OASF taxonomy path as the value.

    Skills: (OASF taxonomy paths)

    [NLP βœ…] β†’ natural_language_processing/natural_language_processing
    [Summarization βœ…] β†’ natural_language_processing/natural_language_generation/summarization
    [Q&A βœ…] β†’ natural_language_processing/information_retrieval_synthesis/question_answering
    [Code Gen βœ…] β†’ analytical_skills/coding_skills/coding_skills
    [CV βœ…] β†’ images_computer_vision/images_computer_vision
    [Data Analysis] β†’ analytical_skills/data_analysis/data_analysis
    [Web Search] β†’ natural_language_processing/information_retrieval_synthesis/web_search
    [Image Gen] β†’ images_computer_vision/image_generation/image_generation
    [Translation] β†’ natural_language_processing/natural_language_generation/translation
    [Task Automation] β†’ tool_interaction/workflow_automation
    [+ Custom] [↩️ Back to Draft]
    

    Domains: (OASF taxonomy paths)

    [Blockchain βœ…] β†’ technology/blockchain/blockchain
    [DeFi βœ…] β†’ technology/blockchain/defi
    [Technology βœ…] β†’ technology/technology
    [SE βœ…] β†’ technology/software_engineering/software_engineering
    [DevOps βœ…] β†’ technology/software_engineering/devops
    [Finance] β†’ finance/finance
    [Healthcare] β†’ healthcare/healthcare
    [Education] β†’ education/education
    [Entertainment] β†’ entertainment/entertainment
    [Science] β†’ science/science
    [Creative Arts] β†’ creative_arts/creative_arts
    [Dev Tools] β†’ technology/software_engineering/development_tools
    [+ Custom] [↩️ Back to Draft]
    

    Display behavior:

  • Buttons show short labels (e.g., "NLP", "Blockchain") for readability
  • Values stored are full OASF paths (e.g., natural_language_processing/natural_language_processing)
  • Tapping toggles βœ… on/off
  • + Custom prompts user to type a custom OASF path or label
  • #### Edit Config Trust models (multi-select):

    [Reputation βœ…] [Crypto-Economic] [TEE Attestation]
    

    Other config:

    [Chain: Base β–Ό] [Storage: Onchain β–Ό] [x402: Off β–Ό]
    [↩️ Back to Draft]
    

    | Trust Model | Description | |-------------|-------------| | Reputation | On-chain feedback & scoring. Default for most agents. | | Crypto-Economic | Staking/slashing guarantees. For financial agents. | | TEE Attestation | Hardware-level trust proof. For high-security agents. |

    Step 4: Back to Draft

    After any edit, re-send the updated full draft as a single message with buttons (same as Step 2). Repeat until user taps βœ… Register.

    Step 5: Execute

    Only after explicit βœ… Register confirmation.

    1. Write the registration JSON to a temp file 2. Run the script:

    source /path/to/.env
    node scripts/register.mjs --json /tmp/registration.json --chain 8453 --yes
    

    The script handles: register() β†’ setA2A()/setMCP() β†’ addSkill()/addDomain() β†’ setWallet()

    Step 5.5: Progress Updates

    Send progress updates during registration:

    ⏳ Step 1/3: Minting agent NFT on Base...
    βœ… Agent minted! ID: 8453:42

    ⏳ Step 2/3: Setting endpoints & metadata... βœ… Endpoints configured

    ⏳ Step 3/3: Linking wallet via EIP-712... βœ… Wallet linked!

    Step 6: Report Result

    βœ… Agent Registered on Base!

    Agent ID: 8453:42 Wallet: 0x1348...e41 A2A: a2a.teeclaw.xyz/a2a TX: 0xabc...def

    View: https://8004.org/agent/8453:42

    Error Handling

    Missing Required Fields

    If Name or Description are empty after prefill, mark them ⚠️ and block registration. Show: "Please fill required fields first."

    No Wallet

    ⚠️ No wallet detected. You need one to register:
      Option A: Paste your 0x... address
      Option B: Add PRIVATE_KEY to your .env file
    

    Transaction Failures

    Show error clearly and offer retry:
    ❌ Registration failed: insufficient funds for gas
    [πŸ”„ Retry] [❌ Cancel]
    

    setWallet Failure

    Public RPCs (e.g. mainnet.base.org) don't support eth_signTypedData_v4. If setWallet fails:
    ⚠️ Wallet linking failed (public RPC limitation).
    You can link your wallet manually at https://8004.org
    
    This is non-blocking β€” the agent is registered, just wallet isn't linked on-chain yet.

    Duplicate Registration Prevention

    The script checks if the wallet already owns agent(s) on the target chain before submitting. If detected:
    ⚠️ Warning: This wallet already owns 1 agent(s) on Base.
       Registering again will create a duplicate.
       Use update.mjs to modify an existing agent instead.
    
    In chat flow, warn the user and suggest updating instead of re-registering. The check is non-blocking if --yes is passed.

    Already Registered

    If the agent already has an agentId, offer to update instead of register.

    Technical Notes

    Registry Overrides

    The SDK only ships with Ethereum Mainnet registry addresses. For Base and other chains, the script passes registryOverrides with deterministic contract addresses:
  • Identity Registry: 0x8004A169FB4a3325136EB29fA0ceB6D2e539a432
  • Reputation Registry: 0x8004BAa17C55a88189AE136b182e5fdA19dE9b63
  • Transaction Handling

    The SDK returns TransactionHandle objects. Use .waitMined() (not .wait()) to await confirmation.

    All Fields Reference

    Basic Info

    | Field | Required | Default | Auto-source | |-------|----------|---------|-------------| | Agent Name | βœ… | β€” | IDENTITY.md | | Agent Address | auto | β€” | .env private key or pasted | | Description | βœ… | β€” | IDENTITY.md / SOUL.md | | Image | No | β€” | Profile image URL | | Version | No | 1.0.0 | β€” | | Author | No | β€” | USER.md | | License | No | MIT | β€” |

    Endpoints

    | Field | Required | Default | Auto-source | |-------|----------|---------|-------------| | A2A Endpoint | No | β€” | IDENTITY.md | | MCP Endpoint | No | β€” | β€” |

    Skills & Domains

    | Field | Required | Default | |-------|----------|---------| | Selected Skills | No | [] | | Selected Domains | No | [] | | Custom Skills | No | [] | | Custom Domains | No | [] |

    Advanced Config

    | Field | Required | Default | |-------|----------|---------| | Trust Models | No | [] (suggest: reputation) | | x402 Support | No | false | | Storage | No | http (fully onchain) | | Active | No | true | | Chain | No | 8453 (Base) |

    Supported Chains

    | Chain | ID | Default | |-------|-----|---------| | Base | 8453 | βœ… | | Ethereum | 1 | | | Polygon | 137 | | | BNB Chain | 56 | | | Arbitrum | 42161 | | | Celo | 42220 | | | Gnosis | 100 | | | Scroll | 534352 | |

    All chains use the same deterministic contract addresses.

    JSON Template (8004.org format)

    {
      "basicInfo": {
        "agentName": "",
        "agentAddress": "",
        "description": "",
        "image": "",
        "version": "1.0.0",
        "author": "",
        "license": "MIT"
      },
      "endpoints": {
        "mcpEndpoint": "",
        "a2aEndpoint": ""
      },
      "skillsDomains": {
        "selectedSkills": [],
        "selectedDomains": [],
        "customSkills": [],
        "customDomains": []
      },
      "advancedConfig": {
        "supportedTrusts": [],
        "x402support": false,
        "storageMethod": "http",
        "active": true
      },
      "version": "1.0.0"
    }
    

    Environment Variables

    | Variable | Required | Description | |----------|----------|-------------| | PRIVATE_KEY / AGENT_PRIVATE_KEY / MAIN_WALLET_PRIVATE_KEY | Yes | Wallet private key | | RPC_URL | No | Custom RPC (auto-detected per chain) | | CHAIN_ID | No | Default chain (8453) |

    Other Operations

    # Search agents
    node scripts/search.mjs --name "AgentName" --chain 8453

    Update agent

    node scripts/update.mjs --agent-id "8453:42" --name "NewName" --yes

    Give feedback

    node scripts/feedback.mjs --agent-id "8453:42" --value 5 --tag1 "reliable" --yes

    Setup

    bash scripts/setup.sh
    

    βš™οΈ Configuration

    bash scripts/setup.sh