Implementation of HashGraph Byzantine Fault tolerance algorithm in Golang programming language with Zero MQ.
Implementation of Hashgraph Byzantine Fault tolerance algorithm in Go programming language with ZeroMQ framework.
Based on:
"The Hashgraph Protocol: Efficient Asynchronous BFT for High-Throughput Distributed Ledgers"
by Leemon Baird and Atul Luykx.
Functions | Protocols |
---|---|
Send Gossip | Divide Rounds |
Manage Client Request | Decide Fame |
Manage Incoming Gossip | Find Order |
Send Gossip function implements the gossip protocol.
Chooses randomly another server and sends all the event we believe it does not know.
It is responsible to receive the client transaction and insert it in the graph.
- Receives the gossip messages from the other servers
- Checks whether or not to insert the events in the graph
- Calls the protocols
The protocols are implemented based on the paper[1]
If you have not already installed Golang follow the instructions here.
cd ~/go/src/
git clone https://github.com/Giorgos-P/HashGraphBFT.git
In bin folder create the following paths:
bin/keys
bin/logs/client
bin/logs/error
bin/logs/out
You can find the instructions for our BFT client here.
To install the program and generate the keys run:
go install HashgraphBFT
HashgraphBFT generate_keys <N> // For key generation
Open different terminals and in each terminal run:
HashgraphBFT <ID> <N> <Clients> <Scenario> <Remote>
ID : is the server id [0 to (N-1)]
N : is the total number of servers
Clients : is the total number of clients
Scenario : is the scenarion number [0 to 2]
Remote : is [0 or 1] 0=local execution, 1 is remote execution (we have to set the correct ip address of the remote servers in ip.go)
Adjust the script (HashgraphBFT/scripts/run.sh) and run:
bash ~/go/src/HashgraphBFT/scripts/run.sh
When you are done and want to kill the processes run:
bash ~/go/src/HashgraphBFT/scripts/killHash.sh
- 0 = Normal : no malicious nodes occurs
- 1 = IDLE : malicious node do not send messages
- 2 = Sleep : malicious nodes sleeo for some time and then restarts executing
- 3 = Fork : malicious nodes send messages with arbitrary content