广播前如何估算煤气成本。
如何计算myfunc()在web3js中的气体成本?
function myfunc(){
require(msg.sender == owner)
...
}
await contractInstance.myfunc.sendTransaction(); //it sends the transaction and wastes the gas if `myfunc` will fail.有什么最好的方法来知道汽油成本之前叫坚固myfunc(),它为我节省汽油吗?(类似于元问题)
发布于 2018-02-12 14:23:38
web3有一个estimateGas方法,您可以使用它来估计事务所需的气体。您也可以将其用于合同方法。
发布于 2018-02-12 14:24:35
https://ethereum.stackexchange.com/questions/39379
复制相似问题