Wednesday, May 22, 2013

Mining Bitcoins


Bitcoin Mining

This article is about mining Bitcoins.


If you just want to find out how to use Bitcoins normally;
(like paying for things, using your wallet,  or saving them)
 Then see my article  "Using Bitcoins" http://www.cpubbq.com/2013/11/using-bitcoins.html


NOTE: You do NOT need to mine Bitcoins to use them. 



You can purchase Bitcoins from any Bitcoin exchange such as MtGox https://www.mtgox.com/ 
You can follow Bitcoin price based on MtGox Exchange in $USD here



MINING Bitcoins   
Edit (November 2013) time has pretty much run out for Bitcoin mining on standard PC equipment. Even many ASIC machines listed below can barely break even with their cost in Electricity, and they are orders of magnitude more powerful and efficient that Standard PCs. 
But new systems are coming out all the time, so keep watch. The underlying explanation in this article remains valid.

Long story short you can create money (Bitcoins) for yourself simply with the computational power of your computer(s).

Based on today (May 2013) rate of $US128 per bitcoin, there is $460,000 up for grabs everyday to the people lucky enough to find it.

There is a block with 25 Bitcoins produced every 10 minutes, that's 3,600 Bitcoins every day.


Those 25 Bitcoins are awarded to whoever can "find the hash of the block". Which is a bit like finding a needle in a haystack, except you can have as many computers looking for that needle as you like.


The more computer power you have, the more likely you will be able to find that needle and the more money you  will make...



Some people take this (valid) theory too an extreme..
In its heyday the above pictured rig could have potentially made $1000 per day, this is significant if you consider it is equally valid in any country in the world .. the cheaper your power... the more profit.

What is the purpose of this mining system?
The massive amount of computing power across the world used in Bitcoin Mining, is used by the Bitcoin system for backend transaction processing (remember there is no central owner or control).

In fact the block that you are attempting to find a hash of is the last10 minutes of Bitcoin transactions found by your Mining machine.
It processes them, and produces a block. It then attempts to find the hash of that block.
If it is successful, and the block is processed, it will have the honour of specifying the very first transaction for the next 10 minute block which will mint 25 brand new Bitcoins and assign them to you (or at least your pool).


Reality Check;
Mining can be difficult, the hardware can be expensive, and the landscape is constantly changing.
In most cases, you simply wont recoup the money you put in.

If you are thinking of making big bucks from this, then go for it!, but in my humble opinion that ship has sailed.

In many cases, hardware solutions that were very valid only 2 or 3 years ago, Would now potentially take hundreds of years to make one $1 worth of Bitcoin (and use thousands of dollars in the process).


The main questions you need to ask yourself are:
       How much computing power do you have?
       Do you know the difference between a GPU and a CPU?
       How much do you pay for power?


Its ONLY about your Video Card(s) and AMD/ATI Radeon dominate nVidia.
The GPUs (Video cards) are the only components that are capable of doing the work efficiently enough to make sense.

The rest of your computer is effectively dead weight, although it will still function as a computer for browsing the web etc etc

The rough cut off for efficiency (at the moment) is 1.2 refer to table below. It is safe to assume this will increase by gradually each day for the forseeably future


Forget your CPU
Efficiency 0.01 to 0.2

It is pointless to use the CPU in your computer for mining since the electricity you use will cost more than the value of Bitcoins you mine. Even if you have "free" Electricity, it will still take weeks to make even a dollars worth of bitcoin..

There is talk that some of the more recent Intel SandyBridge CPUs  are far more efficient than previous generations, and may even touch some of the less capable nVidia GPUs in mining ability... but...

Your nVidia probably WON'T cut it either 
Efficiency 0.1 to 1.1

Most nVidia cards will also not have a positive return for the amount of power they use.


Most have an efficiency of less than 1 many are lower than 0.1


Recent ATI/AMD Cards are OK...... for now
Efficiency 1.5 to 3.9

ATI/AMD Radeon Video cards have a much better return than their price equivalent nVidia competitors when mining bitcoins.
For the moment, it is still  realistic and feasible to be "cash positive" mining with an ATI card.




Comparison of Equivalent AMD/ATI vs nVidia Cards for Bitcoin MegaHashes (May 2013)

Model   Price  GPU Maker  MH/s*  Watts*  Efficiency(HigherBetter)
HD7970  $400   AMD/ATI    550     290      1.89           
GTX670  $400   nVidia     120     313**    0.38     
 
HD7850  $200   AMD/ATI    290      75***   3.86     
GTX660  $220   nVidia      80      75**    1.06

HD7770  $120   AMD/ATI    180      55      3.27     
GTX650  $120   nVidia      60      55**    1.09   


*Green values are ones I measured myself Others I found on the web

**It is hard to know the actual watts used by the nVidia cards as reporting is inconsistent (TDP is not the actual draw under load), so I put in a the same as the AMD cards which is probably a massive favour to the nVidia cards based on various reports and discussions on the web.

***Many sites reported the 7850 as using 276 watts underload, which maybe it does when gaming, but I know for a fact it only uses 75 watts when crunching Bitcoins.

Significantly - the AMD HD7850 is producing 3 times as many hashes on a quarter of the power as the nVidia GTX670 which costs twice as much.


 Time is running out  
Edit [June 9 2013] time has pretty much run out (as predicted below) or will in the next 10 day leap.. at least for me paying $0.28 per KW hour - the last 10 day leap increased difficulty by 40% and it looks like the next one will too... but please keep reading the the theory still stands and the ASICs should still be good for a year or possibly 2..


Even the AMD GPU's days of being useful are numbered as the difficulty of finding the hash is increased automatically by the Bitcoin network to match the growing mining power of all miners.

At this point if you were to go out and buy the most efficent GPU (say an AMD/ATI 7850) at a great price (say $200) its doubtful you would ever get that money back as profit.

Even if you hung on, and kept mining at a slow rate, sooner or later, you efficiency rate would be passed, and you would start losing money.

Block Difficulty jumps roughly every 10 days (when required - which for the last few months is always).

This is done so the Bitcoin Blocks are produced at a steady rate.

The above graph shows the difficulty ration has increased from around 1.5 Million to 10 million in just under a year.

You can see that in November 2012 the difficulty plateaued as the number of Bitcoins produced by each block was halved from 50 to 25 overnight halving the revenue for everyone.

This is automatic and happens every four years. Everyone knew it was coming. It forced many of the less efficient miners out of the network.

But in Feb 2013 The growth of power took off again and has been growing strongly ever since.

It was recently reported in mid May that the total power of the Bitcoin network was 1 ExaFlop.
That is 8 times more powerful than the 500 Largest Super Computers in the world combined.

While its not such good news for little guy miners, its good news for the Bitcoin Network as a whole, as anyone trying to crash or exploit the network would need a sustained majority of the network power.

This means even something like a large BotNet could not take it out....  although I would not bet the farm on it just yet.

FPGAs and ASICs are coming and they will make all the GPUs obsolete for mining.
 
There are custom machines based on chips called "FPGAs" (Feild Programmable Gate Arrays) and even faster ones called "ASICs" (Application Specific Integrated Circuits) which do a far better job of the whole thing and use far less power.

Within about a year (it is May 2013 now), they will be the only "cash positive" way of mining for bitcoins.


The small unit in this picture is an ASIC based ButterflyLabs BitForce 5 GH/s SC.
It costs $275 plus delivery and will pump out 5GH/s and only use 30 watts doing so.

Thats an efficeincy of 167 which is 43 times more efficient than the Radeon HD7850.

There is a long (months) waiting period for them, but they are out in the wild.

Rumours abound in forums when/if they will ever arrive.
If you had one running now, it would pay for itself within a month.

This article explains the Bitcoin Hardware arms race quite well

The ASIC chips are designed exclusively for making Bitcoins.

They cannot do ANYTHING else, they cannot be made to do anything else, so if they get superceded by rising block difficulty then they will be useful only for banging in nails, or throwing at white people who rap.

A rough calculation says that at current block difficulty, the efficiency required to break even is about 1.2. The Bitcoin network would have to increase to about 180 times its current capacity for these things to stop making money.
Edit [June 9 2013] I now calculate the break even point as about 1.75 - not much room for profit now..



A better picture is it would need to double in size five times which (based on current growth trends) could be only as long as 2 years.... yikes... not so far away after all.

But two years is a long time for a system that is a serious threat to vested interests on one hand, and is the holy grail for hackers on the other. There are many events that could change the growth rates, and probably some scandals and failures that could bring the whole thing to a screeching halt.


The important thing to remember is that as the total power of all the worldwide bitcoin hardware increases, the network automatically adjusts to make the hashes harder to find, so that the blocks are produced at the same rate all the time.

Green Power - Zero emissions.

All my power is 100% Green Power from Origin Energy. It is guaranteed to be zero emmission.
Mining bitcoins from CO2 producing electricity is probably unethical. ..... but that is just my opinion.

I pay an extra 2.4 cents per Kilowatt hour for green power.. and I was doing so 6 years ago. I think its a great service.

If the upshot of this whole deal was that I convinced even one other person to change to green power, then it would be worth it and I would not even care if I lost money on it.

Disclosure: I used to work for Origin Energy.. that has nothing to do with any of this.


My Setup
From bits I had lying around I was able to rustle up two reasonably respectable PCs, each with 2 Video cards.

I happen to have Gigabyte cards only for this.. they are reliable and well supported.

Note: power consumption/Computing power etc is measured by me with a watt meter.


First PC  -  i5 650 @2.4Ghz 16GB RAM, Vertex 3C:

Gigabyte AMD Radeon HD7850
Upper mid range gaming graphics card.  
Fast and quiet. A nice card - the most effecient of the lot. 

Retail:                                  $200
Power Consumption:         75 Watts
MegaHashes per second:   293
Mining Efficiency:              4.0


Gigabyte AMD Radeon HD7770
Mid range gaming card
Reliable, fast and quiet

Retail:                                  $200
Power Consumption:         55 Watts
MegaHashes per second:   183
Mining Efficiency:              3.36











Processor  MH/s   Watts  efficncy  degC
HD7850     293     75    4.01      66
HD7770     183     55    3.36      63
BASE PC           103                
TOTAL PC   476    233    2.08





Computing power  476 MegaHashes per second




Second PC i7 2600K  @3.2 24GB RAM, Vertex 3 C:

Gigabyte AMD Radeon HD7970
Upper range gaming graphics card.  
Very powerful... but uses lots of power.. not as efficient.

Retail:                                  $400
Power Consumption:         290 Watts
MegaHashes per second:   566
Mining Efficiency:              2.72


Gigabyte AMD Radeon HD6770
Mid Range
Fast and quiet. About 2.5 years old

Retail:                                  $200
Power Consumption:         48 Watts
MegaHashes per second:   168
Mining Efficiency:              3.54




Processor   MH/s   Watts  MH/s/W  degC
HD7970      566     290   2.72    75
HD6770      168      48   3.54    71
BASE PC             108   1.81        
Second PC   734     446   1.64






FIRST PC        476 MH/s
SECOND PC   734 MH/S
TOTAL           1210 MH/s    (1.21 GigaHashes per second)

The Combined total computing power is 1210 MH/s from 688watts at an efficiency of 1.83

At current block difficulty, break even efficeincy is about 1.2


But that threshold is growing.. sometimes quite quickly.

In July 2010 - such power (1.21 GH/s)  would have produced over $120 per day profit... but that was a long time ago.....

Its all about Efficiency
The ideal PC setup would have as many graphics cards plugged into one machine as possible.
Ultimately this is an exercise in  efficiency.... create the most Mega Hashes per Second (MH/s) for the least amount of power (Watts)

The return Im getting is 1210 MegaHashes per second
which is referred to as 1.21 GigaHashes 

Not to be confused with 1.21 GigaWatts. 
















How much money does that make??..
With a cost of about A$0.27 per Kilowatt hour and using the Bitcoinx.com Mining Calculator this yeilds about 0.055 bitcoin (A$6.73) per day at a cost of $4.46 returning a daily profit of $2.27

Value of Bitcoins created                      $6.73 
cost per day (electricit                        - $4.46
Profit(?)                                               $2.27  per day profitz!!      (meh)
Edit [June 9 2013] profit on this system is now at about $0.20 per day, and even if I tuned the system a bit, it will probably not be capable of turning a profit after the next 10 day leap.



WOW! Gina Rinehart was right!!! a full days work down a mine is only worth $2 per day afterall.

Not particularly interesting.. barely worth it if I was just in it for the money.. time to see what happens if I wind these puppies up a bit (or possibly switch off the the less effient ones)


GETTING STARTED WITH MINING

Install Bitcoin (Bitcoin-qt) (The basic Bitcoin Wallet)  http://bitcoin.org/en/download
To start with Bitcoin, you can download the Bitcoin software (open source and free)
Its called Bitcoin-qt that will get you a wallet.

Warning - the first time you run Bitcoin-qt, it will need to download the entire blockchain, which is 7GB, that can take a day, and some people may not have the data quota to do that.


Create a wallet (The pool will require this)

Install GUI-Miner (guiminer.org)
To mine (from a pool) I used GUI-miner.
Note you don't need one to run the other, and you should probably mine from a pool unless you have a really big system (like the picture above).


Join a pool
There are many pools to choose from
I had a good experience with "Slush's pool" also known as Bitcoin.cz
http://mining.bitcoin.cz/
The seem honest and dedicated to doing the "right thing"