Setting up a Handshake TLD with a hosted DNS service
Tags: tutorial, handshake, dns
Published: 2020-11-19 08:16:40

# What is Handshake?
Handshake is a decentralized naming protocol for allocating ownership rights to Top Level Domains (TLD), such as a `.com` or a `.org`.
[More info.](https://www.namebase.io/blog/tutorial-1-what-is-handshake-and-hns/)

Basically, it lets everyone own and control Top Level Domains (like `.nb`, `.yup`, etc.)

## Get a name.
If you don't have one yet, check out [Namebase](https://namebase.io) (it's a platform to buy/sell hns coins and bid/sell/manage handshake names).

**Now if you bought or manage the name on Namebase, you're already set! It's easy to set DNS records, point to web hosts, or anywhere else.**


# Using a different DNS host
So you've got a new handshake name and want to start using it as soon as possible. Instead of the easy way (sticking with Namebase), if you want a challenge, this post is for you!

There are a lot of different DNS / nameserver hosts out there, like Cloudflare and ClouDNS. But most of them require a traditional domain with an ICANN TLD. These domains need to resolvable by them to work.

Fortunately, some don't have this restriction. Amazon's Route53 and NS1 work fine with handshake names.

There are basically 2 parts:
- Create a zone with any DNS hosting service.
- Update the DNS records on the blockchain to point to the said service.

### I. Create a zone
I'm gonna go with Route53, but any of the supported services will do; the process is similar.

Btw, Route53 costs $0.50 per hosted zone / month + $0.40 per million queries. It's not free, but still pretty cheap.


1. Sign up for AWS and go to [Route53](https://console.aws.amazon.com/route53/v2/home) in the console.

2. ![AWS Route53 Dashboard](https://dev-to-uploads.s3.amazonaws.com/i/3bny8h7oij1vfedu7yjq.png)
  Click on Create a Hosted Zone.

3. Fill in the handshake name and leave the type as **Public**. We want it to be reachable from anywhere.
  For now, I'm gonna go with `http://awstest.giftsld/`

4. ![Hosted zone](https://dev-to-uploads.s3.amazonaws.com/i/513s70l1ylgjpi8avn5o.png)
  Note down the 4 NS records (`ns-*.awsdns-*.*`). We'll use this to update the DNS on the blockchain.

5. Add any DNS records pointing to your webserver or static hosting site has given you. It's typically an `A` record with an IP address or a `CNAME` with a domain.

For example, Vercel gives an `A` record in Settings -> Domain:
![Vercel domain settings](https://dev-to-uploads.s3.amazonaws.com/i/3g6f0tkga5gl0vfprn47.png)


### II. Update the handshake name DNS
Now that Route53 will respond properly, we need to point the handshake name to use it.

1. Open wherever you manage the name. Can be a wallet (like Bob Wallet) or on Namebase itself (we're only using Namebase to update the record, not its DNS hosting service).

2. Get the IP addresses of the 4 nameservers we noted down earlier. The dig program makes this easy: `dig +short ns-507.awsdns-63.com`. 4 domains will give 4 IP addresses.
  We have to do this because only IP addresses can be added for subdomain `NS` records.

3. ![Namebase blockchain DNS](https://dev-to-uploads.s3.amazonaws.com/i/ndytrktymk8omxi534ke.png)
  Create 4 NS records with the Name as the subdomain and the value as the IP addresses.

4. Save it!


And now we wait.
![And now we wait.](https://i.imgur.com/PBSA32O.jpg)
Because of the way the blockchain works and multiple levels of caching, the changes on the network will only reflect in ~6 hours.

If your computer is set to resolve handshake names, try visiting them with `http://<name>`. If not, there's always https://hns.to.

Hope this helps anyone new to Handshake. If you have any tips or suggestions, please leave them down in the comments.