-1

I hope to create channels and install chaincodes in fabric v2.2. But node sdk no longer provides these functions in version 2.2. How can I achieve these functions using nodejs?

I found some examples of calling the system chaincode lscc, qscc to get some functions not provided by the SDK, such as querying the installed chaincode, block information, etc. Can I implement functions such as installing chaincode and adding channels in the same way? But I can't figure out how to format the parameters, is there some concrete example you can provide? or some other methods? I tried to use java and go sdk, but their configuration is too cumbersome and there is no clear tutorial.

npcxh
  • 19
  • 2

1 Answers1

0

You could invoke the peer CLI commands to drive configuration and chaincode deployment.

For a pure Node approach, there is a Fabric admin API here, although (at the time of writing) this is in a development state, not at a formal release version:

https://github.com/hyperledger/fabric-admin-sdk/tree/main/node/admin

I'm not sure that code is published to the NPM registry for use, but you can certainly use it as a reference.

The chaincode deployment in particular uses transaction functions on the _lifecycle system chaincode. Some of the transaction functions (such as InstallChaincode) need to be evaluated on specific peers. Others can use any suitable endorsing peers, like a regular transaction submit or evaluate call. If you can understand Golang, there is an admin implementation in the same repository that uses the standard Fabric Gateway client API for many of the chaincode lifecycle invocations:

https://github.com/hyperledger/fabric-admin-sdk/tree/main/pkg/chaincode

bestbeforetoday
  • 1,302
  • 1
  • 8
  • 12