A 51% Attack
Updated: Apr 1, 2019
A 51% attack refers to an attack on a blockchain by a single or group of corrupt miners vying to control more than 50% of the network’s mining hashrate, or computing power. Before discussing the significance of a 51% attack, it’s important to review how transactions are verified on a blockchain. When a transaction is created on a blockchain, it is put into a pool of unconfirmed transactions. Miners will then group a number of transactions from this pool to form a block of transactions. To be able to add one’s block to the blockchain, a miner will need to solve a complex math problem using computational power. The more computational power a miner has, the better chances that miner has at finding the solution to the problem before another miner can find theirs. As soon as a miner finds the solution, he/she can broadcast it to other miners who will then also verify that all of the transactions inside the block are valid and accept the block to the blockchain.
This is where a corrupt miner can come into play. A corrupt miner can go through all of the same steps listed above, but instead of broadcasting their solution to the other miners, a corrupt miner can create a secondary blockchain with just their non-broadcasted blocks alongside the actual blockchain; therefore, creating two version of the blockchain, the truthful blockchain and the corrupted blockchain.
The corrupt miner can now transact on the truthful blockchain while purposefully not including those transactions on the corrupt blockchain. For example, the miner can spend 5 BTC on additional mining equipment. The mining equipment will be sent to the miner and the 5 BTC will be sent to the merchant. All of this will be recorded on the truthful blockchain; however, the corrupt blockchain will have no record of this transaction occurring.
This is how a 51% attack occurs. Since the blockchain is programmed to follow the majority, whichever blockchain maintains the majority hashing power and is able to add blocks to the blockchain faster will become the blockchain of record. If the corrupt miner is able to gain control of the majority of hashing power, their blocks will be added faster to the blockchain. From there, the corrupt miner can finally broadcast their version of the blockchain to the rest of the network which will then be considered the truthful blockchain. Since the previous blockchain and the new blockchain differ, all transactions that are not included on the new blockchain will be reversed. Going back to our example, this means that the 5 BTC the miner spent on mining equipment will be returned, but the miner has already received the mining equipment. This is why a 51% attack is also commonly referred to as a double spend attack.
How much would a 51% Attack cost?
The costs associated with performing a 51% attack differs for each blockchain. The website www.crypto51.app provides a breakdown for coins and the cost needed to perform a 51% attack for one hour. For example, they estimate that it would cost approximately $475,000 to perform a 51% attack on the Bitcoin blockchain for 1 hour. The site reaches this number “using the prices NiceHash lists for different algorithms we are able to calculate how much it would cost to rent enough hashing power to match the current network hashing power for an hour.” The website, however, does not factor into their calculations the cost of equipment or electricity, which would ultimately increase the cost dramatically. One individual, Maria Dian, came to the conclusion that it would cost nearly $1,006,247,000 per day to perform a 51% attack on Bitcoin once you factor in equipment and electricity.