Skip to main content

What are Resolvers?

Resolvers are smart contracts that store and return information associated with ENS names. When you look up an ENS name, the ENS registry points to a resolver contract, which then provides the actual data (addresses, content hashes, text records, etc.). The resolver system is designed to be flexible and extensible through a profile-based architecture, where each profile implements specific functionality defined in various EIPs (Ethereum Improvement Proposals).

PublicResolver

The PublicResolver is the most commonly used resolver implementation in ENS. It provides a general-purpose resolver suitable for most standard ENS use cases. The PublicResolver permits updates to ENS records by the owner of the corresponding name.

Key Features

  • Multi-profile support: Implements multiple resolver profiles for different data types
  • Authorization system: Supports operators and delegates for managing records
  • Multicallable: Batch multiple operations in a single transaction
  • Versioning: Records are versioned to prevent stale data

Authorization

The PublicResolver includes a sophisticated authorization system:
  • Operators: An address authorized for an owner may make any changes to names owned by that address
  • Delegates: A delegate authorized by an owner for a specific name may make changes to that name’s resolver records
  • Trusted controllers: Special addresses (ETH Registrar Controller, Reverse Registrar) that have elevated permissions
// Approve an operator for all your names
resolver.setApprovalForAll(operatorAddress, true);

// Approve a delegate for a specific name
resolver.approve(node, delegateAddress, true);

Resolver Profiles

The PublicResolver implements the following profiles, each corresponding to specific EIPs:

ABIResolver

EIP-205: Store contract ABIs

AddrResolver

EIP-137, EIP-2304: Address resolution and multicoin support

ContentHashResolver

EIP-1577: IPFS and other content hashes

DNSResolver

DNS record support for ENS names

InterfaceResolver

EIP-165: Interface detection

NameResolver

EIP-181: Reverse resolution

PubkeyResolver

EIP-619: SECP256k1 public keys

TextResolver

EIP-634: Arbitrary text records

Basic Usage

Setting a Resolver

Before using a resolver, you must set it in the ENS registry:
// Set the PublicResolver for your name
ens.setResolver(node, publicResolverAddress);

Reading from a Resolver

// Get the resolver for a name
address resolverAddress = ens.resolver(node);
Resolver resolver = Resolver(resolverAddress);

// Read an address
address ethAddress = resolver.addr(node);

// Read a text record
string memory email = resolver.text(node, "email");

// Read a content hash
bytes memory hash = resolver.contenthash(node);

Writing to a Resolver

// Must be called by the name owner, operator, or delegate
PublicResolver resolver = PublicResolver(resolverAddress);

// Set an Ethereum address
resolver.setAddr(node, myAddress);

// Set a text record
resolver.setText(node, "email", "[email protected]");

// Set a content hash
resolver.setContenthash(node, ipfsHash);

ResolverBase

All resolver profiles inherit from ResolverBase, which provides:
  • Record versioning: Each node has a version number that increments when records are cleared
  • Authorization: Abstract isAuthorised() method that implementations must define
  • EIP-165 support: Interface detection capability
// Clear all records for a name (increments version)
resolver.clearRecords(node);
Clearing records increments the version number, effectively invalidating all previous records for that name without explicitly deleting them.

Supported EIPs

The ENS resolver system implements the following Ethereum Improvement Proposals:
  • EIP-137: Ethereum Domain Name Service
  • EIP-165: Standard Interface Detection
  • EIP-181: Reverse ENS resolution
  • EIP-205: ENS support for contract ABIs
  • EIP-619: ENS support for SECP256k1 public keys
  • EIP-634: ENS support for text records
  • EIP-1577: ENS support for content hashes
  • EIP-2304: ENS support for multichain addresses

Next Steps

PublicResolver

Learn about the PublicResolver contract in detail

Resolver Profiles

Explore each resolver profile and its functions

Build docs developers (and LLMs) love