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/docker
and 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
make
on the following folderscc/public
cc/private
clients/api
clients/ipfs_client
clients/violation_producer
-
Run
export FPC_PATH=$(pwd)
on the top level folder. -
In
cc/public/details.env
add the prefixPUBLIC
to 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
source
oncc/public/details.env
andcc/private/details.env
-
$FPC_PATH/samples/deployment/fabric-smart-client/the-simple-testing-network/env.sh Org1
to get credentials for the gateway -
In
samples/deployment/fabric-smart-client/the-simple-testing-network
runmake run
.To run the API
-
On another terminal do step 6 and then also source the
Org1.env
file created in step 7. -
Run
clients/api/api
To run the IPFS client
-
On another terminal do step 6 and then also source the
Org1.env
file created in step 7. -
Start IPFS by running
docker compose up -d
in theclients/ipfs_client
folder. -
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 down
in theclients/ipfs_client
folder. - The ipfs_client
- The api
- The whole Hyperledger Fabric network