Archive for January, 2012

.bit domains: rather dead than alive

Posted by Vitalie Ciubotaru

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

Understanding gnuplot

Posted by Vitalie Ciubotaru

When it comes to graphs, gretl has a very good interface. This is why sometimes I open gretl not for another regression, but simply to create another graph. On the other hand, the default settings for graphs in gretl are a sort of “one-size-fits-all”, so I often have to fine-tune the graphs before saving them as image. The need to to repeat many steps for every single graph can be annoying — e.g. I save the graph, close gretl and then discover that the title is mis-spelt.

In order to avoid these unnecessary repetitions I looked at gnuplot. gnuplot is a plotting software that can produce very expressive graphs. Actually, it’s gnuplot that produces graphs for gretl, but calling gnuplot directly, without relying at gretl, gives us much more control over the final result.

For the sake of exersice, I used data on Moldovan consumer prices, which I use in my research, to test-drive gnuplot. A bref look at the data:

$ cat cpi_monthly.csv
1994M01,0.173112617709,0.239803992207,0.094400675421,0.358373500574
1994M02,0.195550183875,0.221537226460,0.167194062267,0.239803442394
1994M03,0.095322755336,0.094381285981,0.072302758560,0.193910185446
1994M04,0.048778187476,-0.008989342544,0.065817779879,0.151001315845
1994M05,0.026649336222,0.021757413856,0.022738045009,0.053564944099
1994M06,0.026639092138,0.035333466639,0.012894161453,0.010939501922
1994M07,0.021790046158,-0.015093378960,0.042128161494,0.073228745712
...

and so on up to December 2011.

OK, let’s plot the last eleven years.
$ gnuplot
set datafile separator ","
set xdata time
set timefmt "%YM%m"
set xrange ["2000M01":"2011M12"]
set format x "%Y"
set yr [-.05:.05]
set xzeroaxis lt 0 lw 1 linecolor rgb "black"
set style line 1 lt 1 lw 1 pt 3 linecolor rgb "blue"
set title 'CPI inflation (log monthly changes), 2000-2011'
plot "cpi_monthly.csv" using 1:2 notitle w line ls 1

Yes, if one creates graphs from time to time, then it will look like too much code. However, if one needs to produce many graphs with the same look-and-feel, one can reuse this code for multiple times, with only minor changes. Below is the result (click to enlarge).

CPI inflation (log monthly change), 2000-2011

CPI inflation (log monthly change), 2000-2011