With the establishment of Bitmain’s monopoly over the SHA256 mining industry, the bitcoin community have been talking about the possibilities of a 51% attack by Bitmain on the bitcoin network. In this article, I will try to explain what 51% attacks are and how they affect the blockchain’s security.
51% Attack in Bitcoin
A 51% attack, also known as the majority attack, is a widely known attack in the blockchain ecosystem. This attack involves the attacker being able to control >50% of the hash power of the network. Using this attack, the miner can double spend transactions to any number of confirmations. More confirmations does make this attack more expensive but cannot prevent it.
The mining nodes in bitcoin follow a simple rule i.e. follow the blockchain with maximum work done. Work done is a multiple of blockchain height(number of blocks) and the block difficulty. Every new block mined increases the work done on the blockchain. Whenever two miners find a block at the same time in a blockchain, there is a temporary fork in the network. The miner finding the next block resolves the fork as his chain now has the more work out of two forks. This causes a blockchain reorganization for the nodes that are on the other fork and the block that caused the fork becomes orphaned and is replaced by the block from the fork with more blocks. These type of reorganizations are the reason why it is recommended not to confirm payments until 6 confirmations in bitcoin.
51% Attack Blockchain Reorganization
During a 51% attack, the miner has more hashpower than the rest of the network. This means that the miner is able to create blocks of same difficulty as the network at a rate faster than the rest of the network. This makes him able to trigger blockchain reorganizations at will.
To take advantage of this, the attacker starts mining blocks privately without broadcasting them to network. The attacker then makes a transaction on the public network to an exchange or wherever he can spend it and makes another transaction on his private network to his other address. Other miners mining on the network see his transaction to the exchange, mines a block and confirm it. The receiver of the coins sees that the transaction has now confirmed on the network and allows the sender to be able to spend the credited coins. In case of an exchange, the user can choose to exchange his coins to an altcoin and withdraw the coins.
Now since the attacker have successfully spent his coins, he broadcasts his private chain to the network. Since he has more than 50% of the network’s hashrate, his private blockchain will be longer than the rest of network and this will trigger a block reorganization in the rest of the network. Due to this, the transaction that the attacker made to the exchange will be vanished from the blockchain and will be deemed as a double spend even if it is rebroadcasted to the network as the attacker already moved his coins to some other address in his private blockchain.
Issues with 51% Attack
- Too expensive – It is really expensive to perform 51% attack. Bitcoin’s incentive structure is built in such a way that anyone performing this attack will miss out on huge profits just to do a double spend.
- Possibility of failure – Since the attack is too expensive to carry on for a long time, the attacker may end up with a blockchain that is smaller than the network blockchain. In this case, attacker’s blockchain will not be able to reorg the network blockchain causing the attack to fail causing huge losses to the attacker.
51% attacks are extremely expensive to perform and bitcoin’s incentive structure is built in such a way that the person trying such attack can earn much more from securing the network rather than attacking it. However, such attack is highly possible on altcoins with lower hashrate such as bitcoin cash.
Let me know what you think about 51% attacks in the comments below.