Brought to you by the Liquid team to help you make sense of crypto.

What is a 51% attack?

In Blockchain

Over the past year or so, a number of cryptocurrencies have come under 51% attack.

To understand what 51% attack is, we need to step back and understand a few concepts about how blockchains work.

Decentralized networks have long existed before Bitcoin, the most infamous being Bittorent.

But Bitcoin is the first application of a decentralized network for finance.

So what makes Bitcoin’s decentralized network different from earlier P2P networks? In Bittorent, the same copy of a movie can be downloaded and shared multiple times.

However, when it comes to finance, transfer of digital value has to be spent only once.

If Bob sends Alice Bitcoin, we must be able to verify that Bob no longer has the bitcoin and that Alice has it. Nor should Bob be able to reverse the transaction afterwards to own the spent Bitcoins again.

In operation, a blockchain is a form of democratic governance with pre-coded rules. The nodes (miners) verify the transactions on the blockchain.

The more nodes, the better and more secure the blockchain is.

On top of that, the more the lack of trust between the miners, the more secure the network because transactions will be verified without a vested interest.

What is a 51% attack?

A 51% attack occurs when a malicious miner(s) is able to control more than 51% of the hashing power in a network, enabling them to carry out unconventional transactions, such as double-spending.

To understand how this works, we have to go over how Bitcoin records new transactions to its blockchain.

When a Bitcoin owner signs off a transaction, they add to the pool of unconfirmed transactions.

It is from this pool that miners select transactions to create a block to add to the blockchain.

The Bitcoin blockchain’s speed is slow, supporting only 7 TPS. Transactions with higher transaction fees are given priority because they have higher rewards to the miners.

To add transactions in the waiting pool to the blockchain, miners need to solve a mathematical problem using their computation power.

Once the solution is found, the miner will broadcast it to the network and other miners will only accept it if all transactions in the block are valid according to the existing previous transactions on the blockchain (this is consensus).

The first step of the double-spend attack vector occurs when a bad actor chooses not to broadcast the solution, instead creating a parallel blockchain, and adding more transactions to it.

At this point, other miners can only add transactions to the true blockchain and not to the malicious actor’s hidden blockchain.

The bad actor is still able to spend his Bitcoins on the true blockchain, but he does not record those transactions on his private blockchain.

The result: Bitcoins are spent on the true blockchain and not on the isolated one.

To be able to double-spend the Bitcoin, the miner will need to force the other miners to migrate to the private blockchain, as the underlying governance protocol dictates.

This is where the hard part begins.

Miners follow the longest chain. The majority of miners automatically have a higher cumulative computational power, thereby they can add transactions to the blockchain faster than on a competing parallel chain run by one person.

Therefore, if the malicious actor can get the majority of hashing power, they can add transactions to the malicious chain faster, making it the real blockchain.

Once the miner’s private blockchain surpasses the true blockchain’s true length, it can be broadcast to the network. Then, once the rest of the network realizes the new version of the blockchain is actually longer, they are forced to switch onto the new chain.

When this happens, all wallet balances and pending transactions are updated according to the new chain. All transactions not recorded on this chain are immediately reversed.

This includes the malicious actor’s earlier expenditure, which is returned back to his wallet, enabling them to spend it again on the new chain.

This is a double-spend attack, or a 51% attack.

How safe is Bitcoin from the 51% attack?

It is quite difficult to perform a 51% attack on Bitcoin because of the cost factor of gaining the network’s power.

It would be extremely expensive to purchase all the mining hardware to surpass half the Bitcoin network’s hashing power. Not to mention the operational risks (electricity cost, storage space for hardware, money laundering) and even the risk of prosecution.

What about other blockchains?

While Bitcoin is arguably the most secure decentralized network, other blockchains are more vulnerable.

A large network with a Proof-of-Work consensus protocol is quite hard to compromise unlike a smaller blockchain utilizing the same algorithm due to the reduced amount of hashing power for the attacker to compete with in the latter case.

A number of altcoins have fallen to the 51% attack in the recent past.

Blockchain security

Blockchain security is the umbrella term used to describe safety against attacks on all levels of blockchain systems. Blockchain security can be divided broadly into three parts:

  • Infrastructure level: security of design and implementation. Case in point 51% attacks, Sybil and DDoS attacks
  • Smart contract: security of token contracts such as NEP-5, ERC-20
  • User level: security of wallets, websites, passwords 2FA

The double-spend attack is an example of an infrastructure-level blockchain security attack.

The chances of a 51% attack hinge on the network’s level of decentralization; the more nodes on the network, the harder it is to pull off.

In addition, this attack can only be revelled at Proof-of-Work blockchains like Bitcoin or Ethereum.

Most of the upcoming blockchains are using new consensus algorithms like Proof-of-Stake, more hybrid versions of the two or totally new ones altogether.

The network’s ability to withstand a 51% attack is testament to its security. People would lose confidence in a network that has suffered a successful 51% attack since a double-spend attack beats the logic of a cryptocurrency in the first place.

Due to the high risk involved, attackers only force through 51% attacks to be able to reverse transactions worth large sums of money or to target extremely valuable parties such as exchanges.

In the case of Zencash, more than 21,000 zen (worth about USD500,000 at the time) was in contention whereas in an attack on Bitcoin Gold, about USD18 million was involved.

To be more secure, the higher the number of confirmations of a transaction, the harder it is to steal those particular coins.

Other solutions to the 51% attack vector

A website, Crypto51 can show you how easy it is theoretically to level the 51% attack at any blockchain today.

ASICs

To make the network more secure, it is important to have a low barrier to entry for nodes.

Currently, this is difficult because Bitcoin mining has evolved to be the reserve of specialized computers known as ASIC miners.

The fact that it is quite expensive to own one has drawn criticism that the current setups empowers a number of individuals too strongly.

Smart contract bugs

There are multiple other bugs in cryptocurrency protocols that can be exploited. For instance, smart contract bugs in the Ethereum network can be aimed at coins launched on top of Ethereum. Hackers try to exploit faulty code to create their own tokens.

In April, batchOverflow and proxyOverflow bugs in several Ethereum smart contracts were exploited to artificially create tokens. Malicious actors cashed out these tokens for fiat or Bitcoin, thereby creating new value out of nowhere.

Some of the coins which fell prey to this attack include MESH, UGToken, SMT, SMART, MTC, CNY Token and CNYTokenPlus.

This content is not financial advice and should not form the basis of any financial investment decisions nor be seen as a recommendation to buy or sell any good or product. Trading cryptocurrency is complex and comes with a high risk of losing money, particularly if you trade on leverage. You should carefully consider whether trading cryptocurrencies is right for you and take the time to learn how trading works and decide how much money you are prepared to lose.

WRITTEN BY

Liquid

Providing liquidity for the crypto economy.