---
eip: 8122
label: ERC-8122
title: Minimal Agent Registry
status: Draft
type: Standards Track
category: ERC
created: 2025-12-17
requires: 6909, 7930, 8048, 8049, 8127
official: https://eips.ethereum.org/EIPS/eip-8122
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-8122.md
canonical: https://eips.huatuo.xyz/eip-8122/
lang: en
tldr: A small, deploy-your-own registry for AI agents built on ERC-6909, where each agent is a single-owner token ID with all of its metadata stored on-chain.
tags: [ai-agents, registry, erc6909, metadata, discovery]
---

# ERC-8122: Minimal Agent Registry

> A minimal gas efficient registry design for AI agents

**TL;DR:** A small, deploy-your-own registry for AI agents built on ERC-6909, where each agent is a single-owner token ID with all of its metadata stored on-chain.

## What problem does it solve?

Off-chain agent protocols (MCP, A2A and similar) define how AI agents talk to each other, but not how anyone finds them. [ERC-8004](/eip-8004/) offers an agent registry, but as one singleton per chain. Some use cases want their own registry instead: a curated list of whitehat-hacking agents, a set of DeFi strategy agents, or a fixed-supply collection.

ERC-8122 defines a minimal registry contract that anyone can deploy on mainnet or any L2. Agents are registered as tokens, can be transferred, and carry their metadata fully on-chain so it does not depend on external storage.

## How it works

- **Registry = ERC-6909 contract.** It extends the [ERC-6909](/eip-6909/) minimal multi-token standard, chosen for low gas cost.
- **One agent = one token ID with one owner.** Registration mints a balance of exactly 1 to the owner. `ownerOf(agentId)` returns the owner (reverting for unknown IDs), and `transfer`/`transferFrom` must revert unless `amount == 1`.
- **Global identity.** An agent is identified by the registry's [ERC-7930](/eip-7930/) interoperable address (chain + contract in one binary blob) plus its `agentId`. As text it uses the [ERC-8127](/eip-8127/) form `[alias.]agentId@registry`.
- **On-chain metadata.** Agent data lives in the [ERC-8048](/eip-8048/) key-value store (`metadata(tokenId, key)` returning `bytes`). `setMetadata` may be called only by the owner, an approved spender or an operator. Recommended keys: `name`, `ens_name`, `image`, `description`, `service_type` (for example `mcp` or `a2a`), `service` (endpoint URI) and `agent_account`. URIs may contain `{id}`, which clients replace with the token ID.
- **Registry metadata.** The registry itself should describe itself (`name`, `description`, `image`, …) using ERC-8049 contract-level metadata.
- **Registration** via `register(owner, service_type, service, agent_account)`, `register(owner, MetadataEntry[])` or `registerBatch`. It emits an ERC-6909 `Transfer` from `address(0)`, a `MetadataSet` per entry, and `Registered`.

## Sample code

The ERC-specific interface:

```solidity
// SPDX-License-Identifier: CC0-1.0
pragma solidity ^0.8.20;

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);
}
```

Reading an agent's endpoint (ethers v6):

```ts
import { Contract, JsonRpcProvider, toUtf8String } from "ethers";

const provider = new JsonRpcProvider(process.env.RPC_URL);
const registry = new Contract(registryAddress, [
  "function ownerOf(uint256) view returns (address)",
  "function metadata(uint256 tokenId, string key) view returns (bytes)",
], provider);

const id = 12345n;
const kind = toUtf8String(await registry.metadata(id, "service_type")); // e.g. "mcp"
const url = toUtf8String(await registry.metadata(id, "service")).replace("{id}", id.toString());
console.log(await registry.ownerOf(id), kind, url);
```

## Things to know

- **Status: Draft.** It depends on several other drafts (ERC-8048, ERC-8049, ERC-8127, and ERC-7930 in Review), so details may change.
- How agent IDs are assigned and who may register is left to each implementation.
- The registry only handles discovery and ownership. Reputation, credentials ("know your agent") or validation are expected to be built on top; compare the singleton design in [ERC-8004](/eip-8004/).
- Metadata values are raw `bytes`; unless a type is stated, they are UTF-8 strings.
- The spec lists no security considerations. Anyone can deploy a registry, so treat registry contents as unverified unless you trust its curator.


---

This is an unofficial plain-language summary. Read the full specification: https://eips.ethereum.org/EIPS/eip-8122
