ERC-8004 Deep Dive: Technical Architecture Explained
If you've been following the AI agent revolution in Web3, you've probably heard about ERC-8004—the Ethereum standard that's bringing trustless identity to autonomous agents. But what's actually happening under the hood? In this technical deep dive, we'll break down the architecture that makes on-chain AI agent identity possible.
The Core Problem ERC-8004 Solves
Before diving into the architecture, let's understand the problem. When an AI agent interacts with a DeFi protocol, makes a payment, or collaborates with another agent, how does the receiving party know:
- Is this agent who it claims to be?
- Does it have the required permissions?
- Has it behaved trustworthy in the past?
- Is it actually controlled by a legitimate operator?
Traditional solutions like API keys or OAuth tokens don't work well for autonomous agents. They're centralized, can be revoked arbitrarily, and don't carry reputation information. ERC-8004 solves this with a decentralized, on-chain identity layer.
The Three-Layer Architecture
ERC-8004 is built on three interconnected layers:
Layer 1: The Agent Registry Contract
At the foundation is the Agent Registry—a smart contract that maintains the canonical list of registered AI agents. Think of it as the "birth certificate office" for AI agents on Ethereum.
The registry stores:
- Agent Address: The unique Ethereum address representing the agent
- Operator Address: Who controls/owns the agent
- Metadata URI: Link to off-chain data (capabilities, description)
- Registration Timestamp: When the agent was created
- Status: Active, paused, or revoked
The registry contract implements minimal storage to keep gas costs low. Heavy data lives off-chain (IPFS or Arweave) and is referenced via content-addressable URIs.
Layer 2: Identity NFTs (Soulbound Tokens)
ERC-8004 uses non-transferable NFTs (soulbound tokens) to represent agent identities. When an agent registers, it receives an ERC-721 token bound to its address.
Why NFTs? Several reasons:
- Composability: Works with existing NFT infrastructure
- Uniqueness: Each agent has exactly one identity token
- Visibility: Easy to query and display agent identity
- Extensibility: Can attach additional metadata and attributes
The soulbound nature is crucial—these tokens cannot be transferred or sold. An agent's identity stays with it forever, building reputation over time.
Layer 3: The Attestation System
This is where ERC-8004 gets really interesting. Attestations are signed statements about an agent made by other parties. They're the building blocks of reputation.
Types of attestations include:
- Capability Attestations: "This agent can execute trades"
- Compliance Attestations: "This agent follows protocol X's terms"
- Behavior Attestations: "This agent completed 100 transactions successfully"
- Trust Attestations: "This agent is vouched for by operator Y"
Attestations use the EIP-712 typed data signing standard, making them verifiable on-chain while being created off-chain (gasless for the attestor).
The Registration Flow
Let's walk through how an AI agent gets its on-chain identity:
Step 1: Generate Agent Keys The operator generates a new Ethereum keypair for the agent. This becomes the agent's permanent address. Step 2: Prepare Metadata The operator creates a JSON metadata file describing the agent: name, description, capabilities, operator info, and any relevant documentation. This gets uploaded to IPFS. Step 3: Call Register Function The operator callsregister(agentAddress, metadataURI) on the registry contract, paying a small registration fee (prevents spam).
Step 4: Identity NFT Minted
The registry mints a soulbound identity token to the agent's address. The agent is now officially registered.
Step 5: Gather Attestations
Over time, the agent collects attestations from protocols, users, and other agents it interacts with. These build its reputation profile.
The Verification Flow
When a protocol needs to verify an agent, here's what happens:
Step 1: Query Registry The protocol callsisRegistered(agentAddress) to check if the agent exists and is active.
Step 2: Fetch Metadata
If registered, fetch the metadata URI to get agent details.
Step 3: Check Attestations
Query the attestation index for relevant attestations. Are there capability proofs? Trust endorsements? Any negative attestations?
Step 4: Compute Trust Score
Based on attestation data, compute a trust score. This can be done on-chain (for simple checks) or off-chain (for complex scoring algorithms).
Step 5: Authorize or Reject
Make the authorization decision based on the trust score and protocol-specific requirements.
Gas Optimization Strategies
ERC-8004 implements several gas optimizations:
Minimal On-Chain Storage: Only essential data lives on-chain. Everything else is referenced via content-addressable URIs. Batch Operations: Multiple registrations or attestations can be batched into single transactions. EIP-712 Signatures: Attestations are signed off-chain and only verified on-chain when needed. Merkle Proofs: Large attestation sets can be committed as Merkle roots, with individual attestations proven via Merkle proofs.Cross-Chain Considerations
While ERC-8004 is designed for Ethereum, the standard includes provisions for cross-chain identity:
Chain-Agnostic Identifiers: Agent addresses use a chain-ID prefix system for unambiguous identification across networks. Bridge Attestations: Special attestation types can vouch for identity equivalence across chains. L2 Deployment: The registry can be deployed on L2s for lower gas costs, with cross-L2 verification via message passing.Security Model
The security of ERC-8004 rests on several pillars:
Immutable Registration: Once registered, an agent's core identity cannot be changed. Operator Controls: Operators can pause or revoke agents they control, providing an emergency stop mechanism. Attestation Verification: All attestations are cryptographically signed and verifiable. Slashing Potential: The standard is designed to integrate with slashing mechanisms for malicious behavior.What's Next?
ERC-8004 is still evolving. Upcoming enhancements being discussed include:
- Hierarchical Identities: Allowing agent "organizations" with sub-agents
- Privacy-Preserving Attestations: Using zero-knowledge proofs for sensitive attestations
- Standardized Trust Scores: Common scoring algorithms for interoperability
- Integration with x402: Native support for AI agent payments
Conclusion
ERC-8004's architecture is elegantly simple yet powerful: a registry for identity, NFTs for representation, and attestations for reputation. Together, these components create the foundation for a trustless AI agent ecosystem on Ethereum.
As AI agents become more prevalent in DeFi, governance, and cross-protocol interactions, having a standardized identity layer becomes essential. ERC-8004 provides exactly that—and understanding its architecture is the first step to building with it.
Ready to dive deeper? Check out the official ERC-8004 specification and reference implementation on GitHub.


