# Byzantine Fault Tolerance (BFT) in Blockchain - Shiksha Online

## Metadata
- Author: [[shiksha.com]]
- Full Title: Byzantine Fault Tolerance (BFT) in Blockchain - Shiksha Online
- Category: #articles
- URL: https://www.shiksha.com/online-courses/articles/byzantine-fault-tolerance-in-blockchain/
## Highlights
- Byzantine Generals’ problem was acknowledged in 1982 as a logical decision puzzle. Its basis on how generals of the same side with different troops might have a communication problem in making decisions about the next move against the enemy.
- The problem states like a group of generals with their army are about to attack their enemy. They surrounded the enemy’s castle from 4 different directions. Now how would they communicate the decision of attacking or retreating at the same time?
- Following are problems that may arise while sharing the decision from one general to another: The messenger might get captured while delivering the decision. What if an imposter altered the message received. How can a general make sure if he received the message from the expected general? What if other generals become traitors and they send the message to attack, but they actually retreat. How can the system be sure that each general will attack at the same time from their designated location? Is there no way but to trust each other completely? Blockchain seems to resolve this problem with the Byzantine fault tolerance (BFT) consensus mechanism.
- To ensure the success of the generals’ team, they need an algorithm that could adhere to the following conditions: All the troop generals need to agree on the next action of the plan. The generals should be trustworthy and loyal to the system. Generals must not get influenced to become network traitors. They need to follow the algorithm of the system. The group of generals needs to reach a consensus or decision, irrespective of the traitors’ actions. The system or network should not lead to a 51% attack at any point of action. Byzantine Fault Tolerance (BFT) is a consensus approach that resists a system to get into the Byzantine Generals’ problem. It also means the system should stay intact even if one of the nodes (or general) fails. In addition, BFT aims to reduce the effect of malicious byzantine nodes (or general) on the network.
- In an attempt to overcome the Byzantine problems, Barbara Liskov and Miguel Castro introduced a Practical Byzantine Fault Tolerance (pBFT) consensus algorithm in 1999. They aim to ensure a practical byzantine state machine replication for tolerating malicious or byzantine nodes. The pBFT follows an asynchronous approach. The following are essential aspects of the pBFT consensus algorithm: All nodes are assembled in a sequence. One network node serves as a leader node, and the rest of them are backup nodes. The primary or leader node serves the client’s request. It works as a moderator between client and backup nodes. All nodes are capable of communicating with other nodes to check the honest nodes. Honest nodes should be able to reach a consensus for the next global change in the network based on majority rule. It identifies the source of the message to make sure it’s sent by the correct sender. Ensures the message has not been modified or corrupted in between.
- The PBT highly depends on the condition that the maximum number of malicious or byzantine nodes must exceed one-third of all the nodes in the network. Hence, the security of the network is directly dependent upon the number of total honest nodes. In short, a pBFT system can handle ‘f’ faulty or byzantine nodes where there are 3f + 1 total number of nodes on the network. Following is the process of pBFT consensus algorithm: A client sends a request to the leader node. Then the leader node floods the request to all backup nodes. All the nodes work on the request and send a reply to the client. The client waits for (f + 1) replies from all the nodes with the same result. Here, f = number of possible faulty nodes. The pBFT mechanism consists of 3 phases: Pre-prepare phase: The leader node sends out a pre-prepared message to each backup node. Prepare: After receiving the pre-prepared message from the leader, the backup nodes send the prepared message as a reply to all other nodes including the leader. A node is considered prepared only if it has received pre-prepared by the leader and seen (2f + 1) number of prepared messages from other nodes. Commit: If the nodes are prepared, they send a commit message. If a node receives (f + 1) commit messages, they carry out the client’s request.
- Blockchain like Zilliqa, Hyperledger fabric, and Tendermint uses the Practical Byzantine Fault Tolerance (pBFT) algorithm.
- Benefits of PBFT Following are the advantages of the pBFT consensus algorithm: A pBFT doesn’t require carrying out high mathematical computations like PoW. It is an energy-efficient consensus model. A block of transactions here does not need to follow multiple confirmations by each node. Hence, it requires less time. As pBFT requires every node to participate and serves the client request, each node gets the reward. Hence low reward variance between each node. Limitations of PBFT Following are the disadvantages of the pBFT consensus algorithm: pBFT has a high communication overhead that will increase with the number of nodes in the network. It has scalability issues with more extensive networks. pBFT is susceptible to Sybil attacks in which one node controls or acts as multiple network nodes.