koogawa blog

iOS、Android、foursquareに関する話題

Truffleでdeployする前にガス代を見積もる方法

Gas estimation on mainnet · Issue #3367 · trufflesuite/truffle · GitHub

$ truffle migrate --dry-run

のようにdeploy時に --dry-run オプションを付ければガス代をシミュレーションできるらしい。

ただし、多少の誤差はあるっぽい。

Truffle dry-run on Ethereum Main reports different gas cost (less) than actual deployment gas - Ethereum Stack Exchange

↓こちらの記事も参考になりました。

truffle - What is the real price of deploying a contract on the Mainnet? - Ethereum Stack Exchange