首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >sendTransaction中gas的默认值

sendTransaction中gas的默认值
EN

Ethereum用户
提问于 2016-07-13 05:41:32
回答 1查看 2.8K关注 0票数 7

sendTransaction api中gas的默认值是多少?假设我没有在sendTransaction api中指定gas参数,那么将使用什么?

另外,如果它是一个合同事务而不是普通的乙醚发送事务,这会有所不同吗?

EN

回答 1

Ethereum用户

回答已采纳

发布于 2016-07-13 10:17:38

对于Geth来说,目前的违约是9万个天然气。

https://github.com/ethereum/go-ethereum/blob/e61035c5a3630e4f6fd0fb3e5346a4eed8cedc80/internal/ethapi/api.go#L50

defaultGas = 90000

但是,除非你正在做一个普通的以太转移(没有data,花费21,000瓦斯),最好指定一个值来减少耗尽汽油的机会。

默认的气体不会因交易的不同而变化。调用事务和普通以太发送之间的区别是后者有空的data字段,并且此代码不检查args.Datahttps://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

票数 5
EN
页面原文内容由Ethereum提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://ethereum.stackexchange.com/questions/7054

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档