Tutorial for Setting up a Domain on the ENS and Hosting Decentralized Content on Swarm [Part 1]

Woody Deck
7 min readJan 5, 2018

--

This might be a price bubble, but Ethereum as a technology is for real.

As cryptomania hit full swing during the last quarter of 2017, it surprised many people in the development community that they seemingly overnight became multimillionaires from their work, all while still being deep in the alpha phases of their projects. It didn’t quite feel real, and this has brought quite a lot of stress on those responsible for the future of cryptocurrency. It has left the more financially fortunate wondering if they should just cashout and live a good life without such stress. To add to this dilemma, many projects are already spread thin. There is a huge shortage of developers who actually understand how everything works, and even fewer people who grasp where this whole industry is going. There are many ideas and dreams, but it’s the execution that matters, and any project is certain to fail without enough intellectual weight behind it these days.

Without Ron Paul’s 2012 heart, there is no current GEOTUS.

Fortunately, the Ethereum community seems to be immune from wealth induced burnout. However, it still has many vital projects that are currently left to only a few ‘wizards’, with a roadmap that will take decades to complete if left just to them. (Yes, Ethereum wants YOU!)

Nick Johnson, one of those mysterious wizards, and co-founder of the Ethereum Name Service (ENS), hosted an invite only meet-up last August in London to discuss the future of the ENS. It was a highly productive meeting, but it became clear that Ethereum’s biggest fans haven’t embraced the ENS nearly as quickly as the price has soared to almost $1,000 per ether. Even though ENS .eth domains have seen close to 200,000 name registrations, only ~7,000 domain owners at that time had by then bothered to set the resolver for their domains. Without a resolver set, a domain points nowhere, and does nothing.

The beauty of an ENS .eth domain is that it does much more than your traditional DNS top-level domain (TLD). A .eth domain can point to not only a wallet or contract address, but a decentralized file service hosting a website. It can do both of these things simultaneously!

Many things will change with Ethereum in the coming years, the ENS being no exception, which will move to a more permanent registrar within two years. The ENS is absolutely vital to the future of Ethereum, as it allows contract and wallet addresses to change with the times. The owner of the domain only needs to call the relevant ENS contract to change this info. Contracts, once propagated on the blockchain, cannot be changed, so any business needing to update a contract would be stuck permanently in that contract without a service like the ENS to allow a new contract to be referenced. This tutorial will show you how setup and use a .eth domain to its full potential.

What You’ll Need to Be a .eth Hero:

1) A .eth TLD you won at auction, or a subdomain that you can register instantly on ENSListing.com with the “ENS Now” functionality. [Part 1]

2) The latest version of geth. [Part 2]

3) The latest version of Swarm. [Part 2]

I will use bash on OSX to demonstrate, but it will work similarly in Windows. The command line is a scary place for crypto if you don’t know what you are doing, but don’t worry, we won’t be storing or spending any ether with on it today because I don’t crypto without a hardware jimmy hat. Although geth supposedly offers Trezor support now, I couldn’t get it to work in version 1.8. I recommend keeping your domains on hardware wallets only, and for transacting on Trezor, My Ether Wallet (MEW) is currently the only game in town. One of the reasons widespread adoption hasn’t happened yet is because Mist, MetaMask, and Parity do not yet support hardware wallets, and Swarm really only works right via the command line (there is limited support in Mist). HW support is roadmapped in all of these projects, but as mentioned above, the developers are completely swamped on higher priority issues and are relying on altruistic devs to submit a pull request that adds support. (Again, Ethereum wants YOU!)

The first thing we will do is set up a resolver for our domain. In this case I’m using latvija.eth, because I was sniped when bidding on the motherland, lithuania.eth. I feel a bit aggrieved, and want to make it clear that Lithuania is the superior country to develop blockchain technologies in.

To set a resolver, we head over to MEW and navigate to the ‘Contracts’ tab. Then we select an existing contract and scroll down until will find the ENS Registry contract.

Yes, Ethereum related sites usually have confusing UI and developer art.

You will note that there are four ENS contracts. This is by design, but very confusing. I’m sure it will be refactored when migrated to the new registrar. The most confusing thing is that the contract call “setOwner” in the registry contract actually doesn’t confer ownership to the new ‘owner’ if used. To permanently transfer an ENS name, you must go to the original auction contract and use the contract call “transfer”. “setOwner” and “transfer” are confusing enough, but having them be in different contracts is a head scratcher. It’s not exactly user friendly yet, but it does work well once you get the hang of things.

Click “Access”, and then find the function “setResolver” in the grey “Select a function” pulldown menu. Make sure it says the contract address of 0x314159265dD8dbb310642f98f50C066173C1259b. This address is static.

Click this button to reveal the contract functions.
Make sure you are on the right contract. Ethereum function calls to “set” something cost gas. If you just need to get something already on the blockchain, you can “get” the current value for free. e.g. If you go to the resolver function, you can instantly find out what a node resolves to for free by entering the node.

Next, enter the namehash for your domain where it says “node”. This is another example of confusion, and conflicting nomenclature. Technically, a namehash is a node, but even people well informed about Ethereum will be tripped up by this. You are going to have to put up with developer art and suboptimal UX for a while in crypto, so be patient as the Compuserve and AOL of Ethereum has not yet even been thought of in our current timeline.

These Ethereum wizards are pretty darn smart, but they sure suck swamp water at design. Ethereum desperately needs people just like you to help out with these sort of things. This must be made easy enough for you grandmother someday.

If you need to find your namehash, you can plug your domain into the ENS search of MEW.

They call it a namehash here, but a node on the contract. [Smashes Trezor]

Now enter the resolver address (see above screenshot, it’s just below the node/namehash field). This too is also confusing at first. The ENS docs talk a lot about setting up your own resolver, but you should not do this unless you know exactly what you are doing, and have a memorized 25 second soundbite ready to argue in every Ethereum Improvement Proposal. You should just use the default resolver address of the ENS, which is 0x5FfC014343cd971B7eb70732021E26C35B744cc4. You can find this address by selecting the “ENS Public Resolver” contract. If you are curious, you can navigate with the hyperlink to etherscan, and see approximately how many people have set a resolver on their domains.

Write and submit the transaction with your preferred gas price in Gwei, and wait for it to be confirmed. Step one complete!

MEW is wallet agnostic. You don’t need a Trezor, but you must have a plan for acquiring one ASAP if you don’t. ENS deeds are much more important than ether stored in a hot wallet.

Once that’s confirmed (please consult https://ethgasstation.info to find the lowest safe gas price), let’s make sure latvija.eth can receive ether as a wallet address. Head back to the 0x5FfC014343cd971B7eb70732021E26C35B744cc4 “ENS Public Resolver” contract on MEW and access its functions. Select the “setAddr” function. Paste in your namehash in the node field again, and then under “addr”, put the Ethereum (and only Ethereum) wallet address you want your domain to point (alias) to.

In this case I am going to point to the address on my spiffy new ether.cards Ethereum card wallet 0x5BFA3eF1C4DDcC1264202ed8db42A50bEBF7c96e. (If you note the above screenshot where I found the namehash, you can see I previously resolved latvija.eth to the same address that owns the domain deed.)

You have to pay in sterling, but the good news is that the UK is self-destructing economically by equivocating on Brexit. It might be free by the time you read this.

Write and submit your transaction, and make sure the transaction confirms. Congratulations, your .eth domain now can be used in place of an unmemorizable hash to send and receive ether or tokens! You can also now send ether to both 0x5BFA3eF1C4DDcC1264202ed8db42A50bEBF7c96e and latvija.eth. They are the same.

My children eat ethers. They are very hungry from fighting these smug potatoheads all day at school. I hope this site can equip them with better weaponry soon.

If I someday sell latvija.eth, you will be able to tell that the domain has been transferred and/or the underlying Ethereum address it resolves to has changed by looking at the history on etherscan.io, or the resolved address on the ENS tab of MEW. You can see in the screenshot that I changed the resolver to my ether.cards address and the domain will only now send to this underlying address.

One caveat though, and something you should tell your friends who might be using your ENS address to send you ether…You should never paste an ENS address like you do a hash. Always type it out, because there is an attack where similar looking domains can trick you into sending ether. Mano Samy of ENSListing.com detailed why.

You’ve now completed Part 1! Part 2 will show you how to setup Swarm, and host a website that you can access with your .eth domain.

--

--