With no single leader, blockchain consists of a network of individual nodes that are connected in a decentralized manner. In order for any action to happen or for any transaction to go through, common consensus must be reached. This system functions according to a consensus protocol (mechanism). In this article, we outline the functionality of cryptocurrency consensus algorithms along with their types, peculiarities, and pros and cons in various blockchains.
Blockchain technology functions as a decentralized digital ledger with a peer-to-peer payment and interaction system. Its main characteristic is its independence and freedom from centralized control and the interference of authority. Devoid of single-institution dependence and corruption, the blockchain is currently solving a myriad of organizational issues within a wide range of industries. It provides users, providers, and organizations with transparent record-tracking, immutability, enhanced security, and, of course, safe, fast transaction processing.
On the other hand, the implementation of blockchain might not be as easy as its concept. It is crucial to understand how to make decisions within the system, and how to perform all sorts of actions without the common pattern of centralized leadership management.
What Is a Consensus Mechanism?
According to Wikipedia, consensus decision-making is:
To put it simply, the process of reaching consensus is a common agreement within a group of people that a certain action is true and valid. Commonly, this is performed according to a voting procedure to ensure that the decision is beneficial for the whole group of users, not just a single individual or minority. What’s interesting is that a number of nodes from any part of the world can make this type of decision, without geographical limitation. This approach contributes equality, fairness, and unity to our modern society.
Various blockchains use the consensus mechanism (and there are many types of consensus that will be discussed) with the following objectives:
Having defined consensus, it is now crucial to understand exactly how it is used in the blockchain. Considering that blockchain is a huge network of nodes, it is essential to provide a way to establish trust in the system. Various types of consensus serve as a means of agreement on any transaction placed on the blockchain. If someone wants to send funds to another, it is essential to check whether the sender has sufficient funds in his or her wallet, and whether the receiver has complied with his obligations according to the smart contract. As long as the transaction is verified, it is considered valid, and only then can be executed/processed.
Types of Consensus Algorithms on the Blockchain
Blockchain technology provides different ways of reaching cryptocurrency consensus within the system. This process is called eventual consistency, which means that any action or transaction must eventually go through confirmation and validation in order to be processed. For this, blocks of data, as well as transaction mechanisms, are hosted within data patterns of different parties who do not trust each other. These parties verify data validity with the use of cryptocurrency consensus algorithms and cryptographic data audits, relying on a system of hashes within a Merkle tree:
In order to reach the eventual consistency, an order-executive architecture commonly comes into use. This means that the blockchain system first orders all transactions in sequential order, and only afterward does it execute them one by one. This type of approach often results in low performance due to time inefficiency and high computational costs.
These characteristics refer to the proof-of-work consensus algorithm. The first blockchain platform, Bitcoin, primarily used it. Let’s take a closer look at its working principles and major pros and cons.
Proof-of-Work (PoW) Consensus Algorithm
Proof of Work functions on the principle that miners solve difficult cryptographic problems in order to mine a block and verify its validity for inclusion in the blockchain. In order for a transaction to be executed, it has to go through six stages of verification. Therefore, the proof-of-work process requires a large amount of computational power, energy, and mining effort. The problems miners solve often appear to be complicated in order to provide higher security. This is beneficial in terms of safety, but significantly slows down the process of transaction verification.
The process includes the following:
- miners compete against each other in order to solve a problem/puzzle first
- miners solve mathematical problems and puzzles including hash function definition, integer factorization, and guided puzzle protocol
- the miners who succeed first receive rewards for completed tasks (usually in cryptocurrency)
The major benefit of the PoW consensus protocol is that it definitely works. For this reason, such blockchains as Bitcoin, Ethereum, Litecoin, and many others still use it.
Pros: highest scalability and security; serves as one of consensus smart contracts’ best practices.
Cons: low performance.
Its variations include:
Currently, there exists a wide range of consensus algorithms to choose from. In order to solve the problem of eventual consistency, various platforms have started implementing alternatives to Proof of work. As a result, blockchains have managed to provide more efficient speed of transaction processing, higher scalability, and enhanced security. Let’s take a look at a few alternative consensus mechanisms.
Proof-of-Stake Consensus Algorithm
Proof of stake is another popular algorithm used for reaching consensus. As a matter of fact, Ethereum has been planning to switch PoW to PoS. It hasn’t yet, but the intention remains.
Proof of stake replaces the mining process of data verification with validators. This requires them to own a stake: a number of coins. Validators vote on transaction validity based upon this stake. The votes of nodes holding higher amounts of stake are more valuable. This is further multiplied by computational power.
The process includes the following features:
- a block validator is chosen according to the stake he/she owns
- instead of a reward, the miner charges transaction fees
- PoS currencies can be much more cost-effective
PoS algorithm doesn’t require as much computational power as PoW; therefore, it is less expensive.
On the other hand, the biggest drawback of this consensus protocol is the so-called “nothing at stake.” If a fork occurs, the consensus mechanism enables the network to decide which chain to choose. The problem is that the majority wins, and this doesn’t depend upon which chain is actually the right one. “Nothing at stake” allows the choice of a “wrong” chain, even if it has malicious intentions and will lose nothing. Moreover, the block validator can choose two chains, and get his or her rewards either way.
Pros: high performance, scalability, smart-contract support.
Cons: medium security, nothing-at-stake problem.
PoS has the following variations:
Delegated Proof-Of-Stake Consensus Algorithm
Delegated Proof of Stake is a variation of the above-mentioned PoS algorithm. Currently, EOS, Steemit, and Bitshares implement DPoS in order to provide better scalability.
According to its working principle, token holders don’t have to vote on block validity themselves. Instead, they can delegate their vote to other validators. In EOS, for instance, there are between 21 and 100 random validators.
This approach allows a lot of members participate in the process of decision-making with the opportunity to validate blocks according to the total number of votes they receive relative to other producers.
The process includes the following stages:
- Blocks get confirmed in a round of 21.
- At the beginning of a new round, block producers/validators are chosen (according to the number of votes they have).
- According to the block’s random number, validators shuffle around to assure that the connection of balance and producer maintains.
- Producers have to validate at least one block per 24 hours to avoid the punishment.
Another DPoS peculiarity is that no forking option exists. This is due to an absence of competition and the necessity of cooperation. If a fork does occur, DPoS consensus protocol will switch to the longest chain.
Pros: scalability, speed, cost-efficiency.
Cons: partial centralization in terms of legal agreement between the delegates.
Byzantine Fault Tolerance
The idea of Byzantine Fault Tolerance (BFT) is to ensure the existence of a certain number of validators who must agree on transaction validity. This concerns the Byzantine Generals’ problem. If one person decides to validate a transaction even if it is corrupt, everyone would have to go with it. The BFT algorithm requires the votes of at least one third of the validators in order to provide higher security.
To achieve the agreement, it is important to solve the Byzantine Generals’ Problem through the votes of numerous nodes on the leader of decision-making. The leader is the node that first receives a transaction to verify, and the others vote whether they believe it or not.
Hyperledger, Stellar, Dispatch, and Ripple use this algorithm.
Pros: high throughput, cost-efficiency, smart-contract support
Cons: low scalability, semi-centralized system
Quorum-Based Protocol Example
Quorum has designed another interesting solution for consensus protocol. Quorum is an Ethereum sidechain platform which is especially advantageous for use in the financial sector. This enterprise-focused blockchain functions as a permissioned blockchain. This means that the network won’t be open or freely accessible to anyone. It is possible to store data privately as well as publicly, with certain read or write permissions.
The Quorum consensus protocol, referred to as QuorumChain, initiates from the first block: the genesis block. Quorum protocol is pretty straightforward, as it functions according to a majority of votes. According to this principle, a set of nodes can relegate voting rights and re-assign them to other nodes. For this purpose, smart-contract use comes in handy, as it tracks the conditions and status of voting nodes within the system. The smart contract triggers a voting procedure and further pings the nodes to conduct a transaction within a specific block. Quorum-protocol transactions include hashes of global transactions, public-state root hashes, and the signature of the block creator.
Having discussed the most commonly-used consensus protocols, it is clear that there exists a wide range to choose from. It is crucial to understand, though, that each consensus has its advantages and disadvantages. There is no best match.
To choose the right algorithm, the question of the blockchain platform should be approached. Financial-sector businesses that need to confirm their transactions quickly and scalably with smart-contract use would not choose the Bitcoin platform, as the PoW algorithm isn’t the best match. Even the Ethereum mainnet, the most widespread network in use, charges high gas fees and still uses the PoW. Therefore, considering Ethereum side chains such as Quorum, Corda, Loom, Plasma, and Plasma Cash would be better, as they have an absolutely new approach to the problem of eventual consistency.
Want to launch your project, but still wondering how, and which platform to use? Contact Applicature! Our team of experts would be happy to help you out.[/vc_column_text][/vc_column][/vc_row]