{"eip":820,"title":"Pseudo-introspection Registry Contract","description":"This standard defines a universal registry smart contract where any address (contract or regular account) can register which interface it supports and which smart contract is responsible for its implementation.","authors":["Jordi Baylina \u003cjordi@baylina.cat\u003e","Jacques Dafflon \u003cjacques@dafflon.tech\u003e"],"status":"Final","type":"Standards Track","category":"ERC","created":"2018-01-05","requires":[165,214],"discussionsTo":"https://github.com/ethereum/EIPs/issues/820","repo":"ERCs","label":"ERC-820","officialUrl":"https://eips.ethereum.org/EIPS/eip-820","sourceUrl":"https://github.com/ethereum/ERCs/blob/master/ERCS/erc-820.md","url":"https://eips.huatuo.xyz/eip-820/","tldr":{"en":"A single registry contract, at the same address on every chain, where any address can declare which interfaces it supports and which contract implements them; superseded by ERC-1820.","ja":"すべてのチェーンで同じアドレスにある単一のレジストリコントラクト。任意のアドレスが、どのインターフェースをサポートし、どのコントラクトがそれを実装するかを宣言できる。ERC-1820 に置き換えられた。","ko":"모든 체인에서 같은 주소에 있는 단일 레지스트리 컨트랙트로, 어떤 주소든 자신이 어떤 인터페이스를 지원하는지, 어떤 컨트랙트가 이를 구현하는지 선언할 수 있다. ERC-1820으로 대체되었다.","zh":"一个在每条链上地址相同的单一注册表合约，任何地址都可以在其中声明自己支持哪些接口，以及由哪个合约来实现它们；已被 ERC-1820 取代。"},"tags":["registry","introspection","interfaces","superseded"],"explainers":{"en":{"lang":"en","tldr":"A single registry contract, at the same address on every chain, where any address can declare which interfaces it supports and which contract implements them; superseded by ERC-1820.","tags":["registry","introspection","interfaces","superseded"],"related":[1820,165,777,214],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/eip-820/","markdown":"## What problem does it solve?\n\n[ERC-165](/eip-165/) lets a contract answer \"do you support interface X?\". It has two limits: regular accounts (EOAs) have no code, so they cannot answer, and a contract must implement every interface itself.\n\nSome standards need both. For example, a token may want to ask \"does this recipient, EOA or contract, have a hook to be notified when it receives tokens, and where is it?\". ERC-820 provides one shared registry that answers that question for any address, and lets an address point to a separate contract that implements the interface on its behalf.\n\n## How it works\n\n**One registry everywhere.** The registry is deployed with a keyless method (often called Nick's method): a pre-signed transaction from an address whose private key nobody knows. Anyone can broadcast that same transaction on any chain, so the registry always lands at the same address, and nobody controls it.\n\n**Interfaces by name.** An interface is identified by `keccak256` of its name, e.g. `keccak256(\"ERC777TokensRecipient\")`.\n\n**Core functions:**\n\n| Function | Purpose |\n| --- | --- |\n| `setInterfaceImplementer(addr, hash, impl)` | Declare that `impl` implements `hash` for `addr`. Only the manager of `addr` may call it |\n| `getInterfaceImplementer(addr, hash)` | Look up the implementer, or zero |\n| `setManager(addr, newManager)` / `getManager(addr)` | Each address is its own manager until it delegates |\n| `interfaceHash(name)` | Helper that returns `keccak256(name)` |\n\nIf `impl` is a different contract, the registry calls `impl.canImplementInterfaceForAddress(hash, addr)` and requires it to return the magic value `keccak256(\"ERC820_ACCEPT_MAGIC\")`. That stops anyone from registering a contract that never agreed to the role.\n\n**ERC-165 bridge.** If the last 28 bytes of the hash are zero, it is treated as an ERC-165 interface ID: the registry queries the contract directly and can cache the answer.\n\n## Sample code\n\nRegistering and querying an implementer (Solidity). The same pattern applies to ERC-1820; only the registry address and magic string change.\n\n```solidity\ninterface IRegistry {\n    function setInterfaceImplementer(address addr, bytes32 iHash, address impl) external;\n    function getInterfaceImplementer(address addr, bytes32 iHash) external view returns (address);\n}\n\ncontract Recipient {\n    bytes32 constant RECIPIENT_HASH = keccak256(\"ERC777TokensRecipient\");\n\n    constructor(IRegistry registry) {\n        // A contract can register itself as its own implementer\n        registry.setInterfaceImplementer(address(this), RECIPIENT_HASH, address(this));\n    }\n}\n\n// Anyone can then check:\n// address impl = registry.getInterfaceImplementer(someAddr, keccak256(\"ERC777TokensRecipient\"));\n// if (impl != address(0)) { /* call the hook on impl */ }\n```\n\n## Things to know\n\n- **ERC-820 has been superseded by [ERC-1820](/eip-1820/).** The spec itself says ERC-1820 MUST be used instead. The Solidity 0.5 update introduced an incompatibility in the registry's ERC-165 lookup logic; ERC-1820 fixes that and is otherwise functionally the same.\n- The ERC-820 registry address starts with `0x820`; ERC-1820 has a different address. Do not hard-code the old one in new code.\n- The registry was created mainly for [ERC-777](/eip-777/) token hooks, but any standard can define interface names. Names must not collide with existing ones.\n- Keyless deployment only works because the deployment transaction deliberately does **not** use [EIP-155](/eip-155/) replay protection, and the one-time deployer address must be funded first (0.08 ETH in the spec). Chains that reject non-EIP-155 transactions cannot get the registry this way.\n"},"ja":{"lang":"ja","tldr":"すべてのチェーンで同じアドレスにある単一のレジストリコントラクト。任意のアドレスが、どのインターフェースをサポートし、どのコントラクトがそれを実装するかを宣言できる。ERC-1820 に置き換えられた。","tags":["registry","introspection","interfaces","superseded"],"related":[1820,165,777,214],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ja/eip-820/","markdown":"## 何を解決するのか\n\n[ERC-165](/eip-165/) を使えば、コントラクトは「インターフェース X をサポートしていますか？」に答えられます。ただし 2 つの制約があります。通常のアカウント（EOA）にはコードがないため答えられないこと、そしてコントラクトはすべてのインターフェースを自分で実装しなければならないことです。\n\n標準によっては、その両方が必要になります。たとえばトークンが「この受取人（EOA でもコントラクトでも）には、トークン受信時に通知を受けるフックがあるか、あるならどこか」を尋ねたい場合です。ERC-820 は、任意のアドレスについてその問いに答える共有レジストリを 1 つ提供し、アドレスがインターフェースを代理で実装する別のコントラクトを指し示せるようにします。\n\n## 仕組み\n\n**どこでも同じ 1 つのレジストリ。** レジストリは keyless な方法（Nick's method と呼ばれることが多い）でデプロイされます。これは、誰も秘密鍵を知らないアドレスからの署名済みトランザクションを使う方法です。誰でも同じトランザクションを任意のチェーンでブロードキャストできるため、レジストリは常に同じアドレスに置かれ、誰もそれを支配できません。\n\n**名前によるインターフェース指定。** インターフェースは、その名前の `keccak256` で識別されます。例: `keccak256(\"ERC777TokensRecipient\")`。\n\n**主な関数:**\n\n| 関数 | 役割 |\n| --- | --- |\n| `setInterfaceImplementer(addr, hash, impl)` | `addr` について `impl` が `hash` を実装していると宣言する。呼び出せるのは `addr` のマネージャーのみ |\n| `getInterfaceImplementer(addr, hash)` | 実装者を検索する。なければゼロ |\n| `setManager(addr, newManager)` / `getManager(addr)` | 各アドレスは、委任するまで自分自身がマネージャー |\n| `interfaceHash(name)` | `keccak256(name)` を返すヘルパー |\n\n`impl` が別のコントラクトの場合、レジストリは `impl.canImplementInterfaceForAddress(hash, addr)` を呼び出し、マジック値 `keccak256(\"ERC820_ACCEPT_MAGIC\")` を返すことを要求します。これにより、その役割に同意していないコントラクトを誰かが登録することを防ぎます。\n\n**ERC-165 との橋渡し。** ハッシュの下位 28 バイトがゼロの場合、それは ERC-165 のインターフェース ID として扱われます。レジストリはコントラクトに直接問い合わせ、その答えをキャッシュできます。\n\n## サンプルコード\n\n実装者の登録と照会（Solidity）。ERC-1820 でも同じパターンで、変わるのはレジストリのアドレスとマジック文字列だけです。\n\n```solidity\ninterface IRegistry {\n    function setInterfaceImplementer(address addr, bytes32 iHash, address impl) external;\n    function getInterfaceImplementer(address addr, bytes32 iHash) external view returns (address);\n}\n\ncontract Recipient {\n    bytes32 constant RECIPIENT_HASH = keccak256(\"ERC777TokensRecipient\");\n\n    constructor(IRegistry registry) {\n        // A contract can register itself as its own implementer\n        registry.setInterfaceImplementer(address(this), RECIPIENT_HASH, address(this));\n    }\n}\n\n// Anyone can then check:\n// address impl = registry.getInterfaceImplementer(someAddr, keccak256(\"ERC777TokensRecipient\"));\n// if (impl != address(0)) { /* call the hook on impl */ }\n```\n\n## 知っておくべきこと\n\n- **ERC-820 は [ERC-1820](/eip-1820/) に置き換えられました。** 仕様自体が、代わりに ERC-1820 を使わなければならない（MUST）と述べています。Solidity 0.5 のアップデートで、レジストリの ERC-165 照会ロジックに非互換が生じました。ERC-1820 はそれを修正しており、それ以外は機能的に同じです。\n- ERC-820 のレジストリアドレスは `0x820` で始まります。ERC-1820 は別のアドレスです。新しいコードに古いアドレスをハードコードしないでください。\n- このレジストリは主に [ERC-777](/eip-777/) のトークンフックのために作られましたが、どの標準もインターフェース名を定義できます。名前は既存のものと衝突してはいけません。\n- keyless デプロイが成立するのは、デプロイ用トランザクションが意図的に [EIP-155](/eip-155/) のリプレイ保護を**使っていない**からです。また、一回限りのデプロイヤーアドレスには先に資金を入れておく必要があります（仕様では 0.08 ETH）。EIP-155 でないトランザクションを拒否するチェーンでは、この方法でレジストリを得られません。\n"},"ko":{"lang":"ko","tldr":"모든 체인에서 같은 주소에 있는 단일 레지스트리 컨트랙트로, 어떤 주소든 자신이 어떤 인터페이스를 지원하는지, 어떤 컨트랙트가 이를 구현하는지 선언할 수 있다. ERC-1820으로 대체되었다.","tags":["registry","introspection","interfaces","superseded"],"related":[1820,165,777,214],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/ko/eip-820/","markdown":"## 어떤 문제를 해결하나요?\n\n[ERC-165](/eip-165/)를 쓰면 컨트랙트가 \"인터페이스 X를 지원하나요?\"라는 질문에 답할 수 있습니다. 여기에는 두 가지 한계가 있습니다. 일반 계정(EOA)은 코드가 없어서 답할 수 없다는 것, 그리고 컨트랙트가 모든 인터페이스를 직접 구현해야 한다는 것입니다.\n\n어떤 표준은 두 가지가 모두 필요합니다. 예를 들어 토큰이 \"이 수신자(EOA든 컨트랙트든)에게 토큰을 받을 때 알림을 받는 훅이 있나요? 있다면 어디에 있나요?\"를 묻고 싶을 수 있습니다. ERC-820은 어떤 주소에 대해서든 그 질문에 답하는 공용 레지스트리를 하나 제공하고, 주소가 자신을 대신해 인터페이스를 구현하는 별도 컨트랙트를 가리킬 수 있게 합니다.\n\n## 어떻게 동작하나요?\n\n**어디서나 하나의 레지스트리.** 레지스트리는 키리스(keyless) 방식(흔히 Nick's method라 부름)으로 배포됩니다. 아무도 개인 키를 모르는 주소가 미리 서명해 둔 트랜잭션을 쓰는 방법입니다. 누구든 같은 트랜잭션을 어떤 체인에서든 브로드캐스트할 수 있으므로 레지스트리는 항상 같은 주소에 놓이고, 아무도 이를 통제하지 못합니다.\n\n**이름으로 인터페이스 식별.** 인터페이스는 이름의 `keccak256`으로 식별됩니다. 예: `keccak256(\"ERC777TokensRecipient\")`.\n\n**핵심 함수:**\n\n| 함수 | 역할 |\n| --- | --- |\n| `setInterfaceImplementer(addr, hash, impl)` | `addr`에 대해 `impl`이 `hash`를 구현한다고 선언. `addr`의 매니저만 호출 가능 |\n| `getInterfaceImplementer(addr, hash)` | 구현자를 조회하며, 없으면 0 |\n| `setManager(addr, newManager)` / `getManager(addr)` | 각 주소는 위임하기 전까지 자기 자신이 매니저 |\n| `interfaceHash(name)` | `keccak256(name)`을 반환하는 헬퍼 |\n\n`impl`이 다른 컨트랙트라면 레지스트리는 `impl.canImplementInterfaceForAddress(hash, addr)`를 호출하고, 매직 값 `keccak256(\"ERC820_ACCEPT_MAGIC\")`을 반환하도록 요구합니다. 그 역할에 동의한 적 없는 컨트랙트를 누군가 등록하는 것을 막기 위해서입니다.\n\n**ERC-165 브리지.** 해시의 마지막 28바이트가 0이면 ERC-165 인터페이스 ID로 취급됩니다. 레지스트리는 컨트랙트에 직접 질의하며 답을 캐시할 수 있습니다.\n\n## 샘플 코드\n\n구현자 등록과 조회(Solidity). ERC-1820에도 같은 패턴이 적용되며, 레지스트리 주소와 매직 문자열만 달라집니다.\n\n```solidity\ninterface IRegistry {\n    function setInterfaceImplementer(address addr, bytes32 iHash, address impl) external;\n    function getInterfaceImplementer(address addr, bytes32 iHash) external view returns (address);\n}\n\ncontract Recipient {\n    bytes32 constant RECIPIENT_HASH = keccak256(\"ERC777TokensRecipient\");\n\n    constructor(IRegistry registry) {\n        // A contract can register itself as its own implementer\n        registry.setInterfaceImplementer(address(this), RECIPIENT_HASH, address(this));\n    }\n}\n\n// Anyone can then check:\n// address impl = registry.getInterfaceImplementer(someAddr, keccak256(\"ERC777TokensRecipient\"));\n// if (impl != address(0)) { /* call the hook on impl */ }\n```\n\n## 알아둘 점\n\n- **ERC-820은 [ERC-1820](/eip-1820/)으로 대체되었습니다.** 명세 자체가 대신 ERC-1820을 사용해야 한다(MUST)고 말합니다. Solidity 0.5 업데이트로 레지스트리의 ERC-165 조회 로직에 비호환이 생겼고, ERC-1820이 이를 고쳤으며 그 외에는 기능적으로 같습니다.\n- ERC-820 레지스트리 주소는 `0x820`으로 시작하고, ERC-1820은 다른 주소를 씁니다. 새 코드에 예전 주소를 하드코딩하지 마세요.\n- 이 레지스트리는 주로 [ERC-777](/eip-777/) 토큰 훅을 위해 만들어졌지만, 어떤 표준이든 인터페이스 이름을 정의할 수 있습니다. 이름은 기존 이름과 충돌하면 안 됩니다.\n- 키리스 배포가 가능한 것은 배포 트랜잭션이 의도적으로 [EIP-155](/eip-155/) 리플레이 보호를 **사용하지 않기** 때문이며, 일회용 배포자 주소에 먼저 자금을 넣어야 합니다(명세에서는 0.08 ETH). EIP-155가 아닌 트랜잭션을 거부하는 체인에서는 이 방식으로 레지스트리를 얻을 수 없습니다.\n"},"zh":{"lang":"zh","tldr":"一个在每条链上地址相同的单一注册表合约，任何地址都可以在其中声明自己支持哪些接口，以及由哪个合约来实现它们；已被 ERC-1820 取代。","tags":["registry","introspection","interfaces","superseded"],"related":[1820,165,777,214],"updated":"2026-10-19","url":"https://eips.huatuo.xyz/zh/eip-820/","markdown":"## 它解决什么问题？\n\n[ERC-165](/eip-165/) 让合约能够回答“你支持接口 X 吗？”。它有两个局限：普通账户（EOA）没有代码，因此无法回答；而合约必须自己实现每一个接口。\n\n有些标准两者都需要。例如，代币可能想问：“这个接收方（无论是 EOA 还是合约）有没有在收到代币时被通知的钩子？它在哪里？”ERC-820 提供一个共享的注册表，能针对任何地址回答这个问题，并允许某个地址指向另一个代表它实现该接口的合约。\n\n## 它如何运作\n\n**处处同一个注册表。** 注册表通过无密钥方式（常称 Nick's method）部署：使用一个没人知道私钥的地址预先签好的交易。任何人都可以在任何链上广播同一笔交易，因此注册表总会落在相同的地址上，且无人能控制它。\n\n**以名称标识接口。** 接口由其名称的 `keccak256` 标识，例如 `keccak256(\"ERC777TokensRecipient\")`。\n\n**核心函数：**\n\n| 函数 | 用途 |\n| --- | --- |\n| `setInterfaceImplementer(addr, hash, impl)` | 声明 `impl` 为 `addr` 实现了 `hash`。只有 `addr` 的管理者才能调用 |\n| `getInterfaceImplementer(addr, hash)` | 查询实现者，没有则返回零 |\n| `setManager(addr, newManager)` / `getManager(addr)` | 每个地址在委托之前都是自己的管理者 |\n| `interfaceHash(name)` | 返回 `keccak256(name)` 的辅助函数 |\n\n如果 `impl` 是另一个合约，注册表会调用 `impl.canImplementInterfaceForAddress(hash, addr)`，并要求它返回魔法值 `keccak256(\"ERC820_ACCEPT_MAGIC\")`。这可以防止有人注册一个从未同意担任该角色的合约。\n\n**ERC-165 桥接。** 如果哈希的最后 28 个字节为零，则视为 ERC-165 接口 ID：注册表会直接查询该合约，并可以缓存答案。\n\n## 示例代码\n\n注册和查询实现者（Solidity）。同样的模式也适用于 ERC-1820，只需更换注册表地址和魔法字符串。\n\n```solidity\ninterface IRegistry {\n    function setInterfaceImplementer(address addr, bytes32 iHash, address impl) external;\n    function getInterfaceImplementer(address addr, bytes32 iHash) external view returns (address);\n}\n\ncontract Recipient {\n    bytes32 constant RECIPIENT_HASH = keccak256(\"ERC777TokensRecipient\");\n\n    constructor(IRegistry registry) {\n        // A contract can register itself as its own implementer\n        registry.setInterfaceImplementer(address(this), RECIPIENT_HASH, address(this));\n    }\n}\n\n// Anyone can then check:\n// address impl = registry.getInterfaceImplementer(someAddr, keccak256(\"ERC777TokensRecipient\"));\n// if (impl != address(0)) { /* call the hook on impl */ }\n```\n\n## 需要注意\n\n- **ERC-820 已被 [ERC-1820](/eip-1820/) 取代。** 规范本身就说必须（MUST）改用 ERC-1820。Solidity 0.5 的更新使注册表的 ERC-165 查询逻辑出现了不兼容；ERC-1820 修复了这一点，其余功能上相同。\n- ERC-820 注册表的地址以 `0x820` 开头；ERC-1820 的地址不同。不要在新代码中硬编码旧地址。\n- 该注册表主要为 [ERC-777](/eip-777/) 的代币钩子而创建，但任何标准都可以定义接口名称。名称不得与已有名称冲突。\n- 无密钥部署之所以可行，是因为部署交易有意**不**使用 [EIP-155](/eip-155/) 的重放保护，并且一次性的部署者地址必须先充值（规范中为 0.08 ETH）。拒绝非 EIP-155 交易的链无法通过这种方式获得该注册表。\n"}}}
