New answers tagged


Usually it is safe to leave the gas estimation for the wallet itself and not to try to do it yourself. In the case wallets cannot estimate the gas, which sometimes happens for complex transactions, you can do test transactions on testnet and figure out how many gas units the transactions spend and then use that as a hardcoded limit.


Your best bet will be to Web3's estimate gas function--while it overestimates sometimes, at least your transaction won't fail :) Here's a link to docs about it:

Top 50 recent answers are included