In Hyperledger Fabric framework, the chaincode is a ‘smart contract’ that runs on the peers and creates transactions. BaaS currently supports Go, Node.js and Java, and will support other languages in the future. This document describes how to upgrade a chaincode that already exists in the channel.
If you want to install a new chaincode for the channel, see Install chaincodes.
This chapter is applicable to users who purchase an instances of Fabric V1.4. If you purchase an instances of Fabric V2.2, please refer to the Manage chaincode (V2.2) upgrade chaincode.
Procedures
Upgrade the chaincode source files locally and pack the files.
NoteWhen you pack the files, you need to specify the chaincode name. The name of the chaincode must be the same as the previous version, and the version number must be different.
Add the upgraded chaincodes from above. For more information, see Install chaincodes in Deploy chaincodes.
Install chaincodes in multiple organizations. For more information, see Install chaincodes in Deploy chaincodes.
After you have installed the chaincodes, the chaincode status in the Actions column changes to Upgrade and the chaincode status in the Channels column changes to Upgradable.
In the Actions column, click Upgrade.
In the dialog box that appears, enter the endorsement policy if you need to change the policy
Click Superior in the dialog box, enter the new collection definition JSON file if you need to change it. Attention, once
name
andblockToLive
set, you can’t change it anymore in upgrade.finally click Upgrade.
This operation may take several seconds to several minutes, depending on the complexity of the chaincode dependency. After the chaincode has been successfully updated, the chaincode status changes from Upgradable to Running, and the value of the Actions column becomes empty.