Egels

Onderweg van een uit de hand gelopen vrijgezellenfeest fiets ik door de regen. Het is laat. Ik heb nog niet genoeg gedronken en vang regendruppels met mijn mond. Naast mij staan aan beiden kanten…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




Hyperledger Fabric Upgradation of the network from version 1.4.x to 2.2.x

Hyperledger

Creating a network can be difficult but migration of a network is cumbersome. It is important to note that upgrading a Hyperledger Fabric network can be a complex and time-consuming process. It is recommended to test the upgrade on a non-production environment before applying it to the production network. It is also advisable to have an experienced Hyperledger Fabric administrator or consultant assist with the upgrade process. There are a lot of steps involved for migrating the network and I will be demonstrating the process with fabric-samples 1.4.9.

Here is a high-level overview of the process:

Upgrade the orderer containers

Upgrade the peer containers

Update channel capabilities

Enable New Chaincode lifecycle

Peer databases upgrade

Define ordering node endpoint per org

Test Network architecture is very simple, a two-organization network setup, one for ordering service and two for peer organizations. Inside each peer organization we have one peer and an optional CA.

Following command can be used to install the required images/binaries for the network.

Let’s Start with moving into the working directory which is fabric-samples/first-network and using the byfn script we will build a network and deploy a chaincode.

If everything goes correctly you will have a network up with a single channel called mychannel where a Javascript chaincode will be deployed and the database used is couchdb.

Byfn script end

We can now check if the network is correctly configured and running by Invoking/Query the chaincode.

Invoke/query Successful

Let’s now start with Migrating the network

First we will be upgrading the images/binaries for Orderer then Peer.

Orderer containers should be upgraded in a rolling fashion (one at a time). At a high level, the orderer upgrade process goes as follows:

We only have one Orderer in our test network for demo purpose.

Peer containers should, like the orderers, be upgraded in a rolling fashion (one at a time). As mentioned during the orderer upgrade, orderers and peers may be upgraded in parallel, but for the purposes of this tutorial we’ve separated the processes out. At a high level, we will perform the following steps:

We have four peers running in our network. We will perform this process once for each peer, totaling four upgrades.

(Optional to do now as you can do the same later on) You can add “peer node upgrade-dbs” in the command for docker compose to drop database.

Now to check if the network is working fine, we can do invoke/query as shown above but before doing that lets update the image of CLI container.

If your Invoke is working fine then the network is using the new Images/Binaries but it doesn’t end here. We now have to do the channel upgradation on both System Channel as well as Application Channel but before that we will be dropping the old couchdb database and rebuild the whole database using 2.x standards.

peer-node-upgrade-dbs

You will have to follow the same process as we did while upgrading peers (Upgrade peer containers)

You can also check the database by running the curl request for couchdb

If the database has not been dropped by the command given above, You can do it manually using the following command but do keep in mind there are 4 couchdb instance so you will have to do the same for all the instances (5984, 6984, 7984, 8984)

Again you will have to restart the peers in the same way but this time the command in docker compose should indicate “ peer node start “ and you can find the following logs in the running 2.2.x peer

Make sure you are in the CLI container:

Because only ordering organizations admins can update the ordering system channel, we need set environment variables for the system channel that will allow us to carry out these tasks. Issue each of these commands:

The first step in updating a channel configuration is getting the latest config block:

Now lets make the Required Changes in the channel configuration which will allow peers to use new capabilities as well as Chaincode Lifecycle.

Add Capabilities to all the Capabilities section like this. (append)

# Adding Endorsement to all the organisation before Readers and Writers

Adding Orderer Endpoints to the channel values. This will vary with the amount of orderer present in your network

Now we can create the config update:

Package the config update into a transaction:

Submit the config update transaction: (You might require the config update to be signed by both Organisations by setting up required environment variables

First, switch into Org1 and sign the update:

And do the same as Org2:

And as the OrdererOrg, Submit the config update transaction

Now we have to do the same steps on Application Channel. Most of the steps will remain the same only one addition configuration will be added in Application channel related to ACLs (Access Control List)

For the application group, we will need to reset the environment variables as one organization:

Follow the same steps as system channel to do the configuration updates

Voila!! You now have migrated the network from 1.4 to 2.2 without any data loss. We can verify by making an invoke/query on the network.

Add a comment

Related posts:

10 Ways Cvent Can Help Your Nonprofit

Cvent is a cloud-based event management software that helps organizations manage their events, meetings, and conferences. It is one of the leading event management software in the industry, providing…

How to Coffee Makers and E bay Perfectly Matched?

Coffee goods and the eBay auction website are well suited to each other, with the technical assistance of eBay you will find thousands upon thousands of items that will help you enjoy the magical…

Online interaction and its negative side

This week the negative side of online interaction such as misinformation, trolling, hostility, and hate speech. Among these negative aspects of online interaction, misinformation and toxicity are…