1

Is there a way to get endorsements back from specific peer(s) after submitting a transaction in Hyperledger fabric, using contract.submitTransaction() or channel.sendTransaction()? So far the endorsements always seem to come back from the same peer and not other peers in the organization. Please see my environment details below. Also if I target specific peers using the node sdk sendTransactionProposal(request)'s ChaincodeInvokeRequest preferred or ignore list, that doesn't seem to make any difference. Is there any specific documentation or an alternative resource available that addresses this issue?

ChaincodeInvokeRequest{ targets: allPeers or peer2, // or a different peer preferred: peer2, ignore, peer1 }

Environment details Current setup: 1 org with 2 peers

Simple Endorsement policy:

{"identities":[{"role":{"name":"member","mspId":"Org1MSP"}}],policy:{"1-of":[{"signed-by":0}]}}

Fabric sdk libraries:

fabric-ca-client - v1.4.1
fabric-client - v1.4.1
fabric-network - v1.4.1

Hyperledger Fabric version: v1.4.1

Using the following approach to target specific peers in the sdk:

const request = {
      targets: peers or peer[1] or [peer2], -- target specific peer
      chaincodeId: chaincodeName,
      txId,
      fcn: functionName,
      args,
      transientMap: transientMapData // , // private data,
      ignore: list of peer[s] to ignore
      preferred: list of peer[s] to prefer
    };


    const endorsementResults = await channel.sendTransactionProposal(request);

    if (channel.verifyProposalResponse(endorsementResults[0][0])) {
      const transactionRequest = {
        proposalResponses: endorsementResults[0],
        proposal: endorsementResults[1]
      };
      invokeResponse = await channel.sendTransaction(transactionRequest);
    } 

Expected results:

transaction1 - client submits a transaction to peer1 and gets an endorsement back from peer1. transaction2 - client submits a transaction to peer2 and gets an endorsement back from peer2.

Actual results:

transaction1 - client submits a transaction to peer1 and gets an endorsement back from peer1. transaction2 - client submits a transaction to peer2 and gets an endorsement back from peer1.

Bibek Koirala
  • 330
  • 6
  • 20
vango
  • 11
  • 1

0 Answers0