All Products
Document Center

Upgrade chaincode

Last Updated: Mar 15, 2021

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.


  1. Upgrade the chaincode source files locally and pack the files.

    Note: When 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.

  2. Add the upgraded chaincodes from above. For more information, see Install chaincodes in Deploy chaincodes.

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

  4. In the Actions column, click Upgrade.

  5. In the dialog box that appears, enter the endorsement policy if you need to change the policy

  6. Click Superior in the dialog box, enter the new collection definition JSON file if you need to change it. Attention, once name and blockToLive set, you can’t change it anymore in upgrade.

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