[Ethereum] “Gas estimation failed” on Ropsten using MetaMask!

contract-deploymentgas-estimatemetamaskremixropsten

I'm testing a smart contract using Remix, MetaMask, Ropsten.
Yesterday I developed my contract on Ropsten network and everything goes in the right way.
Today I was developing the SAME contract code, but an error poped-up:

"Gas estimation failed
Gas estimation errored with the following message (see below). The transaction execution will likely fail. Do you want to force sending?"

error pic

So, I developed my contract on Rinkeby and it worked fine.
I send a request to the Mainnet too to develop the contract and gas estimation was ok, it tells me 5239423 gas.

I have to say that is not the first time that this error happens and every time it solves on its own.
This time I would like to figure out, once for all, which is the cause, which is the solution.
Could you help me?
Thanks!

Best Answer

The block gas limit is decided by miners by voting when mining a new block. A new block can increase or decrease the block gas limit in 1/1024 of the previous value.

Networks like mainnet the gas limit is set by agreement between miners at 8M gas. Rinkeby (a proof of authority) has a gas limit set at 7.5M gas.

Ropsten is a test network with limited hash power, so the block gas limit varies a lot. I've seen it from 4.7M gas and up to 20M gas.

Related Topic