This repository creates a network where SLAs are handled between a provider and a client and where data coming from IPFS get compared inside in a Fabric Private Chaincode to calculate if a violation happened.
This provides security, since it guarantees that even the computation is secured and untempered.
Make sure to recursively clone this repository by running
git clone --recursive https://github.com/nkapsoulis/blockchain-sla-management.git-
Make sure you have a new version of Docker installed, as well as make.
-
Go to
utils/dockerand build the development container withmake build-dev -
Run the development container with
make run-dev -
Compile the protocol buffers definitions by running
make -C protos -
Compile the chaincodes and clients by running
makeon the following folderscc/publiccc/privateclients/apiclients/ipfs_clientclients/violation_producer
-
Run
export FPC_PATH=$(pwd)on the top level folder. -
In
cc/public/details.envadd the prefixPUBLICto all the variables (make sure you have the correct permissions to do that).The next steps could be run in virtual terminals so they can survive a disconnect.
To start the network
-
Add the environmental variables of the ccs by running
sourceoncc/public/details.envandcc/private/details.env -
$FPC_PATH/samples/deployment/fabric-smart-client/the-simple-testing-network/env.sh Org1to get credentials for the gateway -
In
samples/deployment/fabric-smart-client/the-simple-testing-networkrunmake run.To run the API
-
On another terminal do step 6 and then also source the
Org1.envfile created in step 7. -
Run
clients/api/apiTo run the IPFS client
-
On another terminal do step 6 and then also source the
Org1.envfile created in step 7. -
Start IPFS by running
docker compose up -din theclients/ipfs_clientfolder. -
Run
clients/ipfs_client/ipfsclient
Bundled in the repository is a Chrome extension, which can be used as a front-end for the different functionalities offered by the applications.
More information on how it can be built and run can be found in the /extension README.
To test the deployment, you will need to have Postman (or a similar tool) installed to interact with the API. A Postman collection is found on the postman folder.
The flow that needs to be followed is the following:
- Login as provider-user with the mnemonic created during api startup
- Create a new SLA, with examples from
test/slas(Only Incident Resolution and Incident Response currently supported) - Approve given SLA
- Logout
- Login as client-user
- Approve SLA
- Now data from IPFS can start flowing in and violations to happen.
You can put data on IPFS using the producer found in clients/violation_producer.
When finished working with the network the following processes need to be stopped (mostly a Ctrl+C would suffice):
- IPFS: With
docker compose downin theclients/ipfs_clientfolder. - The ipfs_client
- The api
- The whole Hyperledger Fabric network