How PBFT works
Hyperledger is the primary blockchain that uses PBFT. Here is how PBFT works in Hyperledger. Each validating node (a computer running the blockchain software and working to maintain consistency) keeps a copy of the internal state of the blockchain. When a node receives a message, it uses the message in conjunction with their internal state to run a computation on what the new state should be. Then the node decides what it should do with the message in question: treat it as valid, ignore it, or take another course of action. Once a node has reached its decision about the new message, that node shares that decision with all the other nodes in the system. A consensus decision is determined based on the total decisions submitted by all nodes:
- Submission: One or more of the nodes on the network submit a transaction that is sent to the other nodes. For instance, if there are ten nodes participating and three of them send messages, it looks as follows:
- All ten computers see three transactions
- These transactions are distributed so that each node has a full copy of all the transactions
- These transactions may arrive at nodes at different times, so the order may not be consistent
- Ordering: One of the validating nodes is elected as the leader by a vote of the other nodes. This validating leader chooses the order of transactions and sends this to the other participating nodes. Each of the other validating nodes then rearranges the transactions they already had into the order set by the validating leader.
- Execution: The validating nodes then execute the newly ordered transactions. Each node independently executes all changes and adds these changes to the global state from previous blocks. If consensus cannot be reached, the transactions are rolled back and rejected.
This process is repeated for each block. The advantage of PBFT is that it is very fast and scales relatively well. The downside is that the participants must be known—not just anyone can join the network.