Skip to main content

ENS Contracts

Welcome to the ENS Contracts documentation. This package provides compiled smart contracts for the Ethereum Name Service (ENS), enabling human-readable names for Ethereum addresses and resources.

What is ENS?

The Ethereum Name Service (ENS) is a distributed, open, and extensible naming system based on the Ethereum blockchain. ENS maps human-readable names like ‘alice.eth’ to machine-readable identifiers such as Ethereum addresses, content hashes, and metadata.

Key Features

Registry Contracts

Core contracts for domain ownership and resolution

.eth Registrar

Contracts for registering and managing .eth domains

Resolvers

Smart contracts for resolving ENS names to resources

L2 Support

Layer 2 deployment and reverse registration

Package Overview

This repository doubles as an npm package with compiled JSON contracts, allowing you to:
  • Import contract ABIs and bytecode in JavaScript/TypeScript projects
  • Import Solidity contracts directly into your smart contracts
  • Access raw Hardhat artifacts for custom integrations
For complete ENS system documentation, visit docs.ens.domains

Contract Categories

Registry

The ENS registry is the core contract that lies at the heart of ENS resolution. All ENS lookups start by querying the registry. The registry maintains a list of domains, recording the owner, resolver, and TTL for each. Available Contracts:
  • ENS.sol - Interface of the ENS Registry
  • ENSRegistry - Implementation of the ENS Registry
  • ENSRegistryWithFallback - Registry implementation after the 2020 migration
  • ReverseRegistrar - Manages reverse resolution via .addr.reverse
  • TestRegistrar - Test registrar for .test TLD on testnets

EthRegistrar

Implements an ENS registrar for the .eth TLD with features including:
  • Controller-based registration system
  • Commit/reveal process to prevent frontrunning
  • Flexible pricing oracles
  • Bulk renewal capabilities
Available Contracts:
  • BaseRegistrar & BaseRegistrarImplementation - Core .eth registrar
  • ETHRegistrarController - Registration controller with commit/reveal
  • BulkRenewal - Renew multiple domains in one transaction
  • StablePriceOracle - Fiat-pegged pricing oracle
  • LinearPremiumPriceOracle - Premium pricing for recently expired domains

Resolvers

Resolvers implement various ENS profiles and EIPs:
  • EIP 137 - Contract address interface
  • EIP 165 - Interface detection
  • EIP 181 - Reverse resolution
  • EIP 205 - ABI support
  • EIP 619 - Public key support
  • EIP 634 - Text records
  • EIP 1577 - Content hash support
  • EIP 2304 - Multicoin support

L2 Contracts

The L2ReverseRegistrar and UniversalSigValidator contracts enable ENS functionality on Layer 2 networks with multi-chain signature support.

Next Steps

Installation

Install the package using npm, yarn, or bun

Quick Start

Get started with importing and using ENS contracts

Build docs developers (and LLMs) love