GithubHelp home page GithubHelp logo

varuneranki / hotstuff_rs Goto Github PK

View Code? Open in Web Editor NEW

This project forked from parallelchain-io/hotstuff_rs

0.0 0.0 0.0 3.28 MB

Rust implementation of the HotStuff consensus algorithm.

Rust 100.00%

hotstuff_rs's Introduction

HotStuff-rs

A Rust Programming Language library for Byzantine Fault Tolerant state machine replication, intended for production systems.

HotStuff-rs implements a variant of the HotStuff consensus protocol, but with extensions like block-sync and dynamic validator sets that makes this library suited for real-world use-cases (and not just research systems). Some desirable properties that HotStuff-rs has are:

  1. Provable Safety in the face of up to 1/3rd of voting power being Byzantine at any given moment.
  2. Optimal Performance: consensus in (amortized) 1 round trip time.
  3. Simplicity: A small API (App) for plugging in arbitrary stateful applications.
  4. Modularity: pluggable networking, state persistence, and view-synchronization mechanism.
  5. Dynamic Validator Sets that can update without any downtime based on state updates: a must for PoS blockchain applications.
  6. Batteries included: comes with a block-sync protocol and (coming soon) default implementations for networking, state, and pacemaker: you write the app, we handle the replication.

Terminology

  • App: user code which implements the App trait. This can be any business logic that can be expressed as a deterministic state machine, i.e., a pure function of kind: (Blockchain, App State, Validator Set, Block) -> (Next Blockchain, Next App State, Next Validator Set).
  • Replica: a public-key-identified process that hosts an implementation of the HotStuff-rs protocol, e.g., this library. There are two kinds of Replicas: validators, and listeners, and each replica contains an instance of an app.
  • Blockchain: a growing sequence of Blocks, which can be thought of as instructions to update a replica's App State and Validator Set.
  • App State: a key-value store that applications can use to store anything; two replicas with the same Blockchain are guaranteed to have the same app state.
  • Validator Set: the set of replicas who can vote in a consensus decision.
  • Progress protocol: the protocol replicas use to create new blocks through consensus and grow the blockchain.
  • Sync protocol: the protocol new or previously offline replicas use to quickly catch up to the head of the blockchain.

Where to start?

Read the docs: docs.rs.

Opening an issue

Open an issue in GitHub if you:

  1. Have a feature request / feature idea,
  2. Have any questions (particularly software related questions),
  3. Think you may have discovered a bug.

Do try to label your issues appropriately.

The HotStuff Consensus Protocol

HotStuff works by building a 'BlockTree': a directed acyclic graph of Blocks. Block is a structure with a data field which applications are free to populate with arbitrary byte-arrays. In consensus algorithm literature, we typically talk of consensus algorithms as maintaining state machines that change their internal states in response to commands, hence the choice of terminology.

HotStuff guarantees that committed Blocks are immutable. That is, they can never be un-committed as long as at least a supermajority of voting power faithfully execute the protocol. This guarantee enables applications to make hard-to-reverse actions with confidence.

A graphic depicting a Tree (DAG) of Blocks. Blocks are colored depending on how many confirmations they have.

A Block becomes committed the instant its third confirmation is written into the BlockTree. A confirmation for a Block A is another Block B such that there is path between B to A.

The choice of third confirmation to define commitment--as opposed to first or second--is not arbitrary. HotStuff's safety and liveness properties actually hinge upon on this condition. If you really want to understand why this is the case, you should read the paper. To summarize:

  1. Classic BFT consensus algorithms such as PBFT require only 2 confirmations for commitment, but this comes at the cost of expensive leader-replacement flows.
  2. Tendermint require only 2 confirmations for commitment and has a simple leader-replacement flow, but needs an explicit 'wait-for-N seconds' step to guarantee liveness.

HotStuff is the first consensus algorithm with a simple leader-replacement algorithm that does not have a 'wait-for-N seconds' step, and thus can make progress as fast as network latency allows.

hotstuff_rs's People

Contributors

lyulka avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.