Blockchain as a Service: Add an external organization to an internal channel

更新时间:
复制 MD 格式

Any organization in a channel of a consortium that is created in Alibaba Cloud BaaS can add an external Hyperledger Fabric organization to that channel — as long as the management chaincode is installed and bound across all organizations in the channel. The channel must be marked with the Hybrid Channel identifier before you begin.

Prerequisites

Before you begin, ensure that:

  • The external organization's peer node addresses follow the <domain name>:<port> format and are accessible over the Internet

  • The external organization uses the same state database type as your BaaS organizations (the default is CouchDB)

  • The Hyperledger Fabric version of the external organization matches your consortium version:

    • BaaS consortium V1.4: Hyperledger Fabric V1.4.2 or later, and earlier than V2.0

    • BaaS consortium V2.2: Hyperledger Fabric V2.2.x

  • The management chaincode is installed in all organizations in the channel and bound with the channel, and the channel shows the Hybrid Channel identifier (see Management chaincodes)

  • The external organization has the interoperability tool — BaaS users can submit a ticket to the BaaS team to get this tool and send it to the external organization. To use the tool, the external organization must have access to the configtx.yaml file and the crypto-config directory in their Hyperledger Fabric environment. If those files are inaccessible, the external organization must use its own blockchain platform's interoperability feature instead

How it works

Adding an external organization involves three phases, each with actions from different participants:

  1. Request: The external organization generates a join request file and sends it to a BaaS organization in the channel.

  2. Approve: All organizations in the channel — both BaaS organizations (via the console) and any existing external organizations (via the interoperability tool) — review and approve the request. More than half of all organizations must approve.

  3. Join: After approval, the BaaS organization sends a response file to the external organization, which uses it to join the channel and install the management chaincode.

Add an external organization

Step 1: Generate and send the join request (external organization)

Run the following command with the interoperability tool to generate a request file:

./cmt.amd64 req generate req.json
工具获取加入请求

Send the generated req.json file to the administrator of a BaaS organization in the target channel through offline means (for example, email or a secure file transfer).

For instructions on configuring and using the interoperability tool, see the description file bundled with the tool. If the tool is unavailable, use your blockchain platform or the Hyperledger Fabric CLI to gather the required information and generate a request file. See the join request example for the expected file content. In the screenshot example, ~/cmt.amd64 req generate req.json indicates that the command is executed in the root directory. Ensure that the cmt tool is available in the root directory. If the cmt tool is in the current directory, you can directly run ./cmt.amd64 req generate req.json. All the screenshot examples in this section are executed in the root directory.

Step 2: Upload the request and initiate approval (BaaS admin)

  1. Log in to the Alibaba Cloud BaaS console. On the Overview page, under My Organization, click the name of your organization in the target channel.

  2. Click the Channels tab, find the target channel, and confirm it shows the Hybrid Channel identifier image.png. Click Add External Organization.

  3. In the Add External Organization pane, upload the request file. Review the key information of the external organization displayed in the lower part of the pane, then click Add. An approval task is issued to all organizations in the channel. More than half of all organizations must approve before the task proceeds.

Step 3: Approve the task — BaaS organizations

On the Tasks page, find the approval task and click Handle in the Actions column. The Task Details pane opens.

Information of the approval task

Review the details of the external organization. Confirm that the Membership Service Provider (MSP) ID and other information are correct, then click Approve. To decline, click Close.

In most cases, the task for the organization that initiated the request is automatically approved.

When an organization that is not the operator that instantiated the management chaincode uses the management chaincode for the first time, it must set up a runtime environment. In this case, the Task Details pane may take longer to respond, and the initiator's task may not be automatically approved.

Step 4: Approve the task — existing external organizations

Existing external organizations in the channel cannot approve tasks through the BaaS console. Use the interoperability tool instead.

  1. Run the following command to list pending tasks:

    ./cmt.amd64 list

    工具浏览任务

  2. Run the following command to approve the task. Replace <Proposal ID> with the task ID shown in the Task Details pane of the BaaS console:

    ./cmt.amd64 approve <Proposal ID>

    工具审批任务

If the interoperability tool is unavailable, use your blockchain platform or the Hyperledger Fabric CLI to sign the channel update and call the management chaincode to process the task.

Step 5: Submit the channel update

After more than half of all organizations approve, the task state changes to Applicable.

  • BaaS organizations: The task is automatically submitted. The state changes to Applied.

  • Existing external organizations: Contact a BaaS organization to click Submit in the Task Details pane to validate the channel update.

Step 6: Download and send the response file (BaaS organization)

  1. On the Overview page, under My Organizations, click your organization name.

  2. On the organization details page, click the Channels tab, then click Get Join Response.

  3. In the pane that appears, download the response file or copy its content.

    Obtain the response file

  4. Send the file or copied content to the external organization being added.

Step 7: Join the channel and configure the tool (external organization)

  1. Use the interoperability tool to process the response file and join the channel.

    If the interoperability tool is unavailable, use your blockchain platform or the Hyperledger Fabric CLI to connect to orderer nodes and get the latest blocks in the channel.

    工具处理加入回复文件

  2. Reconfigure the channel and orderer certificate, and specify the management chaincode for the interoperability tool.

    工具配置2

Step 8: Install the management chaincode (external organization)

Install the management chaincode that matches your BaaS consortium version so you can manage channels alongside other organizations.

For BaaS consortium V1.4

Download cmcc.1.4.cc, then run:

./cmt.amd64 install cmcc.1.4.cc

For BaaS consortium V2.2

  1. Download cmcc.1.5.tar.gz, then run:

    ./cmt.amd64 lifecycle install ./cmcc.1.5.tar.gz
  2. Submit the chaincode definition. Get the chaincode name, version number, and serial number from a BaaS organization in the channel, then run:

    ./cmt.amd64 lifecycle approve cmcc.1.5.tar.gz -n <Chaincode name in BaaS> -v <Version number in BaaS> -s <Serial number in BaaS> -e <Endorsement policy in BaaS>

Step 9: Verify the setup (external organization)

After the management chaincode is installed and the channel update is complete, run the following command to confirm you can view tasks in the channel:

./cmt.amd64 list
工具浏览任务

If tasks appear, the external organization has successfully joined the channel and the management chaincode is bound correctly.