Skip to main content
Skill — Copyable reference implementation. Use as-is or customize. See Skills Philosophy.

ENS Resolution

Resolve Ethereum Name Service (ENS) names to addresses and retrieve ENS records using Voltaire primitives and Contract modules.

Overview

ENS resolution requires two components:
  1. Ens module - Name validation, normalization, and namehash computation
  2. Contract module - Interacting with ENS registry and resolver contracts

Contract Addresses (Mainnet)

ContractAddress
ENS Registry0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e
Public Resolver0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63
Reverse Registrar0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb

Resolving ENS Name to Address

Reverse Resolution (Address to ENS)

Reverse resolution looks up the primary ENS name for an address.
Always verify forward resolution when doing reverse lookups. A user can set any name as their reverse record, but only the verified forward resolution is authoritative.

Getting ENS Records

ENS supports various text records like avatar, email, URL, and custom records.

Common Text Record Keys

KeyDescription
avatarNFT or URL for profile image
urlWebsite URL
descriptionProfile description
emailEmail address
com.twitterTwitter/X handle
com.githubGitHub username
com.discordDiscord username
noticeLegal notice

ENS Name Validation

Validate ENS names before resolution to prevent homograph attacks.
Always normalize ENS names before computing namehash. Names like “Vitalik.eth” and “vitalik.eth” have different namehashes if not normalized first.

Computing Namehash

The namehash is a recursive hash used to identify ENS names on-chain.

Full Resolution Helper

A complete helper function combining all functionality:

L2 ENS Resolution

For L2 networks, use the same contract addresses but connect to an L1 provider for resolution, or use CCIP-read compatible resolvers.

See Also