Are you curious about consensus algorithms, how they differ and it’s usefulness for developers? Great! You’ve come to the right place. To learn blockchain development and be certified I recommend visiting Ivan on Tech Academy.
Blockchain is currently #1 ranked skill by LinkedIn, hence you should definitely learn more about Ethereum to get a full-time position in crypto during 2020.
On my first and second pieces I’ve discussed how Ethereum 2.0 and the best tools for developers. On my third and fourth articles I’ve discussed quadratic voting and open governance models. Finally, on my latest release I’ve looked into Swarm’s infrastructure.
Now to the topic at hand: why do different consensus algorithms matter for Ethereum developers?
In this article I’ll take a look at the key features of consensus algorithms. I’ll answer why decentralisation, immutability, and security are important features for any consensus algorithm to be adopted by the mainstream.
This guide is key for any developer who wishes to understand:
- Why Bitcoin’s technology is currently the best, in terms of security.
- Why is it so hard for other cryptocurrencies to replace Bitcoin in terms of network effects.
- How PoW (Proof-of-Work) guarantees the best balance between security, immutability, and decentralisation.
Why consensus matters?
One of the most widely discussed aspects of blockchains, while hard to digest, are consensus mechanics.
You may have heard some cryptocurrency experts stating how PoS (Proof-of-Stake), or dBFT (Delegated Byzantine Fault Tolerance) are the next big leap in consensus mechanics. Those new consensus algorithms will allow blockchains to truly scale.
However, a few questions remain unanswered when the topic of discussion are different consensus algorithms. For instance:
- Does decentralised consensus matter, if the network is not properly immutable?
- Does decentralised consensus matter, if the supply can be changed or messed with by a few decision-makers?
- And, finally, does decentralised consensus matter if there are single points of failure?
An overview of consensus mechanisms
If you’ve answered “no” to all three questions above, I believe you’re ready to move on to the next section. My goal is to give you a brief explanation of the components, benefits, and supporting technology of distributed and decentralised consensus algorithms.
By understanding each, you’ll most likely comprehend why some consensus mechanics are better for security, while others are better for decentralization or scalability.
|Cryptography||Security, anonymity (or pseudo-anonymity), immutability, auditability.|
Public key cryptography, PGP, hashing
|Security, immutability, auditability, tamper-proof, reliability.|
|Participation, coordination, decentralisation.|
|Security, consistency, liveliness, fault tolerance, protection against double spending.|
PoW, PoS, DBFT
The table above summarizes the benefit of each component pretty clearly. It also explains why there can’t be a truly decentralised consensus mechanic without an immutable, public, and reliable blockchain. Hence, I’ll ignore private-blockchains for the time being as there are no incentives associated to running a node publicly.
A question you might be wondering is when to chose a public-blockchain?
Does it make sense to have a permissionless, borderless and censorship-resistant system for mostly everything?
When to adopt decentralised consensus
As mentioned above, PoW – or any other distributed consensus algorithm – is part of a bigger network infrastructure.
The reason why distributed consensus is needed is due to the fact agents cannot trust each other. Hence, when should a distributed consensus algorithm be considered? In my opinion, only when the above questions are answered positively, as shown in the workflow.
If there is a requirement for parties that do not trust each other to trade, a public blockchain can be a solution. It does not require buyers and sellers to trust each other. However, there are plenty of other infrastructures that can do a faster job than public blockchains. When there is already some level of trust among agents, private-chains may be the best use-case.
Is PoW the best method to maintain long-term value? Or should we look into other alternative consensus algorithms like PoS or dBFT in order to achieve the highest level of security, decentralization or scalability?
How PoW works
In simple terms, the Proof-of-Work consensus mechanism converts energy into hashing power. The more hashing power a network has, the more secure it is. In addition, the more miners (network validators) who are running the PoW algorithm, the more decentralised and secure the network is as well.
To avoid centralisation and to keep the network at its most secure, there is a difficulty adjustment algorithm. Essentially, it adjusts the required energy input to produce an output. Hence, the more validating nodes there are, the harder it is to mine one block and the harder it is to keep the same hashing power (in percentage of the total network). Miners need to spend additional energy to produce the same output, making the entire process more energy consuming.
Therefore, the two most important characteristics of PoW systems are hashing power and the number of validating nodes.
The third and last key point of any consensus mechanic are the incentives. In PoW, there are currently two main economic incentives for network validators: (a) transaction fees and (b) block rewards. Without a reward, there is no incentive for a miner to follow the protocol and keep the network secure.
Is PoW the most secure consensus algorithm?
Regarding the security of consensus mechanisms, there are two key metrics I would like to focus on.
The first is the ability to keep a blockchain immutable. The second is the short-term vs long-term impact of a long-range attack.
Let’s first assume the network is decentralised by nature (meaning anyone can participate). My approach is to understand what are the mechanics that allow a consensus algorithm to keep a high degree of immutability. Otherwise, what’s the point of having a decentralised network if it has a central point of failure?
With PoW, immutability is guaranteed by the energy requirement to validate blocks. When a node connects for the first time to the Bitcoin blockchain, it must run the rules of the protocol and validate all previous blocks as well. The same process happens for nodes validating transactions.
Therefore, there is no shortcut to change previous blocks.
That’s why PoW mechanisms are considered to be probabilistic. The maximum immutability it provides, in the long term, is about 99.9%.
By comparison, for example, Proof-of-Stake (PoS) offers certainty as transactions cannot be altered after being posted. It’s written into the protocol that any posted transaction cannot be changed. In PoW, as discussed, it’s the longest chain (or the heaviest chain) that wins.
Is PoW the most immutable consensus algorithm?
Some crypto-enthusiasts believe that PoS is the most immutable consensus mechanic given transactions cannot be altered. Nevertheless, that only holds true when an attacker is unsuccessful.
PoW is clearly less secure in the short term as it’s “easier” to get 51% of the total hashing power by purchasing more hardware. In addition, the upper-bound limit (price) won’t likely change much when purchasing hardware. However, PoW is also the most robust in the long term. To maintain 51% of the total hashing power, an organisation controlling the validating nodes would have to exponentially increase its energy expenditure to keep mining the longest chain.
Remember, PoW adjusts its energy input requirements through its difficulty adjustment algorithm. Hence, PoW makes validating nodes spend more energy as more hashing power is added to the network.
The outcome is that it’s nearly impossible to maintain 51% of the hashing power. In the long-run.
… And Pos?
In contrast, PoS only requires nodes to purchase or receive the coin and commit it (stake the coin) to validate transactions. While in the short term it’s harder to attack the network – to get 51% of the staking power, one would be required to purchase 51% of the total stake, meaning price would likely increase as more coins were bought (assuming there is a hard supply) – in the long term, there is little that can be done once an attacker is successful.
The only way out is with a protocol hard fork. The solution would require to either increase the supply, ignore the attacker’s coins, or to block the attacker’s addresses.
None of the above solutions keeps the blockchain immutable. Therefore, in the long term at least, PoW is a better option than PoS in terms of immutability.
To conclude the above analysis I would like to underline the following:
- PoS is better for decentralization. It does not require stakers to purchase hardware.
- PoS staking mechanism blocks attackers. If an attacker tries to revert a transaction they lose their stake.
- PoS does not require an asset outside the system (electricity) to maintain security.
This article is not financial advisement. Changes may happen that the author is unaware of. Always check the resources provided! !