I have my two Quorum nodes setup on two different machines A(X.X.X.1) and B(X.X.X.3) and I am trying to interact with the smart contract from a different machine C(X.X.X.4) via Web3j. Below is the smart contract and the code snippet for interacting with the same:

pragma solidity ^0.4.6;

contract DASKDetails {

 struct ASKStructAdditionalDetails{
    //check string
    uint ASKId;
    uint transactionId;
    string transactionStatus;

  ASKStructAdditionalDetails public aSKStructAdditionalDetails;

  function storeASKStructAdditionalDetails(uint ASKId ,uint transactionId ,string transactionStatus) public returns(uint result) {
    aSKStructAdditionalDetails.ASKId = ASKId;
    aSKStructAdditionalDetails.transactionId = transactionId;
    aSKStructAdditionalDetails.transactionStatus = transactionStatus;
    return 1;

  function getASKDetails() public constant returns(uint ASKId ,uint transactionId ,string transactionStatus) {
        return (aSKStructAdditionalDetails.ASKId,

I deploy the contract from the CLI on machine A and get a contract address (CA). I use this contract address to load the contract and call the setEnqMetadataOnBlockchain() method to set the values onto blockchain. I get a transaction receipt (thereby confirming that the transaction was mined). Below is the code snippet for the same:

     private static ASKDetailsLatest2 loadContract() {
        Quorum quorumNode1 = Quorum.build(new HttpService("http://X.X.X.1:RPCPORT"));
        List<String> list = new ArrayList<String>();
         list.add("Public key of recipient node");
         ClientTransactionManager ctm = new ClientTransactionManager(quorumNode1,
                 "fromAddr", list);
         ASKDetailsLatest2 enqContract = null;

         try {
             enqContract = ASKDetailsLatest2
                     .load("ContractAddr", quorumNode1, ctm, Contract.GAS_PRICE, Contract.GAS_LIMIT);

         } catch (Exception e) {
         return enqContract;


     private static String setEnqMetadataOnBlockchain(ASKDetailsLatest2 enqDetCont) {

         try {

             System.out.println("Store function call");
             rec = enqDetCont.storeASKStructAdditionalDetails(new Uint256(BigInteger.valueOf(100)), 
                     new Uint256(BigInteger.valueOf(100)), new Utf8String("PENDING")).get(3, TimeUnit.MINUTES);
             System.out.println("Transaction hash is "+rec.getTransactionHash()+"  to Address is:"+rec.getContractAddress());

         } catch (Exception e) {

         return ASKContractAddr;

     private static void getEnqMetadataOnBlockchain(String ASKCA) {
         Quorum quorumNode4 = Quorum.build(new HttpService("X.X.X.3"));

         List<Type> inputParameters = new ArrayList<Type>();

         List<TypeReference<?>> outputParameters = new ArrayList<TypeReference<?>>();
         outputParameters.add(new TypeReference<Uint256>() {});
         outputParameters.add(new TypeReference<Uint256>() {});
         outputParameters.add(new TypeReference<Utf8String>() {});

         Function function = new Function("getASKDetails", inputParameters, outputParameters);

         String encodedFunction = FunctionEncoder.encode(function);
         System.out.println("ASKCa is :"+ASKCA);
         try {
             org.web3j.protocol.core.methods.response.EthCall response = quorumNode4
                             ASKCA, encodedFunction), DefaultBlockParameterName.LATEST)

             List<Type> someTypes = FunctionReturnDecoder.decode(response.getValue(), function.getOutputParameters());

             System.out.println("4 : response is: " + someTypes.size());
             for (int i = 0; i < someTypes.size(); i++) {

         } catch (Exception e) {



However, when I try to get the value back and print it via Web3j, I am getting null, 0 values from uint and string respectively. Any idea what this could be due to?

PS: I can confirm that the values are being set and get successfully if I do the entire process on different machines (A,B) from backend (i.e Without using web3j).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.