1

In Hyperledger ledger, how could I list endorsing peers of a specific chaincode? I have a channel with 5 peers but I need that only three of them endorse a transaction while the other two need only to access to same ledger.

Pippo Pluto
  • 151
  • 3

2 Answers2

0

You can use the discovery service to get the endorsing peer. Here you can find some information: https://hyperledger-fabric.readthedocs.io/en/latest/discovery-overview.html

Hyperledger fabric has a CLI tool to query the discovery service: https://hyperledger-fabric.readthedocs.io/en/latest/discovery-cli.html

For node.js applications, you can follow the tutorial here: https://hyperledger.github.io/fabric-sdk-node/release-1.4/tutorial-discovery.html

ShaLalala
  • 68
  • 5
0

With the latest Fabric Client SDKs (personally using GO client), you don't need to deal with endorsement policies. Client SDK already does this dirty work for you. It extracts:

  • Which organizations' endorsements are required for this chaincode, key (key level endorsement policy can be defined as well), etc.
  • Which peers currently exist in the system and what are their MSPs (from discovery service).

According to these information, client SDK builds a set of necessary peers then sends your transaction request to all. It waits response from requested endorsers. Once it collects all responses, it sends to orderer and so on.

If you have a special case which you need to manually set endorsing peers of your choice (I had one use case about private collections so I had to use this approach) check out discovery service API of your client SDK.

hsnkhrmn
  • 961
  • 7
  • 20