Our blockchain practical repository for the NEC challenge
To run the network please make sure the following have been installed:
flask
,requests
,flask_cors
,cryptography
sudo npm install pm2 -g
)Steps to run:
bash setup_network.sh
bash start_network.sh
bash stop_network.sh
More details:
To setup the network please run bash setup_network.sh
. The script will:
bash start_network.sh
, which will start the hyperledger network and all apis and clients.
The network can be stopped via bash stop_network.sh
, which will stop the network and shutdown all containers.
NOTE: sometimes HF Fabric gives various non-deterministic errors, please restart the network in that case. The full demo is here: https://www.youtube.com/watch?v=lyzwGfcaPJI
A more raw demo can be seen here: https://www.youtube.com/watch?v=10BqdfQ9dQU
Note, for the aggregator to perform the aggregation you need to make a HTTP POST to http://127.0.0.1:11900/putAggDataOnBlockchain/
, with a JSON data load containing for example: {"query_id": "q2"}
All other operations are done via the UIs.
Run the commands in start_network.sh
up until step 7 from the /fabric
folder. Then go to the /clients
folder, and start in 9 new terminals. For each terminal, start the respective Python clients or React acts (see start_network.sh
for their locations). To start the apps you do not need any parameters other than python3
/npm start
. Note: first start the Python clients (Managing organization first), then the react apps. See the /clients
folder for some examples.
To look into various blockchain aspects, look into the /fabric
folder.
All network code is located in /fabric/
. See readme there for additional info.
All client code is located in /clients
. See readme there for additional info.
Various documentation is located in docs_fabric_api
that was used previously for smart contract testing.
/fabric/artifacts/src/
/fabric_api/
/fabric/api-2.0
HTTP GET
applies a query on the blockchainHTTP POST
applied an invoke on the blockchain/docs_fabric_api/query
The logs of the python clients can be found in the nohup.out
files located next to the python files. For node apps, all logs can be viewed via pm2 logs
, e.g. pm2 logs API
.
To view the logs of the HF containers, first find using docker ps -a
the interesting container, and then use docker logs <id>
.