What is 51% Attack and How to detect it?

Today we’re going to talk about What is 51% Attack and How to detect it?

A 51% attack is an attack on a cryptocurrency blockchain by a group of miners who control more than 50% of the network’s mining hash rate. Owning 51% of the nodes on the network gives the controlling parties the power to alter the blockchain.

The attackers would be able to prevent new transactions from gaining confirmations, allowing them to halt payments between some or all users. They would also be able to reverse transactions that were completed while they were in control. Reversing transactions could allow them to double-spend coins, one of the issues consensus mechanisms like proof-of-work were created to prevent.

A 51% attack is a blockchain restructuring by malicious actors who own more than 51% of a cryptocurrency’s total hashing or validating power.

A 51% attack (or majority attack) refers to a potential attack on the integrity of a blockchain system in which a single malicious actor or organization manages to control more than half of the total hashing power of the network, potentially causing network disruption.

Understanding a 51% attack

Before delving into the technique involved in a 51% attack, it is important to understand how blockchains record transactions, validate them and the different controls embedded in their architecture to prevent any alteration. Employing cryptographic techniques to connect subsequent blocks, which themselves are records of transactions that have taken place on the network, a blockchain adopts one of two types of consensus mechanisms to validate every transaction through its network of nodes and record them permanently.

While nodes in a proof of work (PoW) blockchain need to solve complex mathematical puzzles in order to verify transactions and add them to the blockchain, a proof of stake (POS) blockchain requires nodes to stake a certain amount of the native token to earn validator status. Either way, a 51% attack can be orchestrated by controlling the network’s mining hash rate or by commanding more than 50% of the staked tokens in the blockchain.

To understand how a 51% attack works, imagine if more than 50% of all the nodes that perform these validating functions conspire together to introduce a different version of the blockchain or execute a denial of service (DOS) attack. The latter is a type of 51% attack in which the remaining nodes are prevented from performing their functions while the attacking nodes go about adding new transactions to the blockchain or erasing old ones. In either case, the attackers could potentially reverse transactions and even double spend the native crypto token, which is akin to creating counterfeit currency.

How to detect and prevent a 51% attack on a blockchain?

The first check for any blockchain would be to ensure that no single entity, group of miners or even a mining pool controls more than 50% of the network’s mining hashrate or the total number of staked tokens.

This requires blockchains to keep a constant check on the entities involved in the mining or staking process and take remedial action in case of a breach. Unfortunately, the Bitcoin Gold blockchain couldn’t anticipate or prevent this from happening in May 2018, with a similar attack repeating in January 2020 that lead to nearly $70,000 worth of BTG being double spent by an unknown actor.

In all these instances, the 51% attack was made possible by a single network attacker gaining control over more than 50% of the hashing power and then proceeding to conduct deep reorganizations of the original blockchain that reversed completed transactions.

The repeated attacks on Bitcoin Gold do point out the importance of relying on ASIC miners instead of cheaper GPU based mining. Since Bitcoin Gold uses the Zhash algorithm that makes mining possible even on consumer graphics cards, attackers can afford to launch a 51% attack on its network without needing to invest heavily in the more expensive ASIC miners.

This 51% attack example does highlight the superior security controls offered by ASIC miners as they need a higher quantum of investment to procure them and are built specifically for a particular blockchain, making them useless for mining or attacking other blockchains.

However, in the event that miners of cryptocurrencies like BTC shift to smaller altcoins, even a small number of them could potentially control more than 50% of the altcoin’ s smaller network hashrate.