Introduction
Hi, I'm cardene, a software engineer and technical writer focused on blockchain and AI.
I've also authored Japanese technical books on specification-driven development with LLMs and decentralized application (DApp) development.
I also build and publish a variety of tools, libraries, and open-source projects.
This article examines ENSIP-3, which defines a mechanism for associating Ethereum addresses with names that wallets and applications can display.
The explanation below translates, summarizes, and expands on the original proposal.
I also cover a range of EIPs, BIPs, SLIPs, CAIPs, and ENSIPs.
Overview
ENSIP-3 specifies reverse resolution in the Ethereum Name Service (ENS). It defines a reserved domain, a registrar, and a resolver interface through which Ethereum addresses can be associated with human-readable names. The registration mechanism allows reverse records to be established under the authority of the corresponding address.
Motivation
Conventional ENS forward resolution translates a human-readable name into a machine-readable address. Reverse resolution is useful for several complementary purposes.
- Improved user experience Wallets and applications can display a recognizable ENS name in an account list instead of displaying only a long hexadecimal address.
- Associated metadata Descriptions and other records associated with an address can provide context about its intended use, regardless of how the address was originally obtained.
- Authenticating an address's preferred name In forward resolution, a name owner can point a name to an address belonging to someone else. Reverse resolution allows an address controller to designate a preferred name. Applications must also resolve that name forward and confirm that it returns the original address before displaying it as verified.
Specification
Where reverse records are stored
ENS reverse records are stored within the ENS hierarchy, like ordinary records, but under the reserved domain addr.reverse.
An Ethereum address is represented as lowercase hexadecimal without the 0x prefix, followed by .addr.reverse.
For example, the reverse record for the ENS registry address 0x112234455c3a32fd11230c42e7bccd4a84e02010 is located under the following name.
112234455c3a32fd11230c42e7bccd4a84e02010.addr.reverseA contract performing dynamic reverse resolution therefore needs a mechanism for converting an address into lowercase hexadecimal or directly computing the corresponding namehash.
Registrar
The owner of the addr.reverse domain is a registrar contract that allows callers to claim their corresponding reverse records.
It provides the following functions.
claim
function claim(address owner) returns (bytes32 node)For a caller with address x, this function transfers ownership of the ENS node corresponding to hex(x) + ".addr.reverse" to the specified owner, and returns its namehash.
A contract can use this function from its constructor to assign ownership of its reverse record.
reverseRegistrar.claim(msg.sender)claimWithResolver
function claimWithResolver(address owner, address resolver) returns (bytes32 node)Sets the resolver for the caller's reverse record to the specified resolver and transfers ownership to owner.
This enables an owner and a custom resolver to be configured within a single call.
setName
function setName(string name) returns (bytes32 node)Configures the default resolver and associates the specified name with the caller's reverse record, corresponding to hex(x) + ".addr.reverse".
It provides a convenient way to configure a simple reverse record in one transaction.
Resolver interface
The following resolver interface is defined for reverse name records.
function name(bytes32 node) constant returns (string);This function returns the ENS name recorded for the specified node. If no name has been configured, it returns an empty string.
Its interface ID is 0x691f3431.
Future ENSIPs may introduce additional reverse record types.
Registrar reference implementation
pragma solidity ^0.4.10;
import "./AbstractENS.sol";
contract Resolver {
function setName(bytes32 node, string name) public;
}
/**
* @dev Provides a default implementation of a resolver for reverse records,
* which permits only the owner to update it.
*/
contract DefaultReverseResolver is Resolver {
AbstractENS public ens;
mapping(bytes32=>string) public name;
/**
* @dev Constructor
* @param ensAddr The address of the ENS registry.
*/
function DefaultReverseResolver(AbstractENS ensAddr) {
ens = ensAddr;
}
/**
* @dev Only permits calls by the reverse registrar.
* @param node The node permission is required for.
*/
modifier owner_only(bytes32 node) {
require(msg.sender == ens.owner(node));
_;
}
/**
* @dev Sets the name for a node.
* @param node The node to update.
* @param _name The name to set.
*/
function setName(bytes32 node, string _name) public owner_only(node) {
name[node] = _name;
}
}
contract ReverseRegistrar {
// namehash('addr.reverse')
bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;
AbstractENS public ens;
Resolver public defaultResolver;
/**
* @dev Constructor
* @param ensAddr The address of the ENS registry.
* @param resolverAddr The address of the default reverse resolver.
*/
function ReverseRegistrar(AbstractENS ensAddr, Resolver resolverAddr) {
ens = ensAddr;
defaultResolver = resolverAddr;
}
/**
* @dev Transfers ownership of the reverse ENS record associated with the
* calling account.
* @param owner The address to set as the owner of the reverse record in ENS.
* @return The ENS node hash of the reverse record.
*/
function claim(address owner) returns (bytes32 node) {
return claimWithResolver(owner, 0);
}
/**
* @dev Transfers ownership of the reverse ENS record associated with the
* calling account.
* @param owner The address to set as the owner of the reverse record in ENS.
* @param resolver The address of the resolver to set; 0 to leave unchanged.
* @return The ENS node hash of the reverse record.
*/
function claimWithResolver(address owner, address resolver) returns (bytes32 node) {
var label = sha3HexAddress(msg.sender);
node = sha3(ADDR_REVERSE_NODE, label);
var currentOwner = ens.owner(node);
// Update the resolver if required
if(resolver != 0 && resolver != ens.resolver(node)) {
// Transfer the name to us first if it's not already
if(currentOwner != address(this)) {
ens.setSubnodeOwner(ADDR_REVERSE_NODE, label, this);
currentOwner = address(this);
}
ens.setResolver(node, resolver);
}
// Update the owner if required
if(currentOwner != owner) {
ens.setSubnodeOwner(ADDR_REVERSE_NODE, label, owner);
}
return node;
}
/**
* @dev Sets the `name()` record for the reverse ENS record associated with
* the calling account. First updates the resolver to the default reverse
* resolver if necessary.
* @param name The name to set for this address.
* @return The ENS node hash of the reverse record.
*/
function setName(string name) returns (bytes32 node) {
node = claimWithResolver(this, defaultResolver);
defaultResolver.setName(node, name);
return node;
}
/**
* @dev Returns the node hash for a given account's reverse records.
* @param addr The address to hash
* @return The ENS node hash.
*/
function node(address addr) constant returns (bytes32 ret) {
return sha3(ADDR_REVERSE_NODE, sha3HexAddress(addr));
}
/**
* @dev An optimised function to compute the sha3 of the lower-case
* hexadecimal representation of an Ethereum address.
* @param addr The address to hash
* @return The SHA3 hash of the lower-case hexadecimal encoding of the
* input address.
*/
function sha3HexAddress(address addr) private returns (bytes32 ret) {
addr; ret; // Stop warning us about unused variables
assembly {
let lookup := 0x3031323334353637383961626364656600000000000000000000000000000000
let i := 40
loop:
i := sub(i, 1)
mstore8(i, byte(and(addr, 0xf), lookup))
addr := div(addr, 0x10)
i := sub(i, 1)
mstore8(i, byte(and(addr, 0xf), lookup))
addr := div(addr, 0x10)
jumpi(loop, i)
ret := sha3(0, 40)
}
}
}The following explanation describes the historical Solidity reference implementation rather than a current deployment.
Variables
ens
AbstractENS public ens;A reference to the ENS registry contract. It is used to retrieve or update information about the owners and resolvers of reverse nodes.
Parameter
ens- The ENS registry contract reference.
name
mapping(bytes32=>string) public name;A mapping that stores a name string for each ENS node. Nodes are identified by their namehash, which serves as the key used to retrieve the corresponding human-readable name.
Parameters
bytes32- The ENS node hash.
string- The name associated with the node.
ADDR_REVERSE_NODE
bytes32 constant ADDR_REVERSE_NODE = 0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2;A constant containing the namehash of the addr.reverse domain.
ENS reverse records are stored beneath this domain, whose hash is fixed by the naming hierarchy.
Parameter
ADDR_REVERSE_NODE- The namehash of
addr.reverse.
- The namehash of
defaultResolver
Resolver public defaultResolver;Stores the default reverse resolver.
A default resolver allows users to configure names conveniently through the setName function.
Parameter
defaultResolver- A reference to the default Reverse Resolver contract.
Modifiers
owner_only
modifier owner_only(bytes32 node) {
require(msg.sender == ens.owner(node));
_;
}Restricts an operation to the owner of an ENS node. It checks whether the caller matches the owner returned by the ENS registry. This prevents unauthorized accounts from updating the relevant record.
Parameter
node- The hash of the ENS node being modified.
Functions
DefaultReverseResolver
function DefaultReverseResolver(AbstractENS ensAddr) {
ens = ensAddr;
}The constructor of the historical DefaultReverseResolver contract.
It accepts an ENS registry reference and stores it in ens.
Arguments
ensAddr- The ENS registry contract address.
setName
function setName(bytes32 node, string _name) public owner_only(node) {
name[node] = _name;
}Sets the name associated with a specified node. Only the node's owner can call this function. The supplied human-readable name is stored in the resolver.
Arguments
node- The ENS node hash.
_name- The name to store.
ReverseRegistrar
function ReverseRegistrar(AbstractENS ensAddr, Resolver resolverAddr) {
ens = ensAddr;
defaultResolver = resolverAddr;
}The constructor of the historical ReverseRegistrar contract. It receives references to the ENS registry and default reverse resolver and stores them internally.
Arguments
ensAddr- The ENS registry contract address.
resolverAddr- The default reverse resolver contract address.
claim
function claim(address owner) returns (bytes32 node) {
return claimWithResolver(owner, 0);
}Transfers ownership of the caller's reverse record to the specified owner.
It delegates the operation to claimWithResolver.
Arguments
owner- The new owner of the reverse record.
Return value
node- The hash of the corresponding ENS node.
claimWithResolver
function claimWithResolver(address owner, address resolver) returns (bytes32 node) {
var label = sha3HexAddress(msg.sender);
node = sha3(ADDR_REVERSE_NODE, label);
var currentOwner = ens.owner(node);
if(resolver != 0 && resolver != ens.resolver(node)) {
if(currentOwner != address(this)) {
ens.setSubnodeOwner(ADDR_REVERSE_NODE, label, this);
currentOwner = address(this);
}
ens.setResolver(node, resolver);
}
if(currentOwner != owner) {
ens.setSubnodeOwner(ADDR_REVERSE_NODE, label, owner);
}
return node;
}Configures ownership and, when requested, the resolver of the caller's reverse node. It derives the node from the caller's address and transfers ownership to the specified owner.
Arguments
owner- The new owner address.
resolver- The resolver address to configure. A zero address leaves the resolver unchanged in this example.
Return value
node- The hash of the ENS node being configured.
setName
function setName(string name) returns (bytes32 node) {
node = claimWithResolver(this, defaultResolver);
defaultResolver.setName(node, name);
return node;
}Sets the name associated with the caller's reverse record.
It uses the default reverse resolver to store the name.
Internally, it invokes claimWithResolver to establish the necessary node ownership and resolver configuration.
Arguments
name- The name to register.
Return value
node- The ENS node hash.
node
function node(address addr) constant returns (bytes32 ret) {
return sha3(ADDR_REVERSE_NODE, sha3HexAddress(addr));
}Returns the namehash of the reverse record associated with a specified Ethereum address. It hashes the lowercase hexadecimal address label and combines it with the parent node hash.
Arguments
addr- The Ethereum address being queried.
Return value
ret- The calculated reverse ENS node hash.
sha3HexAddress
function sha3HexAddress(address addr) private returns (bytes32 ret) {
addr; ret;
assembly {
let lookup := 0x3031323334353637383961626364656600000000000000000000000000000000
let i := 40
loop:
i := sub(i, 1)
mstore8(i, byte(and(addr, 0xf), lookup))
addr := div(addr, 0x10)
i := sub(i, 1)
mstore8(i, byte(and(addr, 0xf), lookup))
addr := div(addr, 0x10)
jumpi(loop, i)
ret := sha3(0, 40)
}
}Converts an Ethereum address into lowercase hexadecimal and hashes the resulting string.
The historical implementation uses EVM assembly to perform the conversion efficiently and compute the label hash required for ENS namehash calculation.
The Solidity sha3 terminology in this example refers to Ethereum's Keccak-256 hash function.
Arguments
addr- The Ethereum address.
Return value
ret- The Keccak-256 hash of the lowercase hexadecimal address label.
Conclusion
This article covered ENSIP-3, a proposal for associating Ethereum addresses with human-readable names through reverse resolution. Applications should verify that a returned reverse name also resolves forward to the original address before treating it as a verified name.
If you have questions, feel free to reach out via Twitter DM.
I also publish on the following platforms.


