Deep Dive Into NFT Domains

Photo by Kvalifik on Unsplash

Deep Dive Into NFT Domains

This article will dive deeply into NFT Domains’ use cases and how to build one. The NFT domain technology that we will focus on is ENS, built on the Ethereum blockchain. It will additionally give an overview of the latest developments in the ENS world.

What ENS is

The Ethereum Naming System(ENS) is a distributed, Open and extensible naming system based on the Ethereum Blockchain. An ENS is similar to a DNS in that, they all operate on a system of dot-separated hierarchical names called domains.

The difference between DNS and ENS is observed in their architecture. ENS is built on the Ethereum blockchain and is based on smart contracts that map human-readable names such as “bob.eth” to machine-readable identifiers.

DNS ⇒ amazon.com

ENS ⇒ radicle.eth

The owners of the ENS domains have full control over the subdomains.

Some examples of ENS top-level domains are “.eth” and “.test” owned by registrars. The registrars are smart contracts that specify rules governing the allocation of their subdomains. The owners of the ENS domains have full control over the subdomains.

ENS components

The main components of ENS are resolvers and registry. The ENS registry contains a single smart contract that maintains a list of all domains and subdomains and stores three critical pieces of information about each:

The owner of the domain

The resolver for the domain

The caching time to live for all records under the domain

Resolvers are responsible for translating names into addresses.

ENS Use cases

Human Readable wallet

Crypto/Web3 wallets are made up of long strings of characters that are not human-readable. Owning an ENS domain makes it easy for anyone to remember your wallet address.

Domain Name for your decentralized website

If you own an ENS domain already, you can opt to host your website on a decentralized file storage system(IPFS) and link your ENS domain to it, thus decentralizing your website.

Showcase your digital assets

Anyone can prove ownership of your digital assets using your .eth domain. You will also be able to sign in to web3 websites and applications using your .eth address. Instead of using various login credentials your ENS domain will be used as your web3 digital identity.

Bank account

You can link your ENS to any of your cryptocurrency accounts. Your Bitcoin, Ethereum, and LTC accounts can all use your single ENS name for transactions.

Due to the hierarchical nature of ENS, anyone can configure subdomains for themselves and others. I will demonstrate an example of how this is done using .radicle.eth domain. To register a unique name with Radicle ENS registrar go to https://app.radicle.xyz/registrations .Check if the name is available.

Registrareth.png

You will get a prompt to connect your wallet and then register your .radicle.eth name

Untitled (3).png

Once you have registered your name, you will be able to edit your details and even resolve the domain name.

registration.png

ENS as NFT

When ENS launched in 2017 it complied with neither ERC721 nor ERC115 standards, It was a non-ERC NFT.

The ENS Name Wrapper is a smart contract that wraps existing ENS names, to provide the following new features:

  • All ENS names become a standard compliant NFT, Wrapped names are ERC1155 tokens. Making ENS names ERC1155 compatible allows them to be displayed, transferred, and traded in any wallet that supports the standard.
  • All the ENS domains (Tokens) can now exist under the same collection.
  • Better permission control over wrapped names. The wrapped Names have the ability to burn permissions(replacing subdomains and setting subdomains)
  • Native expiry support for all names

The name Wrapper has special functions to renew, wrap(convert to ERC standard), and unwrap ENS domains. Let us go through one of them:

function wrap(
        bytes calldata name,
        address wrappedOwner,
        address resolver
    ) public override {
        (bytes32 labelhash, uint256 offset) = name.readLabel(0);
        bytes32 parentNode = name.namehash(offset);
        bytes32 node = _makeNode(parentNode, labelhash);

        if (parentNode == ETH_NODE) {
            revert IncompatibleParent();
        }

        address owner = ens.owner(node);

        if (owner != msg.sender && !ens.isApprovedForAll(owner, msg.sender)) {
            revert Unauthorised(node, msg.sender);
        }

        if (resolver != address(0)) {
            ens.setResolver(node, resolver);
        }

        ens.setOwner(node, address(this));

        _wrap(node, name, wrappedOwner, 0, 0);
    }


    }

What the above smart contract function does is:

Wraps a non .eth domain, of any kind. Could be a DNSSEC name vitalik.xyz or a subdomain. Can be called by the owner in the registry or an authorized caller in the registry. The parameter ‘name’ is the name to wrap, in DNS format. The parameter ‘wrappedOwner’ is the Owner of the name in this contract. Parameter ‘resolver’ Resolver contract. All other domains, non .eth names, as well as .eth subdomains such as tee.radicle.eth, can be wrapped by calling wrap(dnsEncodedName, wrappedOwner, resolver).

The next part of this article is on how to build on ENS. You will get understand how you can resolve ENS domains from your application. You will additionally get to understand the building blocks of an NFT Domain.