Hyperledger Fabric Node SDK

Hyperledger Fabric provides SDK versions in multiple languages, among which the Node.js version of the SDK is proposed earlier, more stable and comprehensive .

The relationship between SDK and Chaincode :

  • The SDK exists at the client level and is mainly used to interact with various components in the network, including peer, orderer, event, channel, and chaincode. It provides rich APIs for developers to write applications.
  • Chaincode is at a lower level, providing Query, Invoke, Delete and other APIs to directly read and write to the state database (world state).
  • The methods in the SDK can query the block and various information such as transactions, channels, chaincodes, etc. in the block, but the reading and writing of the state must be done through the Chaincode (by sending Proposal to the endorsement node).

The SDK for Node.js has three top-level modules: API, fabric-client and fabric-ca-client . For details, see the official documentation and source code .

1. API

This module provides developers with a pluggable API to provide alternative implementations of the main SDK interfaces, including CryptoSuite , key , KeyValueStore . Every interface has a built-in default implementation.

2. fabric-client

This module provides user client interaction with Fabric blockchain network components (peer, orderer, event, etc.). The main functions are:

  • create channel
  • Send a message to make the peer node join the channel
  • Install chaincode in peer
  • Instantiate the chaincode on the channel, which is divided into two steps: proposal ( propose ) and transaction (transact)
  • Submit a transaction (need to call chaincode), which is divided into two steps as above
  • Multiple query functions: status (via chaincode), transaction, block, channel, chaincode
  • Monitoring events : including peer, block, transactions, custom events
  • Serializable for signing -capable User objects
  • Hierarchical configuration settings
  • It also provides pluggable logging utility ( logging utility), encryption tool (CryptoSuite) and state storage method (State Store), which can support TLS/non-TLS linking with peer or orderer

3. fabric-as-customer

This module is mainly used for membership management. The main functions are as follows:

  • register new user
  • Login (enroll) the user and obtain the login certificate (enrollment certificate) signed by the Fabric CA (completed by the CA private key)
  • Revoke a user by logging in id (enrollment id )
  • customizable persistence store _

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325937334&siteId=291194637