Initialization
This section provides details of the initialization of Blade's consensus algorithm.
The starting point of Blade's consensus algorithm is the Polybft component, which serves as a wrapper around IBFT. The Polybft component is instantiated only once, during node startup, and remains unchanged throughout the node's operation until it is shut down. Two additional components that also remain unchanged during the node startup are IBFT and ConsensusRuntime (see Components of Consensus Mechanism sequence diagram).

Polybft, through the Initialize() method, sets its initial data and simultaneously invokes the appropriate methods to create IBFT and ConsensusRuntime, and stores their instances within the previously instantiated Polybft.
The
ConsensusRuntimeis created by calling thenewConsensusRuntime()method. The role of theConsensusRuntimeobject is to create a new instance of theIBFTbackend for each new initiation of the IBFT consensus algorithm.Polybftuses thenewIBFT()method to createIBFT, with aim to achieve consensus for a new block.
When a new IBFT sequence is initiated, ConsensusRuntime is tasked with creating a new instance of IBFTBackend by invoking the CreateIBFTBackend() method.
In the sequence diagram below, we can see that when the current node is a validator of the current block, it uses the createIBFTBackend()method to create the backend for IBFT. After creating the IBFT backend, Polybft sets the created backend in IBFT using the setIBFTBackend() method. If all the previous steps are successfully executed, Polybft initiates the IBFT consensus mechanism by calling the RunSequence() method and receives a sequenceCh chain in response, on which it listens for the completion of creating a new block.

In the next section we define the used IBFT model.
Last updated