Byzantine Fault Tolerance, or pBFT, is a property of a computer system that allows it to reach consensus despite the failure of some components.
The Byzantine generals problem is a famous abstraction that shows one of the most critical problems in Computer Science. In particular with distributed systems, i.e., cryptocurrencies. It uses the example of a group of generals camped on the outskirts of a city and communicating only through a messenger.
They must make a joint decision to attack or stop besieging the city at a certain point. However, some of these generals are traitors and may be working against reaching a consensus on the decision. The problem raises the idea of whether loyal generals can decide on a shared plan, regardless of whether or not they know who the traitor generals are.
Further analysis tells us that an algorithm can solve this problem only if more than two-thirds of the generals are loyal. Decentralized systems, as is the case with Bitcoin, are distributed systems. The network comprises nodes that operate individually to compete in aggregating transactions to the Blockchain.
These nodes are geographically separated and independent of each other or central authority, so it is impossible to know which nodes deliver true or untrue information about the blocks and transactions, whether they do it with bad intentions or by accident. In the end, Byzantine Fault Tolerance is a property of these systems to overcome this problem and consistently achieve consensus, even when some nodes disagree with the rest.
This problem gets solved thanks to Practical Byzantine Fault Tolerance (pBFT), which only works if more than 2/3 of the nodes remain loyal to the system. And it is something that cryptocurrencies have solved to varying degrees thanks to consensus algorithms such as Proof of Work, as is the case for Bitcoin, or Proof of Stake, as it will be in the future for Ethereum.
How does pBFT relate to Blockchain?
Blockchain technology allows cryptocurrencies to function by validating, processing, and recording their transactions. For a transaction to be considered valid by the network, a group of nodes must agree on its validity. Each Blockchain uses a consensus algorithm, the rules that nodes must follow to be part of the network and reach a consensus on which transactions are considered valid.
These mechanisms are what allow blockchains to implement Byzantine fault tolerance. Since cryptocurrencies are, after all, distributed systems, they face the problem of the general ones mentioned above. A blockchain must continue to function even if there are nodes that do not work correctly or provide the rest of the network with false information.
Bitcoin was the first to solve the problem with Proof of Work (PoW). An algorithm requires miners to solve a cryptographic problem using specialized computing equipment. The first one to solve it correctly will win the right to add a new block with transactions and thus get rewards (how does Bitcoin mining work?). Otherwise, the node will have wasted its time and resources.
Another popular option in the crypto world is Proof of Stake (PoS), which involves validators staking their cryptocurrencies, meaning that they block these in their wallet to have the right to verify transactions.
Then the protocol chooses a node, and it can add the block to the chain, which generates rewards for the lucky one in the form of commissions and new coins. But there is also a penalty if you do something wrong for the network, losing part of the cryptocurrencies. Thus, both consensus mechanisms have tolerance for byzantine failures to some extent since they can continue to function even when there are problems with some nodes.
What is Practical Byzantine Fault Tolerance?
The pBFT, or Practical Byzantine Fault Tolerance, is a system that has two types of nodes: primary and secondary. These two classes of nodes work together to reach a consensus, making the system one of the solutions to the Byzantine generals' problem.
In general terms, the pBFT works as follows:
The client requests the primary node.
The primary node sends the request to the secondary node.
The node processes the request, provides the service, and responds to the client.
The client waits until it receives the same response from m+1 nodes, where m is the maximum number of failed or malicious nodes that the system allows.
In Practical Byzantine Fault Tolerance, the maximum number of nodes that can fail or be malicious cannot exceed or equal 1/3 of the total nodes.
Advantages and Disadvantages of pBFT
Of course, no system is perfect, and while we can find some advantages of a system that solves the problem of Byzantine generals, as is the case with pBFT, there are also some negative aspects.
There are some essential benefits of pBFT:
It does not require much computational power or energy usage because no miners solve a complex problem for each block of transactions, being more environmentally friendly than Proof-of-Work.
Transactions do not require multiple confirmations. If the nodes agree on the transaction blocks, they are confirmed immediately.
Because all nodes work together, they can share the rewards. Thus there is no asymmetry in tips as in PoW and PoS systems.
But as we said, no solution is perfect, and pBFT has some problems:
It is vulnerable to Sybil attacks (which get its name from a woman with dissociative identity disorder), which happen when an attacker gains control of a large portion of the nodes.
It requires communication between nodes at every step of the process, taking time, which may present scalability issues.