Experiments In Bitcoin

Experiments In Bitcoin

bitcoin Earlier today I got in to discussing Bitcoin Arbitrage with a mate of mine, with the cunning plan of creating a bot to monitor different exchanges and profit on the difference in trading prices. After an analysis this was deemed a silly idea, or conversely we aren’t good enough, as moving real money or bitcoins around the exchanges seems to be an extremely painful process. The first step though was creating a wallet!

Bitcoind

Multibit is a fantastic cross platform GUI Bitcoin wallet which is super easy to use but limits you to only using the workstation you’ve installed your wallet on, unless you get all remote desktopy. There are also numerous places that let you host your own wallets and most exchanges also feature a wallet too, but I’m very DIY! BitcoinD however is a little cross platform daemon that just sits their ticking away, managing your wallet, whislt responding to JSON-RPC over HTTP. Perfect for me!

‘Installation’ on Linux was easy, just download the tar.gz, extract, then run the bitcoind binary of choice! I run mine in a screen but there are init scripts if that’s your thing. It creates a wallet file in ~/.bitcoin. When it starts it suggests you configure a username and password for the RPC interface. You should do this. My ~/.bitcoin/bitcoin.conf looks like this:


rpcuser=rusisawesome
rpcpassword=thisismysecretpassword

GUI

Ok, so you’ve a deamon running, now what. Well it logs to ~/.bitcoin/debug.log which is some indicator that it’s working, but a pretty GUI would be nice. I opted for bitcoin-js-remote, a nice javascript web app app, that comes with it’s own daemon or can be served over Apache. I’ve got Apache installed at home so I opted for that.

Extract bitcoin-js-remote somewhere nice, e.g. /var/www/bjr and configure Apache. You’ll want to use HTTP Basic Auth to protect the directory, which we’ll go in to, and ideally use SSL (best practice ftw) which we won’t go in to!

You’ll need to create, or add to, an htpasswd file with the RPC credentials you’ve configured bitcoind to use earlier.


htpasswd -b -c /etc/apache2/htpasswd.pass rusisawesome thisismysecretpassword

BitcoinD by default will listen on port 8332 on localhost, and the bitcoin-js-remote will call back via Apache to talk to it so we need to configure Apache to do a bit of proxying as discussed here.

 

AuthType Basic
AuthName Restricted
AuthUserFile /etc/apache2/htpasswd.pass
Require valid-user

ProxyPass /lbc/ https://127.0.0.1:8332/

AuthType Basic
AuthName “Bitcoin Access”
AuthUserFile /etc/apache2/htpasswd.pass
Require user rusisawesome
Order deny,allow
Allow from all

Restart Apache and jobs a good’n.

Bitcoin-js-remote also has a settings.json file. I’m not sure if it’s necessary but I added my credentials to that:


{
"RPC": {
"url": "/lbc/",
"user": "rusisawesome",
"password": "thisismysecretpassword",
"account": ""
},
"labelsmode": 1
}

I don’t think this is necessary to be honest. You can now connect to your webserver, present the basic auth credentials and it should log you straight in to your new shiny web based client!

bitcoin-js-remote

If you are hosting your own wallet, it’s advisable to back it up, as if you lose it, you lose all the money that’s inside it!

There are some free sources on the Internet that you can use to get some meagre BTC to play around with, I think I’ve got around $0.15 worth, though as you can see I’m still waiting for transactions to come through, so far the fastest has taken 3 hours and the slowest over 12 hours. Moving BTC around different exchanges for arbitrage purposes is kind of hopeless …

My Bitcoin address is 13gcobY9ofgnokCsU436yNVgCqGB3PVW6z, there are even nice bitcoin URL shortners so I don’t have to remember that monstrosity!

The Blockchain site, as well as offering wallet hosting, lets you observe and track all the transactions going on in the Bitcoin network as well as see the state of all the wallets on the network (if you know the address). The details of my wallet are here and the first transaction made to it earlier today is here. I have to say when I saw that transaction I got all excited by the prospect of almost 5 BTC, but it appears that multiple transactions can be done in the same block, mine was the smaller one at 0.002 BTC 😉

I ran a Bitcoin miner on my MacBook at work earlier and it reckoned it would take 10,000 days to generate 1BTC. I think I’ve missed the bubble there 😉

At the moment Bitcoin feels a little like the Esperanto of the financial world, but you can already by drugs and pay for strippers and pizza with it, which is probably more than Esperanto will let you do!

What’s really awesome about bitcoin is the bitcoin community itself. Reading about it feels like there’s a lot of entrepreneurial adventure going on whilst everyone is making land grabs to provide previously taken for granted services in new and exciting ways due to the financial flexibility that bitcoin provides. I think it’s exciting.

Leave a Reply

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