MCPcopy Index your code
hub / github.com/asonnino/hotstuff

github.com/asonnino/hotstuff @v0.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.0 ↗ · + Follow
424 symbols 1,203 edges 64 files 72 documented · 17%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

HotStuff

build status rustc license

This repo provides a minimal implementation of a 2-chain variant of the HotStuff consensus protocol. The codebase has been designed to be small, efficient, and easy to benchmark and modify. It has not been designed to run in production but uses real cryptography (dalek), networking (tokio), and storage (rocksdb).

Quick Start

HotStuff is written in Rust, but all benchmarking scripts are written in Python and run with Fabric. To deploy and benchmark a testbed of 4 nodes on your local machine, clone the repo and install the python dependencies:

$ git clone https://github.com/asonnino/hotstuff.git
$ cd hotstuff/benchmark
$ pip install -r requirements.txt

You also need to install Clang (required by rocksdb) and tmux (which runs all nodes and clients in the background). Finally, run a local benchmark using fabric:

$ fab local

This command may take a long time the first time you run it (compiling rust code in release mode may be slow) and you can customize a number of benchmark parameters in fabfile.py. When the benchmark terminates, it displays a summary of the execution similarly to the one below.

-----------------------------------------
 SUMMARY:
-----------------------------------------
 + CONFIG:
 Faults: 0 nodes
 Committee size: 4 nodes
 Input rate: 1,000 tx/s
 Transaction size: 512 B
 Execution time: 20 s

 Consensus timeout delay: 1,000 ms
 Consensus sync retry delay: 10,000 ms
 Mempool GC depth: 50 rounds
 Mempool sync retry delay: 5,000 ms
 Mempool sync retry nodes: 3 nodes
 Mempool batch size: 15,000 B
 Mempool max batch delay: 10 ms

 + RESULTS:
 Consensus TPS: 967 tx/s
 Consensus BPS: 495,294 B/s
 Consensus latency: 2 ms

 End-to-end TPS: 960 tx/s
 End-to-end BPS: 491,519 B/s
 End-to-end latency: 9 ms
-----------------------------------------

Next Steps

The wiki documents the codebase, explains its architecture and how to read benchmarks' results, and provides a step-by-step tutorial to run benchmarks on Amazon Web Services accross multiple data centers (WAN).

License

This software is licensed as Apache 2.0.

Extension points exported contracts — how you extend this code

Core symbols most depended-on inside this repo

Shape

Method 254
Function 80
Class 78
Enum 9
Interface 3

Languages

Rust64%
Python36%

Modules by API surface

benchmark/benchmark/utils.py25 symbols
crypto/src/lib.rs23 symbols
benchmark/benchmark/config.py20 symbols
consensus/src/core.rs18 symbols
benchmark/benchmark/plot.py17 symbols
benchmark/benchmark/aggregate.py17 symbols
benchmark/benchmark/remote.py15 symbols
benchmark/benchmark/instance.py15 symbols
consensus/src/messages.rs14 symbols
benchmark/benchmark/logs.py14 symbols
network/src/reliable_sender.rs12 symbols
mempool/src/config.rs11 symbols

For agents

$ claude mcp add hotstuff \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page