Henrique Andrade
Henrique Andrade

Reputation: 981

Hyper Ledger Fabric - How to get the name of all organizations (not the peers) of a network?

I need that, once an organization is added to the network, my application can get the updated list of all organizations.

I've researched this and the solutions I've found (Discovery Service and Node.js SDK Channel class) only return the name of the peers.

Upvotes: 0

Views: 416

Answers (1)

bestbeforetoday
bestbeforetoday

Reputation: 1649

In the Node SDK, at least when using discovery, the getMspids() method on the Channel returns an array of Member Services Provider IDs:

https://hyperledger.github.io/fabric-sdk-node/release-2.2/Channel.html#getMspids

It may be a bit of work to implement but another approach might be to implement a block listener that inspects blocks as they are committed and looks for config update transactions that include changes to the organizations configured for a network:

https://hyperledger.github.io/fabric-sdk-node/release-2.2/module-fabric-network.Network.html#addBlockListener

Upvotes: 1

Related Questions