## The Mining Algorithm And CPU Mining

The Mining Algorithm

What is commonly referred to as Bitcoin “mining” is really the creation of a new block in the block chain. Instead of making block creation a relatively simple operation, Satoshi realized that only a computationally expensive operation, performed as a kind of lottery, would prevent forgers from subverting the digital currency. But for a computationally expensive operation, which costs CPU power and thus electricity, some kind of reward would be necessary. Otherwise, only people with nefarious intent would participate in block creation.

One of the most difficult problems in computer science is reversing a secure hash (finding an input text for a given output, the digital signature). Let me explain this problem in simple terms. Let’s assume the wealthy but terminally ill Alice wrote her will and stored it on her computer. Knowing that a computer can be hacked and the will can be altered, Alice digitally signed her will with the secure hash algorithm SHA-256. She then emailed the digital signature to all her friends, allowing them to check the validity of the document. Bob wants to hack into the computer and change Alice’s will so that he becomes the sole beneficiary, but he faces a problem: he needs to change the will in such a way that the widely distributed SHA-256 signature stays the same. Otherwise, everybody realizes that the will has been forged. This is the computationally difficult problem of reversing or brute-forcing SHA-256, or finding an input that matches a predefined output. Satoshi famously decided that in order to find a new block, people all over the world need to compete in reversing SHA-256, turning block creation into a global lottery.

But since this is a computationally intractable problem, Satoshi made it somewhat easier. You see, an exact match to the signature doesn’t need to be found, but merely a match that satisfies an inequality, or an inexact match. In other words, a signature that differs from the desired output signature by less than a given (and adjustable) number qualifies for the block reward. This number is adjusted downwards as mining difficulty increases, making the brute-forcing problem computationally harder and harder, thus maintaining the average block creation rate of one new block every 10 minutes. Controlling the "money supply" by keeping the block creation rate steady prevents runaway inflation.

Bitcoin Mining on a CPU

Initially, Bitcoin miners simply ran Satoshi’s published code on their computers, adding more computers to gain an advantage over other miners. But when someone ported the mining algorithm to OpenCL (the C-like parallel language that allows graphics cards to act like a poor man’s supercomputer), the mining difficulty rose so much that mining on a CPU became obsolete. In other words, at that point, the cost of electricity for CPU-based mining vastly exceeded the Bitcoin revenue.

Solo Mining vs. Mining on Mining Pools

A solo miner participates in the block-searching lottery on his own, and goes empty most of the time. On the rare occasion when he does find a lock, he instantly gets 25 Bitcoins (plus a small transaction bonus). But solo mining makes sense only for massive mining operations, at, say, 50 GH/s and up. Most miners instead opt to participate in one of the dozens of mining pools (for instance deepbit.net or eligius.st), and thus benefit from a steady income in Bitcoins. Most, but not all, mining pools take a small percentage of the mining revenue to pay for server hosting and DDoS protection.

• Darkman69
Finally a proper write up on Mining Bitcoin with the good the bad and the reality.
• esrever
How does mining new coins make sense if there will ever only be 21 million? I am so confused by that point.
Another thing is, with an economic system like this, a billionaire can easily manipulate market prices and make extremely large amount of money and still be completely fine due to this being in a grey area of the law. You can't pump and dump stocks legally but it seems pretty easy for something like this considering you can dump the bit coins off as currency in any country.
• s3anister
How does mining new coins make sense if there will ever only be 21 million? I am so confused by that point.

To quote the Bitcoin wiki page: "The last block that will generate coins will be block #6,929,999 which should be generated at or near the year 2140."

So to directly answer your question, the whole reason for mining bitcoins is because you'll most definitely be dead before the last block chain is even completed.
• smeezekitty
Shitcoins definitely = fools gold!
Huge waste computing power IMO
• vmem
Shitcoins definitely = fools gold!
Huge waste computing power IMO

someone needs to rewrite the algorithm and somehow hook up block generation to folding@home or some similar constructive use of the computational power.
• smeezekitty
Shitcoins definitely = fools gold!
Huge waste computing power IMO

someone needs to rewrite the algorithm and somehow hook up block generation to folding@home or some similar constructive use of the computational power.
That would be a great idea. Verifying a relatively small hash to screen out the cheaters then perform something useful like F@H.

• dannyboy3210
A very interesting read. I had been reading about Bitcoins (mainly because I just couldn't figure out what they were exactly), but this clears a lot of things up.
Also, at the bottom of page 5, in the Comparison of FPGA and ASIC Chips table it says "Power Fraw".
• slomo4sho
Fiat currencies... I guess for some people the dollar wasn't worthless enough.
It is amazing how you can lose your "wallet" and your funds permanently disappear from the pool.
• toarranre
Never heard of this and I'm quite confused by it. Use graphics cards to find units of a currency that from what I can tell must be extremely succeptable to artificial inflation or all out collapse.
• phenomiix6
www.bitcoinpaypal.info