Hyperledger Fabric course is out!

Back to blog

3 Key Features in Hyperledger Fabric v2.4: Gateway & More

3 Key Features in Hyperledger Fabric v2.4: Gateway & More

Note: Fabric v2.4 features described here are now part of all subsequent releases, including Hyperledger Fabric 3.0 which adds BFT consensus. For new deployments, consider starting with Fabric 3.0.

TL;DR: Fabric v2.4 introduced three important features: the unified Fabric Gateway API for consistent SDK interaction across Go, Java, and Node.js; the ability to unjoin a channel from a peer without recreating it; and environment-variable configuration for external chaincode builders.

Three features in Hyperledger Fabric v2.4 that are worth your attention.

What is the Fabric Gateway API?

The Fabric Gateway is a unified high-level API introduced in Hyperledger Fabric v2.4 that consolidates previously scattered SDKs across Go, Java, and Node.js into a single consistent interface.

Fabric Gateway has offered a high level API to interact with the Fabric network, but these repositories were spread across multiple github projects, therefore, the API wasn't consistent between the programming languages:

  • Go
  • Java
  • Node.JS

The gateway offers the following functionality:

  • Submit transactions to the Fabric network
  • Evaluating transaction on the Fabric network
  • Subscribing to block events on the Fabric network.

Though, not all features are implemented in all SDKs, for example, HSM is only available on GoLang and Node.JS.

You can check out the current fabric-gateway repository on Github

Can I unjoin a channel from a peer?

Yes, since Fabric v2.4. This feature has been requested for a long time, since 2018.

The workaround to remove the channel from a peer was delete the peer completely and recreate other, then join the peer to the desired channels, of course, this meant that the peer will be re-created and will need to download all the blocks for every channel joined, which can take multiple days, even weeks.

The only catch is that the peer needs to be stopped, which is a challenge for cloud native environments like Kubernetes, where stopping the peer and executing the command

peer node unjoin
is not something easy automatable.

How do I configure external builders with environment variables?

Before v2.4, we had a feature to configure external builders, which were used to build the chaincode, but this required to change the core.yaml configuration file for the peer, which felt like too much to only change the external builder configuration, and it was impossible to configure it using environment variables.

As of v2.4, it's possible to configure external builders using environment variables:

CORE_CHAINCODE_EXTERNALBUILDERS=[{name: my-builder, path: /my-builder}]

Which makes it a lot easier to configure external builders without changing the core.yaml file.

Related Posts

References

  1. Fabric Gateway Repository on GitHub — Official Gateway SDK
  2. Hyperledger Fabric Documentation — Official docs
  3. FAB-11334: Unjoin Channel Feature Request — Original JIRA issue