Skip to content

joe-explr/PBFT

Repository files navigation


📘 Project 2 — Linear PBFT with Byzantine Fault Tolerance

# Linear PBFT: Byzantine Fault Tolerant Banking System

A Byzantine Fault Tolerant (BFT) distributed system implementing **Linear PBFT**, achieving consensus with **O(n)** communication complexity in the normal case.

The system tolerates **malicious replicas**, supports cryptographic authentication, and includes a full **view-change mechanism**.

---

## Features

- Linear PBFT (collector-based communication)
- Byzantine fault tolerance (f = 2)
- Cryptographic message authentication
- View-change protocol
- Read-only & read-write requests
- Malicious behavior injection (crash, equivocation, delay)
- Deterministic state machine replication

---

## System Architecture

- **Replicas:** 7 (3f + 1)
- **Clients:** 10
- **Fault Model:** Byzantine (arbitrary faults)
- **Communication:** Signed RPC messages
- **Collector:** Leader aggregates quorum certificates

Each replica maintains:
- Request log
- Prepare / Commit certificates
- View history
- Datastore (balances)

---

## Protocol Overview

### Normal Case (Linearized)
1. Client sends signed request to leader
2. Leader broadcasts `PRE-PREPARE`
3. Replicas send signed `PREPARE` → leader
4. Leader aggregates `n-f` prepares
5. Leader broadcasts aggregated certificate
6. Replicas commit and execute

### View Change
- Triggered by timeout or faulty leader
- Replicas exchange `VIEW-CHANGE` messages
- New leader broadcasts `NEW-VIEW`
- Safe recovery without checkpoints

---

## Failure Models Implemented

- Invalid signatures
- Crash-stop behavior
- Message omission (in-dark)
- Deliberate delays
- Equivocation (conflicting pre-prepares)

---

## Debugging & Introspection

- `PrintDB()`
- `PrintLog(node)`
- `PrintStatus(seq)`
- `PrintView()`

---

## Running the System

```bash
# Build
make

# Start replicas
./replica --id 1
...

# Start client
./client workload.csv

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •