51% Attack

51% Attack is considered to be Bitcoin Network’s biggest threat, and for a good reason. While the attack is still hypothetical, it might be highly damaging to the network itself. Just because this possibility is so dangerous, it’s important for anyone interested in Blockchain Technology, to understand exactly what it is.

By the end of this post, you will fully understand what 51% Attack is along with all of its consequences. But until we get there, few questions should be addressed.

What is Mempool?

Before transactions are included in blocks, they are stored in Mempool. It is a staging area for new transactions, that are waiting to be registered in Blockchain.

Let’s say someone wants to send bitcoin to someone else. First, the transaction goes to Mempool, and is eventually picked up by some miner and included in a block. Once this block is added to Blockchain, the transaction is permanently registered.


How often are blocks added?

The Bitcoin Protocol tries to maintain the time between adding new blocks to be around 10 minutes. It’s adjusted with mining difficulty. Mining difficulty tells how difficult and time consuming it is to solve cryptographic puzzle. The higher mining difficulty, the longer it takes to solve it and add a new block.

What if transaction is not picked up?

If a transaction is stuck in Mempool for 72 hours (as for Bitcoin) it’s released back to its owner.

What do miners do?

Miners are responsible for adding new blocks to Blockchain. First, they form blocks from transactions sitting in Mempool (For Bitcoin Network, it is 1MB block size limit, and approximately 4000 transactions per block). Then, they perform enormous amounts of computations to solve so-called cryptographic puzzle. The first miner, who solves it, adds a new block to its copy of Blockchain. Next, it propagates this copy through the network, so that all other miners have the exact same copy of Blockchain. Popagation

I will talk about mining in great detail in later post. The explanation given above should be sufficient for now.

How Competing Chains are resolved?

What happens if two miners add a block at the same time? This may occur, when two different miners start propagating roughly at the same time. It’s depicted in the illustration below.

Competing Chains

This raises a question - which one of two versions of Blockchain should be adopted? The general rule of thumb says:

Miners keep their copies of Blockchain until another block is added to one of them. Longer chain wins - gets adopted by the network.

Let’s assume, the competing chains conflict happens. For sake of clarity, let’s split miners into two groups by the copy of Blockchain they have. In this case, we have Orange and Purple groups.


According to the rule mentioned above, miners keep their copies and wait. Now, let’s say that one of Orange miners adds a new block first, and propagates its copy through the Orange group. Once all other Orange miners have their copies updated, and their chain is longer than Purple group’s, they win. Their copy of Blockchain is adopted by the entire network.


The blocks that aren’t adopted are called Orphaned Blocks. Transactions that sit inside Orphaned Blocks go back to Mempool.

By now, we have covered enough, to finally demystify the 51% Attack.

What is 51% Attack?

The definition says it is the ability of someone controlling a majority of network computing power to reverse transaction history and prevent new transactions from confirming. Let’s take a closer look at how it is possible.

Control over new blocks

Group having the most computing power is most likely to solve the cryptographic puzzle first, and add a new block. The group can decide which transactions to pick from Mempool, if any. For example, it can keep adding empty blocks, preventing all transactions from being registered in Blockchain. Which may result in halting payments between all users.



Let’s say that someday, a big group of new miners joins the network. They have at least 51% of hashing power - computing power of the network if you will. They automatically receive the most up-to-date copy of Blockchain. Then, all of a sudden they close themselves off from the network, and cut off the connection. Whenever they add a new block to their copy of Blockchain, they don’t propagate it outside.


Meanwhile miners are closed off, they could buy some expensive stuff with Bitcoin. Assume these transactions are included in some of the Green blocks.

Then, after some time they connect back to the network, and cause the Competing Chains conflict. Because they have a longer chain, their version of Blockchain is adopted. Transactions included in Green blocks are now released back to Mempool.

Having control over new blocks, attackers can prevent Green transactions from being registered until they are released back to them (after 72 hours). So, even though their transactions were registered earlier - their bitcoin funds were spent - they get all they spent back.

In short, attackers could buy something with bitcoin, and reverse transactions, getting back their capital - they can double-spend.

Congratulations, you have made it this far! I can’t wait to see you in other posts too. Keep up the great work on discovering the revolutionary Blockchain technology.