What is a 51 Percent Attack in Blockchain?
A detailed explanation of the 51% attack, one of the most discussed security threats to Proof-of-Work blockchains like Bitcoin, and how it can enable transaction censorship and double-spending.
What is a 51% Attack in Blockchain? A Complete Guide
One of the most fundamental security assumptions of a Proof-of-Work (PoW) blockchain like Bitcoin is that no single entity controls a majority of the network's mining power. A 51% attack (or majority attack) is a potential attack on a blockchain where a single miner or a coordinated group of miners controls more than 50% of the network's total hashing power.
This majority control allows the attacker to compromise the integrity of the blockchain, enabling them to prevent new transactions from gaining confirmations and, most critically, to reverse their own transactions while they were being confirmed. This is commonly known as a double-spend attack.
This guide provides a clear and comprehensive overview of what a 51% attack is, how it works, its potential consequences, and why it is so difficult to execute on large, established blockchains.
Key Insights
- Core Concept: A 51% attack occurs when a single entity or group controls over 50% of a Proof-of-Work blockchain's mining hashrate.
- Primary Threats: The main dangers of a 51% attack are transaction censorship and double-spending.
- What They CAN Do: An attacker can orphan valid blocks from other miners and reverse their own transactions.
- What They CAN'T Do: An attacker cannot steal funds from other users' wallets, create tokens out of thin air, or change the fundamental rules of the protocol.
- Feasibility: While theoretically possible, executing a 51% attack on a major blockchain like Bitcoin is prohibitively expensive and logistically complex. Smaller PoW coins with lower hashrates are far more vulnerable.
How a 51% Attack Works: The Power of Majority Hashrate
In a Proof-of-Work system, the "longest chain" is considered the one true, valid chain (a principle known as the fork choice rule). Miners compete using computational power (hashrate) to find the next block. Since finding a block is a probabilistic process, the miner with the most hashrate will, over time, find the most blocks.
An entity that controls more than 50% of the hashrate is, statistically, guaranteed to be able to build a new chain faster than the rest of the network combined. This power allows them to execute a double-spend attack.
The Double-Spend Scenario
Let's walk through how an attacker could use a 51% attack to double-spend their coins:
-
The Setup: The attacker controls a majority of the network's hashrate. They have a large amount of cryptocurrency they want to spend twice.
-
The First Spend (Public): The attacker broadcasts a transaction to the public network, sending their coins to a merchant (e.g., a cryptocurrency exchange) in exchange for goods or a different currency (e.g., USD). This transaction is included in a block by an honest miner on the public chain.
-
The Secret Chain: Simultaneously, the attacker uses their majority hashrate to mine a secret, private version of the blockchain. In their secret chain, they create a different transaction that sends the exact same coins back to a wallet they control. Because they have the majority hashrate, they can find blocks for their secret chain faster than the honest miners can for the public chain.
-
Waiting for Confirmations: The attacker waits for the merchant on the public chain to consider their initial transaction final. Most exchanges wait for a certain number of block confirmations (e.g., 6 confirmations for Bitcoin) before crediting a deposit. As the honest network adds blocks to the public chain, the attacker is secretly adding blocks even faster to their private chain.
-
The Reveal: Once the merchant has accepted the payment and delivered the goods, the attacker's secret chain is now longer than the public chain. The attacker then broadcasts their longer, secret chain to the entire network.
-
The Reorganization (Re-org): According to the "longest chain" rule, all nodes in the network will see this new, longer chain and accept it as the valid history. They will discard the original public chain they were working on.
-
The Result: The original transaction to the merchant is now on an orphaned chain and is effectively erased from history. The attacker's second transaction (sending the coins back to themselves) is now part of the canonical chain. The attacker has successfully received their goods from the merchant and kept their original coins. They have double-spent.
What an Attacker CAN and CAN'T Do
It's crucial to understand the limits of a 51% attack.
An attacker CAN:
- Reverse their own transactions to double-spend coins.
- Prevent specific transactions from being confirmed (transaction censorship).
- Prevent other miners from finding blocks (by orphaning their blocks).
An attacker CANNOT:
- Steal coins from someone else's wallet. They do not have access to other users' private keys.
- Change the rules of the network, such as increasing the block reward or creating new coins out of thin air. Such blocks would be rejected by all other nodes as invalid.
- Reverse transactions from other users. They can only re-org transactions that they themselves initiated.
The Cost and Feasibility of a 51% Attack
While a 51% attack is a serious threat, executing one on a large, established blockchain is incredibly difficult and expensive.
- Hardware Costs: An attacker would need to acquire a massive amount of specialized mining hardware (ASICs). For Bitcoin, this would mean acquiring more hardware than currently exists in the entire global network, a feat that would cost billions of dollars and be logistically impossible to do secretly.
- Energy Costs: The electricity required to power this hardware would also be astronomically expensive.
- Economic Disincentive: If an attacker were to succeed, the news of the attack would almost certainly cause the price of the cryptocurrency to crash. This would devalue the very coins the attacker is trying to double-spend and the expensive mining equipment they acquired, making the attack economically irrational.
Because of this, smaller Proof-of-Work cryptocurrencies with much lower total network hashrates are far more vulnerable. There have been several documented cases of successful 51% attacks on smaller coins like Ethereum Classic, Verge, and Bitcoin Gold, where acquiring the necessary hashrate was feasible for a determined attacker.
Frequently Asked Questions (FAQ)
Q: Can a 51% attack happen on a Proof-of-Stake (PoS) network? A: Yes, but it works differently. In a PoS network, an attacker would need to acquire more than 50% of the total staked cryptocurrency. However, PoS protocols have a built-in defense called "slashing." If an attacker tries to compromise the network (e.g., by validating two different blocks at the same height), the protocol can automatically detect this and destroy a large portion of the attacker's staked funds. This makes the attack incredibly expensive and self-defeating.
Q: Why is 51% the magic number? Why not 49%? A: Mining is a probabilistic game. While an attacker with 49% of the hashrate could get lucky and find several blocks in a row, it is statistically very unlikely. With over 50% of the hashrate, an attacker has the statistical certainty of being able to build a longer chain over time.
Q_ Has Bitcoin ever been 51% attacked? A: No, the Bitcoin network has never been successfully 51% attacked. The sheer scale and cost of its mining network make it the most secure blockchain in the world.
Q: What is the biggest danger of a 51% attack? A: While double-spending is the most cited example, the biggest danger is the erosion of trust. A successful 51% attack on a major blockchain would shatter the perception of its immutability and security, causing its value and utility to plummet.
Internally, this article links to: double-spending-problem-in-cryptocurrency
, what-is-a-blockchain-fork-choice-rule