Consensus Attacks

In this article, we learn about consensus mechanisms, and attacks on these mechanisms and give an example of an attack, how it unravels and how it is mitigated in blockchains.

Table of contents.

  1. Introduction.
  2. Consensus Attacks.
  3. The 51% Attack.
  4. Occurrence of a 51% Attack.
  5. Other Consensus Attacks.
  6. Summary.
  7. References.


A consensus mechanism is a fault-tolerant mechanism used by blockchain systems such as bitcoin to achieve the necessary agreement on a state or data value of the network across distributed processes such as cryptocurrencies. In Bitcoin, this mechanism is referred to as PoW(Proof-of-Work) whereby miners use their computational power in order to solve a puzzle specified by the network. This keeps peers of the network honest.

In Bitcoin, the PoW consensus mechanism is theoretically vulnerable to attacks by miners or mining pools that attempt to use their hashing power to a destructive end. In Bitcoin PoW depends on miners acting honestly out of their own self-interest, in that, they contribute their hashing power for a reward, otherwise, they lose both the reward and the computational power used to solve the puzzle if they decide to act dishonestly.

A very resourceful individual or mining pool can manage to acquire a significant share of mining power after which they can use it to attack the consensus mechanism in order to disrupt the security and availability of the bitcoin network. In this article, we learn how such attacks can happen and be prevented.

Consensus Attacks.

Consensus attacks are a tug-of-war between miners for mining the next block. In this case, the group that is stronger in terms of hashing power wins.
Consensus attacks affect future consensus. As time passes and peers increase in a blockchain such as bitcoin. The database is distributed among its peers and the more this happens the more immutable it becomes. More peers mean more security.

Consensus attacks do not affect the security of private keys and the signing algorithm, they are also not able to steal bitcoins or spend them without the required signatures, in addition to this consensus attacks cannot change transactions already recorded on the ledger or change their ownership, instead, they can only affect the most recently mined blocks thereby causing a denial-of-service making it impossible to create any other blocks.

The 51% Attack.

Also referred to as a majority attack whereby a single party is able to gain control of over 50% of the blockchain's hashing power. These attackers are able to block new transactions from being confirmed as well as change the ordering of transactions. They are also able to rewrite parts of the blockchain and reverse their own transactions leading to a double-spending problem whereby more than a single party owns a single digital asset.

As mentioned in such attacks, the attacker is only able to manipulate his/her own transactions. He/she is not able to reverse other people's transactions, prevent others from broadcasting their transactions, steal private keys, or steal and spend others' bitcoins.

Double spending can only occur on the attacker's transactions since there is the only one he/she is able to provide digital signatures for.

Note that 51% is just the threshold under which such an attack is proven to succeed. On the other hand, such an attack does not necessarily require 51% of the network's hashing power instead can be attempted with a smaller percentage of the network's hashing power. The more hashing power a single party is able to control, the loner the fork the miner is able to deliberately create, and the more blocks he/she can invalidate or control. Such an attack is possible with even 30% of the network's hashing power.

Occurrence of a 51% Attack.

In a large distributed network such as Bitcoin, the chances of a 51% attack are very rare due to the size of the network and its constant growth. The cost of being able to initiate a 51% attack is in tandem with the current network hash rate, meaning the larger the network, the more hashing power that is needed to be able to control 51% of the hashing power.

In the case an attacker is able to acquire 50% of the network's hash rate, he/she is still not able to take over the blockchain since blocks are linked together and for him/her to be able to change a block, all subsequent blocks must be eliminated.

In large blockchain networks such as Bitcoin, 51% attacks are rare for the following two reasons:

  • First, the attacker would have to use a lot of electricity to acquire a 51% hash rate, this is very expensive, especially in large blockchains such as Bitcoin.
  • Secondly, since the attacker is not following the consensus rules, they are not rewarded for their mining power.

Also, Bitcoin has a very high total hashing power(216.99M) meaning a miner should control 51% of the value which is almost impossible for a single miner to possess. This is not the case for managed mining pools since the pool operator controls the construction of candidate blocks and the transactions included in the blocks. In this case, the pool operator is able to double spend or exclude specific transactions in a block thereby profiting without being noticed.

Note that not all attackers are motivated by financial gain rather they can enact the attack to cripple Bitcoin thereby making others lose trust in the blockchain and thereby leaving the blockchain. This weakens the blockchain. Such attacks can be orchestrated by financially able individuals, groups, governments, corporations, etc.

In such attacks, the benefits are small compared to the financial costs meaning even if an attacker is able to acquire the needed resources to enact the attack, the constant growth of the network would only give him/her a very small window to be able to act maliciously.

Other Consensus Attacks.

In this section we look at the different types of consensus attacks on the blockchain apart from the 51% attack;

  • Selfish Mining Attacks - as we know during blockchain forks, the chain that is considered the main chain is the one with the most cumulative proof of work. A selfish miner can keep building blocks stealthy on top of the existing chain and later public his/her private fork which later gets accepted as the main chain since it will be the longest.

  • Mining malware - in this attack, hackers manage to install mining software that uses the miner's computing power to mine tokens that are redirected to the hackers.

  • Timejack attack - in this attack a hacker alters the network time counter of a node forcing it to accept an alternative blockchain that is not the true one.

  • Finey Attack - this is a type of double-spending attack the miner can generate a block where he/she includes a transaction from an address A to address B where both addresses belong to him/her.

  • Race Attack - this attack involves a race between two transactions that have been broadcasted at the same time or near the same time. The hacker will replace the first with another that returns the sent funds to their wallet before the first transaction is recorded on the blockchain.


Miners with the highest hash rate are able to mine the majority of blocks, they can also cause deliberate forks and the double-spending problem in addition to executing denial of service attacks against specific transactions or addresses.
Consensus attacks are theoretically possible but impractical for larger blockchains such as Bitcoin which continues to grow at a very fast pace.
A consensus mechanism is any number of methodologies that are used to achieve an agreement, trust, or security across a decentralized system such as a blockchain.
PoW(Proof-of-Work) and PoS(Proof-of-Stake) are used in cryptocurrencies such as Bitcoin and Etherium as consensus mechanisms.


Ethereum Consensus Mechanism