ENS Bulk Mint
Batch-mint ENS subdomains with Merkle-proof access, commit-reveal security, and pause controls.
Problem Statement
ENS BulkMint Factory revolutionizes ENS by enabling the distribution of thousands of subdomains in a single, gas-optimized transaction. Leveraging Merkle-proof access control, a commit-reveal scheme to thwart front-running, and a robust pause/unpause safety mechanism, this solution delivers enterprise-grade security without altering parent domain ownership. Built with Foundry-powered Solidity contracts, a Node.js API for Merkle tree management, and a React dashboard for seamless user interaction, BulkMint Factory empowers DAOs, gaming communities, enterprises, and events to onboard large audiences instantly and reliably—transforming ENS from a niche naming service into a scalable, mass-adoption platform.
Solution
The ENS BulkMint Factory is the result of a tightly integrated, full-stack architecture crafted for security, performance, and scalability:Foundry + SolidityWe wrote BulkSubdomainFactory.sol, leveraging Foundry for rapid compilation, testing, and scripting.It orchestrates a commit-reveal anti-MEV pattern, Merkle-proof access control, and batch calls to the ENS NameWrapper contract.We used OpenZeppelin’s ReentrancyGuard and Ownable for reentrancy protection and pausable admin controls, plus custom fuses and expiry checks so subdomains can never outlive their parent.Node.js + Express BackendOur backend generates Merkle trees from CSV or database lists of authorized claimers, using the merkletreejs library for efficient proof generation.It exposes REST endpoints for: 1) deploying new factory instances (via Ethers.js scripts), 2) publishing fresh Merkle roots, and 3) serving per-user proofs on demand.We integrated Alchemy’s JSON-RPC API for reliable on-chain interactions and Infura’s WebSocket subscriptions to monitor transaction confirmations in real time.React + Ethers.js DashboardThe React frontend uses wagmi and Ethers.js to connect wallets, switch networks, and call contract functions.We built custom hooks to manage commit timestamps, enforce the 10-minute delay, and display live transaction status.The UI automatically generates clickable proof links (Etherscan, ENS App), and administrators can upload new claimer lists via a drag-and-drop CSV uploader.Partner TechnologiesOpenZeppelin Defender automates guardian-style pause/unpause actions and sends alerts on critical events (e.g., suspicious claim volume).Dune Analytics dashboards track gas usage and claim statistics, helping us fine-tune gas thresholds and batch sizes.Notable HacksWe implemented an on-chain gas smoothing mechanism that dynamically adjusts the Merkle proof batch size based on block.baseFee to avoid out-of-gas failures during congestion.To minimize storage costs, we bit-packed our Config struct so all parameters fit into two storage slots, saving over 5,000 gas per campaign.Our deployment scripts detect reopened campaigns and reuse existing factory instances by reading on-chain state, avoiding unnecessary redeployments and preserving campaign history.By combining these tools and techniques, BulkMint Factory delivers a production-ready, battle-tested system for issuing ENS subdomains at true Web3 scale—and it’s all orchestrated end-to-end from smart contracts to user interface.
Hackathon
ETHGlobal New Delhi
2025
Contributors
- Shubz224
20 contributions