新手。有一个 go-ethereum 方法:
eth.estimateGas({from:'firstAccount', to:'secondAccount'})
效果很好,但是与合同地址相同的方法,例如:
eth.estimateGas({from:'firstAccount', to:'contractAddr'})
因错误而失败
所需气体超过限额或交易总是失败
我查看了 go-ethereum 源代码,它有一行,其中包含使用合约地址作为第二个参数的建议: https ://github.com/ethereum/go-ethereum/blob/master/accounts/abi/bind/ base.go#L221
问题是:是否有可能使用带有合约地址的 eth.estimateGas 作为第二个参数以及如何避免上述错误?谢谢你。