In the previous articles of Blockchain 101, we have already established a basic knowledge of blockchain technology, how it works and what are the consensus mechanisms. In this chapter, we’ll discuss what a 51% attack on the blockchain is and what can happen if such an attack takes place.
51% attack definition
51% attack refers to an attack on any of the blockchain networks which is using the Proof-of-Work consensus by the individual or group controlling more than 50% of the mining power (hashing power). Attackers, who possess such a power, would be able to alter transactions and/or blocks, due to the control of the majority of the votes in the network.
The ultimate outcome would depend on the aim of the attackers where severity would range from harmless to complete failure. Harmless would mean the group of individuals would like to prove that the 51% attack is real and can be done on the large scale network like i.e. Bitcoin. Potentially the attackers would leave just a proof they have been able to achieve it without impacting any of the core network functionality. Since 51% attack on the blockchain network like Bitcoin or Ethereum require significant means, in most of the cases attackers would most likely be willing to recover the costs of their investment. Therefore, once the attack is successful there would be serious damages done. Below is the list of few examples
Prevent transaction confirmations
Attackers would be able to prevent legitimate transactions from receiving confirmations either temporarily or permanently. It means that no user would be able to either spend any of the coins stored in the wallet nor receive any coins from other wallets. Those unconfirmed transactions could either stay in the pending queue or be marked as invalid and removed permanently.
Reversing any of the already completed transactions is also possible while controlling 51% of the mining power. Such an operation would be resource intensive but the time to reverse would depend on how far in the past (how many blocks) desired transaction was made. As you may remember from our previous article, altering any data in the block would require to invalidate and recreate all consecutive blocks until the most recent one. So, imagine the time required to reverse the transaction made just 1000 blocks back.
Double spend is when a user spends the same coin twice. Blockchain was built the way it should prevent such situations and in most of the cases, it does. However, by controlling the majority of the network power, attackers would be able to validate their own transactions even though they have no coins left in the wallet.
Once in control of the majority of the hashing (mining) power, attackers can alter the consensus and invalidate all future transactions, leaving the minority with the choice either to accept the change and follow the fork (in this case it would be permanent) or adhere to the old chain under the other network name. We have seen hard forks and hash wars in the past on Bitcoin, Bitcoin Cash and others.
51% attack conclusion
In large distributed networks like Bitcoin, with a large number of miners and extremely high hashing power, such an attack seems just hypothetical but it is still valid. Newer blockchain implementations have built-in mechanisms that would make 51% attack less probable by implementing checkpoints or moving out from Proof-of-Work consensus into other more advanced like Proof-of-Stake or Proof-of-Elapsed Time. None of those are perfect and have their own flaws but are resistant to 51% attack.