4 votes

MetaMask incorrectly estimates 100,000 gas for ERC20 transfer. Why?

Since you are interested in knowing why does Metamask estimate wrong the gas limit, I'll share with you some information that is good to know. Metamask makes use of the function eth_estimateGas to ...
Ilya Slyusarchuk's user avatar
3 votes

MetaMask incorrectly estimates 100,000 gas for ERC20 transfer. Why?

As a disclaimer Rob and I work together so I have an unfair advantage here but thought it would be helpful to give a very detailed breakdown of what is going on... TLDR; Likely an unhandled error in ...
Alexander McFarlane's user avatar
2 votes

ethers.js - estimating gas limit

(The OP has commented on the question that they're looking for a way to estimate the gas price, not the gas limit, this answer is based on that clarification.) Method 1 Ethers has a built-in function ...
The Renaissance's user avatar
2 votes
Accepted

Why the BSC block gas limit change and what's the logic behind it?

I've been reviewing the source code for the bnb node (erigon version). I've discovered that it follows the same mechanism as Ethereum or Polygon in which in each block, the producer could vary the gas ...
Carlos Lostao's user avatar
1 vote

Avoiding loops in Solidity for a simple situation

Looping through all users is not just very gas inefficient, it may become impossible once your contract has a lot of users and the looping consumes more gas than the block gas limit. I would recommend ...
merkleplant's user avatar
1 vote

gas estimation error because of reverted

You need to add the necessary gas at the time you create the transaction. It appears that you know in advance how much gas will be needed: 266_087. So you put this value when creating the transaction. ...
Xavier Leprêtre B9lab's user avatar
1 vote

MetaMask - failed transaction, maximum gas rate suggested is to low

The gas value is set in the UI code, not inside the contract. Usually, you would call estimateGas first and then add ~20% on top of that to ensure there is enough gas allocated for the transaction.
Vas Treck's user avatar
  • 392
1 vote

Is it possible to get consumed and remained gas from within a smart contract?

You can check this previous post to get an idea about how to procced: Is gasleft() the best way to manage big loops in solidity?
Alexander Herranz's user avatar
1 vote

How to fix "Transaction was not mined within 50 blocks, please make sure you transaction was properly sent." error?

I see you're facing the Transaction was not mined within 50 blocks error while working with Ethereum transactions. First, try to increase the gas limit. Certain transactions may require more gas ...
Ari Setiawan's user avatar
1 vote
Accepted

The simplest way to return a list of items + gas limits on long lists when using pragma experimental ABIEncoderV2?

Most RPC Provider will enforce a gasLimit for eth_call as DOS Protection. For instance, Alchemy has a limit of 550 mio. and Infura has a limit of 300 mio. You can create a view function that ...
Markus Schick's user avatar
1 vote

Error: cannot estimate gas

This error pops when something is wrong while calling the contract functions. Few things you should check. You should be passing the arguments correctly, as I see there are so many parameters in the ...
Zartaj Afser's user avatar
  • 2,230

Only top scored, non community-wiki answers of a minimum length are eligible