What I have done
a) When I use web3.eth.estimateGas
to estimate the cost of a contract creation constructor with no parameters, the estimate is correct.
b) If the contract is already deployed then estimating the gas cost of a contract function with parameters, it works fine. (contract.myMethod.estimateGas()
using the web3 api )
Issue
a) When I estimate gas in a contract on contract creation time (contractObject.new
) with a parameterized constructor then it gives an incorrect estimation of gas cost. (web3.eth.estimateGas
of web3 api)
What I want
a) When I estimate gas with multiple parameter constructor of contract then it should estimate correct gas.
(contractObject.new
for calling constructor)
b) Browser-soldity gives right gas estimation of contract with parametrized constructor --> before contract create/deploy (like transaction cost or execution cost, how can I use their algorithm with web3 api to estimate gas correct way?)
.estimateGas()
? With.getData()
?