In this repository we have implemented the Snowball consensus algorithm in C++, and used a variety of tools to help us achieve a distributed network. Please see the presentation to learn more about what we did and how we did it.
To run this project you should have a Linux Docker image with:
- cmake
- The grpc library
- etcd v3.5.
- python3
- The project repo with the
node_maintarget compiled.
You should also have python3 on your local machine and any unix shell. And you should have a Docker network called snowball_cluster that can be created by the following command:
docker network create --subnet=172.20.0.0/16 snowball_cluster
Compiling our target is performed in the same manner as any other target in the gRPC library, please refer to the gRPC docs to see how they compile their example target.
In the final version of the project, we only run one target and that is node_main, found in node_main.cc and we use the Node object found in node.cc and node.hpp.
The fies query_client.hpp and query_server.hpp are the client and server functions of gRPC, you can learn more about gRPC here.
The coordinator.cc, coordinator_main.cc, and run.py files are part of an older implementation of our project that wasn't fully distributed where we used a local coordinator node and relied on our localhost address and ports and local filesystem.
And finally the runDocker.py is the script that creates all the nodes and runs the protocol, the config_tuple function is where you can configure which parameters will be tested in the current run.
To run the main script (runDocker.py), just use the command python3 runDocker.py in your terminal, you should have the Docker daemon running in order for the script to use the Docker CLI, and you should have an already running etcd server running on the aforementioned snowball_cluster network with the address 172.20.0.5:2379.