sendTransaction api中gas的默认值是多少?假设我没有在sendTransaction api中指定gas参数,那么将使用什么?
另外,如果它是一个合同事务而不是普通的乙醚发送事务,这会有所不同吗?
发布于 2016-07-13 10:17:38
对于Geth来说,目前的违约是9万个天然气。
defaultGas = 90000
但是,除非你正在做一个普通的以太转移(没有data,花费21,000瓦斯),最好指定一个值来减少耗尽汽油的机会。
默认的气体不会因交易的不同而变化。调用事务和普通以太发送之间的区别是后者有空的data字段,并且此代码不检查args.Data:https://github.com/ethereum/go-ethereum/blob/e61035c5a3630e4f6fd0fb3e5346a4eed8cedc80/internal/ethapi/api.go#L1151。
代码也不会更改创建契约的事务的gas:https://github.com/ethereum/go-ethereum/blob/e61035c5a3630e4f6fd0fb3e5346a4eed8cedc80/internal/ethapi/api.go#L1149
https://ethereum.stackexchange.com/questions/7054
复制相似问题