code: private Fabric.Response execute(Transaction tx) throws CryptoException, IOException {
          logger.debug(String.format("Executing transaction [%s]", tx));
  
          // Set nonce
          tx.getTxBuilder().setNonce(ByteString.copyFrom(this.nonce));
  
          // Process confidentiality
          logger.debug("Process Confidentiality...");
  
          this.processConfidentiality(tx);
  
          logger.debug("Sign transaction...");
  
          if (getChain().isSecurityEnabled()) {
              // Add the tcert
              tx.getTxBuilder().setCert(ByteString.copyFrom(tcert.getCert()));
              // sign the transaction bytes
              byte[] txBytes = tx.getTxBuilder().buildPartial().toByteArray();
              BigInteger[] signature = this.chain.getCryptoPrimitives().ecdsaSign(tcert.getPrivateKey(), txBytes);
              byte[] derSignature = this.chain.getCryptoPrimitives().toDER(
                      new byte[][]{signature[0].toByteArray(), signature[1].toByteArray()});
  
              tx.getTxBuilder().setSignature(ByteString.copyFrom(derSignature));
          }
  
          logger.debug("Send transaction...");
          logger.debug("Confidentiality: " + tx.getTxBuilder().getConfidentialityLevel());
  
          if (tx.getTxBuilder().getConfidentialityLevel() == Chaincode.ConfidentialityLevel.CONFIDENTIAL &&
                  tx.getTxBuilder().getType() == Fabric.Transaction.Type.CHAINCODE_QUERY) {
              Fabric.Response response = this.getChain().sendTransaction(tx);
              if (response.getStatus() == StatusCode.SUCCESS) {
                  byte[] message = decryptResult(response.getMsg().toByteArray());
                  return Fabric.Response.newBuilder()
                          .setStatus(StatusCode.SUCCESS)
                          .setMsg(ByteString.copyFrom(message))
                          .build();
              } else {
                  return response;
              }
          } else {
              return this.getChain().sendTransaction(tx);
          }
      }
docs: Execute a transaction
  @param tx {Transaction} The transaction.