Bitcoin's consensus mechanism is theoretically vulnerable to attack by miners for dishonest or destructive purposes.
As we have seen in other articles, the consensus depends on having a majority of miners interested in keeping the network working honestly. However, if a group succeeds in gathering enough mining power, it can launch an attack on the network with the aim of changing the consensus rules, whether for their own benefit, to disable the network or to block specific addresses.
An attack on the network consensus is known as a "51% attack". To achieve this, the group of miners will have to be able to gather a majority of the computing power of the network.
Having this power, they can mine most of the blocks. This allows for two types of rule perversions:
- Create double-spending transactions - attackers are able to create a transaction that spends twice the same currencies by creating a fork below previously confirmed blocks. Gathering enough power, it would be possible for an attacker to invalidate six or more blocks, thus reversing transactions that were validated (it is considered valid after 6 confirmations, 6 blocks published above the one that includes it). Note that this would only be possible for the attacker's own operations. In this attack, evildoers wait for their transaction to be validated, fork it down and use those currencies again to make another payment. In this way, the address that had received the bitcoins the first time loses them and the attacker manages to keep the good or service for which he exchanged those coins.
- Prevent service from transactions or specific addresses. In this type of attack, attackers are able to block transactions or even addresses from receiving or sending bitcoins. As the attackers are in control of the network, they can identify certain operations and choose that they are not included in the blocks that will be added to the chain. This selection of transactions can be made individually or, if you want to reach a specific address, identify transfers that are destined for or made from there. And, even if another miner includes one of these transactions in a block, attackers could fork and mine the block again without including it.
Despite all these risks, it is important to emphasize that an attack on the network consensus can only affect the future consensus or, at worst, the recent past (dozens of blocks). Theoretically, a fork can be achieved at any point in the chain, but in practice it would take absurd computing power to change very old blocks. Transactions stored on the blockchain are increasingly secure as time passes and more blocks are mined. It should also be noted that these types of attacks are not able to steal bitcoins, spend bitcoins without the signature of their own address or change previous operations or possession of bitcoins. This type of attacks cannot reach the security of private keys or the transaction signature algorithm. This means that even if a malicious group managed to “take care” of the network, it could not steal all Bitcoins for itself.
In fact, a 51% attack does not really need to have 51% of the total computing power of the network. According to some estimates, that figure could be just 30%. This attack is essentially an arm wrestling between the attackers and the net, in which the strongest group will win. The more computing power the group has, the greater the likelihood of being able to dominate Bitcoin.
However, once again Bitcoin's strength lies in numbers and the decentralization of power. Currently, the computing power of the network is around 100 million TH / s (100 million third attempts are made to find the solution for Proof-of-Work per second). It is possible to buy mining equipment that does 73 TH / s at about $ 2000. Doing the math: to have computing power, just for the 30%, it would be necessary to invest more than 800 million dollars.
That is, even if it is theoretically possible to carry out an attack of this type, too many resources would be needed to execute it.
If, on the other hand, the attackers' intentions were just to try to destroy confidence in Bitcoin, they certainly would. But on the other hand, the network and software are constantly evolving and the community would quickly be able to respond with measures that would make Bitcoin more robust from then on.
The likelihood of such an attack to be successful becomes even less if we consider all the players in the network. Bitcoin is made up of miners, programmers, wallets, end users and more. They all have a say in changing the consensus rules. For example, even if a majority of miners agreed to change a rule, even without malicious intent, the other actors could simply not follow them because they disagreed with that change. This would cause economic activity to remain in a minority chain and these miners would be mining a worthless currency.
The way to make changes or improvements to the blockchains will always be through forks that change the rules of the consensus so that all stakeholders can decide which rules they want to follow, being free to choose which chain they want to follow from that moment on.
As we saw when we studied forks, there are valid reasons for choosing soft and hard forks. For each case, there are also risks and therefore each proposal will have to be analyzed by the members of the network to make their decision. The only constant that we have ensured in the development of consensus software is that the changes are difficult and require compromises that make the community satisfied. Bitcoin and Crypto-Community as a decentralized system keeps the bar high on this topic and is the community par excellence to innovate this type of software.