> For the complete documentation index, see [llms.txt](https://ethernal-2.gitbook.io/blade/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ethernal-2.gitbook.io/blade/detailed-design/consensus-mechanism/ibft-2.0-consensus-algorithm/initialization.md).

# Initialization

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).

<figure><img src="/files/IOBWQxmRDw5e0wm7r0zz" alt=""><figcaption><p>Components of Consensus Mechanism</p></figcaption></figure>

`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`.

1. The `ConsensusRuntime` is created by calling the `newConsensusRuntime()` method. The role of the `ConsensusRuntime` object is to create a new instance of the `IBFT` backend for each new initiation of the IBFT consensus algorithm.
2. `Polybft` uses the `newIBFT()` method to create `IBFT`, 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.

<figure><img src="/files/MVpxHJrYJPQcTpGXnO3J" alt=""><figcaption><p>Sequence diagram for IBFT backend creation</p></figcaption></figure>

In the next section we define the used `IBFT` model.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://ethernal-2.gitbook.io/blade/detailed-design/consensus-mechanism/ibft-2.0-consensus-algorithm/initialization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
