I would like to call a function which returns a boolean. How would I go about calling this function and storing the true or false in a variable? I have tried this var result = contract.checkCertHash(certid,hashedData,address); and initialised the contract using : var parsed= JSON.parse(fs.readFileSync(jsonFile)); const abi = parsed.abi; const contract = new web3.eth.Contract(abi, '0xce395e1f6532e128f35469bb304ca46660a9f376');

I tried searching over here but I have tried what I found but none worked. Thanks in advance!

  • What does your contract look like? I'm guessing your function is not view or pure so you can't get the return value directly. Commented Nov 4, 2018 at 18:49

1 Answer 1


I found a way that works(Answering my own question): contract.methods.checkCertHash(certid,hashedData,address).call().then(function(result){}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.