Source Code for hotstuff with Themis
We assume you have the latest Terraform and Ansible installed on your work computer (a work computer is your laptop/home computer).
we had the folder libhotstuff
for data of original LibHotstuff. The code is the same as libhotstuff. Another folder Aequitas-hotstuff/libhotstuff
is the one integrated Themis.
On your work computer, you have cloned the latest Themis-code repo. Finally, you have already built the repo so binaries hotstuff-keygen and hotstuff-tls-keygen in the two version of libhotstuff are available in their root directory. (See the instructions here )
Now let's move to reproduce the results. Take a look at the guide of libhotstuff first to get an idea, our process is nearlly the same.
We use Terraform to launch a bunch of ec2 instance to get the corresponding replicas.txt
and client.txt
in scripts/deploy
. You can skip this step if you want to generate it manually.
You can skip this step if you want to generate your own replicas.txt
and client.txt
manually.
In the folder Terraform, we have two subfolders. One is for one datacenter (e.g. Ohio), the other is for geo-distributed datacenters.
To use Terraform, you need
- AWS account;
- AWS Identify and Access Management (IAM) credentials and programmatic access. The IAM credentials that you need for EC2 can be found here;
- setting up AWS credentials locally with aws configure in the AWS Command Line Interface (CLI). You can find further details here, remember to add permission AdministratorAccess;
- a VPC configured for EC2. You can find a CloudFormation template to do that here;
- Enter the correspondidng folder you want to (
one-region-ohio
orgeo-distributed
), openresources.tf
, assignaccess_key
andsecret_key
to youraccess key ID
andsecret access key
from your IAM credentials. - Change the
region
to the datacenter's name. - In the block
resource
, change thecount
to the number of servers you need, which equals to#replicas + 2
, here2
is forclient
, and actually we will use one server as8
clients, you can reduce the client number by removing some lines inclients.txt
. Also assignami
to the coresponding VPC configuration for EC2, alsoprivate_key
andpublic_key
to yours that used to log in to the EC2 instance. - Run
terraform init
, then./terra_to_txt.sh
. - Paste the generated
replicas.txt
andclients.txt
toAequitas-hotstuff/libhotstuff/scripts/deploy
orlibhotstuff/scripts/deploy
, depending on which one you want to test.
-
You need running following commands in your terminal
> sudo chmod 600 path/to/your/id_rsa > eval `ssh-agent -s` > ssh-add path/to/your/id_rsa
-
Now move to
scripts/deploy
of coresponding folder. -
Generate
node.ini
andhotstuff.gen.*.conf
by running./gen_all.sh
. -
Build libhotstuff on all remote machines by
./run.sh setup
.
-
Change the
block-size
inhotstuff.gen.conf
-
Follow the third step in the guide of libhotstuff to reproduce the benchmarks in the folder libhotstuff.
In the one datacenter setting, when I set the block-size
to 400
, client number to 16
, replica number to 10
. I got the following results:
[308385, 302775, 304241, 303517, 304156, 301061, 307310, 303565, 302551, 304807, 115632]
lat = 9.157 ms
lat = 9.143 ms
Where the first line is the throughput, the second line is the mean end-to-end latency, the third line is the mean end-to-end latency after removing outliers.
- Change the
block-size
inhotstuff.gen.conf
. - Change the
#define max_num_all_txn
toblock-size + 5
inconsensus.h
andhotstuff.cpp
. - Then follow the third step in the guide of libhotstuff to reproduce the results.
In the five geo-distributed datacenters' setting, when I set the block-size to 400, client number to 12, replica number to 100. I got the following results:
[3183, 2817, 3196, 2804, 2800, 3200, 2800, 2800, 3200, 2800, 3168, 2832, 2800, 3200, 1600]
lat = 707.553 ms
lat = 681.231 ms
There is no simple way to stop the server by using Terraform. Therefore we use the UI. In the AWS console, select the servers with the filter "running", then change the instance status to "suspended".