Overview
The ENS v2 devnet is a local Ethereum development network pre-configured with all ENS v2 contracts deployed. It’s perfect for:- Testing contract integrations
- Developing dApps against ENS v2
- Running end-to-end tests
- Experimenting with ENS v2 features
Quick Start
Native Local Devnet (Recommended)
Start the devnet using the built-in script:- Compile all contracts
- Start Anvil on
http://localhost:8545 - Deploy all ENS v2 contracts
- Deploy ENS v1 contracts (for migration testing)
- Set up test names and resolvers
- Start a health check endpoint on port 8000
Chain ID:
31337 (default Anvil chain ID)Using Docker Compose
For a containerized devnet:Ensure Docker is installed
Download from docker.com
Devnet Configuration
Network Details
| Property | Value |
|---|---|
| RPC URL | http://localhost:8545 |
| WebSocket URL | ws://localhost:8545 |
| Chain ID | 31337 (0xeeeeed for custom deployments) |
| Native Currency | ETH |
| Block Time | Instant (on transaction) |
| Health Check | http://localhost:8000 |
Pre-funded Accounts
The devnet includes several pre-funded accounts derived from the test mnemonic:| Name | Address | Purpose |
|---|---|---|
| deployer | 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 | Contract deployer |
| owner | 0x70997970C51812dc3A010C7d01b50e0d17dc79C8 | Owner of registry roots |
| bridger | 0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC | Cross-chain bridge account |
| user | 0x90F79bf6EB2c4f870365E785982E1f101E93b906 | General test user |
| user2 | 0x15d34AAf54267DB7D7c367839AAf71A00a2C6A65 | Secondary test user |
Deployed Contracts
When the devnet starts, it displays a table of all deployed contracts. Key contracts include:Core Contracts
- RootRegistry: ENS v2 root registry
- ETHRegistry: Registry for
.ethTLD - ETHRegistrar: Registrar for
.ethnames - UniversalResolverV2: Universal resolver for ENS v2
- RegistryDatastore: Singleton storage for all registries (implied)
Factory Contracts
- HCAFactory: Factory for creating hierarchical registries
- VerifiableFactory: Factory for UUPS proxies
- SimpleRegistryMetadata: Metadata provider for registries
Implementation Contracts
- PermissionedResolverImpl: Implementation for permissioned resolvers
- UserRegistryImpl: Implementation for user-owned registries
- WrapperRegistryImpl: Implementation for wrapped registries
ENS v1 Contracts (for migration testing)
- ENSRegistryV1: ENS v1 registry
- ETHRegistrarV1: ENS v1 .eth registrar (BaseRegistrar)
- NameWrapperV1: ENS v1 Name Wrapper
- PublicResolverV1: ENS v1 Public Resolver
- UniversalResolverV1: ENS v1 Universal Resolver
Utility Contracts
- StandardRentPriceOracle: Price oracle for registrations
- MockUSDC: Mock USDC token for testing
- MockDAI: Mock DAI token for testing
- BatchGatewayProvider: Gateway provider for CCIP-Read
Working with the Devnet
Using Cast
Interact with the devnet using Foundry’scast:
Using viem/ethers
Connect from JavaScript/TypeScript:Using MetaMask
Add the devnet to MetaMask:Enter network details
- Network Name: ENS v2 Devnet
- RPC URL:
http://localhost:8545 - Chain ID:
31337 - Currency Symbol: ETH
Advanced Configuration
Custom Chain ID
Modifyscript/setup.ts to use a custom chain ID:
Custom Port
The devnet script accepts a--port parameter (when called programmatically). For Docker, modify docker-compose.yml:
Additional Test Names
Enable pre-registration of test names:Deployment Artifacts
By default, the devnet saves deployment artifacts todeployments/devnet-local/. These include:
- Contract addresses
- ABIs
- Transaction receipts
- Deployment metadata
Devnet API
ThesetupDevnet function returns a rich environment object:
Time Travel
Warp time forward on the devnet:State Snapshots
Save and restore blockchain state:Helper Methods
Deploy custom contracts:Docker Configuration
The devnet Dockerfile performs the following steps:Build contracts
- Compiles ENS v1 contracts (
lib/ens-contracts) - Compiles ENS v2 contracts with Forge and Hardhat
Environment Variables
| Variable | Default | Description |
|---|---|---|
ANVIL_IP_ADDR | 0.0.0.0 | Anvil bind address |
BATCH_GATEWAY_URLS | ["x-batch-gateway:true"] | CCIP-Read gateway URLs |
FOUNDRY_DISABLE_NIGHTLY_WARNING | true | Disable Foundry warnings |
Troubleshooting
Port Already in Use
If port 8545 is already in use:Devnet Won’t Start
Ensure all contracts are compiled:lib/ens-contracts is compiled:
Connection Refused
Wait for the devnet to fully start. Look for the “Ready!” message:Docker Container Issues
View container logs:Reset State
The devnet state persists only in memory. Restart to reset:Production Profiles
Thedocker-compose.yml includes profiles for additional services:
Default Profile
Includes devnet, Account Abstraction (AA) infrastructure, and mock paymaster:devnet: ENS v2 devnetcontract-deployer: Deploys AA contractsalto: ERC-4337 bundler (port 4337)mock-paymaster: Verifying paymaster (port 3000)
Local Profile
Runs AA services against an external devnet:http://host.docker.internal:8545
Next Steps
Testing
Run tests against the devnet
Deployment
Deploy to testnets and mainnet
Contract Integration
Integrate ENS v2 in your dApp
Migration
Migrate from ENS v1