The purpose of this implementation is to discover possible adaptations of our use case (tokenizing campaigns and storing them in a secure ledger) in the context of a traditional blockchain.
Create a folder on integration cluster OR on your local machine by naming it as blockchain
To install all the necessary libraries make sure that you have following files in your blockchain folder:
- begin.sh
- /files/requirements.txt
To install them just run the command below, which:
- will create your virtualenv with a name blockchain-py3
- will install all the necessary libraries in your virtualenv
sh begin.sh
To activate your virtualenv:
source blockchain-py3/bin/activate
To deactivate your virtualenv:
deactivate
You can initialize and run your blockchain nodes either on localhost or on cluster:
Activate your virtualenv:
source blockchain-py3/bin/activate
Initialize the first node on integration cluster on master <master_ip>
python node.py
And, initialize other nodes on other machines in the cluster by following the same procedure described above.
Activate your virtualenv:
source blockchain-py3/bin/activate
Initialize the master node on integration cluster on master <master_ip> with 2 different ports (2 separate networks)
python node_multilayer_singlemaster.py master <port_no_1> <port_no_2>
Example:
python node_multilayer_singlemaster.py master 20000 30000
And, initialize other nodes on other machines in the cluster (choose the network by choosing the port among the ports available on master)
python node_multilayer_singlemaster.py slave <port_no_1 OR port_no_2>
Example:
python node_multilayer_singlemaster.py slave 20000
Activate your virtualenv:
source blockchain-py3/bin/activate
Initialize the first and second master nodes on integration cluster on different machines with 2 different ports for 2 diff. networks
python node_multilayer_multimaster.py master <port_no_1> <port_no_2>
Example:
python node_multilayer_multimaster.py master 20000 30000
And, initialize other nodes on other machines in the cluster (choose the network by choosing the port among the ports available on master)
python node_multilayer_multimaster.py slave <master_ip_1> <master_ip_2> <port_no_1 OR port_no_2>
Example:
python node_multilayer_multimaster.py slave <slave_ip> <master_ip> 20000
After launching the script among node.py OR node_multilayer_singlemaster.py OR node_multilayer_multimaster.py;
You will be able to access to corresponsing node's chain by passing the command:
get chain
to send a hey to peers (connection test):
hey
to get the active peers list:
get peers
to get the network that the node belongs to:
get network
to get the unvalidated transactions list:
get txs
to mine:
mine
to reach a consensus:
consensus
to shut down the node properly:
q