×
Community Blog Alibaba Cloud BaaS - Part II: Blockchain as a Service with Hyperledger Composer

Alibaba Cloud BaaS - Part II: Blockchain as a Service with Hyperledger Composer

In this article, we will show you how to configure Alibaba Cloud's Blockchain as a Service offering through the console to set up a Hyperledger network.

By Sai Sarath Chandra, Alibaba Cloud Tech Share Author. Tech Share is Alibaba Cloud's incentive program to encourage the sharing of technical knowledge and best practices within the cloud community.

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:

1

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?

Hyperledger fabric is the core of blockchain implementation, but Composer gives us an easier way to create and understand the blockchain network. It provides more tools for business owners and developers to create smart contracts and blockchain applications to solve business problems. Built with technologies like JavaScript, leveraging modern tools including Node.js, npm, CLI and popular editors.

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

2

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
    1. Any : There should be approval from at least one organization to create a new channel on the network
    2. 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.

3

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

4

You can see the entre information of all the consortium's and organizations after creation in the dashboard like below

5

Once the organization is successfully created you can click on the organization for more information,

6

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

7

Then you can also see the peer node who are on the network

8

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

9

We need at least one user to even configure the network. For now the "users" tab shows empty information,

10

We will start adding a user by clicking the "Add User" button

11

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

12

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,

13

If you extract the downloaded package, you will see different files like below,

14

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

cd <downloaded-SDK-rootpath>
bootstrap.sh

This will execute the script and prompt you for preferred choice of SDK as below

欢迎使用阿里云区块链服务(https://baas.console.aliyun.com)
已为您生成区块链网络的配置信息, 使用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],若不需要请选择[4]:
Please input the language of sdk to download [1-3],to exit input [4]:
-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.sh

curl -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.

Conclusion

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.

0 0 0
Share on

Alibaba Clouder

2,605 posts | 747 followers

You may also like

Comments