How can we pre-compute Gas needed for successful execution of a function inside a smart contract. I got to know about web3.eth.estimateGas but cannot follow it completely from the docs.
My function receives some input parameters, calls Oraclize and then updates data in mappings inside the contract. My understanding is that in order to calculate gas estimate, value of input parameters must be used every time. What is the correct way to calculate gas estimates in this scenario, please help..
function createProof (string _title, string _ipfshash, string
_proofremarks, string _prooftags)
payable public {
/*** Some Logic ***/
/// Call Oraclize to get current timestamp
update();
}
estimateGas
is indeed the right way. Perhaps you could show us the code where you're trying to get the gas estimate and call the function.web3.js
are you using? According to the error,Blockproof.createProof
is undefined.const blockproofInstance = BlockProof.at('0x1234...')