title: Hyperledger fabric Failed to submit transaction: Error: Endorsement has failed
body: <p>I have 3 organisation with 6 peer and i have created the channel transaction, even i can query the fabcar chaincode from fabric node client. But when i use the farbic sdk node to submit the transcation it give me error </p>
  
  <blockquote>
    <p>Failed to submit transaction: Error: Endorsement has failed</p>
  </blockquote>
  
  <p>I am using the below code for submitting the transcation</p>
  
  <pre><code>async function Invoke(userwallet,usename,channelName,chaincodeName) {
  try {
  
      // Create a new file system based wallet for managing identities.
      const walletPath = path.join(process.cwd(), 'wallet');
      const wallet = new FileSystemWallet(walletPath);
      console.log(`Wallet path: ${walletPath}`);
  
      // Check to see if we've already enrolled the user.
      const userExists = await wallet.exists(userwallet);
      if (!userExists) {
          console.log('An identity for the user "user1" does not exist in the wallet');
          console.log('Run the registerUser.js application before retrying');
          return;
      }
  
      // Create a new gateway for connecting to our peer node.
      const gateway = new Gateway();
      await gateway.connect(ccp, { wallet, identity: usename, discovery: { enabled: true } });
  
      // Get the network (channel) our contract is deployed to.
      const network = await gateway.getNetwork(channelName);
  
      // Get the contract from the network.
      const contract = network.getContract(chaincodeName);
  
      // Submit the specified transaction.
      // createCar transaction - requires 5 argument, ex: ('createCar', 'CAR12', 'Honda', 'Accord', 'Black', 'Tom')
      // changeCarOwner transaction - requires 2 args , ex: ('changeCarOwner', 'CAR10', 'Dave')
     // await contract.submitTransaction('CAR12', 'Honda', 'Accord', 'Black', 'Tom');
     await contract.createTransaction('createCar').submit('CAR22', 'Honda', 'Accord', 'Black', 'Tom')
      //await contract.submitTransaction('changeCarOwner', 'CAR10', 'Dave');
      console.log('Transaction has been submitted');
  
  
      // Disconnect from the gateway.
      await gateway.disconnect();
  
  } catch (error) {
      console.error(`Failed to submit transaction: ${error}`);
      process.exit(1);
  }
   }
  </code></pre>
  
  <blockquote>
    <p>configTx</p>
  </blockquote>
  
  <pre><code>  Organizations:
  
  - &amp;OrdererOrg
      Name: OrdererOrg
  
      # ID to load the MSP definition as
      ID: OrdererMSP
  
      # MSPDir is the filesystem path which contains the MSP configuration
      MSPDir: crypto-config/ordererOrganizations/example.com/msp
  
      Policies:
          Readers:
              Type: Signature
              Rule: "OR('OrdererMSP.member')"
          Writers:
              Type: Signature
              Rule: "OR('OrdererMSP.member')"
          Admins:
              Type: Signature
              Rule: "OR('OrdererMSP.admin')"
  
  - &amp;Org1
  
      Name: Org1MSP
  
      # ID to load the MSP definition as
      ID: Org1MSP
  
      MSPDir: crypto-config/peerOrganizations/org1.example.com/msp
      Policies:
          Readers:
              Type: Signature
              Rule: "OR('Org1MSP.admin', 'Org1MSP.peer', 'Org1MSP.client')"
          Writers:
              Type: Signature
              Rule: "OR('Org1MSP.admin', 'Org1MSP.client')"
          Admins:
              Type: Signature
              Rule: "OR('Org1MSP.admin')"
  
      # leave this flag set to true.
      AnchorPeers:
          - Host: peer1.org1.example.com
            Port: 7051
  
  - &amp;Org2
      # DefaultOrg defines the organization which is used in the sampleconfig
      # of the fabric.git development environment
      Name: Org2MSP
  
      # ID to load the MSP definition as
      ID: Org2MSP
  
      MSPDir: crypto-config/peerOrganizations/org2.example.com/msp
  
      Policies:
          Readers:
              Type: Signature
              Rule: "OR('Org2MSP.admin', 'Org2MSP.peer', 'Org2MSP.client')"
          Writers:
              Type: Signature
              Rule: "OR('Org2MSP.admin', 'Org2MSP.client')"
          Admins:
              Type: Signature
              Rule: "OR('Org2MSP.admin')"
  
      AnchorPeers:
          - Host: peer1.org2.example.com
            Port: 7051
  
  - &amp;Org3
      Name: Org3MSP
  
      # ID to load the MSP definition as
      ID: Org3MSP
  
      MSPDir: crypto-config/peerOrganizations/org3.example.com/msp
      Policies:
          Readers:
              Type: Signature
              Rule: "OR('Org3MSP.admin', 'Org3MSP.peer', 'Org3MSP.client' , 'Org3MSP.member')"
          Writers:
              Type: Signature
              Rule: "OR('Org3MSP.admin', 'Org3MSP.client', 'Org3MSP.member')"
          Admins:
              Type: Signature
              Rule: "OR('Org3MSP.admin')"
  
      AnchorPeers:
          # AnchorPeers defines the location of peers which can be used
          # for cross org gossip communication.  Note, this value is only
          # encoded in the genesis block in the Application section context
          - Host: peer1.org3.example.com
            Port: 7051
  
  
   Capabilities:
  
     Channel: &amp;ChannelCapabilities
       V1_4_3: true
       V1_3: false
       V1_1: false
  
  Orderer: &amp;OrdererCapabilities
      V1_4_2: true
      V1_1: false
  
  Application: &amp;ApplicationCapabilities
      V1_4_2: true
  
      V1_3: false
  
      V1_2: false
  
      V1_1: false
  
  Application: &amp;ApplicationDefaults
  
  ACLs: &amp;ACLsDefault
  
      #---Lifecycle System Chaincode (lscc) function to policy mapping for access control---#
  
      #ACL policy for lscc's "getid" function
      lscc/ChaincodeExists: /Channel/Application/Readers
  
      #ACL policy for lscc's "getdepspec" function
      lscc/GetDeploymentSpec: /Channel/Application/Readers
  
      #ACL policy for lscc's "getccdata" function
      lscc/GetChaincodeData: /Channel/Application/Readers
  
      #---Query System Chaincode (qscc) function to policy mapping for access control---#
  
      #ACL policy for qscc's "GetChainInfo" function
      qscc/GetChainInfo: /Channel/Application/Readers
  
      #ACL policy for qscc's "GetBlockByNumber" function
      qscc/GetBlockByNumber: /Channel/Application/Readers
  
      #ACL policy for qscc's  "GetBlockByHash" function
      qscc/GetBlockByHash: /Channel/Application/Readers
  
      #ACL policy for qscc's "GetTransactionByID" function
      qscc/GetTransactionByID: /Channel/Application/Readers
  
      #ACL policy for qscc's "GetBlockByTxID" function
      qscc/GetBlockByTxID: /Channel/Application/Readers
  
      #---Configuration System Chaincode (cscc) function to policy mapping for access control---#
  
      #ACL policy for cscc's "GetConfigBlock" function
      cscc/GetConfigBlock: /Channel/Application/Readers
  
      #ACL policy for cscc's "GetConfigTree" function
      cscc/GetConfigTree: /Channel/Application/Readers
  
      #ACL policy for cscc's "SimulateConfigTreeUpdate" function
      cscc/SimulateConfigTreeUpdate: /Channel/Application/Writers
  
      #---Miscellanesous peer function to policy mapping for access control---#
  
      #ACL policy for invoking chaincodes on peer
      peer/Proposal: /Channel/Application/Writers
  
      #ACL policy for chaincode to chaincode invocation
      peer/ChaincodeToChaincode: /Channel/Application/Readers
  
      #---Events resource to policy mapping for access control###---#
  
      #ACL policy for sending block events
      event/Block: /Channel/Application/Readers
  
      #ACL policy for sending filtered block events
      event/FilteredBlock: /Channel/Application/Readers
  # Organizations is the list of orgs which are defined as participants on
  # the application side of the network
     Organizations:
  
     # Policies defines the set of policies at this level of the config tree
    # For Application policies, their canonical path is
    #   /Channel/Application/&lt;PolicyName&gt;
  Policies:
      Readers:
          Type: ImplicitMeta
          Rule: "ANY Readers"
      Writers:
          Type: ImplicitMeta
          Rule: "ANY Writers"
      Admins:
          Type: ImplicitMeta
          Rule: "MAJORITY Admins"
      Org1MemberPolicy:
          Type: Signature
          Rule: "OR('Org1MSP.member')"
      Org2MemberPolicy:
          Type: Signature
          Rule: "OR('Org2MSP.member')"
      Org1Org2MemberPolicy:
          Type: Signature
          Rule: "OR('Org1MSP.member','Org2MSP.member')"
  
  Capabilities:
      &lt;&lt;: *ApplicationCapabilities
  
   Orderer: &amp;OrdererDefaults
  
  # Orderer Type: The orderer implementation to start
  # Available types are "solo","kafka"  and "etcdraft"
  OrdererType: etcdraft
  
  Addresses:
      - orderer.example.com:7050
  
  # Batch Timeout: The amount of time to wait before creating a batch
  BatchTimeout: 2s
  
  # Batch Size: Controls the number of messages batched into a block
  BatchSize:
  
      # Max Message Count: The maximum number of messages to permit in a batch
      MaxMessageCount: 10
  
      # Absolute Max Bytes: The absolute maximum number of bytes allowed for
      # the serialized messages in a batch.
      AbsoluteMaxBytes: 99 MB
  
      # Preferred Max Bytes: The preferred maximum number of bytes allowed for
      # the serialized messages in a batch. A message larger than the preferred
      # max bytes will result in a batch larger than preferred max bytes.
      PreferredMaxBytes: 512 KB
  
  Kafka:
      # Brokers: A list of Kafka brokers to which the orderer connects
      # NOTE: Use IP:port notation
      Brokers:
          - 127.0.0.1:9092
  
  # EtcdRaft defines configuration which must be set when the "etcdraft"
  # orderertype is chosen.
  EtcdRaft:
      # The set of Raft replicas for this network. For the etcd/raft-based
      # implementation, we expect every replica to also be an OSN. Therefore,
      # a subset of the host:port items enumerated in this list should be
      # replicated under the Orderer.Addresses key above.
      Consenters:
          - Host: orderer.example.com
            Port: 7050
            ClientTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
            ServerTLSCert: crypto-config/ordererOrganizations/example.com/orderers/orderer.example.com/tls/server.crt
  
  
  # Organizations is the list of orgs which are defined as participants on
  # the orderer side of the network
  Organizations:
  
  # Policies defines the set of policies at this level of the config tree
  # For Orderer policies, their canonical path is
  #   /Channel/Orderer/&lt;PolicyName&gt;
  Policies:
      Readers:
          Type: ImplicitMeta
          Rule: "ANY Readers"
      Writers:
          Type: ImplicitMeta
          Rule: "ANY Writers"
      Admins:
          Type: ImplicitMeta
          Rule: "MAJORITY Admins"
      # BlockValidation specifies what signatures must be included in the block
      # from the orderer for the peer to validate it.
      BlockValidation:
          Type: ImplicitMeta
          Rule: "ANY Writers"
  
    Channel: &amp;ChannelDefaults
     # Policies defines the set of policies at this level of the config tree
     # For Channel policies, their canonical path is
     #   /Channel/&lt;PolicyName&gt;
    Policies:
      # Who may invoke the 'Deliver' API
      Readers:
          Type: ImplicitMeta
          Rule: "ANY Readers"
      # Who may invoke the 'Broadcast' API
      Writers:
          Type: ImplicitMeta
          Rule: "ANY Writers"
      # By default, who may modify elements at this config level
      Admins:
          Type: ImplicitMeta
          Rule: "MAJORITY Admins"
  
  Capabilities:
      &lt;&lt;: *ChannelCapabilities
  
  Profiles:
  
  ThreeOrgsOrdererGenesis:
      &lt;&lt;: *ChannelDefaults
      Application:
          &lt;&lt;: *ApplicationDefaults
      Orderer:
          &lt;&lt;: *OrdererDefaults
          Organizations:
              - *OrdererOrg
          Capabilities:
              &lt;&lt;: *OrdererCapabilities
      Consortiums:
          SampleConsortium:
              Organizations:
                  - *Org1
                  - *Org2
                  - *Org3
  ChannelAll:
      Consortium: SampleConsortium
      &lt;&lt;: *ChannelDefaults
      Application:
          &lt;&lt;: *ApplicationDefaults
          Organizations:
              - *Org1
              - *Org2
              - *Org3
          Capabilities:
              &lt;&lt;: *ApplicationCapabilities
  Channel12:
      Consortium: SampleConsortium
      &lt;&lt;: *ChannelDefaults
      Application:
          &lt;&lt;: *ApplicationDefaults
          Organizations:
              - *Org1
              - *Org2
          Capabilities:
              &lt;&lt;: *ApplicationCapabilities
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/dFJPp.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dFJPp.jpg" alt="enter image description here"></a></p>