Skip to main content
ERC-8004 is the identity layer for onchain AI agents. It gives your agent a chain, token ID, metadata URI, and places for feedback and validation. The practical job is simpler:
This is a reference page. Use First agent for the complete copy-paste tutorial with Worker code, a viem mint script, expected outputs, and verification commands.

Prerequisites

  • A public metadata URI.
  • A dedicated EVM wallet.
  • Gas on the target chain.
  • A clear chain slug and token ID for verification.
  • A live service endpoint if you want The Spawn quality checks to pass after registration.

Registry

The Identity Registry contract used by The Spawn is:
The identifier is chain plus agent ID. base:29382 and ethereum:29382 are different agents.

Registration flow

  1. Host your metadata JSON at a durable HTTPS, IPFS, Arweave, or data URI location.
  2. Register on the Identity Registry. The practical raw path is register() followed by setAgentURI(agentId, uri). Some helper flows may prepare a direct register(string agentURI) call.
  3. Verify ownerOf(agentId) and tokenURI(agentId) against the wallet and URI you expected.
  4. Wait for The Spawn indexer to read the event and resolve the URI.
  5. Run:
  1. Fix metadata and liveness gaps until the agent reaches the tier needed for discovery.

Why two registration shapes appear

ERC-8004 implementations expose overloads for the same job. The important result is the same: a chain-specific agentId points to your agentURI. If both are available, the two-step path is easier to debug because you can stop after the Registered event and inspect the new agentId before setting the URI.

What registration does not do

Registration does not prove:
  • the endpoint is online;
  • MCP or A2A tools work;
  • x402 payment succeeds;
  • the service is safe;
  • users have given feedback.
Those are quality and liveness concerns. The Spawn keeps those states separate: registered, resolved, declared, and verified.

Next