New answers tagged

1

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.


-2

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: https://docs.alchemyapi.io/alchemy/documentation/alchemy-api-reference/json-rpc#eth_estimategas


Top 50 recent answers are included