.eth Domain from ENS – Can It Be Used for a Website?

ens

I recently registered a .eth domain through the Ethereum Name Service. Is it possible to use this domain for a website? Or is it just an alias for an ethereum address (and other metadata)?

Best Answer

Yes, but AFAIK not all the browsers resolve .eth domains automatically, you'll need a gateway.

About your question, it's is possible to link a website with a ENS domain if you link the web content with your .eth domain. You can do it with IPFS or Swarm but in this case I'm going to focus on Swarm, so:

About Swarm

From the Swarm docs:

By registering a name and setting it to resolve to the content hash of the root manifest of your site, users can access your site via a URL such as bzz://theswarm.eth/.

Currently The bzz scheme is not supported in major browsers such as Chrome, Firefox or Safari. If you want to access the bzz scheme through these browsers, currently you have to either use an HTTP gateway, such as https://swarm-gateways.net/bzz:/theswarm.eth/ or use a browser which supports the bzz scheme, such as Mist https://github.com/ethereum/mist.

About ENS

From the ENS docs:

contenthash is used to store IPFS and Swarm content hashes, which permit resolving ENS addresses to distributed content (eg, websites) hosted on these distributed networks.

  • With Geth:

Using the function setContenthash:

function setContenthash(bytes32 node, bytes calldata hash) external;

Where:

node: namehash("yourdomain.eth") if you do it manually with a client like Geth or yourdomain.eth if you use ENS manager.
hash: e.g. the Swarm or IPFS hash of the content you’re referring

Once you own the eth domain and doing some steps like setting the resolver:

publicResolver.setContenthash(namehash("yourdomain.eth"), "hashOfYourContent", {from: eth.coinbase})
  • With ENS Manager (used Rinkeby testnet):

enter image description here

Introduce your IPFS (or Swarm) hash and you will see the following:

enter image description here

IPFS

I've found the following tutorial that will illustrate more easily how to do what you ask with IPFS.

Tutorial about hosting a Dapp using IPFS and ENS

Swarm

Then you can use the Swarm gateway and browse to your web like that:

https://swarm-gateways.net/bzz:/yourdomain.eth/

You can try (probably gives error but if you reload it will work):

https://swarm-gateways.net/bzz:/theswarm.eth/

enter image description here

For your interest, you can test all the process using .test ENS names in a testnet like Ropsten or Rinkeby to see how it works. You can read more about here.

Related Topic