Skip to content

A case-study that shows how the SCIP protocol can be used in a heterogeneous multi-blockchain setup.

License

Notifications You must be signed in to change notification settings

ghareeb-falazi/SCIP-CaseStudy

Repository files navigation

Smart Contract Invocation Protocol (SCIP) Case Study

Introduction

A case-study that shows how the SCIP protocol can be used in a heterogeneous multi-blockchain setup.

The following picture highlights the architecture of the distributed system that is invloved in the case study: Arch.png

We will create the various components of this system, bring it up and then run a sample the client application against it. The sample client application is described by the following figure:

CaseStudy

Prerequisits

  • Active internet connection :)
  • Docker with Docker-Compose
  • Git bash (for Windows users)
  • The ports 4200, 7050, 7051, 7054, 8080, 8081, 8082 8545 must be avaialable at the host machine.

Setup

  • The following instructions assume you are using Windows. Otherwise, ignore the requirement that you need to run the commands using git bash, since bash will be readily available for you.

  • Using git bash, navigate to the AutomateSetup directory, and run the shell script Start.sh, i.e.,

    > cd AutomateSetup
    > ./Start.sh
    

    This will pull/create the necessary docker images, execute the docker-compose file to bring up the various docker containers needed, and deploy the Ethereum and Fabric smart contracts.

  • When the script is fully executed, you can proceed to the Demo section below.

  • At the end, you can bring down the network with the command

    > ./Stop.sh
    

    You can also remove BAL and ganache-cli images by cmobining the previous command with the rmi option as follows:

    > ./Stop.sh rmi
    

Demo

  • A Video of this demo is available on Youtube
  • Open the browser to http://localhost:4200 to open the frontend of the client applicaiton.
  • Click on the button Query State. This should result in the state of the energy management system (EMS) shown on the left side of the page.
  • Start the workflow demonstrated in the fiture above by clicking on the Start Workflow button.
  • Then a stream of log messages from the backend of the client application is shown on the right side with a black background.
  • Wait until the Subscribe request message is sent to the first Gateway and is confirmed by it.
  • Reduce the energy bulk price to below or equal 500, by either:
    • Using the tab entitled Power Plant Controls, or

    • Sending a POST message to the address: http://localhost:8082/blockchain-access-layer/webapi?blockchain=fabric&blockchain-id=fabric-0&address=mychannel/ems, which corresponds to the SCL of the energy management system smart contract gateway of the Hyperledger Fabric permissioned blockchain, with the following body:

      {
         "jsonrpc": 2.0,
         "method": "Invoke",
         "id": 1,
         "params": {
             "functionIdentifier": "changeBulkPrice",
             "inputs": [{
               "name": "newPrice",
               "type": " {\"type\":\"integer\",\"minimum\": 0,\"maximum\":4294967295}",
               "value": 500
             } ],
             "outputs": [],
             "doc": 50,
             "callbackUrl": "http://localhost:8081/webapi/submit-transaction/dummy",
             "timeout": 100000,
             "correlationIdentifier": "abc",
             "signature": ""
          }
      }
      

      This has the effect of triggering the transaction that reduces the bulk energy price. You can use a tool like Postman, or curl to achieve this task.

  • Go back to the initial tab (Power Provider Controls), and check how the log messages proceed according to the presercibed workflow.
  • When the Done!!! message is received, recheck the state of the EMS and notice how it is changed according to the workflow.

Notes

  • The crpyto artifacts for Fabric are already generated. If you need to generate them again use the script generate.sh. Then you need to update the keyfile name mentioned inside the docker-compose file (in the ca service specification).

About

A case-study that shows how the SCIP protocol can be used in a heterogeneous multi-blockchain setup.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published