Introduce
Before delving into the concept of a 51% attack, we need to learn about the cryptocurrency mining process and blockchain systems.
One of the main strengths of Bitcoin and blockchain technology is the decentralized nature of data construction and verification. Decentralized nodes always ensure protocol rules are followed and all participants agree on the current state of the blockchain. This means that the majority of nodes need to regularly reach consensus regarding the mining process, the software version being used, the validity of transactions, etc.
Bitcoin's consensus algorithm (Proof of Work - Proof of Work) is responsible for ensuring that miners are only allowed to confirm a new block containing transactions if they receive consensus from a majority of nodes in the block. system about the accuracy of that block's hash chain (for example, the hash chain proves that the miner has done enough work, finding a suitable solution for that block's problem).
Blockchain's infrastructure - such as a distributed ledger and distributed system - prevents centralized entities from joining the network to carry out work for their own purposes. Because in the Bitcoin system, there is no individual with higher decision-making power than other members.
The mining/cryptocurrency process (in systems using the PoW consensus mechanism) requires quite a large investment in electricity and computing power. Therefore, a miner's performance will be based on the computing power he or she possesses, also known as hash power or hash rate. In such a system, there exist many miner nodes from many different regions, these nodes compete with each other in finding valid hash chains to receive rewards in the form of newly born Bitcoin units.
With such conditions, computational energy will be distributed fairly evenly among nodes, not concentrated on any single entity. At least that's what it's supposed to be.
However, the question is once the hash rate is no longer decentralized, what will happen? What if a single entity or organization has the ability to collect more than 50% of the entire system's computing power? This is what we call a 51% attack or also a majority attack.
What is a 51% attack?
A 51% attack is a potential attack on a blockchain network where one entity or organization can control the majority of the hash rate, potentially causing network disruption. In such a case, the attacker would have enough mining power to intentionally exclude or modify the order of transactions. This attack allows attackers to reverse transactions and cause double spending.
If the attack is successful, the attacker can prevent the confirmation of some or all transactions (also known as denial of service of transactions), or prevent other miners from working, leading to to the form of monopoly exploitation.
However, this form of attack does not allow the attacker to reverse transactions of other users or prevent transactions that have been declared on the network. In addition, it is almost impossible for an attacker to change block rewards, create new fake coins at will, or steal coins that he does not own.
How does a 51% attack happen?
Since a blockchain is maintained by a distributed network of nodes, all participants cooperate in the process of reaching consensus. This is one of the reasons why blockchain creates high security. The larger the network, the stronger the protection against attacks and data corruption.
When it comes to Proof of Work blockchains, the more hashrate a miner has, the higher the chance of finding a valid solution for the next block. This is true because cryptocurrency mining is essentially trying a hash chain countless times, and more computing power means more attempts per second. Some of the first miners joined the Bitcoin network to contribute to its development and security. With the rise in the price of Bitcoin as a currency, many new miners have entered the system to compete for the block reward (currently set at 12.5 BTC per block). Such competitive tendencies are one of the reasons why Bitcoin is secure. Miners have no incentive to invest large amounts of resources if it is not acting honestly and striving to receive block rewards.
Therefore, a 51% attack on Bitcoin is quite unlikely due to the size of the network. When a blockchain grows large enough, the likelihood of one person or group having enough computing power to overwhelm all other participants quickly drops to very low levels.
Furthermore, altering previously confirmed blocks becomes increasingly more difficult as the chain grows, as the blocks are all linked through cryptographic proofs. For the same reason, the more confirmations a block has, the higher the cost of changing or reverting the transactions in it. Therefore, a successful attack can only modify the transactions of a few recent blocks, over a short period of time.
Going further, imagine a scenario where a malicious entity is not motivated by profit and decides to attack the Bitcoin network simply to destroy it, regardless of the cost. Even if an attacker manages to disrupt the network, the Bitcoin software and protocol will be quickly modified and adapted in response to that attack. This will require other network nodes to reach consensus and agree on these changes, but that can happen very quickly in an emergency situation. Bitcoin is very resilient to attacks and is considered the most secure and trustworthy cryptocurrency today.
While it is quite difficult for an attacker to get more computing power than the rest of the Bitcoin network, it is not too difficult to do with smaller cryptocurrencies. When compared to Bitcoin, altcoins have relatively low hashing power to secure their blockchain. This rate is low enough that 51% attacks are actually possible. A few notable examples of victims of majority attacks include Monacoin, Bitcoin Gold, and ZenCash.