đ§ Network Configuration
- Number of Nodes: Total nodes in the network (4-12). More nodes demonstrate scalability but increase complexity.
- Byzantine Nodes: Number of malicious/faulty nodes. Automatically limited to maintain fault tolerance (f < n/3).
- Byzantine Fault Tolerance Rule: For n nodes, maximum faulty nodes f ⤠â(n-1)/3â. This ensures honest majority.
- Recommended: Start with 7 nodes and 1-2 Byzantine nodes to see clear behavior differences.
đŽ Actions & Controls
- Animation Speed: Controls how fast messages move and phases transition (0.5x to 3x speed).
- Simulation Mode:
- Step-by-step (Manual): Click "Next Step" to manually progress through each consensus phase
- Automatic: Watch the full consensus process run automatically
- Reassign Nodes: Randomly shuffles which nodes are Byzantine, honest, or leader without changing total counts.
- Reset Network: Stops current consensus and reinitializes the entire network.
đ Understanding Node Types
- īŋŊ Leader Node (Gold): Initiates consensus by proposing a value (Pre-Prepare phase). Must be an honest node.
- īŋŊ Honest Node (Green): Follows the PBFT protocol correctly, validates messages, and helps achieve consensus.
- īŋŊ Byzantine Node (Red): Malicious node that may send conflicting messages, lie, or remain silent to disrupt consensus.
- Node Values: Each node starts with a random binary value (0 or 1) that they want the network to agree on.
- Message Types: Pre-Prepare (leader proposal), Prepare (replica validation), Commit (final agreement).
đ PBFT Consensus Protocol
This simulation implements the Practical Byzantine Fault Tolerance (PBFT) consensus algorithm with three distinct phases:
- Phase 1 - Pre-Prepare:
- Leader broadcasts a pre-prepare message with the proposed value to all replica nodes
- All replicas receive the same proposal from the leader
- This establishes the initial proposal for this consensus round
- Phase 2 - Prepare:
- Each replica broadcasts prepare messages to all other nodes (including the leader)
- Honest replicas send prepare messages with the leader's proposed value
- Byzantine replicas may send conflicting prepare messages or stay silent
- Nodes collect prepare messages to verify network agreement on the proposal
- Phase 3 - Commit:
- Nodes that received âĨ 2f+1 prepare messages (including leader's implicit prepare) enter commit phase
- These nodes broadcast commit messages for the agreed value
- Byzantine nodes may send conflicting commits or remain silent
- Final consensus is reached when nodes receive âĨ 2f+1 commit messages
Safety Guarantee: All honest nodes that commit will commit the same value, even with up to f Byzantine nodes (where f < n/3).
đ¯ Simulation Modes Explained
- Manual Mode Benefits:
- Step through each phase at your own pace
- Read detailed logs for each action
- Perfect for learning the protocol step-by-step
- Watch message animations carefully
- Automatic Mode Benefits:
- See the full consensus process flow
- Observe timing and synchronization
- Good for demonstrating the complete algorithm
- Useful for testing multiple consensus rounds quickly
đ Understanding the Visualization
- Node Circles: Color indicates node type, size shows activity level
- Node Labels: Show node ID and current value (0 or 1)
- Message Lines: Blue lines show messages traveling between nodes
- Node Connections: Thin gray lines show network topology (all nodes can communicate)
- Pulsing Effect: Active nodes pulse during message sending/receiving
- Phase Indicator: Top-left shows current consensus phase
đ Statistics Panel Explained
- Network Status: Current state (Ready, Running, Consensus Reached, etc.)
- Consensus Round: How many consensus attempts have been made
- Messages Sent: Total network communication overhead
- Current Phase: Which step of the consensus protocol is active
- Byzantine Tolerance: Shows the fault tolerance formula and safety status
đ¯ Recommended Experiments
- Basic Consensus:
- Start with 7 nodes, 1 Byzantine node
- Use manual mode to step through one complete consensus
- Observe how Byzantine node behaves differently
- Fault Tolerance Testing:
- Gradually increase Byzantine nodes until f = â(n-1)/3â
- Observe how consensus becomes harder with more faults
- Try to exceed the fault tolerance limit
- Network Size Scaling:
- Compare consensus with 4 vs 12 nodes
- Observe message count and consensus time
- See how fault tolerance scales with network size
- Byzantine Behavior Analysis:
- Use "Reassign Nodes" to change which nodes are Byzantine
- Run multiple rounds to see varying Byzantine tactics
- Compare outcomes with different Byzantine node configurations
- Manual vs Automatic:
- First run in manual mode to understand each step
- Then switch to automatic to see full flow
- Adjust animation speed to match your learning pace
đ What to Watch For
- Message Patterns: Notice how Byzantine nodes may send different messages to different recipients
- Consensus Success: Despite Byzantine interference, honest majority should reach agreement
- Fault Tolerance Limits: Consensus fails when f âĨ n/3 (too many Byzantine nodes)
- Leader Behavior: Leader must be honest - observe what happens during leader proposal
- Vote Counting: Final decision based on majority of honest nodes, not all nodes
- Network Resilience: System continues working despite presence of malicious actors
â ī¸ Common Misconceptions
- â "More nodes = more security": Security depends on the ratio f < n/3, not absolute numbers
- â "Byzantine nodes are just offline": Byzantine faults are worse - they actively mislead
- â "Majority of all nodes needed": Only majority of honest nodes needed for consensus
- â "Leader can be Byzantine": Leader is always chosen from honest nodes in this simulation
- â
Understanding: This simulation demonstrates the fundamental challenge of reaching agreement in the presence of malicious actors