This is the accompanying code repository to the paper "Using Weighted Voting to Optimise Streamlined Blockchain Consensus Algorithms", developed for my Bachelor's Thesis at TU Delft. This research project was conducted as part of the CSE3000 course of the Computer Science and Engineering degree program, under the close supervision of Jérémie Decouchant and Rowdy Chotkan.
The corresponding research paper is available here.
Software development ended as of 26th of June, 2024 (Thesis defense day).
This project investigates the impact of weighted voting on streamlined consensus algorithms. Inspired by AWARE's established self-monitoring (deterministic latency prediction) and self-optimising (leader relocation and weight distribution tuning) mechanisms, this research applies weighted voting on the representative Hotstuff.
The focus of this study lies on:
- Developing two latency prediction models for Weighted Hotstuff and Weighted Chained Hotstuff, respectively.
- Analysing the impact of vote power assignment (Best Assigned Weighted) and leader rotation (Optimal Leader Rotation Weighted) optimisations by employing Simulated Annealing algorithms.
- Introducing a generalisation from the discrete weighting paradigm (a novel continuous weighting scheme) through a Simulated Annealing approach in Continuous Weighted Hotstuff.
In short, the results provided in this research, together with the novel ideas described, are a founding base for the study of weighted voting in streamlined algorithms and its shift from the discrete model.
To set up the project locally, follow these steps:
-
Clone the repository
-
Run the command below in terminal, in this way you create a virtualenv named
venv
, activate it and install all the required dependencies for running the project (note that we use python version 3.10).virtualenv venv && source venv/bin/activate && pip3 install -r requirements.txt
The project should function properly now.
For running experiments you will use the experiments.py
script, using commands of the following form, with various options that are explained below.
python3 experiments.py --paper --continuous
You can use the following options to change some of the parameters for running custom experiments.
The results generated by running these commands can be found in root project under ./results/figures
and ./results/data
.
--paper
runspaper_experiment_hotstuff
--paper --chained
runspaper_experiment_chained
--paper --continuous
runspaper_experiment_continuous
--paper --lr
runspaper_leader_rotation
By running self-tailored experiments the results will be gathered in a CSV file in ./results/data
for further analysis and processing.
--chained
run experiments with Chained Hotstuff (Without this flag, experiments will run with Hotstuff by default!)--sim
to change the number of protocol simulations (by default 1)--views-lower-bound
and--views-upper-bound
to set for how many views we want to run a protocol for; they constitute an interval as we can run experiments over multiple views too (by default both 1)--f
to change the number of arbitrary node failures the system can withstand--delta
to change the number of additional replicas in the system--faulty
to run experiments in faulty scenarios (the f replicas holding highest weight are considered idle)--all
runs all protocols, but you can also run specific ones:--basic
runs unweighted protocol--weighted
runs weighted protocol--best
runs Best Assigned Weighted protocol variant--lr
runs Optimal Leader Rotation Weighted protocol variant--best --lr
runs (Optimal Leader Rotation + Best Assigned) protocol variant--continuous
runs Continuous Weighted Hotstuff
Attention! When running experiments with Optimal Leader Rotation variants use number of views equal or greater than the number of network participants, since in a complete rotation each participant is leader exactly once.
Note that the network setup on which we run experiments can be also tweaked by using the --network-setup
option. The framework offers the following variants (see more in experimental_utils
):
- zero (default value) - run experiments with matrix of within clusters latency generated randomly between
0ms and 400ms
- one - run experiments on the network environment used in the paper (see
./results/figures/clusters_map.pdf
) - two - run experiments with
f = 2
on custom network topology with data retrieved from cloudping - three - run experiments with
f = 3
on custom network topology with data retrieved from cloudping
The main file through which you can run multiple experiments is experiments.py
. However, this repository consists of multiple files which support the research of weighted voting on streamlined algorithms.
weighted_hotstuff
chained_weighted_hotstuff
paper_leader_rotation
- analysis of leader rotation impact on the latency of Hotstuff protocolpaper_experiment_hotstuff
- non-faulty and faulty simulation of Weighted Hotstuff and variants for computing average latency per view over multiple viewspaper_experiment_chained
- non-faulty and faulty simulation of Weighted Chained Hotstuff and variants for computing average latency per view over multiple viewspaper_experiment_continuous
- Best Assigned vs Continuous Weighted Hotstuff, latency difference analysis over 1000 simulations
These files should be run directly from the IDE, not by using the experimental framework created.
experiments_hotstuff
- 4 experiments on assessing Weighted Hotstuff behaviour + analysis of Continuous Weighted Hotstuff convergence time for multiple f valuesexperimemts_chained_hotstuff
- 3 experiments of Weighted Chained Hotstuff and its optimisation variants
hotstuff
- skeleton of Basic Hotstuff implementation in python to observe protocol's communication phasesexperimental_utils
- utils used by the developed latency prediction modelsmap
- file generating the geographical map of clusters used in the paper experiments
For any direct questions please feel free to contact Diana Micloiu. For further questions or collaboration inquires for the Professor and Supervisor you can contact the Data Intensive group.