Setting up Composer REST servers for each participant

As part of the prerequisites for the installation of the Hyperledger Composer development environment, you would have also installed the Composer REST server.

This component is an API server based on the Loopback framework (http://loopback.io) and includes a loopback-connector-composer to connect to the Hyperledger Composer environment and a script that dynamically gather assets, participants, and transactions models. 

The easiest way of starting a Composer REST server is by running the cli commands and filling the startup questionnaire correctly. For our convenience, we will be running it using the following command:

composer-rest-server -c "<business card name>" -n never -u true -w true -p <port defined for the participant server> 

Open a terminal window for each participant to start a dedicated Composer REST server for it:

composer-rest-server -c "Factory@food-safety-b10407" -n never -u true -w true -p 3000

composer-rest-server -c "Warehouse@food-safety-b10407" -n never -u true -w true -p 3001

composer-rest-server -c "Store@food-safety-b10407" -n never -u true -w true -p 3002

composer-rest-server -c "Consumer@food-safety-b10407" -n never -u true -w true -p 3003

composer-rest-server -c "Transporter@food-safety-b10407" -n never -u true -w true -p 3004

Each running instance is related to a single user, meaning that all operations that were invoked through the Composer REST server that is listening on port 3003 are related to the Consumer with identifier 5For example, if a new Consumer participant is created (let's say ID 6), then a new business card must be issued to the participant, and another instance of a Composer REST server must be started using the new card.

In most use cases, a single business card is enough for an entire organization. Other rules for issuing business cards can be defined by governance, such as a business card per branch/subsidiary, or each user must have their own business card.

At this point, you should have five instances of the Composer REST server running on your computer, and each one should be capable of being accessed through a browser at the following address: http://localhost:<port>.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.223.106.100