What is a 51% attack?

A 51% attack occurs when a miner group controls over 50% of a network, allowing them to double-spend transactions. It's costly and requires more than 51% resources.

Most of us have heard the term 51% attack before, and it sounds terrifying!

A 51% attack refers to a point in time where a group of miners have control of more than 50% of the network and wish to act maliciously. How much damage can actually be done during this time? 🤔

Let's think about what we have learned. Every block is built upon the hash of the block before it. To change a block that has been confirmed many times, let's say the block has been confirmed 6 times for example, the attacking blockchain would need to mine 8 new blocks before the existing blockchain mines 1 to be accepted as the Main Chain. This would require more than just 51% of the resources! 💰


Opportunity Cost of a 51% Attack

Of course, the attacking blockchain could also just stubbornly stick to its chain for a longer period of time. The more time they do this, the more expensive the attack becomes. If they had these kind of resources, they could make significant money just playing along honestly!

What can the attack actually accomplish? One thing that an attack could do is double-spend a transaction, by choosing to override it within the new blocks. So if someone sent you a large payment, they could attack the network and essentially override that payment. Of course, this attack would cost a lot of money, so it's very unlikely this would be cost-effective.

For safety purposes, if someone sends you millions of dollars on the blockchain, maybe wait a day or two to be sure it's cleared. We'll talk more about UTXOs which will help us understand how double-spends are prevented.


Fun Fact

Double-Spends can occur during a blockchain fork, as shown by the bug caused by the Berkeley DB when the bitcoin network was partially between versions. See BIP_0050.

Learn More About 51% Attacks

Alchemy University offers free web3 development bootcamps that explain 51% attacks and help developers master the fundamentals of web3 technology. Sign up for free, and start building today!