Registration Flow
The ENS registration process consists of multiple steps to ensure security and prevent front-running:Search for Domain
Users search for available .eth names from the ENS Search Sheet.
src/screens/ENSSearchSheet.tsx
- Minimum 3 characters required
- Real-time validation and availability checking
- Shows current registration status and expiration
Configure Records
Set up profile information and records before registration.
- Avatar (NFT or image URL)
- Description and display name
- Social media profiles (Twitter, Discord, GitHub, etc.)
- Cryptocurrency addresses (ETH, BTC, LTC, DOGE)
- Custom text records
Commit Transaction
First transaction commits to the registration.
src/helpers/ens.ts
- Creates a commitment hash
- Prevents front-running attacks
- Requires gas payment
Wait Period
60-second waiting period after commit confirmation.
- Ensures blockchain confirmation
- Prevents MEV attacks
- Shows countdown timer in UI
Register Transaction
Complete the registration with the register transaction.
src/helpers/ens.ts
- Finalizes domain ownership
- Sets initial resolver and records
- Mints ENS NFT to your wallet
Set Records (Optional)
Additional transaction to set custom records if configured.
- Text records (social profiles, description)
- Address records (cryptocurrency addresses)
- Content hash (IPFS, decentralized websites)
Registration States
The registration UI adapts based on the current state:COMMIT State
src/screens/ENSConfirmRegisterSheet.tsx
- Shows total cost estimate
- Duration selector (1-10 years)
- Gas fee breakdown
- “Hold to Begin” button
WAIT_COMMIT_CONFIRMATION State
- Shows transaction pending status
- Displays transaction hash
- Waits for blockchain confirmation
WAIT_ENS_COMMITMENT State
src/components/ens-registration/WaitENSConfirmationContent.tsx
- 60-second countdown timer
- Explanation of waiting period
- Cannot be skipped
REGISTER State
src/screens/ENSConfirmRegisterSheet.tsx
- Final registration details
- Reverse record toggle
- “Hold to Register” button
- Shows ENS avatar if configured
Cost Calculation
Registration costs include:- Base rent: Price per year (varies by name length)
- Gas fees: For all transactions (commit, register, set records)
- Network fees: Ethereum mainnet fees
src/hooks/useENSRegistrationCosts.ts
- Per year:
rentPrice.perYear.display - Total registration: Includes all gas fees
- Estimated total: Rent + gas for selected duration
Longer registration periods (3-10 years) save on gas fees by reducing the frequency of renewal transactions.
Pending Registrations
If a registration is interrupted, it can be resumed:src/screens/ENSSearchSheet.tsx
- Stored in local state
- Resume from any step
- Shows in search sheet
Renewing Domains
Renew existing ENS domains before expiration:Select Renewal Duration
Choose how many years to extend (1-10 years).
src/screens/ENSConfirmRegisterSheet.tsx
Registration Modes
The registration system supports multiple modes:src/helpers/ens.ts
Error Handling
- Insufficient balance: Warns before transaction
- Invalid name: Shows validation error immediately
- Already registered: Displays owner and expiration
- Transaction failed: Allows retry from last step
- Gas estimation failed: Shows fallback estimates
Technical Details
Salt Generation
Each registration uses a unique salt:src/helpers/ens.ts
Gas Limit Estimation
Gas is estimated for the entire flow:src/handlers/ens.ts
Record Formatting
src/handlers/ens.ts