Skip to main content

Try it Live

Run ENS examples in the interactive playground
Conceptual Guide - For API reference and method documentation, see ENS API.
ENS (Ethereum Name Service) is the decentralized naming system for Ethereum. This guide teaches ENS fundamentals using Tevm.

What is ENS?

ENS provides human-readable names for Ethereum addresses, content hashes, and other resources. Instead of 0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb2, use vitalik.eth. ENS operates on-chain via smart contracts - no centralized DNS servers. Names are NFTs (ERC-721) that can be owned, transferred, and renewed.

Why ENS Exists

Addresses are hostile to humans:
  • 42 hex characters are error-prone
  • No way to verify correctness by inspection
  • Difficult to share verbally or remember
Names solve this:
  • alice.eth0x1234...
  • token.uniswap.eth → Contract address
  • dao.eth → IPFS content hash

Name Structure

ENS names are hierarchical labels separated by dots, read right-to-left:

Labels

  • Separated by . (U+002E FULL STOP)
  • Can contain letters, numbers, emoji, non-Latin scripts
  • Maximum 255 characters per label
  • Must be normalized before use (see below)

Hierarchy

  • .eth - Primary ENS TLD (controlled by ENS DAO)
  • name.eth - Second-level domain (what users register)
  • subdomain.name.eth - Unlimited subdomains (owner controls)

Normalization

Critical: ENS names must be normalized to prevent homograph attacks and ensure canonical representation.

Normalization Process

  1. Lowercase - Convert ASCII uppercase to lowercase (A-Za-z)
  2. Unicode NFC - Normalize to composed form (é not e + ´)
  3. UTS-46 Processing - Map/disallow characters per Unicode standard
  4. Script Validation - Reject mixed scripts (e.g., Latin + Cyrillic)
  5. Confusable Detection - Reject characters that look identical

Name Resolution

ENS resolution is a multi-step process from human-readable name to on-chain data:

1. Normalize Name

2. Compute Namehash

Namehash converts names to deterministic 32-byte identifiers:
Namehash Algorithm:

3. Lookup Resolver

Query ENS registry for resolver contract address:

4. Query Records

Call resolver contract for specific data:

Complete Example

Common Use Cases

Wallet Addresses

Most common ENS usage - map names to Ethereum addresses:

Content Hashes

Point names to IPFS content:

Text Records

Store arbitrary key-value data:

Reverse Resolution

Resolve addresses back to primary ENS name:

Security

Homograph Attacks

Problem: Visually identical characters from different scripts

Confusable Characters

Problem: Characters that look similar (I vs l vs 1)

Best Practices

  1. Always normalize before use
  2. Display normalized form to users
  3. Validate on both client and server
  4. Use beautify for display, normalize for logic

Resources

Next Steps