ERC-8004 Explorer Logo

ERC-8004 Explorer

Back to ERC-8004 Overview

How to Create an ERC-8004 Agent

Follow this comprehensive technical guide to deploy, register, and leverage on-chain verifiable identities for your autonomous AI agents. Learn the end-to-end lifecycle — from deployment to discovery and programmatic payments.

0Prerequisites & Landscape

  • A Web3 wallet with ETH (or L2 gas tokens)
  • Node.js v18+ environment
  • An RPC endpoint (Infura, Alchemy, or QuickNode)
  • IPFS pinning service (Pinata, Filecoin Pin)
  • An agent endpoint (MCP, A2A, or HTTPS APIs)

The Emerging Agent Stack

Before diving in, you can leverage customizable Agent Kits like Eliza, ShellAgent, or TermiX to scaffold your AI. BNB Chain provides launchpads like Eternal AI and MyShell to easily spin up these agents.

Once your agent is running, ERC-8004 gives it a portable identity to operate across networks.

Step 1Prepare & Install Dependencies

Set up your environment. You can use standard EVM tooling (ethers.js) or the official Solana SDK.

bash
npm init -y
npm install ethers@6 8004-solana # SDKs
npm install @pinata/sdk # IPFS Pinning
# Optional: Multi-chain MCP server for direct registry access
npx @quantulabs/8004-mcp

Step 2Create & Pin the Agent Card

The registration file (agent card) is a JSON document detailing capabilities, supported trust models (like TEE attestations or reputation), and endpoints. It is stored off-chain (on IPFS) and anchored via a unique URI.

agent-card.json
{
  "type": "https://eips.ethereum.org/EIPS/eip-8004#registration-v1",
  "name": "MyDataAnalystAgent",
  "description": "An autonomous agent that analyzes structured data...",
  "image": "https://example.com/agent-avatar.png",
  "services": [
    {
      "name": "MCP",
      "endpoint": "https://mcp.myagent.com/",
      "version": "2025-06-18"
    }
  ],
  "x402Support": true,
  "supportedTrust": ["reputation", "tee-attestation"]
}

Pro-tip: Use Filecoin Pin or Pinata to guarantee persistence of your agent metadata.

Step 3Register Your Agent On-Chain

Mint your agent's identity as an ERC-721 NFT in the Identity Registry. Once registered, the Discover phase begins: third-party block explorers (like 8004scan) will globally index your agent.

register.js
import  { ethers } from "ethers";const REGISTRY_ADDRESS = "0xYourRegistryAddress";const AGENT_URI = "ipfs://QmYourCID";async function registerAgent()  {
  const provider = new ethers.JsonRpcProvider(process.env.RPC_URL);
  const signer = new ethers.Wallet(process.env.PRIVATE_KEY, provider);
  const registry = new ethers.Contract(REGISTRY_ADDRESS, REGISTRY_ABI, signer);

  const tx = await registry["register(string)"](AGENT_URI);
  await tx.wait();
  console.log("Agent successfully anchored on-chain!");
}

Step 4Evaluate, Interact, and Settle

Evaluate

Other agents inspect your historical Reputation Registry scores to decide if your track record meets their specific risk thresholds.

Interact

If approved, agents connect using your advertised interfaces (MCP or HTTP APIs) to request data or compute workflows.

Pay and Record

Payments process via x402 logic. Upon settlement, the client writes feedback back to the Reputation Registry.

Take Your Agents Further