Reverse Resolution

Reverse resolution is the process of resolving an address to a domain name. EIP-181 specifies a TLD, registrar, and resolver interface for reverse resolution.

Reverse BNS records are stored in the BNS hierarchy in the same fashion as regular records, under a reserved domain, addr.reverse. To generate the BNS name for a given account’s reverse records, convert the account to hexadecimal representation in lower-case, and append addr.reverse. For instance, the BNS registry’s address at 0xB0eef18971290b333450586D33dcA6cE122651D2 has any reverse records stored at 112234455c3a32fd11230c42e7bccd4a84e02010.addr.reverse.

Reverse Registrar

The owner of the addr.reverse domain is the reverse registrar that permits the caller to take ownership of the reverse record for their own address. In order to take ownership of the reverse record for their own address, the caller can call the claim function of the reverse registrar with the desired name.

   reverseRegistrar.claim(address owner) public returns (bytes32 node)

where owner is the address to claim the reverse record for.

Or the caller can claim the reverse record for any address by directly calling the SetName function of the reverse registrar.

   reverseRegistrar.setName(string name) public returns (bytes32 node)

When called by account x, sets the resolver for the name hex(x) + '.addr.reverse' to a default resolver, and sets the name record on that name to the specified name. This method facilitates setting up simple reverse records for users in a single transaction.

Reverse Resolving

Once the reverse record is claimed, the caller can use the resolver to lookup the name associated with the address.

   resolver.name(bytes32 node) view returns (string)

where node is the reverse record node obtained from the reverse registrar calling:

   reverseRegistrar.node(address owner) view returns (bytes32)

Last updated