Implement a new consensus protocol
mainThere are two primary ways to implement a new consensus protocol in hotstuff:
- The
Consensusinterface: This is the most general and powerful interface. It is highly integrated with other modules (Blockchain, Acceptor, Executor, Synchronizer, etc.). Use this if you need full control over how the protocol interacts with the system. - The
RulesandProposeRulerinterfaces: These are simplified interfaces designed for implementing only the core consensus logic (e.g., deciding whether to vote for a proposal or if a block is safe to commit). A default implementation of theConsensusinterface handles the complex module interactions for you, allowing you to focus solely on the protocol rules.
You can also use these interfaces to override existing behaviors, such as implementing Byzantine behaviors via the rules/byzantine package.