After we get the instance of Contract(testInstance), we can invoke its method by three ways:

  • testInstance.testFunc.sendTransaction()

    • It will make a transaction which will be broadcasted into the net, use gas and return the txHash
  • testInstance.testFunc.call()

    • Call the contract function in VM, no broadcast and no gas used, return the response from method
  • testInstance.testFunc()

    • If the testFunc is signified constant, which means it won’t change the state on chain, it won’t be executed(web3 will invoke it by .call()). If the testFunc is not constant, sendTransaction() will be invoked.