Consensus mechanisms (also known as consensus protocols or consensus algorithms) are used to validate transactions and keep the underlying blockchain secure.
There are many types of consensus mechanisms, each with its own set of advantages and disadvantages.
Is not as simple as it appears conceptually.
Collecting everyone's approval on a single modification ( achieving consensus) sounds time-consuming and sophisticated.
Even so, it is difficult to have the approval of every member of the blockchain; yet, individuals were able to accomplish so by creating mechanisms. Each blockchain works through its own consensus mechanism with pre-defined algorithms. Let’s have a detailed look at it.
The term "consensus" in general means a broad agreement. Consensus for blockchain is the process through which the peers of a blockchain network agree on the current state of the network's data. Consensus algorithms build dependability and trustability into the blockchain network in this way.
Achieving consensus requires a majority of nodes to agree on the network’s global state. In most networks, it requires 51 percent of nodes to validate a transaction.
Consider a group of individuals heading on a trip. A consensus is reached when there is no dispute about a suggested destination option. If there is a dispute, the group must be able to choose the place. In severe instances, the group will break up.
The consensus mechanism refers to the full set of protocols, incentives, and concepts that allow a network of nodes to agree on a blockchain's state. A consensus mechanism is a fault-tolerant technique used in computer and blockchain systems to obtain the necessary agreement among nodes. It is handy for keeping records, among other things, too.
The most common consensus mechanisms in the context of blockchains and cryptocurrencies are proof-of-work (PoW) and proof-of-stake (PoS). The consensus method on the Bitcoin blockchain, for example, is known as Proof-of-Work (PoW), which involves the use of computational power to solve a tough but arbitrary problem to keep all nodes in the network legitimate.
Public blockchains function on a worldwide scale as decentralized, self-regulating networks with no central authority. They entail contributions from hundreds of thousands of participants who work on the verification and authentication of blockchain transactions as well as block mining operations.
In the context of the blockchain's dynamically changing status, they require an efficient, fair, real-time, functional, reliable, and secure mechanism to ensure that all transactions occurring on the network are legitimate and that all participants agree on a consensus on the ledger's status.
This critical role is carried out by the consensus mechanism, which is a system of rules that determine the legality of contributions made by the blockchain's various participants (i.e., nodes or transactors).
Consensus algorithms ensure that some processes and systems will be unavailable and that only a subset of the nodes will respond when solving a consensus problem. They also presume that some signals will be lost while being sent.
However, a response from the access nodes is required. An algorithm, for example, may require at least 51% of nodes to reply to reach a consensus or agreement on a data value or network state.
This assures that consensus is reached with little resources, even if other resources are missing or malfunctioning. The technique also ensures the integrity of judgments made by the network’s agreeing nodes.
There are many consensus algorithms available that a decentralized system can use. Each algorithm has its own method for attaining global consensus on a network update.
Proof-of-Work: This consensus algorithm is used to choose who will mine the next block. This PoW consensus algorithm is used by Bitcoin. The main concept behind this method is to solve a hard mathematical puzzle, which demands a huge amount of computational power. The node that solves it as quickly as possible gets to mine the next block and gets a block reward.
Proof-of-Stake: The most common alternative to PoW. Ethereum's consensus has moved from PoW to PoS. Instead of investing in expensive technology to verify blocks and transactions, validators invest in the system's currency by locking up a certain amount of their coins as a stake.
Validators are then chosen at random to validate, the block. Blocks are validated by many validators, and when a certain number of validators confirm that the block is correct, it is completed and closed.
Proof-of-Activity: Proof of activity (PoA) is a consensus process that combines the PoW and PoS consensus mechanisms. The most well-known blockchain project which utilizes PoA is Decred (DCR).
In PoA systems, mining begins similarly to PoW, with miners vying to solve an intricate mathematical problem using massive processing power. However, after the block has been mined, the system changes to PoS mode, with the successfully created block header being broadcast to the PoA network. A set of validators is then chosen at random to sign off on the hash, therefore verifying the new block.
Proof-of-Burn: Instead of investing in costly hardware, validators burn coins by sending them to an address from which they can never be reclaimed. Validators acquire the right to mine on the system based on a random selection procedure by sending the coins to an unreachable address.
Thus, validators make a long-term commitment in return for a short-term loss by burning tokens. Miners burn the native currency of the Blockchain application or the currency of an alternate chain, depending on how the PoB is implemented. The more coins they burn, the more likely it is that they will be chosen to mine the next block. While PoB is an interesting alternative to PoW, it still wastes resources inefficiently.
Proof-of Capacity: Validators in the Proof-of-Capacity consensus are expected to contribute their hard drive space rather than investing in expensive gear or burning coins. The more hard drive space validators have, the more likely it is that they will be chosen to mine the next block and get the block reward.
Proof-of-History: This mechanism is based on the time problem associated with the consensus. Many programmable blockchains, such as Ethereum, rely on third-party applications to assign a timestamp, which is then used to authenticate transactions in the order in which they were received.
Solana’s Proof of History tackles this problem by allowing these "timestamps" to be embedded into the blockchain itself. This is accomplished using a VDF(verified delay function). Every block miner needs to go through the VDF, this proof of history, to get to their allotted position and generate a block. It is accomplished by introducing data into the sequence and appending the hash of the previously created data.Proof-of-Elapsed Time: PoET is popular in permissioned blockchain networks. In this technique, each validator on the network is given an equal opportunity to construct their own block. All nodes accomplish this by waiting for a random period of time and recording their wait in the block. The produced blocks are published to the network for evaluation by others.
The validator with the lowest timer value in the proof portion wins. The winning validator node's block is added to the blockchain. The program includes extra checks to prevent nodes from always winning the voting and from providing the lowest timer value.