MultiversX Tracker is Live!

Setting High Gas Limit Question

Etherum Reddit

More / Etherum Reddit 108 Views

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

submitted by /u/SaltyKleenex
[link] [comments]
Get BONUS $200 for FREE!

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