ENS Logo

Reverse Registrar

Reverse resolution in ENS - the process of mapping from an Ethereum address (eg, 0x1234...) to an ENS name - is handled using a special namespace, .addr.reverse. A special-purpose registrar controls this namespace and allocates subdomains to any caller based on their address. The reverse registrar is specified in EIP 181.

For example, the account 0x314159265dd8dbb310642f98f50c066173c1259b can claim 314159265dd8dbb310642f98f50c066173c1259b.addr.reverse. After doing so, it can configure a resolver and expose metadata, such as a canonical ENS name for this address.

The reverse registrar provides functions to claim a reverse record, as well as a convenience function (setName) to configure the record as it's most commonly used, as a way of specifying a canonical name for an address.

Lookup Primary Name

If you are interested in querying the primary name for an address you can checkout the web section.

Set Primary Name

function setName(string memory name) public returns (bytes32)

Configures the caller's reverse ENS record to point to the provided name.

This convenience function streamlines the process of setting up a reverse record for the common case where a user only wants to configure a reverse name and nothing else. It performs the following steps:

  1. Sets the reverse record for the caller to be owned by the ReverseRegistrar.
  2. Sets the reverse record for the caller to have defaultResolver as its resolver.
  3. Sets the name() field in the defaultResolver for the caller's reverse record to name.

In short, after calling this, a user has a fully configured reverse record claiming the provided name as that account's canonical name.

Users wanting more flexibility will need to use claim or claimWithResolver and configure records manually on their chosen resolver contract.

Multichain Considerations

The current infrastructure for primary names across multiple chains is being worked on.

Other Functions

Claim Address

function claim(address owner) public returns (bytes32);

Claims the caller's address in the reverse registrar, assigning ownership of the reverse record to owner. Equivalent to calling claimWithResolver(owner, 0).

function claimWithResolver(address owner, address resolver) public returns (bytes32)

Claims the caller's address in the reverse registrar, assigning ownership of the reverse record to owner. If resolver is nonzero, also updates the record's resolver.

After calling this function:

  • The reverse record for the caller (1234....addr.reverse) is owned by owner.
  • If resolver is nonzero, the reverse record for the caller has its resolver set to resolver; otherwise it is left unchanged.

Get Default Resolver

Resolver public defaultResolver;

Returns the address of the resolver contract that the ReverseRegistrar uses for setName.

Last Modified
3 months ago