This is an implementation of ThemiX: a novel timing-balanced consensus protocol
.
.
|- Makefile
|- README.md
|- acs
| |-Makefile
| |-README.md
| |- src
| |- script
|
|- src
| |- client
| |- crypto
| |- Makefile
| |- themix
| |- transport
|
|- test
|- client
|- server
You can build the whole project as follows
cd src/
make
We set n=5 and t=3
as default. You can refer to Build Step by Step for more information.
- Build ThemiX
# Download dependencies. cd src/themix go get -v -t -d ./... # Build ThemiX go build -o main server/cmd/main.go
- Verification of client request signature is set to
false
as default. You can use flag-sign true
to change it. -
$2\Delta$ is set as 2500ms and$2\delta$ is set to 500ms as default. You can refer toserver/instance.go
line 99 and 100 to change them.
- Verification of client request signature is set to
- Generate BLS Keys and ECDSA Key
# Download dependencies. cd src/crypto go get -v -t -d ./... # Generate bls keys. # Default n=5, t=3 go run cmd/bls/main.go -n 5 -t 3 # Generate ECDSA key. go run cmd/ecdsa/main.go
- Build Client
# Compile protobuf. cd src/client/proto make # Build Client. cd src/client go build -o client main.go
client
binary is supposed to be copied to directorytest/client
for further use.
First of all, you are supposed to change key
in every shell script to the path of your own ssh key to access your AWS account. Our access key is named aws
, and you can change it to your own key.
-
Create a cluster of AWS EC2 machines. You may refer to narwhal for help. We create 5
t3.2xlarge
instances in regionus-east-1
,us-west-1
,ap-northeast-1
,ap-southeast-1
andap-east-1
, and we openPort 5000-7000
. -
Fetch machine information from AWS. First,
test/server/aws.py
is supposed to be modified:- line 5 should contain the regions of your instances
- line 6 and line 7 is supposed to be set according to your own AWS secret keys
- line 23 is the name of your AWS secret key to access other instances
After modification, you can fetch instance information as following
cd test/server python aws.py
-
Generate config file(
node.json
) for every node.python generate.py
-
Deliver nodes. Again, value
key
in every shell script is supposed to be the path of your AWS secret key to access other instances.chmod +x *.sh # Compress BLS keys. ./tarKeys.sh # Deliver to every node. # n is the number of nodes in the cluster. ./deliverNode.sh n
-
Run nodes.
./beginNode.sh n <batchsize>
-
Stop nodes.
./stopNode.sh n
-
Deliver client.
chmod +x *.sh # n is the number of nodes in the cluster ./deliverNode.sh n
-
Run client for a period of time.
./beginNode.sh <size of payload> <size of batch> <running time>
-
Copy result from client node.
./createDir.sh n ./copyResult.sh n <name of log file>
-
Calculate throughput and latency.
python cal.py <number of nodes> <batchsize> <path> <name of log file>
-
aws.py: get machine information from AWS.
You may need to change line 5-7 and 23 to your own config.
-
generate.py:generate configuration for every node.
-
tarKeys.sh: compress BLS keys.
-
deliverNode.sh: deliver node to remote machines.
./deliverNode.sh <the number of remote machines>
-
beginNode.sh: run node on remote machines.
./beginNode.sh <the number of remote machines>
-
stopNode.sh: stop node on remote machines.
./stopNode.sh <the number of remote machines>
-
Simulate the crash of specific nodes.
- You can refer to
crash33.sh
, and changeADDR
to your specific situation. ./crash33.sh
- You can refer to
-
Simulate the crash of the last few nodes.
- eg. simulate the crash of the last 33 nodes of 100 nodes.
./crash.sh 100 33
- eg. simulate the crash of the last 33 nodes of 100 nodes.
-
rmLog.sh: remove log file on remote machines.
./rmLog.sh <the number of remote machines>
-
deliverNode.sh: deliver client to remote machines.
./deliverNode.sh <the number of remote machines>
-
Get log files from remote machines
mkdir log ./createDir.sh <the number of remote machines> ./copyResult.sh <the number of remote machines> <name of log files>
-
beginNode.sh: run client on remote machines.
- These args are supposed to be assigned.
- -payload: the size of a single request
- -time: running time
- -batch: the size of batch
- These args are supposed to be assigned.
We also implement ACS in directory acs/
. You can refer to acs/README.md
for more detailed information.
Please refer to dumbo for more information. We provide some scripts for help.