# Tutus Consensus Go implementation of the dBFT 2.0 (delegated Byzantine Fault Tolerant) consensus algorithm for the Tutus blockchain. ## Overview This library provides the core consensus mechanism for Tutus blockchain nodes, enabling deterministic finality with 1-second block times. ## Features - **Immediate Finality** - No forks, no rollbacks - **Byzantine Fault Tolerant** - Tolerates up to f = (n-1)/3 faulty nodes - **Configurable Validators** - Support for dynamic validator sets - **Formal Verification** - TLA+ specifications in formal-models/ ## Installation ```go import "github.com/tutus-one/tutus-consensus" ``` ## Design 1. **Interface-Driven** - Cryptography, hashing, and block types are provided via interfaces 2. **Block & Transaction Abstractions** - Located in block.go and transaction.go 3. **Timer Abstraction** - timer package provides production-ready timer implementation 4. **Callback Architecture** - Event-driven design for integration flexibility ## Usage Implement your event loop and call the provided callbacks: - `Start()` - Initialize consensus - `Reset()` - Reinitialize for new height - `OnTransaction()` - Process proposed transactions - `OnReceive()` - Handle incoming payloads - `OnTimer()` - Handle timer events See internal/simulation/main.go for a complete 6-node example. ## Documentation - [dBFT Research Paper](https://github.com/NeoResearch/yellowpaper/blob/master/releases/08_dBFT.pdf) ## License MIT License - see [LICENSE.md](LICENSE.md) --- Part of the [Tutus](https://github.com/tutus-one/tutus-chain) blockchain infrastructure.