If a developer modifies a chaincode’s source, then you’ll need to deploy it to a new version of the chaincode. If needed, you can revert back to an older version of a chaincode.
You can instantiate different versions of the same chaincode on different channels.
You must be an administrator to perform this task.
- Go to the console and select the Chaincodes tab.The Chaincodes tab is displayed and the table lists all of the chaincodes installed on the network.
- Locate the chaincode that you want to upgrade, click More Actions, and select Upgrade. The More Actions button only displays for chaincodes that have been instantiated.The Upgrade Chaincode Step 1 of 2: Select a version page is displayed.
- Select a version source. Note the following information:
- Click Select from existing versions if you want to upgrade to a version that is already on the network. You might choose this option because the most current chaincode version contains errors and you need to temporarily use an older version until the chaincode can be fixed. Because the older version is on your system, the chaincode is already installed on the peers.
- Choose Install a new version to upload the chaincode file. In the Version field enter a version number and in the Target Peers field, select the peers to install the chaincode on. In the Chaincode Source field, click Upload Chaincode File and browse for the chaincode ZIP file to upload.
- Click Next.The Upgrade Chaincode Step 2 of 2: Upgrade page is displayed.
- Decide if you want to instantiate the chaincode version now or later.
The chaincode is upgraded.
- Click Close to close the wizard and upgrade later.
- To upgrade now, select the channel to upgrade the chaincode on and the peers to instantiate the chaincode to. If required, enter initialize parameters, an endorsement policy, and transient map. See Specify an Endorsement Policy. Click Next.