Double-Spending Explained (51% Attack and Sybil Attack)

Byzantine General’s Problem

In the Byzantine General’s Problem,  a fortress needs to be conquered. For the invasion to be successful, all the platoons led by each captain of the general’s army must attack simultaneously.

How does the general guarantee that all captains receive the same message to attack at the same time?  How does the general guarantee that the messenger is not captured by the enemy and alters the message that is sent to the captain?  How does the general guarantee that the captains themselves are not traitors?

The Byzantine General’s Problem highlights the challenges of obtaining a unified set of records across a distributed ledger, whereby it is (i) difficult to synchronize data across a large number of nodes in the network (ii) protect the data in the network from being corrupted due to a malicious node.

To achieve consensus across all the nodes regarding the right block of data to add to the blockchain, we can either use central validation or a random consensus model.

  • Central validation  

This is where full authority is assigned to a single node to ascertain the block of data to be added next, and all other nodes simply verify the transactions in the designed block of data.  This is not a sufficiently decentralized approach for blockchain purists.

  • Random consensus

This is where the authority to ascertain the next block of data to be added to the blockchain is randomly assigned to any node within the network.  The problem with this approach is the possibility of the randomly assigned node being malicious.


Attackers of the network are unable to steal money from the blockchain due to the asymmetric cryptography protecting each wallet’s private keys, neither are they able to perform denial-of-service attacks for extended periods of time on the blockchain as block time (i.e., the designated time for a block to be created) is usually set to 10 minutes or less.

Attackers in control of nodes (i.e., malicious nodes) can perform double-spending.  Double-spending occurs as an attacker is able to change the transactions in the distributed ledger. After the attacker has made payments for a product/service and received the product/service, the attacker can make the payment disappear and the funds re-appear back in his wallet by removing the payment transaction from the distributed ledger.


Let’s say at block 11 the attacker is selected to create the next block of data which is block 12.  In block 12, you can create two sets of blocks that are both pointing back at block 11.  


In the ‘Green’ version of block 12, you have spent 0.25 BTC on buying an item.   In the green version, the seller of the item thinks that you have sent over BTC and he gives you the product.  In the ‘Red’ version of block 12 you have not made any purchases, so the BTC remains in your wallet. 


Thus, a fork has been created on a blockchain. The green block 12 is economically legitimate, but the red block 12 is not economically legitimate.  However, both are technically legitimate as they have hash pointers pointing back at block 11.


By protocol, the longest blockchain (or the chain of blocks that is the most expensive to compute) is always selected as the the ‘truth’.  As we have a ‘forked’ blockchain and created two competing versions of the truth, it is the longest chain which will be chosen as the economically legitimate truth. Therefore, it is important as to what happens after block 12.

In our example, the green block 12 was created earlier than the red block 12 so most of the nodes would have received the green block 12.  Thus if we have sufficient honest nodes, then the green blockchain will be the longest, as the red blockchain does not have enough malicious nodes to build enough blocks to be longer than the green blockchain. 

However, what happens what if the attacker is able to have more malicious nodes (i.e., Sybil attack) or if the malicious nodes hold a majority of the computing power in the network (i.e., 51% attack) on the network?  Even though the green block 12 was sent out earlier, the attacker with his malicious nodes control a majority of the network and can build the red blocks faster than the green blocks. The economically illegitimate red chain is now the longest chain and chosen as the ‘truth’. The economically legitimate green chain is now orphaned and discarded.  In this manner, double-spending has occurred.  


In short, the attacker is able to alter the entries on the distributed ledger to make his payments disappear after they have been spent so that the funds re-appear back in his account.

An Honorary Senior Fellow at the University of Queensland with professional experience as a quantitative researcher for BlackRock and Bank of America Merrill Lynch in New York, USA. He led research teams in the development of capital models, securitized products and factor models in both equities and fixed income asset classes. Rand has several academic publications in cryptocurrency, portfolio management, systemic risk & quantitative trading


‘Hodling’ is a term used in the cryptocurrency industry when someone holds on to their cryptocurrencies instead of selling…