ChrisMcQueen
ChrisMcQueen

Reputation: 100

Hyperledger Fabric - endorsement based on specific parties involved in the transaction

I'm using Fabric along with Composer. I understand that you set the endorsement policy at instantiation. However, if this is the case and I have the following scenario:

Company A says it has moved a physical asset to Company B. I want Company B to be the endorser for the transaction, but company A might have moved it to B, C or D, etc...

Is it therefore possible to dynamically choose the receiving company to be the endorser at runtime?

Upvotes: 0

Views: 583

Answers (1)

Nitish Bhardwaj
Nitish Bhardwaj

Reputation: 1187

Updated the answer:

Yes, there is a way to dynamically choose endorser peer based on Endorsement policy. Hyperledger Fabric v1.2 and later, offers a service named as Service Discovery. This service needs to be enabled at a peer level.

Once this is enabled, you can send a transaction to the channel using the service discovery. Service discovery will check the endorsement policy by it's own and sends the transaction proposal to the required endorsers.

Attached a snipped from an JAVA-SDK application:

channel.sendTransactionProposalToEndorsers(request,
                 createDiscoveryOptions().setEndorsementSelector(ServiceDiscovery.EndorsementSelector.ENDORSEMENT_SELECTION_RANDOM)
                        .setForceDiscovery(true));

There is a concept of Application SDK for interacting with your Hyperleger network. If you have multiple organization, each organization needs to have its own SDK. Using that SDK, you can utilize service discovery to locate endorser peers for sending transaction proposals. Refer this image for referenceenter image description here

Hope this helps.

Upvotes: 2

Related Questions