---
eip: 820
label: ERC-820
title: Pseudo-introspection Registry Contract
status: Final
type: Standards Track
category: ERC
created: 2018-01-05
requires: 165, 214
official: https://eips.ethereum.org/EIPS/eip-820
source: https://github.com/ethereum/ERCs/blob/master/ERCS/erc-820.md
canonical: https://eips.huatuo.xyz/eip-820/
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]
---

# ERC-820: Pseudo-introspection Registry Contract

> 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.

**TL;DR:** 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.

## What problem does it solve?

[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.

Some 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.

## How it works

**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.

**Interfaces by name.** An interface is identified by `keccak256` of its name, e.g. `keccak256("ERC777TokensRecipient")`.

**Core functions:**

| Function | Purpose |
| --- | --- |
| `setInterfaceImplementer(addr, hash, impl)` | Declare that `impl` implements `hash` for `addr`. Only the manager of `addr` may call it |
| `getInterfaceImplementer(addr, hash)` | Look up the implementer, or zero |
| `setManager(addr, newManager)` / `getManager(addr)` | Each address is its own manager until it delegates |
| `interfaceHash(name)` | Helper that returns `keccak256(name)` |

If `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.

**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.

## Sample code

Registering and querying an implementer (Solidity). The same pattern applies to ERC-1820; only the registry address and magic string change.

```solidity
interface IRegistry {
    function setInterfaceImplementer(address addr, bytes32 iHash, address impl) external;
    function getInterfaceImplementer(address addr, bytes32 iHash) external view returns (address);
}

contract Recipient {
    bytes32 constant RECIPIENT_HASH = keccak256("ERC777TokensRecipient");

    constructor(IRegistry registry) {
        // A contract can register itself as its own implementer
        registry.setInterfaceImplementer(address(this), RECIPIENT_HASH, address(this));
    }
}

// Anyone can then check:
// address impl = registry.getInterfaceImplementer(someAddr, keccak256("ERC777TokensRecipient"));
// if (impl != address(0)) { /* call the hook on impl */ }
```

## Things to know

- **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.
- The ERC-820 registry address starts with `0x820`; ERC-1820 has a different address. Do not hard-code the old one in new code.
- 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.
- 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.


---

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