{"id":320,"date":"2011-04-16T10:00:00","date_gmt":"2011-04-16T08:00:00","guid":{"rendered":"https:\/\/www.fussylogic.co.uk\/blog\/?p=320"},"modified":"2012-11-17T10:46:51","modified_gmt":"2012-11-17T10:46:51","slug":"bitcoin-baby-steps-ii","status":"publish","type":"post","link":"https:\/\/www.fussylogic.co.uk\/blog\/?p=320","title":{"rendered":"Bitcoin Baby Steps (II)"},"content":{"rendered":"<p>The continuing saga of the bitcoins. So far, it\u00e2\u20ac\u2122s looking like a viable technology to me. The next step is to get a real address.<\/p>\n<p>I could sign up for an <a href=\"https:\/\/en.bitcoin.it\/wiki\/EWallet\">eWallet<\/a> 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).<\/p>\n<p><em>Note: before I begin, I\u00e2\u20ac\u2122m doing this using the command line <code>bitcoin<\/code> tool; don\u00e2\u20ac\u2122t 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.<\/em><\/p>\n<p>The <code>bitcoin<\/code> command line server has recently appeared in Debian, so that makes it easy to get at for me.<\/p>\n<pre><code>$ apt-get install bitcoind\nSetting up bitcoind (0.3.20.2~dfsg-2) ...\n<\/code><\/pre>\n<p>Then I check it\u00e2\u20ac\u2122s working using my existing testnet address.<\/p>\n<pre><code>$ bitcoind -testnet -daemon\nbitcoin server starting\n$ netstat -ltnp\nActive Internet connections (only servers)\nProto Recv-Q Send-Q Local Address           Foreign Address         State       PID\/Program name\ntcp        0      0 0.0.0.0:18333           0.0.0.0:*               LISTEN      26559\/bitcoind\n<\/code><\/pre>\n<p>There she blows; one <code>bitcoin<\/code> 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, <code>bitcoin<\/code> doesn\u00e2\u20ac\u2122t need an incoming connection for most functions. It\u00e2\u20ac\u2122s already begun downloading the testnet blockchain:<\/p>\n<pre><code>$ while true; do du .bitcoin\/testnet\/database; sleep 5; done\n22108   .bitcoin\/testnet\/database\n22236   .bitcoin\/testnet\/database\n22464   .bitcoin\/testnet\/database\n<\/code><\/pre>\n<p>See? Getting bigger. I presume it downloads the blocks backwards because it already seems to know the latest block straight away:<\/p>\n<pre><code>$ bitcoind getblocknumber\n13763\n<\/code><\/pre>\n<p>A quick glance at <a href=\"http:\/\/blockexplorer.com\/testnet\">blockexplorer<\/a> agrees. The <code>bitcoin<\/code> server has automatically created an \u00e2\u20ac\u0153account\u00e2\u20ac\u009d (which is simply a name it uses to group addresses together).<\/p>\n<pre><code>$ bitcoind listaccounts\n{\n   &quot;Your Address&quot; : 0.00000000\n}\n<\/code><\/pre>\n<p>This account is unsurprisingly empty. Now I want to send a few of my test coins from my phone to my desktop account. I\u00e2\u20ac\u2122ll need an address on the desktop. It has also made a default address for this account, which we can fetch:<\/p>\n<pre><code>$ bitcoind getaddressesbyaccount &quot;Your Address&quot;\n[\n    &quot;n2KskbpkjY5k5swsT1vf3h6hyNDgQGvjPQ&quot;\n]\n<\/code><\/pre>\n<p>Over to the phone, which still has 45BTC in its wallet and use the <em>Send Coins<\/em> 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\u00e2\u20ac\u2122ll have to wait a while\u00e2\u20ac\u00a6<\/p>\n<pre><code>$ bitcoind listreceivedbyaddress 0 true\n[\n    {\n        &quot;address&quot; : &quot;n2KskbpkjY5k5swsT1vf3h6hyNDgQGvjPQ&quot;,\n        &quot;account&quot; : &quot;Your Address&quot;,\n        &quot;label&quot; : &quot;Your Address&quot;,\n        &quot;amount&quot; : 0.00000000,\n        &quot;confirmations&quot; : 0\n    }\n]\n<\/code><\/pre>\n<p>I suspect that the server gets to see the transaction being reported by the network before the confirmations appear, but I don\u00e2\u20ac\u2122t 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.<\/p>\n<p>The final step then is to go live on the real network.<\/p>\n<pre><code>$ bitcoind -daemon\n<\/code><\/pre>\n<p>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 \u00e2\u20ac\u201d which to be honest would be far more sensible). Then I wanted an actual named account in the wallet.<\/p>\n<pre><code>$ bitcoind listreceivedbyaddress 0 true\n[\n    {\n        &quot;address&quot; : &quot;1D8AwfJogaXM6HnFTw7CdhMaQhXd7Wz1NS&quot;,\n        &quot;account&quot; : &quot;Your Account&quot;,\n        &quot;label&quot; : &quot;Your Account&quot;,\n        &quot;amount&quot; : 0.00000000,\n        &quot;confirmations&quot; : 0\n    }\n]\n$ bitcoind setaccount 1D8AwfJogaXM6HnFTw7CdhMaQhXd7Wz1NS &quot;Fussy Logic&quot;\n$ bitcoind listreceivedbyaddress 0 true\n[\n    {\n        &quot;address&quot; : &quot;1D8AwfJogaXM6HnFTw7CdhMaQhXd7Wz1NS&quot;,\n        &quot;account&quot; : &quot;Fussy Logic&quot;,\n        &quot;label&quot; : &quot;Fussy Logic&quot;,\n        &quot;amount&quot; : 0.00000000,\n        &quot;confirmations&quot; : 0\n    }\n]\n<\/code><\/pre>\n<p>So it begins.<\/p>\n<p>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\u00e2\u20ac\u2122t 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.<\/p>\n<p>At time of writing Bitcoins have undergone a <a href=\"http:\/\/www.mtgox.com\/\">bit of a surge<\/a>, and are trading around 1 BTC\/USD (I have been suitably educated that currency ratios are not ratios, so that should be read as \u00e2\u20ac\u0153one dollar per BTC\u00e2\u20ac\u009d, not that it makes any difference when it\u00e2\u20ac\u2122s one-for-one). That should give you a frame of reference for value.<\/p>\n<p>If you\u00e2\u20ac\u2122ve got your own blog, go and grab the <a href=\"http:\/\/www.bitcoin.org\/\">bitcoin client<\/a>, publish your address and help free us from the tyranny of central banks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The continuing saga of the bitcoins. So far, it\u00e2\u20ac\u2122s 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\u2026 <span class=\"read-more\"><a href=\"https:\/\/www.fussylogic.co.uk\/blog\/?p=320\">Read More &raquo;<\/a><\/span><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[24,1,53],"tags":[20],"_links":{"self":[{"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/320"}],"collection":[{"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=320"}],"version-history":[{"count":7,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/320\/revisions"}],"predecessor-version":[{"id":964,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/320\/revisions\/964"}],"wp:attachment":[{"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=320"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=320"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.fussylogic.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=320"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}