title: Hyperledger Fabric: check if the transaction has been committed to the ledger
body: <p>I have three client application that uses respectively the Java, Node.js and Go SDKs to interact with my blockchain Fabric. Using them, I can query and update the ledger successfully.</p>
  
  <p>Now I want to measure the latency during update of the ledger. So, I was thinking to do it taking a timestamp before the submission of the request and another one after that the transaction has been successfully committed to the ledger, and then compute the difference.</p>
  
  <p>My problem is that I can't find any complete documentation about SDK's API for Java, Go and Node.js, so I don't know if, when the method of submission returns, I can consider the transaction as correctly commited to the ledger.</p>
  
  <p>This are my three client's code.
  Java:</p>
  
  <pre><code>NetworkConfig ccp = NetworkConfig.fromJsonFile(networkConfigPath.toFile());
  // initialize default cryptosuite and setup the client
  CryptoSuite cryptoSuite = CryptoSuite.Factory.getCryptoSuite();
  HFClient client = HFClient.createNewInstance();
  client.setCryptoSuite(cryptoSuite);
  
  Channel channel = client.loadChannelFromConfig(ccp.getChannelNames().iterator().next(), ccp);
  channel.initialize();
  
  TransactionProposalRequest transactionProposal = client.newTransactionProposalRequest();
  // build chaincode id providing the chaincode name
  ChaincodeID mychaincodeID = ChaincodeID.newBuilder().setName("mychaincode").build();
  transactionProposal.setChaincodeID(mychaincodeID);
  // calling chaincode function
  transactionProposal.setFcn("mymethod");
  transactionProposal.setArgs("a1");
  
  Collection&lt;ProposalResponse&gt; res = channel.sendTransactionProposal(transactionProposal);
  channel.sendTransaction(res);
  </code></pre>
  
  <p>Node.js:</p>
  
  <pre><code>const gateway = new Gateway();
  await gateway.connect(ccp, { wallet: wallet, identity: userName, discovery: { enabled: false } });
  
  // Get the network (channel) our contract is deployed to.
  const network = await gateway.getNetwork('mychannel');
  
  // Get the contract from the network.
  const contract = network.getContract('mychaincode');
  
  const result = await contract.submitTransaction('mymethod', 'a1');
  </code></pre>
  
  <p>Go:</p>
  
  <pre><code>sdk, err := fabsdk.New(config.FromFile(configFile))
  if err != nil {
      fmt.Printf("failed to create SDK: %v\n", err)
      return
  }
  fmt.Println("SDK created")
  
  // Prepare channel client context using client context
  clientChannelContext := sdk.ChannelContext(channelID, fabsdk.WithUser(userName), fabsdk.WithOrg(orgName))
  // ChannelClient is used to query and execute transactions
  client, err := channel.New(clientChannelContext)
  if err != nil {
      fmt.Printf("failed to create new channel client: %v\n", err)
      return
  }
  fmt.Println("channel client created")
  
  response, err := client.Execute(channel.Request{ChaincodeID: ccID, Fcn: "mymethod", Args: [][]byte{[]byte("a1")}}, channel.WithRetry(retry.DefaultChannelOpts))
  if err != nil {
      fmt.Printf("failed to execute the invoke function: %v\n", err)
  } else {
      fmt.Println("Proposal responses: ")
      for _, element := range response.Responses {
          fmt.Printf("Endorser: %s Status: %d ChaincodeStatus: %d\n", element.Endorser, element.Status, element.ChaincodeStatus)
      }
      fmt.Println("chaincode transaction completed: " + string(response.Payload))
  }
  // Close SDK
  sdk.Close()
  </code></pre>
  
  <p>These codes work. My problem is: Can I am sure that after the lines</p>
  
  <pre><code>channel.sendTransaction(res)
  </code></pre>
  
  <p>(in Java)</p>
  
  <pre><code>const result = await contract.submitTransaction('mymethod', 'a1');
  </code></pre>
  
  <p>(in Node.js)</p>
  
  <pre><code>response, err := client.Execute(channel.Request{ChaincodeID: ccID, Fcn: "mymethod", Args: [][]byte{[]byte("a1")}}, channel.WithRetry(retry.DefaultChannelOpts))
  </code></pre>
  
  <p>(in Go)
  the transaction has been committed to the ledger?</p>
  
  <p>I have only found that on docs:</p>
  
  <p>"Submit a transaction to the ledger. The transaction function name will be evaluated on the endorsing peers and then submitted to the ordering service for committing to the ledger." for submitTransaction in Node.js at <a href="https://fabric-sdk-node.github.io/release-1.4/module-fabric-network.Contract.html#submitTransaction__anchor" rel="nofollow noreferrer">https://fabric-sdk-node.github.io/release-1.4/module-fabric-network.Contract.html#submitTransaction__anchor</a></p>
  
  <p>and </p>
  
  <p>"Execute prepares and executes transaction using request and optional request options" for Execute in Go at <a href="https://godoc.org/github.com/hyperledger/fabric-sdk-go/pkg/client/channel#Client.Execute" rel="nofollow noreferrer">https://godoc.org/github.com/hyperledger/fabric-sdk-go/pkg/client/channel#Client.Execute</a></p>
  
  <p>For Java I can't find documentation... and I am not sure also about Node.js and Go.</p>