Update: For some reason, just redeploying with truffle migrate --network ropsten --compile-all
fixed the issue, and MetaMask now suggests Gwei.
After deleting build/contracts
dir, I deployed my Smart Contract to Ropsten with:
truffle migrate --network ropsten --reset --compile-all
and the following in truffle.js
config:
networks: {
[...],
ropsten: {
provider: new HDWalletProvider(mnemonic, "https://ropsten.infura.io/"+infura_apikey),
network_id: 3,
gas: 4500000, // Current Ropsten gas limit. See https://ropsten.etherscan.io/block/3141628
gasPrice: 1100000000 // 1.1 GWei - based on the lower end of current txs getting into blocks currently on Ropsten.
}
}
solc: {
optimizer: {
enabled: false,
runs: 500
}
}
Everything works fine on my local Ganache. But deployed to Ropsten, MetaMask always prefills transactions with Gas Price: 0
How can I fix the gas price estimation for MetaMask?
PS. Transaction works fine if I manually set the gas price in the MetaMask dialog. But it's a really ugly user experience.
Best Answer
I believe the error message you're getting is probably coming from Infura (the node MetaMask connects to by default). So, there's no way to fix this for the final user in order that the error comes from a 3rd party.
Otherways, you'll be obligated to change manually the Gas Price manually, which in most cases isn't that bad trust me. Lots of people have lost many money by extremely high Gas Prices paid.
Hope it helps.