Tales from the Crypto: Double Spending and the 51% (Explain Like I’m 5)
Last time you mentioned this 51% attack that was possible. So why don’t I set up in Iceland, where Edison’s medicine is dirt cheap, buy a mountain of ASICs to give me 51% of the hashrate and hijack Bitcoin?
Go ahead. But you may discover that it’s not feasible. A recent estimate of the cost of the computer hardware needed to do that is $4,410,539,111, to which you can add an electricity cost of about $3,032,245 per day. Anyway, there isn’t a mountain of ASICs available at any time to buy “off the shelf.”
The only way to get 51% of the hashrate would be gradually. And it would become obvious to other miners that you were trying to do that. Everything that happens on the Bitcoin blockchain, including the appearance of new nodes and who owns them, is reported in real-time.
OK. So let’s assume I get there slowly, but I do it anyway. What profit do I make when I pull it off.
Well, if you dominate the mining consensus you could, for example, have your mining software increase the Bitcoin reward from 12.5 Bitcoin to, say, 10,000 Bitcoin.
That sounds like a legendary heist. Could anyone stop me?
The problem with this fraud is it probably won’t work. It would violate one of the rules that other mining nodes apply when they check new blocks. The law is that the block reward must be 12.5 Bitcoin. So they would reject the block. Their software would never accept it in a million years. They would then sit around waiting for a valid block.
With your 51%, you would fork the blockchain into two, accepting your cheating blocks in your fork, while the other fork accepted only valid blocks. As everything that happens on the blockchain is on display, it would be clear that something was very wrong. When your “attempted coup” became obvious, the price of Bitcoin would collapse. Confidence in Bitcoin would collapse.
It is unlikely that you could make enough money quickly enough to pull off that attempted fraud.
So that’s a bust. What else could I try with my 51%?
You might like to try a double spending scam.
What is double spending?
That’s when you manage to spend your Bitcoin twice. Basically, wallets that receive Bitcoin wait for confirmations before they accept the payment. So let’s imagine I buy your battered pick-up truck for one Bitcoin. You can hardly believe your luck — a piece of junk on wheels, and I’m gonna part with a whole Bitcoin for it.
However, I have also bought my mistress an attractive piece of jewelry with the same Bitcoin at the same time I spent it on your pathetic pick-up truck. Both you and the jeweler are anticipating the arrival of the precious Bitcoin, but only one of you will get it.
How does that work?
Both transactions will go into the unconfirmed pool of transactions on each mining node. When one of the transactions gets confirmed — that is when one gets included in a Bitcoin block — the other will be rejected as invalid by all mining nodes accepting that block. If two different blocks with different transactions get created in different parts of the network, only one will survive.
What do you mean, Cryptoman?
It is possible for the blockchain to experience a minor split, but the split doesn’t persist. This is because of the way mining consensus works. When the chain splits, each mining node knows that, and it will immediately go with the longest chain of the two chains, as soon as it is clear which is longest.
How does it know?
This is determined by the block counter. If a mining node is on block 500, it will be trying to complete block 501. If a block numbered 501 arrives, it will accept it. The hash link on that block will determine what the previous block must be. So if the mining node has the “wrong” block 500, it will swap it out for the block 500 which matches that link.
Any split in the chain will be healed within a few blocks because the mining power will gravitate to the longest block.
So how does that affect me and that luxury pick-up truck I’m selling you?
You, with your battered old pick-up truck and the jeweler with his jewelry will wait for “confirmations.” Traditionally merchants being paid in Bitcoin wait for six confirmations — which means six new blocks must be added to the blockchain — before releasing the goods that were paid for.
As Bitcoin blocks take about 10 minutes to confirm this would take over an hour. It is impossible for both transactions to get six confirmations, so either you or the jeweler will not get the money and thus will not release the goods.
How does the double spending scam work?
It’s simple. If I have 51% of the mining power, I can create a block that contains both the broken-down pick-up transaction and the jewelry transaction and also ensure that it has the mining consensus it needs to get six confirmations. And I can, of course, do this many times until I’m fabulously rich. Eventually, I will double-spend my Bitcoin on Lamborghini’s and holiday homes in The Hamptons.
Has anyone ever mounted a successful 51% attack?
Yes, but not on Bitcoin. It is probably impossible with Bitcoin because of the massive cost. The cryptocurrency Krypton was the victim of a 51% attack and some double-spending in August 2016. And this week, the cryptocurrency Verge got hit with a 51% attack, for the second time in two months. If you are going to pull off a 51% attack, you need to find a coin where you can buy the mining power required.
And you’d better hurry, Rookieboy. Clever coders are working the asses off finding ways to prevent this kind of attack. They’ll make it impossible eventually.