Ever since cryptocurrencies hit the scene, people have been looking for ways to exploit them. Blockchains, like any network, can be attacked by malicious actors, with the important difference that attackers stand to gain millions of dollars by exploiting the vulnerabilities of a blockchain.
This state of affairs has seduced many and a rich ecosystem dedicated to hacking, breaching, tricking and exploiting this still new technology has emerged. The most common approach in this regard revolves around the consensus mechanism which underpins blockchains and seeks to manipulate it for personal gain.
The key to understanding blockchain security is often found in decentralization – or more specifically – the level of decentralization. The bitcoin network for example currently consists of around 9,600 nodes spread all over the world. This network continually verifies transactions and checks key signatures to ensure the integrity of the bitcoin blockchain.
Importantly, a significant number of network participants expend computing power to solve complex computational problems. In doing so, they verify every transaction that is pushed to the network and add it to a block which references the previous block of transactions, which then forms the blockchain. As an incentive for expending the energy necessary to ensure that only real transactions are stored, they receive a reward. In the case of bitcoin, miners currently receive 12.5 bitcoins, while Ethereum miners receive the equivalent of 5 Ether.
The form of consensus mechanism described so far is called Proof-of-Work (PoW) and is by far the most popular. Ethereum and others are looking into switching to Proof-of-Stake, which does away with the need for miners, but large-scale adoption is still some way off.
In the case of Proof-of-Work the math problem miners are tasked with solving, is extremely complicated, because of the limitations – or parameters – which miners need to abide by. In bitcoin’s case, one of these limitations is that the generated hash must begin with a certain number of zeros. Exactly how few or many are required, is typically determined by a self-regulating algorithm. In bitcoin’s case, this algorithm is called bitcoin difficulty. Importantly, the speed at which the miners are able to solve the mathematical problem is called the hashrate, a very important term, which ultimately describes the overall security of a network.
If the necessary hashrate to mine a block of transactions is low, it becomes easier for malicious actors to mine blocks which contain fake transactions. The higher the hashrate of a network, the safer it typically is.
In very rare cases, two miners will solve the computational problem and submit their blocks at the same time. In the Proof-of-Work model, this then splits the existing chains into two, one for each of the submitted blocks. This is called a fork.
This happens semi-regularly and is typically overcome quickly. The rest of the network continues to mine and add transactions to the version of blockchain they believe to be the correct one. Within a short time frame, one version will emerge as the one the network overwhelmingly supports.
Crucially, miners who continue to add blocks to the losing chain do not receive a reward and are thus incentivized to support the longest chain and the one that the community as a whole chooses to keep.
51% attack and double-spending
Now that we have a good understanding of how mining works in a PoW system, we can turn our attention to 51% attacks.
As discussed previously, in a PoW system miners hold a disproportionate amount of power. Specifically, they are unelected/unappointed individuals and groups who are tasked with safeguarding billions of dollars worth of funds.
In most cases, the interests of the miners are aligned with those of the network. After all, their rewards are paid out in the network’s proprietary token, the value of which is determined in no small part by the integrity of its blockchain.
For malicious actors outside of the network, the situation is very different. For them, the prospect of injecting false transactions into the system provides the opportunity of double-spending their tokens and defrauding the network of vast sums of money.
The most obvious way of doing that is through a 51% attack. A “51% attack” is a situation in which an individual or group of miners control more than 50% of the network’s mining hashrate, and use their power to bend the blockchain to their will.
In this position of power, the malicious actors can prevent new transactions from gaining confirmations, and reverse previous transactions allowing them to spend coins they had already spent.
If a malicious actor holds less than 50% of the mining hashrate on the other hand, the rest of the network would simply reject the false transaction. This results in a situation in which the malicious actor is spending computational energy for nothing, and subsequently stops. Once the attacker has acquired more than 50% of the mining hashrate of the network he can influence the consensus and build a blockchain with incorrect transactions.
Krypton’s 51% attack and what we can learn from it
One such attack happened on the Ethereum Krypton blockchain. In this case, the 51% attack took a two-pronged approach. First, attackers overpowered the network with at least 51% of the hashing power, which allowed them to roll back transactions and spend their coins twice. While this was going on, the attackers launched a DDos attack on Krypton’s biggest mining pools, ensuring that the network was weak the time of attack. In the end, the attackers managed to steal around 21,000KR from Bittrex by double spending their coins.
To counter this threat, Krypton changed the number of confirmations required to validate transactions to 1,000. Bitcoin has used a similar approach in the past, with a new block not being considered fully valid until the block has been confirmed more than five times.
It has to be said, that although Krypton’s network was breached and the attackers managed to double-spend their coins, the damage done was quite limited. The 21,000KR only amounted to 5 BTC or around $4,000 at the time.
The Krypton example shows how uneconomical 51% attacks have typically been, and how the PoW system effectively battles malicious actors. In short, the energy involved in breaching the system is typically not justified by the meager results.
But that is now changing.
Understanding the sea change in 51% attacks
2018 has seen a spate of successful 51% attacks.
In each case, attackers were able to gain enough of the networks mining hashrate to compromise the network. Importantly, all the affected coins are relatively small, meaning that the computational power required to overwhelm the network was relatively small.
Nevertheless, these smaller networks hold a tremendous amount of value and the attackers were able to abscond with millions of dollars worth of tokens.
Understanding what has changed
The key to understanding why 51% attacks are experiencing a renaissance is that computational power can now be bought and rented at much more affordable prices than just a few years ago. With this new access to mining hashrate, nefarious actors have a much easier time overwhelming smaller networks and taking control – something that was practically impossible five years ago.
Marketplaces like NiceHash allow almost anyone to acquire the mining power to attack smaller networks. On the site Crypto51, interested parties can even discover how much a 51% attack would cost, using NiceHash as a reference point.
As of July 2018, an hour-long attack on Bytecoin, with a market cap north of $540 million can be purchased on NiceHash for just $368 dollars. With these staggering numbers in mind, it’s not difficult to see why more and more malicious actors are trying their luck.
51% attacks are a divisive issue because they tap into many of the existing battles raging on in the cryptocurrency space.
The easiest way of combating these attacks is by increasing the number of confirmations a block has to go through before being deemed valid by the network. This approach gives the network time to detect the nefarious actor and effectively shut down transactions until the situation is rectified.
On the downside, increasing confirmation times has the negative side effect of slowing down payments. This means consumers would need to wait even longer before their transactions are processed, making mainstream adoption a thing of impossibility.
You can imagine paying for your coffee with LTC and having to wait 90 minutes in Starbucks before leaving because your transaction took so long to confirm. This will surely never be acceptable to the average consumer and should make us think twice about increasing confirmation times.
An alternative approach that is picking up steam is abandoning PoW for alternative consensus mechanisms. It has long been held in the crypto-space that miners are too powerful and that mining pools centralize that power, potentially posing a threat to the network.
That is why many successful altcoins have opted for more unconventional consensus mechanisms. EOS, for example, uses delegated proof of stake, while Cardano is working on the Ouroboros Proof of Stake algorithm.
These alternative consensus mechanisms, get rid of the need for miners by finding new and innovative ways of securing the blockchain. Maybe bitcoin should too.