ERC-926 Address Metadata Registry
Stagnant · Names & metadata · created 2018-03-12
A standard that lets contracts and external accounts register a metadata provider address for themselves in a single shared registry, so that anyone can look it up on-chain or off-chain.
Why it is needed
The uses for address metadata keep growing, but right now a new dedicated registry contract is built for each use case. For example, EIP777 (which handles token receipt conditions), EIP780 (which handles claim information), and EIP181 (the ENS reverse registry) all use separate registries. As these special-purpose registries keep multiplying, callers have to learn a different registry address and lookup method for each use case, and new contracts must be deployed every time a new use case arises, driving up duplication and integration cost.
What to implement
function provider(address target) view returns(address);: Returns the address of the metadata provider registered for the given address (target).function setProvider(address _provider);: Specifies the metadata provider address to associate with the caller's (msg.sender) address.function supportsInterface(bytes4 interfaceID) constant returns (bool): Returns whether the provider supports the functionality corresponding to the given interface ID.
In depth
Registry interface
The registry itself is a simple indirection structure with only two functions: provider(address target) and setProvider(address _provider). setProvider stores the address of the provider contract that will actually supply metadata for the caller's (msg.sender) address, and provider(target) returns the provider address registered for any given address. The reference implementation handles this with a single mapping(address=>address) public provider.
Fixed-Address Deployment
The registry is compiled with an agreed-upon version of Solidity and deployed at the same fixed address on every chain via a trustless deployment mechanism. This means the registry can be looked up at the same address regardless of which chain you are on.
Rules Providers Must Follow
A provider may implement only a subset of the metadata record types defined in this document. However, if a given record type's specification requires multiple functions, it must implement either all of them or none of them. If called with a function ID it does not support, the provider must throw.
EIP-165-Based Support Checking
Every provider must implement supportsInterface(bytes4 interfaceID). The interface ID is the XOR of the signature hashes of the functions belonging to that interface; for an interface with only one function, it equals that function's signature hash. If a provider returns true from supportsInterface(), it must actually implement that interface's functions, and supportsInterface must always return true for its own interface ID, 0x01ffc9a7.
Lookup Target Address as the First Argument
It is specified that the first argument of every provider function must be the address being looked up. This rule allows a single provider contract to act as a multi-user provider, handling metadata for multiple users at once.
The List of Standardized Interfaces Is Empty
The original document presents a table of 'currently standardized provider interfaces,' but the interface name, hash, and specification columns are all empty. The registry is designed to be extended by having other EIPs define new interfaces and add them to this table.
Design Rationale: Choosing Indirection
There were two ways to build a general-purpose metadata registry: a key/value store approach and an indirection approach. Indirection adds the cost of an extra contract call per lookup and requires changing the provider over time, but it was chosen because it is far more flexible than a key/value store.
Proposal status
This proposal is currently in Stagnant status, meaning discussion on it has stalled.