What are consensus algorithms?
Consensus means finding a way so people on a blockchain can reach a common agreement about the present state of the distributed ledger.
Consensus algorithms make sure that all the nodes on the blockchain can reach a consensus over some computation. As a result, It will bring reliability to the blockchain network and establish trust among all the nodes in a blockchain.
Blind Assignment of Blockchain Extension (BABE) primarily provides block authoring. In comparison with other consensus algorithms like AURA aka “Authority Round” which uses a round-robin to choose the authorities. BABE uses a verifiable random function (VRF). It breaks Time into epochs, and then those epochs into slots.
These slots got assign to an author known as slot leader. The slot leader can be a single node, no node, or a group of nodes selected to be the slot leader. However, these assignments are secret that only the slot leader knows about its assigned slot. The other nodes get to know about the leader of the particular slot after the leader publicly claims their slot when they produce a new block in one.
Importing a Babe-Pallet Crate
So to use Babe first we need to import Babe pallet to our runtime’s cargo.toml file.
now add the pallet std feature to runtime’s cargo.toml file std features.
Adding Babe-Pallet to the construct_runtime! Macro
Importing babe-pallet to runtime’s cargo.toml file is not enough we need to add the pallet to runtime construct.
Implement Babe-pallet to runtime
After adding babe-pallet to runtime we need to implement the pallet in runtime.
If you want to read more content like this? Subscribe to Rust Times Newsletter and receive insights and latest updates, bi-weekly, straight into your inbox. Subscribe to Rust Times Newsletter: https://bit.ly/2Vdlld7.