Giter Club home page Giter Club logo

libhotstuff's Introduction

libhotstuff

libhotstuff is a general-purpose BFT state machine replication library with modularity and simplicity, suitable for building hybrid consensus cryptocurrencies.

Paper

This repo includes the prototype implementation evaluated in our HotStuff: BFT Consensus in the Lens of Blockchain paper. The consensus protocol is also used by Facebook in Libra project.

Feel free to contact us if you'd like to reproduce the results in the paper, or tweak the code for your own project/product.

Features

  • Simplicity. The protocol core logic implementation is as simple as the one specified in our paper. See consensus.h and consensus.cpp.
  • Modular design. You can use abstraction from the lowest level (the core protocol logic) to the highest level (the state machine replication service with network implementation) in your application, or override/redefine the detailed behavior to customize your own consensus.
  • Liveness decoupled from safety. The liveness logic is entirely decoupled from safety. By defining your own liveness gadget ("PaceMaker"), you can implement your own liveness heuristics/algorithm. The actual performance varies depending on your liveness implementation, but the safety is always intact.
  • Friendly to blockchain systems. A PaceMaker could potentially be PoW-based and it makes it easier to build a hybrid consensus system, or use it at the core of some cryptocurrencies.
  • Minimal. The project strives to keep code base small and implement just the basic functionality of state machine replication: to deliver a consistent command sequence to the library user. Application-specific parts are not included, but demonstrated in the demo program.

Try the Current Version

NOTICE: the project is still in-progress. Try at your own risk, and this section may be incomplete and subject to changes.

# install from the repo
git clone https://github.com/hot-stuff/libhotstuff.git
cd libhotstuff/
git submodule update --init --recursive

# ensure openssl and libevent are installed on your machine
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED=ON -DHOTSTUFF_PROTO_LOG=ON
make

# start 4 demo replicas with scripts/run_demo.sh
# start the demo client with scripts/run_demo_client.sh

TODO

  • Add a PoW-based Pacemaker
  • Branch pruning & swapping (the current implementation stores the entire chain in memory)
  • Limit the async events (improve robustness)
  • Persistent protocol state (recovery?)

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.