Intro

Several months ago (probably at the end of September 2011) I came across the Namecoin. This is what I want to talk about today.

What are namecoins?

Unlike Bitcoin, the Namecoin project is not all that much about money, although namecoins can be and are traded against bitcoins and real money. More than anything else, it’s about the new first-level internet domain, the “dot-bit”, they created. Having some namecoins (or should I say “namecoin” since the coins are almost perfectly divisible and due to this exactness are often uncountable) allows one to register and administer an address ending in “.bit”, like http://www.example.bit. One doesn’t need to apply to a registrar (although it’s possible) — it would suffice to run the namecoin software and issue a single command.

An idea

After I grasped the general concept of namecoins and *.bit domains, I wondered how easy is it to register a domain and to have it running. I also wanted to know how many domains were registered and how how many of them are active. For this purpose I decided to register a domain, to assign it to an IP, to set up a DNS-server, to count registered domains, to set up a search engine, and — finally — to index all .bit domains. My humble attempts of merged-mining did not yield enough namecoins to register a domain and it was only due to the Namecoin Faucet that I collected a sufficient amount for my experiments.

Registering a *.bit domain

The command to pre-order a domain is
namecoind name_new d/yourdomainname
where yourdomainname is the desired name without the “.bit” part. If everything is OK, a transaction identifier and a short ransom number are displayed. The domain name is registered by issuing
bitcoind name_firstupdate rand json
where rand is the random number from the previous step and json looks like can have many forms, but generally looks like ‘{“ip”: “1.2.3.4”, “map”: {“”: “1.2.3.4”, “www”: “1.2.3.4”}}’. It will take some time for everyone namecoin server to update their .bit address database.

Counting the bucks

So I registered a domain and assigned it to a real IP address at a free hosting. Of course, I could not see my new website in the browser — my provider’s DNS server knew nothing about websites ending in .bit. So I need a DNS capable of resolving .bit addresses. But first I want to know how many domains ware there. For this I downloaded a small and simple utility from https://gist.github.com/967992, compiled it and ran
./namecoin-hosts 127.0.0.1:port rpcuser rpcpassword > hosts.txt
where port, rpcuser and rpcpassword are taken from ~/.namecoin/bitcoin.conf. OK, now we have a file that contains all registered .bit domains. To find out how many addresses there are, we just count the lines:
wc -l hosts.txt
At this moment there are 13712 websites, which include duplicates with and without the trailing “www.”.

Setting up a dot-bit-compatible local DNS-server

There are dozens of solutions with similar functionality. I chose to use dnsmasq. Configuration is reduced to adding one line to /etc/dnsmasq:
addn-hosts=/path/hosts.txt

to be continued

Leave a Reply