0 votes
1 view
in Blockchain by (7k points)

I am using the Node SDK with Hyperledger 1.0 and want to check if a channel with a specific name exists. Is there a way to query all existing channels? And is there a way to get a channel by name?

1 Answer

0 votes
by (14.5k points)

Though you cannot view all available channels, you can anchorage the CSCC (Configuration System Chaincode) GetChannels API to get a list of those channels that clients are eligible to. All you need to do is invoke the chaincode that goes by the name CSCC.

Considering NodeJS the request will look as:

const request = {

  chaincodeId : "cscc",

  txId: 213213123123, // Some random transaction id

  fcn: "GetChannels",

  args: ['']

}

You also can also perform the same action with peer CLI:

peer channel list

Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...