---
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/ja/eip-8122/
lang: ja
tldr: ERC-6909 上に構築された、自分でデプロイできる小さな AI エージェント用レジストリ。各エージェントは単一オーナーのトークン ID で、メタデータはすべてオンチェーンに保存される。
tags: [ai-agents, registry, erc6909, metadata, discovery]
---

# ERC-8122: Minimal Agent Registry

> A minimal gas efficient registry design for AI agents

**TL;DR:** ERC-6909 上に構築された、自分でデプロイできる小さな AI エージェント用レジストリ。各エージェントは単一オーナーのトークン ID で、メタデータはすべてオンチェーンに保存される。

## 何を解決するのか

オフチェーンのエージェントプロトコル（MCP、A2A など）は、AI エージェント同士がどう会話するかを定めていますが、誰がどうやってそれらを見つけるかは定めていません。[ERC-8004](/eip-8004/) はエージェントレジストリを提供しますが、チェーンごとに 1 つのシングルトンです。ユースケースによっては、独自のレジストリが欲しい場合があります。たとえば、ホワイトハットハッキングのエージェントを選りすぐったリスト、DeFi 戦略エージェントの集合、供給量固定のコレクションなどです。

ERC-8122 は、誰でもメインネットや任意の L2 にデプロイできる最小限のレジストリコントラクトを定義します。エージェントはトークンとして登録され、転送でき、メタデータを完全にオンチェーンで持つため、外部ストレージに依存しません。

## 仕組み

- **レジストリ = ERC-6909 コントラクト。** ガスコストの低さから選ばれた、最小限のマルチトークン標準である [ERC-6909](/eip-6909/) を拡張します。
- **1 エージェント = 1 つのトークン ID と 1 人のオーナー。** 登録するとオーナーにちょうど 1 の残高がミントされます。`ownerOf(agentId)` はオーナーを返し（未知の ID では revert）、`transfer`/`transferFrom` は `amount == 1` でなければ revert しなければなりません。
- **グローバルな ID。** エージェントは、レジストリの [ERC-7930](/eip-7930/) 相互運用可能アドレス（チェーンとコントラクトを 1 つのバイナリにまとめたもの）と `agentId` で識別されます。テキストとしては、[ERC-8127](/eip-8127/) の形式 `[alias.]agentId@registry` を使います。
- **オンチェーンのメタデータ。** エージェントのデータは [ERC-8048](/eip-8048/) のキーバリューストア（`bytes` を返す `metadata(tokenId, key)`）に保存されます。`setMetadata` を呼べるのは、オーナー、承認されたスペンダー、オペレーターだけです。推奨キーは `name`、`ens_name`、`image`、`description`、`service_type`（たとえば `mcp` や `a2a`）、`service`（エンドポイント URI）、`agent_account` です。URI には `{id}` を含めることができ、クライアントがトークン ID に置き換えます。
- **レジストリのメタデータ。** レジストリ自身も、ERC-8049 のコントラクトレベルのメタデータを使って自己記述する（`name`、`description`、`image` など）べきです。
- **登録**は `register(owner, service_type, service, agent_account)`、`register(owner, MetadataEntry[])`、または `registerBatch` で行います。`address(0)` からの ERC-6909 `Transfer`、各エントリごとの `MetadataSet`、そして `Registered` を emit します。

## サンプルコード

ERC 固有のインターフェース:

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

エージェントのエンドポイントを読み取る（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);
```

## 知っておくべきこと

- **ステータス: Draft。** 他の複数のドラフト（ERC-8048、ERC-8049、ERC-8127、そして Review 中の ERC-7930）に依存しているため、詳細は変わる可能性があります。
- エージェント ID の割り当て方法と、誰が登録できるかは、各実装に委ねられています。
- レジストリが扱うのは発見とオーナーシップだけです。評判、資格情報（「know your agent」）、検証は、その上に構築されることが想定されています。[ERC-8004](/eip-8004/) のシングルトン設計と比較してください。
- メタデータの値は生の `bytes` です。型が明記されていない限り、UTF-8 文字列です。
- 仕様にセキュリティ上の考慮事項は記載されていません。誰でもレジストリをデプロイできるため、運営者を信頼できない限り、レジストリの内容は未検証として扱ってください。


---

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