How to get all existing channels in Hyperledger 1.0 (Node SDK)

回眸只為那壹抹淺笑 提交于 2019-12-05 22:00:54

You cannot see all available channels, while you can leverage CSCC (Configuration System Chaincode) GetChannels API to get a list of channels client eligible to. You just need to invoke chaincode named CSCC.

The CSCC is the system chaincode, meaning it inherently built in into peer binary and loaded and "instantiate" during peer startup. You can find details here. Considering NodeJS the request will look as following

const request = {
  chaincodeId : "cscc",
  txId: 213213123123, // Some random transaction id
  fcn: "GetChannels",
  args: ['']
}

BTW you also can do it with peer cli:

peer channel list
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!