Bitcoin Baby Steps (II)

By | 2011-04-16

The continuing saga of the bitcoins. So far, it’s looking like a viable technology to me. The next step is to get a real address.

I could sign up for an eWallet account, which has certain appeal for the anonymity it would provide (and simplicity). Possibly that would be the best first step for a non-geek to take. However, I like the idea of being able to do these things for myself (just like I run my own email server, I like the idea of having my own Bitcoin node).

Note: before I begin, I’m doing this using the command line bitcoin tool; don’t be scared by that, there is a perfectly serviceable graphical client that non-geeks can use. The command line has output that is much easier to cut and paste into a blog post though.

The bitcoin command line server has recently appeared in Debian, so that makes it easy to get at for me.

$ apt-get install bitcoind
Setting up bitcoind (0.3.20.2~dfsg-2) ...

Then I check it’s working using my existing testnet address.

$ bitcoind -testnet -daemon
bitcoin server starting
$ netstat -ltnp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:18333           0.0.0.0:*               LISTEN      26559/bitcoind

There she blows; one bitcoin node listening on port 18333. My network is heavily firewalled so that listening connection is not going to receive many incoming connections at present. However, bitcoin doesn’t need an incoming connection for most functions. It’s already begun downloading the testnet blockchain:

$ while true; do du .bitcoin/testnet/database; sleep 5; done
22108   .bitcoin/testnet/database
22236   .bitcoin/testnet/database
22464   .bitcoin/testnet/database

See? Getting bigger. I presume it downloads the blocks backwards because it already seems to know the latest block straight away:

$ bitcoind getblocknumber
13763

A quick glance at blockexplorer agrees. The bitcoin server has automatically created an “account” (which is simply a name it uses to group addresses together).

$ bitcoind listaccounts
{
   "Your Address" : 0.00000000
}

This account is unsurprisingly empty. Now I want to send a few of my test coins from my phone to my desktop account. I’ll need an address on the desktop. It has also made a default address for this account, which we can fetch:

$ bitcoind getaddressesbyaccount "Your Address"
[
    "n2KskbpkjY5k5swsT1vf3h6hyNDgQGvjPQ"
]

Over to the phone, which still has 45BTC in its wallet and use the Send Coins facility to send 20BTC to this address. Now we have to wait for that transaction to be included in signed blocks by the network. The real network makes approximately six blocks per hour, so we would see it appear within ten minutes. The testnet relies on people willing to run the non-profitable client for no reason other than to promote Bitcoins. We’ll have to wait a while…

$ bitcoind listreceivedbyaddress 0 true
[
    {
        "address" : "n2KskbpkjY5k5swsT1vf3h6hyNDgQGvjPQ",
        "account" : "Your Address",
        "label" : "Your Address",
        "amount" : 0.00000000,
        "confirmations" : 0
    }
]

I suspect that the server gets to see the transaction being reported by the network before the confirmations appear, but I don’t think there is a way of getting this tool to tell me that information, so we just need a little patience. Eventually then, the amount ticks over to 20, and the confirmations goes to 1. Exciting stuff.

The final step then is to go live on the real network.

$ bitcoind -daemon

This takes a while to get started because it downloads the whole block chain to initialise (I managed to refute my guess that the chain was downloaded backwards — which to be honest would be far more sensible). Then I wanted an actual named account in the wallet.

$ bitcoind listreceivedbyaddress 0 true
[
    {
        "address" : "1D8AwfJogaXM6HnFTw7CdhMaQhXd7Wz1NS",
        "account" : "Your Account",
        "label" : "Your Account",
        "amount" : 0.00000000,
        "confirmations" : 0
    }
]
$ bitcoind setaccount 1D8AwfJogaXM6HnFTw7CdhMaQhXd7Wz1NS "Fussy Logic"
$ bitcoind listreceivedbyaddress 0 true
[
    {
        "address" : "1D8AwfJogaXM6HnFTw7CdhMaQhXd7Wz1NS",
        "account" : "Fussy Logic",
        "label" : "Fussy Logic",
        "amount" : 0.00000000,
        "confirmations" : 0
    }
]

So it begins.

I like the idea of bloggers getting micropayments, so that can be my Bitcoin address for anyone to donate anything they would like. I actually don’t care for myself, but I do love the idea of a world where the really popular bloggers could make money from thousands of tiny donations.

At time of writing Bitcoins have undergone a bit of a surge, and are trading around 1 BTC/USD (I have been suitably educated that currency ratios are not ratios, so that should be read as “one dollar per BTC”, not that it makes any difference when it’s one-for-one). That should give you a frame of reference for value.

If you’ve got your own blog, go and grab the bitcoin client, publish your address and help free us from the tyranny of central banks.

Leave a Reply