IMPORTANT: To see how to run tests, please check the end of this readme file.
HDSLedger is a simplified permissioned (closed membership) blockchain system with high dependability guarantees. It uses the Istanbul BFT consensus algorithm to ensure that all nodes run commands in the same order, achieving State Machine Replication (SMR) and guarantees that all nodes have the same state.
-
Java 17 - Programming language;
-
Maven 3.8 - Build and dependency management tool;
-
Python 3 - Programming language;
Can be found inside the src/main/resources/ folder of the Common module.
Config of a node:
{
"type" : "node",
"id": <NODE_ID>,
"isLeader": <IS_LEADER>,
"hostname": "localhost",
"port": <PORT>,
"clientRequestPort": <ANOTHER_PORT>,
"privateKeyPath" : "Keystore/<FILENAME_OF_PRIVATE_KEY>",
"publicKeyPath" : "Keystore/<FILENAME_OF_PUBLIC_KEY>",
"serviceConfig" : <SERVICE_CONFIG_FILENAME>
}Config of a client:
{
"type" : "client",
"id": <NODE_ID>,
"hostname": "localhost",
"port": <PORT>,
"privateKeyPath" : "Keystore/<FILENAME_OF_PRIVATE_KEY>",
"publicKeyPath" : "Keystore/<FILENAME_OF_PUBLIC_KEY>"
}Can be found inside the src/main/resources folder of the Service module. Contains some general configurations about the service (e.g., transaction fee percentage, number of transactions in a block, etc.).
Example:
{
"initial_account_balance": 1000,
"transaction_fee": 0.05,
"num_transaction_in_single_block" : 1
}To install the necessary dependencies run the following command:
./install_deps.shThis should install the following dependencies:
- Google's Gson - A Java library that can be used to convert Java Objects into their JSON representation.
- Junit - Junit is a simple framework to write repeatable tests.
The puppet master is a python script puppet-master.py which is responsible for starting the nodes
of the blockchain.
The script runs with kitty terminal emulator by default since it's installed on the RNL labs.
To run the script you need to have python3 installed.
The script has arguments which can be modified:
terminal- the terminal emulator used by the scriptserver_config- a string from the arrayserver_configswhich contains the possible configurations for the blockchain nodes
Run the script with the following command:
python3 puppet-master.pyNote: You may need to install kitty in your computer
It's also possible to run the project manually by using Maven.
Compile and install all modules using:
mvn clean install
To run:
cd Client/
mvn compile exec:java -Dexec.args="<id_of_client> <filename_of_config> localhost <port> all <false>"
To run the test, first change to the Test module
cd TestThen, to run a single test, perform the following command:
mvn test -Dtest=<NAME_OF_TEST>To run all of the test, tou can simply execute the following command:
mvn test