Home

Awesome

Hyperledger Fabric Client SDK for Node.js <a href="https://github.com/hyperledger/fabric-sdk-node/actions/workflows/scheduled.yml"><img src="https://github.com/hyperledger/fabric-sdk-node/actions/workflows/scheduled.yml/badge.svg" alt="Build status" style="float: right"></a>

Note: This API is deprecated as of Fabric v2.5. When developing applications for Hyperledger Fabric v2.4 and later, you should use the Fabric Gateway client API.

The Hyperledger Fabric Client SDK makes it possible to use APIs to interact with a Hyperledger Fabric blockchain. This readme is directed towards a current or future contributor to this project, and gives an overview of setting up the project locally and running tests. For more information on the SDK, including features and an API reference, please visit the SDK documentation.

This project publishes the following npm packages:

Build and Test

To build and test, the following pre-requisites must be installed first:

Run unit tests

Clone the project and launch the following commands to install the dependencies and perform various tasks.

In the project root folder:

Run Integration Tests

Integration tests run on the main branch require the most recent stable Fabric images, which are hosted on Artifactory. A utility script is provided to retrieve non-published docker images, which may be run using the command npm run pullFabricImages

Now you are ready to run the integration tests. It is advisable to clear out any previous key value stores that may have cached user enrollment certificates using the command (rm -rf /tmp/hfc-*, rm -rf ~/.hfc-key-store) prior to testing in isolation.

We have functional and scenario based tests that may be run via the following commands:

Special Tests for Hardware Security Module support via PKCS #11 interface

The SDK has support for Hardware Security Module (HSM) via PKCS #11 interface. See the test README for details of how to run HSM tests locally.

Pluggability

HFC defines the following abstract classes for application developers to supply extensions or alternative implementations. For each abstract class, a built-in implementation is included with the ability to load alternative implementations via designated environment variables:

  1. To replace FileKeyValueStore with a different implementation, such as one that saves data to a database, specify "KEY_VALUE_STORE" and provide the full require() path to an alternative implementation of the api.KeyValueStore abstract class.

  2. The cryptography suite used by the default implementation uses ECDSA for asymmetric keys cryptography, AES for encryption and SHA2/3 for secure hashes. A different suite can be plugged in with "CRYPTO_SUITE" environment variable specifying full require() path to the alternative implementation of the api.CrytoSuite abstract class.

  3. If the user application uses an alternative membership service than the one provided by the component fabric-ca, the client code will likely need to use an alternative client to fabric-ca-client to interact with that membership service.

Continuous Integration

Our Continuous Integration is run using Azure Pipelines. Builds are automatically triggered on opening pull requests.

Release notes

Check the ./release_notes directory for the release notes of the specified release.

Contributing

Check the documentation on how to contribute to this project for the full details.

<a rel="license" href="http://creativecommons.org/licenses/by/4.0/"><img alt="Creative Commons License" style="border-width:0" src="https://i.creativecommons.org/l/by/4.0/88x31.png" /></a><br />This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/4.0/">Creative Commons Attribution 4.0 International License</a>.