Introduction

Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.

I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.

I also build and publish a variety of tools, libraries, and open-source projects.

When choosing an AI agent, check who published it and where it connects as well as its name. ERC-8122 records the agent's registry, owner, description, and endpoint on-chain, where a client can look them up by ID.

Overview

Suppose a user searches for a DeFi agent and finds one named Alpha. Another registry may list a different agent under the same name. Opening an endpoint by name alone can connect the user to the wrong agent.

The user can first use descriptions to shortlist candidates, then identify the intended agent by pairing the registry location with its agent ID. They can check the current owner, then read the communication protocol and endpoint before connecting.

A registry is a contract that records agents, owners, descriptions, and endpoints. ERC-8122 gives clients separate fields for display names, identity, ownership, and connection details so they can check each independently.

Anyone can deploy a registry geared toward a particular use case. The same agent ID can therefore appear in multiple registries. An identifier saved by a client needs both the registry location and the ID.

The owner is the address that can transfer the registration. The service metadata tells users where to initiate communication. The operator of the service at that URI may differ from the current owner, so clients check ownership and metadata separately.

Reading the owner and endpoint using the registry location and agent ID

The original diagrams retain their Japanese labels.

Globally unique agent identity

agentRegistry identifies the chain and registry contract. agentId is the number issued by that registry. Two references identify the same agent only if both values match.

ERC-7930 encodes the chain type, chain reference, and contract address in a single byte sequence. Clients use it to locate the registry and avoid resolving a number against an entry on the wrong chain.

See the following article for more on ERC-7930.

[ERC-7930] One address format for multiple chains

A single owner

Each agent ID always has one owner. ERC-8122 builds on ERC-6909 and restricts transfer amounts to exactly one. A transfer also updates the current owner.

See the following article for more on ERC-6909.

[ERC-6909] A simpler multi-token interface

Display names

To present a human-readable reference with an optional name, the ID, and the registry location, use [alias.]agentId@registry. In this ERC-8127 format, the alias helps readers distinguish entries. The authoritative reference includes the ID and registry.

Motivation

Even if agents can communicate, users still need a way to discover candidates and find out who published them. ERC-8122 puts discovery information on-chain and lets different use cases deploy their own registries.

A communication protocol alone leaves users to decide whom to connect to. If names and service URIs live only in separate service databases, every client needs a different search integration and has no common basis for deciding whether two same-name entries are the same registration.

ERC-8122 assigns each entry a number and associates its owner and metadata with it. A client can use an external search interface to find candidates, then return to the registry to identify the agent and verify its owner on-chain.

The on-chain record provides the core information needed to narrow down candidates and resolve endpoints, such as the name, description, protocol, and URI. Clients retrieve that information with the agent ID without storing entire search indexes or lengthy descriptions on-chain.

Deploying independent registries for different use cases

Why put discovery information on-chain?

Names and descriptions help users narrow down candidates. Protocols and endpoints determine how to connect. Associating these values with agent IDs lets clients retrieve them in a shared format.

External databases are useful for search and updates. If they hold the only copy of the registration, however, a change of operator can make the authoritative record difficult to identify. With ERC-8122, a client can take the registry location and agent ID returned by an external search and verify on-chain that the ID exists, who owns it, and what metadata it currently holds. The standard offers no guarantee about URI contents or endpoint safety.

Why give each collection its own registry?

DeFi strategies, vulnerability research, and fixed-supply collections can have separate registries. Clients can use registry membership alongside display names when choosing agents.

Separate registries can define their own registrants, metadata meanings, update permissions, and selection criteria. Matching agent IDs in different registries refer to different entries. Users should decide which registries and operating policies they trust before relying on a candidate's name.

Specification

An ERC-8122 registry extends ERC-6909 and implements ERC-8048 for per-agent metadata. It can also implement ERC-8049 to describe the registry itself.

Agent registry and single ownership

The registry stores a current owner for each agentId and returns it through ownerOf. Looking up a nonexistent ID or transferring an amount other than one reverts.

Restricting transfer amounts to one and updating the owner

Registry metadata

Registry-level name, description, and image fields describe the collection. Implementations using ERC-8049 can set them and can also provide symbol, banner_image, featured_image, and external_link.

Agent metadata

Each agent ID can have name, ens_name, image, description, service_type, service, and agent_account stored as ERC-8048 key-value pairs. A call to setMetadata reverts unless the caller is the owner, an approved user, or an operator.

Storing per-agent and registry-wide metadata separately

Key What the client reads
name The agent's display name.
description A description of what the agent does.
service_type The communication protocol used to connect.
service The URI of the primary off-chain service.
agent_account The account the agent uses for transactions.

Values are stored as bytes. When the specification does not assign a type to a key, its value encodes a UTF-8 string. The client substitutes the agent ID for {id} in URIs. Additional endpoints are paired using numbered keys from ERC-8119.

IERC8122

js
interface IERC8122 {
    struct MetadataEntry { string key; bytes value; }
    event Registered(uint256 indexed agentId, address indexed owner, string service_type, string service, address agent_account);
    function register(address owner, string calldata service_type, string calldata service, address agent_account) external returns (uint256 agentId);
    function register(address owner, MetadataEntry[] calldata metadata) external returns (uint256 agentId);
    function registerBatch(address[] calldata owners, MetadataEntry[][] calldata metadata) external returns (uint256[] memory agentIds);
    function ownerOf(uint256 agentId) external view returns (address);
}

MetadataEntry

js
struct MetadataEntry { string key; bytes value; }

MetadataEntry pairs the type of information to register with its value. The caller supplies it and the registry stores it as an ERC-8048 entry for the agent ID.

  • Fields
Field Details
key The type of information to store.
value The bytes value associated with the key.

Registered

js
event Registered(uint256 indexed agentId, address indexed owner, string service_type, string service, address agent_account);

The registry emits Registered when it registers a new agent. The event log exposes the ID, owner, and basic endpoint information. Clients look up the full metadata separately in storage.

  • Fields
Field Details
agentId The indexed ID of the new agent.
owner The indexed owner after registration.
service_type The communication protocol, or an empty string if unset.
service The endpoint URI, or an empty string if unset.
agent_account The account used for transactions, or the zero address if unset.

register

js
function register(address owner, string calldata service_type, string calldata service, address agent_account) external returns (uint256 agentId);

This overload registers a single agent with its owner and basic connection information.

  1. Allocate an agent ID. Choose a unique number.
  2. Record the owner and a balance of one. Store the owner and ERC-6909 balance.
  3. Emit the registration event. Include the connection information in Registered and return the agent ID.
  • Parameters
Parameter Details
owner The owner after registration.
service_type The protocol used for the primary connection.
service The URI of the primary endpoint.
agent_account The account used by the agent.
  • Returns
Return value Details
agentId The newly assigned number.
  • Conditions

    • Unset connection information is represented by empty strings or the zero address in the event.

register

js
function register(address owner, MetadataEntry[] calldata metadata) external returns (uint256 agentId);

This overload registers one agent using an arbitrary array of metadata entries.

  1. Allocate an agent ID. Choose a unique number.
  2. Record the owner and a balance of one. Store the owner and balance.
  3. Store the metadata. Associate each MetadataEntry with the agent ID.
  • Parameters
Parameter Details
owner The owner after registration.
metadata The key-value pairs to store.
  • Returns
Return value Details
agentId The newly assigned number.
  • Conditions

    • Registration can succeed without basic connection information. The event uses empty default values for the missing fields.

registerBatch

js
function registerBatch(address[] calldata owners, MetadataEntry[][] calldata metadata) external returns (uint256[] memory agentIds);

registerBatch registers several agents from corresponding arrays of owners and metadata.

  1. Pair the inputs. Read owners and metadata at the same index as a single agent.
  2. Register each agent. Assign a unique number and set the owner, balance of one, and metadata.
  3. Return the IDs. Return agent IDs in input order.
  • Parameters
Parameter Details
owners The array of owners for the agents.
metadata The array of values to store for each agent.
  • Returns
Return value Details
agentIds The IDs assigned during registration.
  • Conditions

    • Owner and metadata entries at the same index represent one agent.

ownerOf

js
function ownerOf(uint256 agentId) external view returns (address);

ownerOf is a view function that returns the current owner of an agent ID.

  1. Check that the ID exists. Check for a stored entry under the specified agent ID.
  2. Return the owner. Return the current owner of an existing entry.
  • Parameters
Parameter Details
agentId The ID whose owner the caller wants to read.
  • Returns
Return value Details
address The current owner.
  • Conditions

    • Passing a nonexistent agent ID reverts.

IERC8049SetContractMetadata

js
interface IERC8049SetContractMetadata {
    function setContractMetadata(string calldata key, bytes calldata value) external;
}

setContractMetadata

js
function setContractMetadata(string calldata key, bytes calldata value) external;

setContractMetadata sets a key and value describing the registry itself.

  1. Specify the information type. Set key to the kind of registry metadata to update.
  2. Store the value. Update value at registry level.
  • Parameters
Parameter Details
key The type of information to update.
value The bytes value to store.
  • Conditions

    • Each registry implementation decides who can call the function.

What happens during registration?

The registrant submits the receiving owner and the metadata that describes the agent. The registry assigns the new agent ID and records the owner, balance of one, and metadata in the same operation.

Deriving storage entries and events from registration input

Users can synchronize Transfer, MetadataSet, and Registered events to discover additions. Before choosing an endpoint, they reread full metadata and current ownership from registry storage.

Additional notes

Resolving the endpoint from metadata

The client reads service_type to select the communication protocol, then reads the matching service to find the endpoint. It checks ownership separately with ownerOf, since a URI alone does not identify the publisher.

For example, if service is https://api.example.com/agents/{id}, the client substitutes the registered agent ID for {id}. If the agent advertises multiple protocols, the numbered keys keep each protocol paired with its URI. A resolved URI provides an off-chain response. The client must separately verify that the response comes from the expected party.

Updatable information and ownership

The owner, approved users, and operators can update agent metadata. The authority to update registry metadata depends on the implementation. When using a collection's description as a trust signal, clients should check who operates the registry and how updates are authorized.

Ownership transfers and service updates are separate operations. Users can check the current owner with ownerOf, account for the possibility that an authorized metadata update changed the endpoint, and evaluate service authentication and reputation independently.

Compatibility

Existing operations and data formats

ERC-8122 combines ERC-6909 transfers, ERC-8048 agent metadata, and, optionally, ERC-8049 registry metadata. It preserves the semantics of balances and transfers, metadata key-value pairs, and registry metadata. It adds single ownership, registration events, and discovery APIs.

Implementations can use existing tools that understand ERC-6909 balances and transfers to monitor registration and transfers. ERC-8048 clients read metadata key-value pairs, and ERC-8049 clients read registry descriptions. Tools still need to understand the ERC-8122 Registered event and single-owner semantics to provide agent discovery.

Coexistence with existing registries

The standard does not require existing agent registries to migrate. New ERC-8122 registries offer a shared format for IDs, single ownership, and on-chain metadata.

Adoption imposes no bulk ID migration or replacement of existing owners. An application adds supporting registry addresses to its list and verifies that each registry implements the ERC-8122 interface before including it in searches. Identical names or IDs at different registry locations identify separate entries.

Security considerations

Metadata update permissions

The specification's security section adds no requirements. Implementations still need to restrict who can make updates, and clients should assess mutable endpoints independently from ownership.

The absence of additional requirements does not certify metadata contents or off-chain services. An implementation that lets callers other than owners, approved users, and operators call setMetadata exposes endpoints to unauthorized changes. Clients can check update permissions and inspect MetadataSet history. To avoid relying on cached data indefinitely, they can reread the current values when needed.

Connecting to off-chain services

The service URI points to an endpoint. Clients still need to check the protocol's authentication mechanism, what the URI resolves to, and whether they trust the IPFS gateway before connecting.

Someone can register a URI that resembles a legitimate agent's endpoint, and a party with update privileges can substitute a malicious URI. Before connecting, check TLS or protocol-specific authentication, decide whether to trust the content returned by an IPFS gateway, and verify that {id} substitution resolves to the intended agent. A correct owner address does not establish that the owner's service is available, returns trustworthy responses, or handles keys securely.

Conclusion

ERC-8122 identifies AI agents by registry location and agent ID and provides a way to read ownership and on-chain metadata. Single ownership, independent registries, and registration events let clients check where an agent is registered, who published it, and where to connect.

Find more of my articles and resources here.

Reference