What You Need To Know To Understand Blockchain Technology Part 8

The first layer of security on a blockchain network.


The main benefit of the proof-of-work algorithm is that it makes blockchain networks extremely secure and this security has several layers to it. To understand these layers, you need to know the term “hashrate.” Winning a right to add a block to the blockchain is all about coming up with a winning nonce, adding this nonce to the data about transaction and generating a hash for the data to see if it matches the difficulty parameter. Hashrate is simply the speed with which computer hardware can be generating hashes to test if one of these hashes is a winning hash. Obviously, the faster the hashrate, the more hashes the hardware can generate, the higher the changes of winning the right to create a block.

The parameter of difficulty on the network depends on the large part on how many miners the network has. Because the Bitcoin blockchain tries to create a block of the blockchain every ten minutes, if the number of miners goes up significantly, then the miners will be creating the blocks faster, and so the difficulty would go up to keep the blocks still being added at the speed of one per every ten minutes. Practically speaking, this means that as the number of miners is increasing, the difficulty is also increasing, and so to stay competitive miners are increasing the hashrate power of their hardware. Here is the chart on which you can see what has been happening to the hashrate of the Bitcoin network since its inception in 2009: https://blockchain.info/charts/hash-rate?timespan=all. And this is the hashrate chart for the Ethereum network: https://etherscan.io/chart/hashrate


The first layer of security: hashrate and the rule of the longest chain

The easiest way to explain the rule of the longest chain is by considering an example. Let’s say there is a blockchain that has four miners, M1, M2, M3 and M4. Let’s now say that miners M1 and M2 disagree about something with miners M3 and M4 and now M1 and M2 are mining their own blocks of the blockchain and not accepting blocks from M3 and M4 with M3 and M4 doing the same: mining their own blocks and not accepting blocks from M1 and M2. When this happens, after miners create just one block, let’s say it’s a block by M1 and M2 and let’s call it BLOCKM12 with B0 being the block before that, when all the miners agreed, every miner now has a choice. The choice has two options. The first one is to ignore the block BLOCKM12 and keep adding blocks to the block B0. The second choice is to accept BLOCKM12 as a legitimate continuation of the blockchain and add a block not to B0, but to BLOCKM12. With four miners on the network and two miners disagreeing with the other two, what will the network do?

In cases like this one, the Bitcoin blockchain and most other blockchains use the rule of the longest chain. This rule says that the longest chain wins. Typically, this rule solves a lot of problems and disagreements because miners can only be mining blocks on one chain. This means that they need to decide quickly which chain they prefer, otherwise, if they keep mining on a chain that is going nowhere, they will not make any money because the value of the token on a blockchain that is going nowhere will be equal to zero.

Practically speaking, this means that if there are four miners and two are competing against the other two, the ones that are going to win are going to be the ones that have the hardware with the higher hashrate.

With higher hashrate, they will be able to come up with the winning hashes faster, which means they will be adding the blocks to the blockchain faster, which means that the network will accept their version of the blockchain as a true version according to the longest chain rule.

What follows from this is the first layer of security on a proof-of work blockchain such as Bitcoin, which is that to successfully attack a network, an attacker would need to have hashrate that is equal or higher than 51% hashrate of the network. Otherwise, 51% of the network’s hashrate will be creating blocks faster and the network will accept these blocks as legitimate.