Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

HyperLeger Fabric SDK Development (1)-- A brief introduction to Fabric SDK Development

Shulou Source: shulou.com Published: 2022-06-03 02:46:11 10月04日 Update

HyperLeger Fabric SDK development (1)-- introduction to Fabric SDK development 1. Introduction to Fabric SDK 1. Introduction to Fabric SDK

Both Peer node and Orderer node of Farbric provide interfaces based on gRPC protocol for command / data interaction with Peer node and Orderer node. In order to simplify development, API,Fabric officially provides multiple language versions of SDK for developers to develop applications that operate the Fabric blockchain network.

Fabric provides SDK in three languages, one of which is as follows:

A 、 Fabric Nodejs SDK

B 、 Fabric Java SDK

C 、 Fabric Go SDK

Fabric block chain applications can access a variety of resources in Fabric block chain network through SDK, including account books, transactions, chain codes, events, rights management and so on. The application interacts with the Fabric blockchain network on behalf of the user, and Fabric SDK API provides the following features:

A. Create a channel

B. Add the peer node to the channel

C, install the chain code in the peer node

D, instantiate the chain code in the channel

E, call the transaction through the chain code

F, query the account book of a transaction or block

2. Fabric SDK installation

Download Fabric SDK:

Go get-u github.com/hyperledger/fabric-sdk-go

3. Fabric Go SDK source code structure

Pkg/fabsdk: the main package of Fabric SDK that allows you to create contexts based on configuration. The context is used by the client package.

Pkg/client/channel: provides channel transaction related functions

Pkg/client/event: provides channel event-related functions

Pkg/client/ledger: enable the query of account books at the bottom of the channel

Pkg/client/resmgmt: provides resource management functions, such as installation chain codes

Pkg/client/msp: enable identity management related featur

2. Fabric SDK function module 1, API

For application developers, plug-in API can support optional implementations of key interfaces provided by SDK. For each interface, there is a built-in default implementation, which can also be flexibly customized.

2 、 fabric-client

The fabric-client module provides API to interact with the core components based on the Hypreledger Fabric block chain network, namely peer,order and event flow, and the main functions are as follows:

A. Create a channel

B. Request the peer node to join the channel

C. install the chain code in the peer node

D. instantiate the chain code in the channel

E. invoke the transaction by calling the chain code

F, multiple queries

G, listening for events

3 、 fabric-ca-client

The fabric-ca-client module provides API,fabric-ca that interacts with the optional component fabric-ca to provide member management services. The main functions of the fabric-ca-client module are as follows:

A. Register a new user

B. Register the user to obtain the registration certificate signed by Fabric CA

C. Revoke an existing user or revoke a specific certificate by registering for ID

D, customizable persistent storage

Tags: Function node channel development block event module user network transaction application management introduction multiple interface account book query upper and lower context instance Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno NVidia OPPO Reno Apple MariaDB Linux