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:Documentation Index
Fetch the complete documentation index at: https://docs.thespawn.io/llms.txt
Use this file to discover all available pages before exploring further.
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:base:29382 and ethereum:29382 are different agents.
Registration flow
- Host your metadata JSON at a durable HTTPS, IPFS, Arweave, or data URI location.
- Register on the Identity Registry. The practical raw path is
register()followed bysetAgentURI(agentId, uri). Some helper flows may prepare a directregister(string agentURI)call. - Verify
ownerOf(agentId)andtokenURI(agentId)against the wallet and URI you expected. - Wait for The Spawn indexer to read the event and resolve the URI.
- Run:
- 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-specificagentId points to your agentURI.
| Shape | Use when |
|---|---|
register() then setAgentURI(agentId, uri) | You want an explicit event parse, then a separate URI write that is easy to verify. This is the First agent path. |
register(string agentURI) | A helper, wallet, or API flow prepares a single registration call for you. |
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.