An attack on a blockchain by a group of miners controlling over 50% of a network’s mining hashrate – the sum of all computing power dedicated to mining and processing transactions – is called a 51% attack.
A blockchain is a type of ledger technology that stores and records data. Put simply, a blockchain is a distributed list of transactions that is constantly being updated and reviewed. One of the key features of a blockchain is that it is made up of a decentralized network of nodes (a crucial piece of ensuring that a cryptocurrency remains decentralized and secure).
A blockchain is decentralized in that no single person or select group of people controls the blockchain network. That decentralization is important because all participants on the blockchain need to agree on the current state of the blockchain. By requiring an entire network of distributed participants to come to the same agreement, the validity of the block’s state can be certain.
Think of it as asking for a movie recommendation. If you were to ask someone if a particular movie was good and they reply yes, it could still be terrible. But if you were to ask 1,000 different people about the movie and they all said yes, then there’s a far better chance the movie is, in fact, good because it’s been unanimously verified. For proof-of-work (PoW) blockchains like Bitcoin, this “consensus” assures that a miner can validate a new block of transactions only if the network nodes agree on the block’s validity. Such consensus algorithms are the picky movie critics of the blockchain world: They will see the new movie only if everyone agrees that it was good. The consensus algorithm, however, merely asks “everybody,” regardless of whether everybody is 10 people or a billion. If a majority agree that the movie was good, then the algorithm will agree with it.
The mining process
In our example above, “everybody” for a PoW blockchain means all the mining nodes, or “miners.” These miners are competing against each other by using their machines to generate a code (known as a hash) that has an equal or higher number of zeros at the front than the target hash (the code every miner needs to beat). Whoever produces the winning hash that beats the target hash wins the right to fill a new block with transaction data and earn free crypto and transaction fees in return.
Read more: How Bitcoin Mining Works
Miners with more machines or those with machines that have a higher hashrate (capable of producing more hashes per second) have a greater chance of beating the target hash and winning the right to fill the next block with transaction data and adding it to the chain. This is similar in a way to a lottery system where a person with 10,000 tickets has a greater chance of winning versus someone who has only five tickets.
But what happens when a malicious agent manages to gain majority control of the hashrate?
The 51% Attacks!
A 51% attack, also known as a majority attack, occurs when a single person or group of people gains control of over 50% of a blockchain’s hashing power. That is usually achieved by renting mining hash power from a third party.
Successful attackers gain the ability to block new transactions from being confirmed as well as change the ordering of new transactions. It also allows the malicious agents to essentially rewrite parts of the blockchain and reverse their own transactions, leading to an issue known as double spending. This problem was traditionally an issue faced mostly by electronic payments where a network was incapable of proving that two or more people didn’t spend the same digital asset.
A 51% attack, however, is theoretically limited in the amount of disruption it can cause. While the attacker could trigger the double-spending problem, they cannot reverse others’ transactions on the network or prevent users from broadcasting their transactions to the network. Additionally, a 51% attack is incapable of creating new assets, stealing assets from unrelated parties or altering the functionality of block rewards.
Likelihood of a 51% attack
As a blockchain network grows and acquires news mining nodes it makes the chances of a 51% attack taking place less likely. That is because the cost of performing a 51% attack rises in tandem with the network hashrate (the amount of computational power committed to the network). Essentially, the bigger the network and the more nodes there are participating in it, the more hash power is needed to control over 50% of it.
But even if an attacker were to reach above 50% of the hashrate, the size of a blockchain could still provide security. Because blocks are linked together in the chain, a block can be altered only if all subsequently confirmed blocks are eliminated.
While possible, doing so would be incredibly costly for the attacker for two reasons:
- The attacker would have to expend great amounts of computing power (cost of electricity) to achieve a 51% hashrate, particularly on larger more established networks
- Because the miner is not acting in a way that participates appropriately, they would no longer be receiving the blockchain rewards that come with mining
Thus, the more significant number of transactions there are, the more blocks are on the chain and the more difficult it is to alter a block.
While the threat of a 51% attack still exists (albeit extremely unlikely) on big blockchains like Bitcoin, the financial costs would far outweigh the benefits. Even if an attacker were to expend all of its resources to attack a blockchain, the constant addition of blocks to the chain would give only a relatively small window to a number of transactions for the attacker to alter.