This repository has been archived by the owner on Mar 19, 2024. It is now read-only.
发布合约的时候gas是怎么估算的? #50
-
在发布合约的时候,遇到一个疑惑,gas-budge是怎么估算的,随便填一个比较大的值就可以吗?但随便填的话,就不能避免发布gas高的合约。 经查阅得知,最小值是10000000,并且是根据合约的复杂性来的。 疑问:我如何才能提前得知一个合约需要多少gas? |
Beta Was this translation helpful? Give feedback.
Answered by
bruceeewong
Nov 17, 2023
Replies: 1 comment
-
可以通过 Dry Run 来模拟任何Transaction的花销(包括发布合约),其返回包含了预估Gas开销,结合这个返回再加点Gas做Buffer防止波动,基本上就能以不太高出实际gas的效果完成transaction |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ruizer
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
可以通过 Dry Run 来模拟任何Transaction的花销(包括发布合约),其返回包含了预估Gas开销,结合这个返回再加点Gas做Buffer防止波动,基本上就能以不太高出实际gas的效果完成transaction
https://docs.sui.io/sui-api-ref#sui_dryruntransactionblock