Leveraging Alternative DNS for Fun and Cats! – avyenterprises.bit

In reaction to the Interwebz imploding last week and inspired by a recent speculation thread at the Cryptocurrency Collector’s Club I got to thinking about our old pal the Domain Name System and how it makes the world go round.

As we just saw it only takes a few centralized points to fail and all hell breaks loose.

Shayla Doesn't GAF
All Hell breaking loose in the Network Ops Center at AvY Enterprises HQ

Enter Namecoin:

Namecoin is a public blockchain that enables its participants to register and resolve ‘.bit’ domains independent of the existing, ICANN regulated DNS infrastructure. Its decentralized and pseudonymous nature lends well to both political dissidents and geeks alike who are just looking for a little more redundancy and immutability in their complex series of tubes.

via KnowYourMeme.com
via KnowYourMeme.com

As you may have guessed from the post’s title I already dove right in and if you really wanted you could continue reading this article at avyenterprises.bit/blog … and if you already are then congratulations! This will mostly just be a review for you so I hope you like cats.

… but we’ll get to all of that. First let’s back up and start from the beginning.

via BlueLight (NSFW)
via BlueLight (NSFW)

Getting Started

Before we can do anything we’re going to need the official qt (or core if you think you’re hard) wallet with a fully synced and validated copy of the blockchain. Note: This is going to take awhile.

No, really – It’s going to be at least several hours depending on how fast your machine can download and verify the entire database. May I suggest a cat nap or perhaps moar lolcats in the meantime?

BRB, Catching up on 5 years of Namecoin history
brb – catching up on 5 years of Namecoin history

Why the wait?

The .bit system works such that users cryptographically sign their .bit domain registrations as NMC transactions which are then broadcast to the Namecoin network. The network in turn confirms these transactions into the blockchain by way of majority consensus making the transfer of domain ownership both easy and publicly verifiable.

That is to say that in order to register and resolve .bit domains we will need a copy of this ledger to peruse and build upon.

Acquire Currency

Once we have a wallet we’re also going to need a little NMC to pay for our domain registration. I’ll just hop on cryptopia.co.nz and trade in a bit of my Monero holdings for some of the historic crypto, but you can source your NMC however you like.

The name registration part of this project will only cost 0.02 NMC but you’ll probably want to keep a bit more on hand considering 1 NMC is cheap at $0.25 USD as of this posting and I assume you’ll want to renew when your name expires.

I'll just take that off the lowest ask, not that I'm in any hurry...
I’ll just take that off the lowest ask, not that I’m in any hurry…
o.O
o.O
O.0
O.0
O.O
O.O !!

Here: have sum moar cats.

 

via mnn.com
via mnn.com

Once we finally have our wallet synced with a usable NMC balance we are ready for action.

ACTION!

Hopping into the terminal (Help >> Debug >> Console for those following along in the QT) let’s first check to see if our desired name is available.

To do this we need to run name_show d/name where ‘name’ is the domain we’d like to check. This reviews the blockchain and reports back the name’s status.

Dirty squatter scum!
Dirty squatter scum!

Alright! I wasn’t really expecting to nab a 3 character domain without a fight and we have some acceptable alternatives to work with. Let’s go ahead and preregister our name by announcing our intent to the network.

name_new d/name

prereg

Make a note of (copy into a textfile) the output from our ‘name_new’ command. We’ll need one of those hashes later. Unfortunately for now it’s time to wait a little while longer as our preregistration transaction accumulates a dozen or so confirmations.

prereg0conf
Not yet. Wait for it.

This will take another two hours on average. Namecoin inherits its 10-minute block time target along with most everything else from Bitcoin and thus 12 blocks * 10 minutes/block = 120 minutes.

“So why do we have to wait so long again, isn’t the transaction confirmed after one block?” you may moan. Someone’s getting cranky.

Here's your cat fix you junkie - via LOLCatPics.com
Here’s your cat fix you junkie – via LOLCatPics.com

This round of waiting is a side effect of the way blockchains are built by consensus and how we manage the associated risks as informed users of the system. At any given time there may be several competing Namecoin chains vying to be accepted and built upon by the rest of the network yet in the end there can only be one.

If we do not wait for our transaction to be confirmed in a longer chain we risk threats ranging from mildly annoying blockchain reorganizations to brutally malicious double-spending attacks.

Waiting for 100 confirmations on a chain as robust as Namecoin‘s is probably overkill (most definitely); however acting upon single confirmation transactions on any chain is – I hope – an informed decision made at your own peril.

Please do your homework and use your best judgement!

For additional heady reading on the topic of split chains I recommend this thought experiment discussed on Quora.

Are we there yet?

That all depends. Does your preregistration transaction have an appropriate number of confirmations such that you feel comfortable proceeding?

That'll do
“That’ll do”

OK then! Now we’ll follow up our name_new operation with something like the name_firstupdate example we have below. Notice we’ve pulled the second, shorter hash from our initial output and the JSON at the end has us simply assigning our name to our webserver’s static IP address.

name_firstupdate d/avyenterprises 6582785d0d6b31a600 ‘{“map”:{“”:”52.37.65.64″}}’

Success!
Success!

This registration will remain in effect for the next 36,000 blocks which – if we remember our math from earlier with ten minute blocks – should average out to 35.71 weeks or “about 6 months”.

After that time has passed we will need to run name_update with the same parameters, as our ‘firstupdate’, less the hashed value, to renew our registration for another 36,000 blocks. Like so:

name_update d/avyenterprises ‘{“map”:{“”:”52.37.65.64″}}’

This same name_update operation may be used to transfer ownership later on if you decide you don’t want your .bit name anymore, or someone makes you an offer you can’t refuse.

As soon as our record has been confirmed in a block it should be publicly visible and usable immediately so let’s just configure our web server for the additional domain, wait for a confirmation and take it for a spin shall we?

????

“But wait, AvY, you never told us how to resolve these crazy newfangled .bit domains!”

I said we’d get there alright? Have a cat and chill. We need one more piece of gadgetry…

NMControl

Windows users will want to pull down the NMControl installer released on the namecoin forums while the *nix crowd should find everything needed to compile their own binaries on the git page.

Once set up NMControl will function as our own private DNS server; listening for name requests from our resident client on 127.0.0.1, passing along traditional FQDN‘s to our chosen ‘normal’ authoritative name servers (defaults to google at 8.8.8.8 and 8.8.4.4) and resolving .bit requests through its connection to our wallet and the blockchain.

We’ll just need to setup a namecoin.conf file as shown here to ensure NMControl can securely communicate with the wallet; set our workstation to use 127.0.0.1 for its primary name server, give everything a restart for good measure and we should be ready to rock!

DNS on loopback!
DNS on loopback!

System check: Namecoin-QT, running. NMControl, sets off Windows Firewall, check!

This is a good sign. Click 'Allow'
This is a good sign. Click ‘Allow’

And now for the moment of truth…

Elvis has left the building ladies and gentlemen!
Elvis has left the building ladies and gentlemen!

Thanks for following along with my adventures here

Be sure to follow me on Facebook for updates and more posts like this!

via Pinterest
via Pinterest

12 thoughts on “Leveraging Alternative DNS for Fun and Cats! – avyenterprises.bit”

    1. Will do, Jimbo! This was the first big blockchain to come along and build another system on top of it and is an example of one that never really became all that popular but continues to exist and function nonetheless.

      I’ve just realized I’m late to the party on things like Steemit and Expanse which envision themselves as reddit-style blogging and decemtralized-computing/smart-contracting for-the-masses-by-the-masses platforms, respectively.

  1. I changed name servers in my system to OpenNIC’s and found this site via grep.geek. It listed it under the .bit domain.

    The thing is, all URIs here are referring to resources at .com which I think defeats the purpose of the registration quite. ._.

    1. You make a very good point, Fumu. Unfortunately most of the off-site links will not be able to be listed by .bit mirrors as their owners themselves likely do not have such registrations and there is very little we can do about that.

      However for the onsite links it does seem it should be possible to configure WordPress to work more conveniently with multiple domains and I am working on that as I type this.

      Though, I suppose if you were really concerned about your DNS being poisoned you could simply change the URI’s manually.

      Thank you for your comment!

Leave a Reply

Your email address will not be published. Required fields are marked *