D Updating Applications for Hyperledger Fabric v2.x

When you upgrade the platform version, you might need to make changes to your existing applications so that they work with the new version of Hyperledger Fabric.

Multiple versions of the Hyperledger Fabric SDKs are available. Use a version of the SDK that is compatible with the version of Hyperledger Fabric that your instance is based on. For instances based on Hyperledger Fabric v2.x, use versions that are compatible with the Hyperledger Fabric v2.2 long-term support (LTS) release. Oracle Blockchain Platform was verified to work with the following versions for Hyperledger Fabric v2.x:
  • Hyperledger Fabric client SDK for Node.js version 2.2.9
  • Hyperledger Fabric client SDK for Java version 2.2.2
  • Hyperledger Fabric client SDK for Go version 1.0.0

Hyperledger Fabric v2.x requires Go version 1.20 or later, so you might need to upgrade the version of Go that you use.

Note:

You might encounter timeout errors on queries if you deploy an existing chaincode .zip file again and the indexes are stored in the root directory of the chaincode package, instead of under the META-INF directory. To avoid timeout errors, ensure that indexes in existing chaincode that you deploy to a Hyperledger Fabric v2.x instance are in the following directory:
META-INF/statedb/relationaldb/indexes
For more information, see State Database Indexes.

You might need to update your application if it uses a client SDK to complete more complex operations such as managing chaincode life cycles, listening for events, or managing digital wallets, as discussed in the following sections.

Hyperledger Fabric SDK for Node.js

The following table summarizes the differences between versions 1.4 and 2.x of the Hyperledger Fabric SDK for Node.js. For more information, see Migrating client applications from v1.4 to v2.0 in the Hyperledger Fabric documentation.

Change in version 2.x Customer action
The fabric-client module was removed. Refactor applications to use the fabric-network module.
Wallets, used for storing and accessing identity information, were redesigned. See the Hyperledger Fabric documentation for guidelines and utilities to migrate wallets.
The event listener API and behavior were redesigned. Rewrite the event listeners to use the new API.
The SDK no longer provides administrative and management capabilities, include the ability to create channels and manage chaincode life cycles. Use the command-line interface for these operations. Existing clients that use version 1.4 functions for life cycle management will not work with a Hyperledger Fabric v2.x instance.

The following table lists the classes that are available in the Hyperledger Fabric v2.x fabric-network module versus the Hyperledger Fabric v1.4.7 fabric-network module.

Version 2.x fabric-network module classes Version 1.4 fabric-network module classes

DefaultCheckpointers
Gateway
HsmX509Provider
IdentityProviderRegistry
Transaction
Wallet

AbstractEventHubSelectionStrategy
AbstractEventListener
BaseCheckpointer
BaseWallet
CommitEventListener
Contract
ContractEventListener
CouchDBWallet
EventHubManager
FileSystemCheckpointer
FileSystemWallet
Gateway
HSMWalletMixin
InMemoryWallet
Network
Query
RoundRobinEventHubSelectionStrategy
Transaction
X509WalletMixin

Hyperledger Fabric SDK for Java

If your application uses lifecycle APIs that are now deprecated in the Java SDK for Hyperledger Fabric 2.0 (InstallProposalRequest, InstantiateProposalRequest, and UpgradeProposalRequest), rewrite your application to use the APIs in the newer version of the SDK. For more information, see Java SDK for Hyperledger Fabric 2.0 release notes.

Oracle Blockchain Platform REST API (REST Proxy)

No changes are needed to invoke existing chaincodes.

To support the initialization function for newer chaincodes that require it, an optional isInit parameter was added to the existing transaction API. For more information, see Send a Transaction in the REST API documentation.

Oracle Blockchain Platform REST API (Console)

Update the version used in all API calls. For Hyperledger Fabric v1.4.7, the API version number is 1.1. For Hyperledger Fabric v2.x, the API version number is 2.

For example, to get the list of installed chaincodes for Hyperledger Fabric v1.4.7, use the following REST endpoint:
/console/admin/api/v1.1/chaincodes
To get the list of installed chaincodes for Hyperledger Fabric v2.x, use the following REST endpoint:
/console/admin/api/v2/chaincodes

Note:

Although most of the existing APIs have a new Hyperledger Fabric v2.x equivalent, there is not a 1:1 match. Some APIs are unique to each version of Hyperledger Fabric, and some have different parameters for each release. For example, on Hyperledger Fabric v2.x the deployment functions have moved from the chaincode subpath to the channel subpath. For more information, see New, Changed and Deprecated APIs in the REST API documentation.

Because Hyperledger Fabric v2.x includes a new chaincode life cycle with new procedures for installing chaincode on peers and starting it on a channel, you might need to update any related API calls. To learn more, see Chaincode Life Cycle.