Alibaba Cloud BaaS — Part II: Blockchain as a Service with Hyperledger Composer
In the previous article, we have discussed about the blockchain, as well as briefed about the Hyperledger Fabric and the advantages of Blockchain as a Service. Now let’s see more about Alibaba Cloud’s Blockchain as a Service (BaaS).
Alibaba Cloud Blockchain as a Service (BaaS)
Alibaba Cloud BaaS provides an enterprise-level platform service based on leading blockchain technologies. This service helps you build a secure and stable blockchain environment as well as manage the deployment, operation, maintenance, and development of blockchain easily. Alibaba Cloud BaaS enables you to focus on business innovation.
There are different benefits of using Alibaba Cloud Blockchain as a Service
Alibaba cloud has a wide range of security products and security strategies also it has achieved the multi-tenant isolation perfectly Alibaba cloud blockchain as a service can provide advanced security protection using the chip encryption Technologies.
Due to Alibaba’s distributed storage system called “Pangu”, this service also provides end to end and highly available services that can scale up quickly based on the need.
It is effortless to use as it provides enhanced administrative functions in the concerned it helps in creating an enterprise level blockchain with just one-click. It also supports open source blockchain Technologies like Hyperledger fabric and Enterprise Ethereum — Quorum, natively out-of-the-box.
Let’s get started. Head over to the Alibaba Cloud console and look for Blockchain as a Service. You should see something similar to the image below:
Contrary to traditional system, we will create a blockchain network on the cloud with just few clicks this makes the Blockchain as a Service, you must perform the following operation to create a blockchain network. Before we proceed further, remember we are doing this based on the Hyperledger fabric & Hyperledger Composer.
What Is Hyperledger Composer?
Let’s get some basic concepts and terms related to Blockchain as a Service cleared up so that we all are on the same page. Since we need to give the information while we are creating the blockchain:
- Consortium: This is nothing but a simple business entity name for which you want to create the blockchain network.
- Organizations: Organizations are the participants to your blockchain network, there should be at least one participant in your network.
- Channels: Are the private channels between different peers on the network.
- Chaincodes: This Is the smart contract between the participants of the network. It encapusulates the business logic of all the business here.
Now we need to click “quick start” to setup the consortium, you will see a form like below
We need to fill all the below information
- Consortium Name : This is nothing but the related business name
- Consortium Domain Name : It is the Unique identifier in the entire blockchain globally and cannot be modified. It is just the prefix for the consortium domain name.
- Channel Creation policy : There are two option for you
- Any : There should be approval from at least one organization to create a new channel on the network
- All : All the organization should approve the creation of the new channel
- Consensus: This is chosen by default and this is Kafka.
- Region: I have kept the region similar to the Blockchain Region, but you are free to choose on your own
- Node Quantity : How many peers you want to maintain in the organization.
Then we have to add the organization like below, it is nothing but the enterprise/government institution or community that participates in the blockchain network. We can keep adding the organizations once the network is created.
Fill the organization name and domain, make sure the organization domain is globally unique. Then Click “Create”, you can see the blockchain network is creating
You can see the entre information of all the consortium’s and organizations after creation in the dashboard like below
Once the organization is successfully created you can click on the organization for more information,
You can see several information along with the general information like organization name and the domain, The creator UUID and also at the bottom of that the consortium tab you can see what are all the consortiums the organization is part of for example :
“DemoOrganization” is a member of “DemoConsortium” and it is accepted automatically because we need at least one organization to create a network.
Now click on the Channels tab to find out more information
Then you can also see the peer node who are on the network
The “Chaincodes” tab which also shows empty as below since we have not configured and uploaded the blockchain code yet, to upload we need to have atleast one user
We need at least one user to even configure the network. For now the “users” tab shows empty information,
We will start adding a user by clicking the “Add User” button
The user creation is simple it simple asks for the username and the password, confirm password to create a user. Once the user is created you can see the information as below
The user creation gives us option to reset the password and to “Download SDK Configuration”
Now we need to download the SDK configuration, to setup further,
If you extract the downloaded package, you will see different files like below,
We will start with “bootstrap.sh”, which is an automated script to setup the environment based on our choice. If you are on windows systems you can execute it directly
This will execute the script and prompt you for preferred choice of SDK as below
已为您生成区块链网络的配置信息, 使用Fabric SDK 即可连接您的区块链网络。
Welcome to use aliyun blockchain as a service.
You can use fabric sdk with below connection profiles to operate fabric network.由于不同 SDK 配置文件有一些差异，我们为您生成了不同 SDK 的配套配置文件：
There are different format of connection profile for different fabric sdk:
- connection-profile.yaml: Golang SDK的配置文件 (For Golang fabric sdk)
- connection-profile-standard.yaml: Java/Node SDK的配置文件 (For Java/Nodejs fabric sdk in yaml format)
- connection-profile-standard.json: Json格式，Java/Node/Python 等SDK可以使用 (For Java/Nodejs fabric sdk in json format)另外，我们为您准备了SDK示例程序，若需下载请选择SDK的编程语言[1-3]，若不需要请选择:
Please input the language of sdk to download [1-3]，to exit input :
-e [-] 1. Golang
-e [-] 2. Java
-e [-] 3. Nodejs
-e [-] 4. 退出(Exit)
请选择1-4中的其中一项(please input 1-4):2
-e [-] 开始下载 fabric-sdk-java 示例程序到目录: <downloaded-SDK-rootpath>
-e [-] Going to download fabric-sdk-java demo application into path: <downloaded-SDK-rootpath>
-e [-] 下载完成，您可以通过 https://help.aliyun.com/document_detail/88774.html 了解详细使用方法
-e [-] Downloading finished，you can find more information about how to use the demo application from: https://help.aliyun.com/document_detail/88774.html
-e [-] Happy Hacking!
Despite having a lot of information in Chinese, you can find the translated counterparts in English right below. Since I have chosen the Java SDK, it will download the SDK into the path with an example.
Unfortunately, if you want the same script needs to run in the Linux/MAC systems it will not work and pose so many errors. I have modified the script for you, open bootstrap.sh and replace with the below content.
## replace this
## wget -q https://baas-sdk.oss-cn-hangzhou.aliyuncs.com/installer.sh -O installer.sh && bash installer.shcurl -0 https://baas-sdk.oss-cn-hangzhou.aliyuncs.com/installer.sh -o installer.sh && sh installer.sh
Once you run this command, you will see the installer.sh also gets downloaded, we need to edit that too, replace the wget commands with curl commands
# replace wget -q $GOSDK -O golang.tar.gz
curl -0 $GOSDK -o golang.tar.gz
# replace wget -q $JAVASDK -O java-sdk.tar.gz
curl -0 $JAVASDK -o java-sdk.tar.gz
# replace wget -q $NODESDK -O node-sdk.tar.gz
curl -0 $NODESDK -o node-sdk.tar.gz
The tar command might fail, but you can unzip it yourself, using 7zip or the extracting application of your choice.
In this article we have seen what Alibaba Cloud Blockchain as a Service is. We have also discussed how to configure the service on the Alibaba Cloud console and we also downloaded the required packages for the setting up Hyperledger. In the next article, we will see some important key components in Hyperledger by creating a use case and deploying it on the Blockchain network of Alibaba Cloud.