Recently I was struck down with a cold that just wouldn’t go away! During my time resting in bed, I read up on Ethereum Name Service (ENS) and followed the threads of discussions and information in various forums, the rabbit hole I went down lead me to reading up on the Interplanetary File Systems (IPFS) which I was loosely aware of but hadn’t taken much notice.

I was immediately intrigued by the possibilities so decided to put what I had read and learnt into practice.  Hence the following post which outlines a bit of what I have learnt, plus the process I went through to host an IPFS website, register an ETH domain and assign that domain to a wallet and a website.

What is ENS?

ENS is to the blockchain what DNS is to the Internet. ENS is a naming system based on the blockchain that associates Ethereum addresses, content hashes and metadata to human-readable names. This is similar to DNS that is a naming system for computers connected to the internet that associates server IP addresses to a name, ie domain names.

What this means is that you can register a domain (currently .ETH, .XYZ and .LUXE domains) and assign that domain to a wallet address. You may be used to seeing a wallet address like 0x0e072296a3a0ae62491b29e8793b726ce7ab68a9, and we’ll all agree that’s not a particularly memorable address, instead, you can register a domain such as increaseo.eth and assign that wallet address to that domain. You could also create a subdomain such as pay.increaseo.eth, and utilise that’s a more memorable wallet address if you desired. In addition to assigning a wallet to the domain, you can also assign a website.

Advantages of ENS

  • Allows for human-readable wallet addresses meaning you can send funds to a domain name
  • Can allow for easy access to Swarm and IPFS content hashes
  • Better security than DNS as ENS runs on the Ethereum block chain as a set of smart contracts
  • You can create subdomains
  • Domains and subdomains can be resold

If you want to read up more on ENS, visit the ENS website here.

What is IPFS?

IPFS stands for Interplanetary File System and is a bit like a BitTorrent, in that it allows users to not only receive but host content. IPFS aims to create a permanent and distributed web by using a content-addressed system instead of HTTP’s location-based system. What this means is that instead of storing a website on one particular server, each file of a website is distributed across a variety of nodes. Most of us don’t know the intricacies of HTTP most people won’t need to know the intricacies of IPFS, it will just happen for people.

Great visual representation of HTTP vs IPFS is as follows:

HTTP vs IPFS

Image courtesy of MaxCDN

Advantages of IPFS

  • IoT friendly
  • An immunity to DDoS attacks
  • Better performance when internet access is unstable and allows data blocks to be accessed via offline cache when available
  • Global store of files with automatic versioning & backups
  • Facilitate secure filesharing and encrypted communication.
  • Fewer servers are required for content distribution
  • Content can load faster but also uses more bandwidth because you need to contribute to the network.
  • Data integrity as files match the hash
  • Censorship resistant, except self-censorship.
  • Cheaper or free hosting
  • Archiving of immutable data

Negatives of IPFS

  • Content addressing is currently not very user-friendly
  • Established actors may perceive loss of control as you are giving up control of the data
  • Search engines need to improve, eg http://ipfs-search.com/
  • Browsers need to improve, eg https://beakerbrowser.com/

If you want to read up more on IPFS, read this article by WolverineBlockchain.

How to Host a Website on IPFS

Step 1. install IPFS

You need to visit the official documentation and download the installation package. Then in a terminal, you need to unpack and run the installation. (Note, I went down the command line way of doing this, I realised afterwards that there is a desktop application that may be a bit easier)

$ tar xvfz go-ipfs.tar.gz
$ cd go-ipfs
$ ./install.sh

Before you use IPFS for the first time you need to initialise the repository.

$ ipfs init

Step 2. Create your website

I took a single page template site and modified it ever so slightly. I just used the Eventually template here.

Step 3. Start IPFS

Once you are ready to join the public network and load up your files, you need to start running the IPFS Daemon. Open up a new terminal and type the following:

$ ipfs daemon

Step 4. Upload to IPFS

Next, you want to upload your files to the network, you do this by running the add command and using -r to add all files in the folder recursively.

$ ipfs add -r mysite

You should get a response  something like:

added QmXPbe82s7tN8FPKVrrPj3QR8rVpSPfPnYYqQjSUSwSTmV increaseo-eth/assets/css/fontawesome-all.min.css
added QmWj8WUo3wPsv9kApaqDsRuxff8gi1ooRLgYMjxubyrK6x increaseo-eth/assets/css/main.css
added QmfFZcEiEpfiDew1bcr1ZcmffiZ6CSxMLj89CW2N4zAAet increaseo-eth/assets/js/main.js
added QmXXbBXVctVecdHpHRFxXK4PeVBMQXZoSXbZy6EiGKy3ed increaseo-eth/assets/sass/base/_bg.scss
….
added QmUfJnsdXifjf7ZK9sjw6jWBUGHcTawaDmqLiKjFDiCda7 increaseo-eth/assets
added QmTV2QgsTMKgaMFivxbQQse2UEnqdeFaKvWWvsyUhfBnNo increaseo-eth/images
added QmQgYHujYGEobDTaFZjgNCmnYAXon7zzHZhJ5zDnBNwngX increaseo-eth

If you consider the content you added is important and you want it to stay on the network, you should pin it. The command for this was:

ipfs pin add /ipfs/QmQgYHujYGEobDTaFZjgNCmnYAXon7zzHZhJ5zDnBNwngX

Step 5. Visit your website on a Gateway

Now that you have published your website to the IPFS network, you can visit it via one of a number of gateways. eg:

Once we have our website on the network, we need to assign it to a domain name so you can have an easy to remember website address, rather than one of the ones listed above.  The Cloudflare Distributed Web Gateway is a good option to go with,  simply assign the CNAME record of your chosen domain to the cloudflare gateway url (see the example above), and you also get an SSL certiicate with it.

I’ve decided to go a slightly different path with this experiment and register an ETH domain name and assign that to the IPFS website.

How to Register an ETH Domain Using ENS

Step 1. Open and Ethereum Enabled Browser

The following steps need to be made on an Ethereum enabled browser. This is either a browser extension such as MetaMask or the Brave browser which has MetaMask built-in. I used Brave.

Step 2. Visit ENS Registrar

Visit https://app.ens.domains/

Step 3. Search for your ETH domain name

Type in your desired name into the search field, if the domain is not available you can see a screen which shows the ENS records. If it is available you will be presented with the next steps.

ENS Available ETH Domain Search

Step 4. Select the domain registration period

Click the + or – buttons to increase/decrease the duration you wish to register the domain name for, the minimum is 1 year and you must have enough Ethereum in your wallet to pay for the registration + the gas.

ENS ETH Select Year

Step 5. Start Registration

Click the Request to Register button, this will launch a popup window asking you to confirm the details of the transaction. Click confirm.

ENS ETH Confirmation Notification

Step 6. Wait

Once you have confirmed the transaction, you just need to wait for the transaction to confirm. Once the transaction is confirmed, you need to wait until the registration is confirmed. Don’t close your browser while this is happening.

Step 7. Finish Registration

You will then need to click the final Register button which launches another popup, this confirms everything and pays for your rent for the registration. Click Confirm.

Step 8. Assign Resolver

Now that you have registered your domain, you need to set the resolver, just select Accept Public Resolver. You are then able to set TXT records, add wallet addresses for BTC, ETH, etc and also add your IPFS record above. You’ll see something like this once it is done:

ENS ETH Records

I’ve done this for the domain I registered, Increaseo.eth. If you don’t have an Ethereum Enabled Browser, you can visit this at increaseo.eth.link.

Concluding Thoughts

It was a challenging process to go through all the above, but it’s a fascinating emerging area of technology. Ping me if you see any mistakes or have any suggestions for improvements in what I have done!