This document describes how to deploy and use Hyperledger Composer in the Alibaba Cloud BaaS console. For more information about Hyperledger Composer, see Documentation.
You have installed Docker (version 17 or later) on Linux or Windows. You have a basic understanding of Hyperledger Composer and you are familiar with the basic operations.
This example uses "quick mode" to create a consortium named "composer" and two organizations named "composer1" and "composer2", respectively. The user name is "composer".
Log on to the Alibaba Cloud BaaS console. In My Organizations, locate the organization named "composer1", and click the name "composer1" to enter the Basic Information page. Click the Users tab and then click Add User. The name of the new user is "composer" .
"Download SDK Configuration". Decompress the SDK to the local disk. Open a command shell and go to the decompressed SDK directory. You can use command-line shells, such as CMD, Bash, and PowerShell. This example uses the CMD shell.
Modify the firstname.lastname@example.org\composer\cards\composer\metadata.json file. Change the userName parameter to "composer" and the enrollmentSecret parameter to the password of the user "composer".
"userName": "composer", // username
"enrollmentSecret": "********", // password
Modify the email@example.com\composer\cards\composer\connection.json file based on your needs. For more information, see Hyperledger Composer Documentation. Only one channel key can be reserved. The channel key of the channel named "first-channel" is reserved in this example.
Run commands in a shell script. We recommend that you back up the composer folder before running the commands.
# REM CMD command
docker run --rm -ti -v %PWD%/composer:/home/composer/.composer -e PORT=8080 -p 8080:8080 registry.cn-hangzhou.aliyuncs.com/aliyun-blockchain/baas-composer:0.20.0
# PowerShell command
docker run --rm -ti -v $P/composer:/home/composer/.composer -e PORT=8080 -p 8080:8080 registry.cn-hangzhou.aliyuncs.com/aliyun-blockchain/baas-composer:0.20.0
# Bash command
docker run -u 0 --rm -ti -v $PWD/composer:/root/.composer -e PORT=8080 -p 8080:8080 registry.cn-hangzhou.aliyuncs.com/aliyun-blockchain/baas-composer:0.20.0
Open Hyperledger Composer in a browser.
Click Deploy a New Business Network to deploy a new composer business network using the name and the password of the user "composer". You can specify multiple admin users by separating each with a comma, for example, "user1,user2,user3,…”. However, you can only specify one password, which is the password of the first user.
Click Download. In the Save dialog box displayed, click Save. You cannot use the new Business Network Card displayed at the same time. The @install package is generated.
Log on to the Alibaba Cloud BaaS console. In My Organizations, locate "composer1" and click the name to enter the Basic Information page. Click the Chaincodes tab and then click Upload Chaincode (Use the ccpack downloaded in Step 2. Install and instantiate the chaincode.
Go back to Hyperledger Composer. Click Connect now. We recommend that you delete the peer node in the group named "composer2" for quicker processing. The group "composer2" is in the channel "first-channel" in the file named "connection.json". It may take a while before you can enter the dev mode and start development.
Click Deploy changes. In the Save dialog box displayed, click Save. The @upgrade package is generated.
Use the new ccpack to upgrade the chaincode. You have now completed the chaincode installation and Hyperledger Composer upgrade. All functions with the exception of the Issue New ID function are the same as that of Hyperledger Composer.
The ID Name for the Issue New ID operation uses the "username,password" format. The username must be a user managed by the Alibaba Cloud BaaS console.
- There is only one channel in the connection.json file, and the channel must be the same as the channel joined by the user’s organization.
- Reducing the number of peer nodes and orderer nodes in the file named "connection.json" can accelerate the connection speed to the Alibaba Cloud BaaS console.
- The @install package and the @upgrade package correspond to the new composer business network and the upgraded composer business network, respectively. Pay attention to applicable scenarios to prevent errors or data loss.
- Secure and backup the Business Network Card to prevent data loss or management problems.