Getting on the Bitcoin Bandwagon

(In which I spend far too much time and effort trying to scrape together a few fragments of BTC, and attempt to hook up one of these ASIC devices I’ve been hearing so much about lately)

A shiny graphic of what a Bitcoin might look like, conceptually.
A Bitcoin (artist’s impression)

So I’ve been looking recently at Bitcoin, not because they have any intrinsic value (unlike the bits of folding paper/plastic in your pocket), but because they’re a bit nerdy and I really should have got on this bandwagon a while ago, if the squiggly lines are to be believed.

Squiggly lines like this:

The sort of hockey-stick graph that gets people throwing money at people who sell hockey sticks.
The sort of hockey-stick graph that gets people throwing money at people who sell hockey sticks.

How do I earn these Magical Coins ?

Bitcoins are discovered by solving cryptographic puzzles by brute force, which require some defined amount of computing power, with the difficulty of solving the puzzle increasing as more people try to solve the puzzle.

Lots of people are trying to solve these puzzles these days, so the probability of you actually solving one is extraordinarily slim. So slim, in fact, that you’re probably better off just buying a bitcoin off someone else who’s already solved one, rather than trying to generate your own.

I like to compare this process of trying to create bitcoins to someone attempting to increase their wealth through successfully negotiating the Instant Casket ticket (or ‘scratchy’) protocol, since these actually exist in the real world, and people know what they are.

This is problably completely inaccurate, but helps me to read through this sort of thing without my brain exploding.

Scratchies !

The Bitcoin mining process
The Bitcoin mining process

So to elaborate: you can think of the creation of Bitcoins as millions of people running programs to scratch those instant casket tickets with random numbers underneath them. With these scratchies, let’s say there’s a hidden panel with a really long number underneath it, and to win, you need to scratch off the panel from the left hand side and get a continuous stretch of 7’s. The number of 7’s you need to find increases as the number of people buying scratchies increase.

So in the beginning, say, a single seven would net you ฿25 BTC but now you’d need fifteen 7’s in a row to get that ฿25 BTC. This is much less likely, so there’s more scratchies to go through before you hit the jackpot. This process of feverishly scratching tickets solving cryptographic puzzles is called mining. It’s a bit of a lottery, so some people group together with other people to pool their scratchies and share out the winnings.

It’s estimated that there are 213 ExaFLOPS (2.13×1020 FLOPs), or approximately half the computing resources on the planet currently devoted to mining Bitcoins, incidentally, so these puzzles are really quite hard these days. In order to expect ฿1 a day, you’d have to go through about 477,187,200,000,000 of these puzzles (or about 5,523,000,000 every second).

Anyway, you used to be able to use your bog-standard computer CPU to solve enough of these puzzles to make it worthwhile, which at the time could solve (or ‘hash‘) about 2 to 10 million puzzles a second (2-10 Mhash/s). Then people started using their GPU, and that jumped to 10 to 200 million puzzles a second (10-200 Mhash/s). Then people started using custom-built hardware, and that jumped to a billion to a trillion puzzles a second (1GHash/s-1THash/s). People now have data centres devoted to this shit, so getting Bitcoins through the process of ‘mining’ isn’t really something that people should even attempt if they have any regard to hardware costs or running costs, or if they even remotely value their own rapidly diminishing time on this mortal coil.

So because keeping up with yesterday’s cool thing is something that keeps me entertained, I ordered some Block Erupters a couple of weeks ago, and they turned up yesterday.

Bitcoin Erupter
Bitcoin Erupter

They’re ASICMiner Block Erupter ASICs ( Application Specific Integrated Chips), which, like anything that doesn’t involve digging a hole in the ground, are a bastard to get in Australia. These have long since past their useful life, and therefore someone was flogging them on ebay for USD$45.00 for two of them, plus about $30.00 to ship them Down Under.

They can churn out about 300 Mhash/s each, giving me about 600 Mhash/sec, or about the same power as a relatively high-spec GPU.

So what’s involved in getting these up and running and depositing that sweet, sweet Bitcoin into my virtual wallet ? I guess I need

  • a virtual wallet to hold my bitcoins

  • some software to run the Erupters, and
  • to select a mining pool to amortise my almost certain failure of solving these puzzles with other people who might scratch the winning ticket

After the minimum amount of research required, I went for the qt-bitcoin client to serve as my wallet, and bfgminer to run the Erupters. As I intend to run these continually, I’m doing this on an Ubuntu machine, although you can use Windows if you prefer.

Wallets

So the Bitcoin guys have their own software (called ‘bitcoin-qt‘) which can be used to manage wallets (each of which are identified on the bitcoin network with ‘addresses’ that look something like this: ‘1KbFdPvi2iKrU2PGdbhHirNa8QgJjJ4eyd‘). Seeing as these addresses are a bit non-intuitive for human beings to manipulate, you can label each address in the bitcoin-qt application.

I added the Ubuntu bitcoin PPA to my list of software sources and installed it using the commands:

knoxg@bnehyp03:~$ sudo apt-add-repository ppa:bitcoin/bitcoin
[sudo] password for knoxg: ******
gpg: keyring `/tmp/tmpEdSnzu/secring.gpg' created
gpg: keyring `/tmp/tmpEdSnzu/pubring.gpg' created
gpg: requesting key 8842CE5E from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpEdSnzu/trustdb.gpg: trustdb created
gpg: key 8842CE5E: public key "Launchpad PPA for Bitcoin" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
knoxg@bnehyp03:~$ sudo apt-get update
Hit http://au.archive.ubuntu.com lucid Release.gpg
...
Hit http://ppa.launchpad.net lucid/main Packages
Fetched 16.6kB in 4s (3,764B/s)
Reading package lists... Done
knoxg@bnehyp03:~$ sudo apt-get install bitcoin-qt
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libboost-filesystem1.40.0 libboost-program-options1.40.0 libboost-system1.40.0 libboost-thread1.40.0 libdb4.8++ libminiupnpc8
  libqrencode3
Recommended packages:
  minissdpd
The following NEW packages will be installed:
  bitcoin-qt libboost-filesystem1.40.0 libboost-program-options1.40.0 libboost-system1.40.0 libboost-thread1.40.0 libdb4.8++
  libminiupnpc8 libqrencode3
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,548kB of archives.
After this operation, 9,921kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://au.archive.ubuntu.com/ubuntu/ lucid/main libboost-system1.40.0 1.40.0-4ubuntu4 [30.9kB]
...
Unpacking bitcoin-qt (from .../bitcoin-qt_0.8.6-lucid1_amd64.deb) ...
Processing triggers for desktop-file-utils ...
Processing triggers for python-gmenu ...
Rebuilding /usr/share/applications/desktop.en_AU.utf8.cache...
Processing triggers for python-support ...
Setting up libboost-system1.40.0 (1.40.0-4ubuntu4) ...
Setting up libboost-filesystem1.40.0 (1.40.0-4ubuntu4) ...
Setting up libboost-program-options1.40.0 (1.40.0-4ubuntu4) ...
Setting up libboost-thread1.40.0 (1.40.0-4ubuntu4) ...
Setting up libdb4.8++ (4.8.24-1ubuntu1) ...
Setting up libminiupnpc8 (1.6-lucid1) ...
Setting up libqrencode3 (3.0.3-1) ...
Setting up bitcoin-qt (0.8.6-lucid1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
knoxg@bnehyp03:~$

And there we have it. I can now kick off the bitcoin-qt app from the command-line or under the shortcut installed under my ‘Office’ start menu, and get the following:

The bitcoin-qt Overview screen
The bitcoin-qt Overview screen

I want to set up a new receiving address, so I clicked on ‘Receieve‘ and hit ‘New Address‘, and filled out the new address label. The label is just used within the application to give a more useful name to your bitcoin address. I’m using eligius-bfgminer-pool-address here, which will make a bit more sense later. Honestly.

The dialog box after clicking 'New address' on the 'Receive' screen of bitcoin-qt
The dialog box after clicking ‘New address’ on the ‘Receive’ screen of bitcoin-qt

This gives me a new bitcoin address ( 1FySe5ULV821cYSSeWxi5VqxbkNCvgicDV ) which I’ll use when mining.

My new labelled bitcoin address
My new labelled bitcoin address

You might notice the ‘262 weeks behind’ in the status bar of the app (and the ‘out of sync’ text on the first screenshot). This indicates that I still need to download the bitcoin blockchain, which is used to verify and confirm transactions in the bitcoin system. The block chain is about 14GB at the moment and getting bigger, so the bitcoin people recommend torrenting the thing and installing it manually.

Onto the mining software, then.

Mining

First of all I plugged in the Erupters, and ensured that they’re detected by my system, by using lsusb to list all USB devices.

knoxg@bnehyp03:~$ sudo lsusb
[sudo] password for knoxg: ******
Bus 002 Device 007: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x Composite Device
Bus 002 Device 006: ID 045e:0745 Microsoft Corp.
Bus 002 Device 005: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP210x Composite Device
Bus 002 Device 003: ID 413c:2105 Dell Computer Corp. Model L100 Keyboard
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Looks OK so far. I intend to use bfgminer, so need to add their repository and install it:

knoxg@bnehyp03:~$ sudo add-apt-repository ppa:unit3/bfgminer
gpg: keyring `/tmp/tmpNfWKTc/secring.gpg' created
gpg: keyring `/tmp/tmpNfWKTc/pubring.gpg' created
gpg: requesting key 0AE7FCDA from hkp server keyserver.ubuntu.com
gpg: /tmp/tmpNfWKTc/trustdb.gpg: trustdb created
gpg: key 0AE7FCDA: public key "Launchpad PPA for Graeme" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
OK
knoxg@bnehyp03:~$ sudo apt-get update
Hit http://au.archive.ubuntu.com lucid Release.gpg
...
Hit http://archive.canonical.com lucid/partner Packages
Get:3 http://ppa.launchpad.net lucid/main Packages [6,746B]
Fetched 21.0kB in 1s (10.9kB/s)
Reading package lists... Done
knoxg@bnehyp03:~$ sudo apt-get install bfgminer
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
  libjansson4
The following NEW packages will be installed:
  bfgminer libjansson4
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 644kB of archives.
After this operation, 1,487kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Get:1 http://ppa.launchpad.net/unit3/bfgminer/ubuntu/ lucid/main libjansson4 2.0-0ppa1~lucid [25.6kB]
Get:2 http://ppa.launchpad.net/unit3/bfgminer/ubuntu/ lucid/main bfgminer 3.10.0-0lucid1 [618kB]
Fetched 644kB in 6s (107kB/s)
Selecting previously deselected package libjansson4.
(Reading database ... 558473 files and directories currently installed.)
Unpacking libjansson4 (from .../libjansson4_2.0-0ppa1~lucid_amd64.deb) ...
Selecting previously deselected package bfgminer.
Unpacking bfgminer (from .../bfgminer_3.10.0-0lucid1_amd64.deb) ...
Setting up libjansson4 (2.0-0ppa1~lucid) ...
Setting up bfgminer (3.10.0-0lucid1) ...
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place

and then check that bfgminer can find the devices as well:

knoxg@bnehyp03:~$ sudo bfgminer -S all -d?
 [2014-01-28 11:08:41] Started bfgminer 3.10.0
 [2014-01-28 11:08:41] Devices detected:
 [2014-01-28 11:08:41]  CP2102 USB to UART Bridge Controller by Silicon Labs (driver=icarus; procs=1; serial=ICA24; path=/dev/ttyUSB1)
 [2014-01-28 11:08:41]  CP2102 USB to UART Bridge Controller by Silicon Labs (driver=icarus; procs=1; serial=ICA21; path=/dev/ttyUSB0)
2 devices listed
knoxg@bnehyp03:~$

Hooray. Ideally, bfgminer would also detect my PC’s GPU and use that as well, but I’ll ignore that for the time being.

Before I dive in and start mining, I should probably find a pool to swim in with all these big, burly miners.

Joining a mining pool

Looking at this probably-out-of-date comparison chart, I went for the first pool I saw that had zero transaction fees, since I imagine that even a small fee is going to wipe out my meager mining returns. The pool I selected was called Eligius, which has no fees, and also appears to have about 13% market share in the bitcoin mining world.

Judging by their twitter feed, it appears they had some recent “technical difficulties” processing payouts, but the forum seem to indicate that it’s back up and running. Also, that the person running the site does so within close proximity to their bedroom.

Conveniently, it has no sign-up process at all. When you connect to the Eligius servers (that tell you which puzzles to try to solve), you just use your bitcoin address as your username, and ignore the password.

So. Armed with the Eligius server details and my bitcoin address from earlier, I can now tell bfgminer to grab some puzzles off the shelf and get solving:

knoxg@bnehyp03:~$ sudo bfgminer --url gbt.mining.eligius.st:9337 --user 1FySe5ULV821cYSSeWxi5VqxbkNCvgicDV --scan all
[sudo] password for knoxg: ******

And there you go. This is what bfgminer looks like after running for about 17 hours:

 bfgminer version 3.10.0 - Started: [2014-01-28 14:28:09] - [  0 days 17:00:02]
 [M]anage devices [P]ool management [S]ettings [D]isplay options                                                     [H]elp [Q]uit
 Connected to stratum.mining.eligius.st diff 4 with stratum as user 1FySe5ULV821cYSSeWxi5VqxbkNCvgicDV
 Block: ...bd0331d8 #282940  Diff:2.19G (15.70Ph/s)  Started: [07:06:12]
 ST:4  F:1  NB:110  AS:0  BW:[317/  8 B/s]  E:0.97  I: 6.64uBTC/hr  BS:9.64k
 2            | 684.0/670.4/673.8Mh/s | A:2371 R:10+2(.50%) HW:79/.81%
-----------------------------------------------------------------------------------------------------------------------------------
 ICA 0:       | 268.3/335.2/342.5Mh/s | A:1210 R: 3+1(.33%) HW:34/.69%
 ICA 1:       | 342.9/335.2/331.2Mh/s | A:1161 R: 7+1(.68%) HW:45/.94%
-----------------------------------------------------------------------------------------------------------------------------------
 [2014-01-29 07:18:21] Accepted 2fd18c18 ICA 1  Diff 5/4
 [2014-01-29 07:19:06] Stratum from pool 0 requested work update
 [2014-01-29 07:19:15] Accepted 0aca8bd2 ICA 0  Diff 23/4
 [2014-01-29 07:19:16] Accepted 12402c3f ICA 0  Diff 14/4
 [2014-01-29 07:19:37] Accepted 0b09b127 ICA 1  Diff 23/4
 [2014-01-29 07:23:37] Stratum from pool 0 requested work update
 [2014-01-29 07:24:23] Stratum from pool 0 requested work update

You can check the github page of bfgminer to see what all those numbers mean, but the thing to take from this mumbo-jumbo is the number at the top after the “I:” label. This represents my estimated income from running this, which appears to be 6.64 μBTC/hr. (micro-bitcoins per hour)

Since

The nice people at Eligius allow miners to view their statistics, which currently looks like this for me.

Notice I’ve hit 0.00010228 BTC which is something of a milestone. At going rates, that’s almost 1.13 cents !

Doh. Guess I forgot to keep it running overnight. Anyway. If I play my cards right, I might be able to get a Macca’s 50c cone out of all this.

One Comment

Add a Comment

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