2

Just wanted to know that using the Gas values generated for a contract in Remix IDE when Javascript VM option, does the Gas values are useful when deploying contracts to testnet or live, does the Javascript VM generate accurate Gas values so that it can be used to know the required Gas for a contract or function?

1 Answer 1

2

The Ethereum yellow paper outlines fixed gas costs for operations in appendix G; these are used to estimate gas costs in Remix.

Given the non-deterministic logic of gas refunds the compiler may struggle to estimate what (if any) gas will be refunded upon completion, so the gas estimate from Remix should provide a rough idea and it may actually cost less than estimated depending on your contract.

If you set a gas limit higher than required you will be refunded the difference upon deployment, so the only time this will be an issue is if Remix wildly underestimates the gas requirement - and if this is the case the transaction will fail so you'll know about it pretty quickly!

See here for more methods of estimating gas price if you'd like to double check before deploying.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.