3 min read

ENS Subname Contract Generator and Deployer

ENS Subname Contract Generator and Deployer

Introduction

I've made reference to this before, and have sent it to a few individuals to support them with their integrations with Unruggable Gateways. Noting the positive reception, I polished it up and am releasing it publicly.

This started as an internal development tool that I built for deploying an end-to-end subname solution that utilises Unruggable Gateways for trustless subnames.

There is a learning curve to utilising the Unruggable Gateways builder syntax. Alongside our examples, I am hoping that this tool will support developers with their integrations.

ENS Subname Solution Contract Generator

The Solution

It is a browser based step by step deployment solution. The code being deployed is shown in line with explanatory comments, and is updated on-the-fly based on user selections.

The solution works with both testnets and mainnets.

Step 1

  • Deploys a data store/registry on the L2 of your choice.
  • Verifies it on the appropriate Etherscan branded explorer.

Step 2

  • Deploys a resolver on L1 Ethereum.
  • Verifies it on Etherscan.

Step 3

  • Sets the Resolver on your ENS name on L1 Ethereum.

Step 4

  • Allows Registration of subnames using your new setup.

Step by Step Walkthrough

Architecture

Layer 2

It is worth highlighting how the contracts deployed with this solution have been architected.

Profiles

They utilise the concept of a 'Profile' which maps a user defined identifier to a set of data: addresses, text records, and a content hash. A profile can be reused across multiple subnames - define your data once, and reuse it.

The default solution offers free subnames. I wrote the contracts to be flexible - the IRegistrationController interface allows the solution deployer to create a separate contract that can contain additional logic defining when registrations are allowed, and how they are executed. This is left as an exercise for the user.

Getters and setters are exposed for individual records as well as bulk operations. See L2ProfileStorage.sol.

Layer 1

Built to be utilised with ENSIP-10.

Resolves:

Utilises the Unruggable Gateways builder interface to read profile data.

Code

The code is open source, and can be run locally.

Also worth taking a look at our documentation.

Examples

The screenshot below demonstrates an example deployed on Optimism.

ENS Subname Solution Contract Generator|690x415
Optimism Demo

Both thomas.optimismdemo.eth and another.optimismdemo.eth resolve the same profile data from Optimism Mainnet.

I also deployed an example on Linea.

Both thomas.lineademo.eth and another.lineademo.eth resolve the same profile data from Linea Mainnet.

Linea Demo|609x500
Linea Demo

The solution works with all of the chains for which Unruggable operates development gateways: Arbitrum, Base, Linea, Optimism, and Scroll.

Verifier deployments can be found here.

Chain Support|690x135
Chain Support

Note that each chain is subject to its own finalisation considerations. These are outlined when you select an L2 to deploy to.

Questions, comments, feedback.

Welcome, and appreciated. Comment on this thread, or directly.