You are viewing a single comment's thread from:

RE: Ethereum "Gas" - How it Works

in #ethereum6 years ago

ERC20 is only a spec in terms of which functions are required to exist and what they do, not how they are written or what additional functions are present. Because of this, you can have many ERC20 compliant tokens that do completely different things, meaning they have different code and thus require different amounts of gas to execute in the EVM.

You can't reliably determine gas without pre-executing the contract. Even then, if something depends on the state, you can't even be correct 100% of the time with pre-execution. However, you can reliably estimate the amount by simply checking similar transactions to the contract that were successful. This is how many interfaces estimate gas cost, and it's generally good enough.

Coin Marketplace

STEEM 0.21
TRX 0.13
JST 0.030
BTC 68156.06
ETH 3517.56
USDT 1.00
SBD 2.81