After you setup the network and have your HLF network running with a channel and peers, you may follow the bellow’s steps to deploy a sample chaincode and web application. The application demonstrates a DLT transaction that records a case for particular event during a a clinical trial.
The functionality assumes there are multiple parties involved on the clinical trial, who can perform specific steps of the overall process of recording an event at the hospital site to processing that case on the controlling site (i.e. a pharma company).
The chaincode and web application mentioned below are free to use. However those applications are just samples and should not be used for any production deployment or taken as a reference implementation for a production grade application implementation.
Before you proceed, make sure you have at least 1 MSP with a running peer, a running OSP and a deployed channel. However to complete all steps below you will need at least 2 MSPs. If you perform the steps with a single MSP you will be able only to record a case on the ledger.
Make sure to open the ports so that you can access the web applications from your browser. We will be using in the example below the external ports 8080 and 8090 for the web applications. Make sure they are open or use any other ports you have already opened.
Lets assume you already have a running consortium with the following topology:
The purpose of this step is to bring the chaincode on the peers of NOVA and GH.
To install the chaincode on the peers:
After the installment of your chaincode is done, you may proceed with the chaincode deployment process and instantiate it on a channel.
The chaincode implements few simple functions to record a case (on the ledger) based on some very basic information, update the status of the case and query the case data.
This is very simple implementation to showcase the deployment process. However an access control logic is usually required in the chaincode like who can update the status and who can record a case. For example GH as hospital is the only one who can create a case, NOVA however will be the only one allowed to change the status of the case, etc.
Perform the following steps to instantiate your chaincode:
After the chaincode is deployed you may proceed further with the deployment of your web application that will transact on the ledger (by calling the chaincode) and expose the business logic to your customers.
The HLF chaincode business logic is usually consumed using the HLF provided SDKs. HLF community provides as well best practice design elements for those applications.
After the chaincode is deployed, you may deploy the corresponding web application that is available on the dockerhub repository.
You may notice there are multiple web applications (packaged as docker images) on the above repository. Every web application is slightly different depending on the business that will use it. For example GH will use the application to capture the data of a case and record it, whereas NOVA will the application to see the case and update its status.
The web applications above are using the HLF Java Gateway to transact with the chaincode, expose the functionality over Web APIs and implement simple Vue.js based UI for the end consumer.
Perform the following steps to deploy the web applications (repeat the steps twice for each application):
After both web application above are bootstrapped, your are ready to use them and start recording transactions on the ledger.
To access the applications you may go to Manage -> Applications, where you will find your web applications and the endpoints they may be accessed at.
The ghweb application allows you to record a case providing the patient name and sample description. When the case is recorded the web application uses the HLF Gateway to connect to the peer/orderers to endorse and commit the transaction that contains the case data.
The novaweb application allows you to list the recoded cases and update the status.