Polkadot, launched in May 2020, is often considered a next-gen blockchain protocol. It is a heterogeneous multi-chain combining an entire network of independent blockchains to provide trust-free cross-chain interoperability. Any data can be sent between these blockchains, and any application deployed on Polkadot can be substantially scaled-out over a number of these parachains. A wide range of real-world use-cases can be built leveraging the best of the multiple blockchains. A network of heterogeneous and sovereign blockchain shards are called parachains. These chains connect to the Polkadot Relay Chain. It holds the states of each parachain. Supported by proof of stake protocol, it maintains the network’s security, consensus, and cross-chain interoperability. To understand how consistency is achieved on the Polkadot relay chain, let us dive into its unique set of consensus protocols. Issues with Existing Consensus Mechanisms Nakamoto consensus, largely known as Proof of Work, has been part of many blockchains, including Bitcoin. It is known to consume an incredible amount of energy. The miners gain awards for adding blocks accepted by the majority. Nothing is at stake here for miners and their malicious behavior often gets unpunished. Bitcoin, being a distributed system, prefers availability over consistency and believes the nodes will catch up eventually to the longest blockchain followed by the majority in the system. It only provides probabilistic finality for a block. A block once included in a blockchain in the past is only as safe as the number of blocks that have been built on top of it, expending more computational work behind this particular chain. However, there is no guarantee that this chain containing the block will always remain the canonical chain. A malicious miner with unlimited resources could potentially build a competing chain and expend enough computational resources to create a chain that did not contain a specific block. In such a situation, the longest chain rule employed in Bitcoin and other proof of work chains would move to this new chain as the canonical one. Other consensus mechanisms like pBFT provide finality to the fate of every block after making it. More than 2/3rd of the validators approve the inclusion of a block making it final. Here, consistency among nodes is more important than availability. But these blockchains are vulnerable to stalling in the case of a network partition where more than 2/3rd of the validators get disconnected. In such cases, no majority can be achieved on a block, and the system may stall and may not be able to continue forward. Consensus Mechanism in Polkadot Polkadot employs a hybrid consensus mechanism. With some conditions applied, it tries to achieve consistency, availability, and partition tolerance. It provides provable finality for blocks that can never be reverted after some process of Byzantine agreements has taken place. It allows blocks to be rapidly produced with an Irreversible consensus without risking slower transaction processing or stalling. It employs a Proof of Stake based mechanism to choose a validator set that participates in consensus using a hybrid protocol referred to as, BABE and GRANDPA. NPoS (Nominated Proof-of-Stake) This algorithm selects a validator set from candidates who are interested in maintaining the network by staking DOT (the native token of Polkadot). The selection is repeated every era (a day in Polkadot). Validators assume the role of producing new blocks in BABE, validating parachain blocks, and guaranteeing finality. Like other PoS protocols, in case some validator tries to do something malicious or otherwise detrimental to the network, a percentage of their stake is slashed. Validators bonds are kept for longer periods of around 3 months. It allows future misbehavior to be punished, thus mitigating any short-range attacks on the chain. Long-range, nothing-at-stake attacks after validators bond ends are not possible in Polkadot because of finality achieved by GRANDPA protocol. BABE Protocol Blind Assignment for Blockchain Extension (BABE). It is a block production mechanism that runs between the validator nodes and determines the authors of new blocks. BABE is similar to a consensus mechanism, Ouroboros Praos (Cardano network will switch to it soon, currently on Ouroboros protocol), with some key differences in chain selection rule and slot time adjustments. In this mechanism, time is divided into epochs. Each epoch is further split into discrete units of time, called slots, nominally 6 seconds in length. A block is produced in every slot. At the beginning of an epoch, all validators participate in a lottery to determine which slot they would produce the block for. Every validator has their own pair of public and secret block signing keys. When an epoch starts, all the validators use their secret keys and some randomness (uses VRF, verifiable random function) from previous epochs (2 epochs past). They generate a pseudo-random number using these values. If the value produced is less than a target, then that validator is … Continued
The post How BABE and GRANDPA Achieve Consensus in Polkadot? appeared first on Cryptoknowmics-Crypto News and Media Platform.
from Live Crypto News – Cryptoknowmics-Crypto News and Media Platform