Hello Everyone,
I hope you guys are doing well! I am new to the Web3 space, so please excuse my ignorance. After viewing numerous tutorials, many of the tutorials like to do this when setting the gas limit
const estimateGasPrice = await testContract.send.esimateGas(id)
const transaction = await testContract.send(id, {gasLimit: estimateGasPrice.toNumber() + x});
My question is, why do they instead just not hardcode a high gas limit such as 500,000 or 1,000,000 instead of calculating an estimateGasPrice. I have read numerous articles stating that, even if you set a high gas limit, only the required gas for the transaction will need to be paid. Thus, isn't hardcoding a big number, let's say 1,000,000 just more efficient as sometimes estimateGasPrice can be inaccurate and you would anyways need to add another hardcoded number x to make up for it? Please let me know and sorry if this is a basic question!
Thanks
[link] [comments]
You can get bonuses upto $100 FREE BONUS when you:
π° Install these recommended apps:
π² SocialGood - 100% Crypto Back on Everyday Shopping
π² xPortal - The DeFi For The Next Billion
π² CryptoTab Browser - Lightweight, fast, and ready to mine!
π° Register on these recommended exchanges:
π‘ Binanceπ‘ Bitfinexπ‘ Bitmartπ‘ Bittrexπ‘ Bitget
π‘ CoinExπ‘ Crypto.comπ‘ Gate.ioπ‘ Huobiπ‘ Kucoin.
Comments