I have some web application based on Ethereum. This is how I call some function from a contract:

contract.doSomething.sendTransaction(data, {gasPrice: web3.toWei(10, 'Gwei')}, callback...);

This code works. But I have few questions:

1) Can I change GASPRICE for this transaction in the MetaMask?

2) How does the MetaMask know what GASLIMIT to set?

3) If there is no GASPRICE specified in the transaction code, how does the MetaMask know how to set the GASPRICE?


Metamask performs estimations about how much gas is needed (gas limit). I'd assume it adds some "safety" margin on top of that. Also, the gas estimations are sometimes very inaccurate and/or impossible to perform due to various reasons.

The default gas price is probably taken from a gas price prediction system such as https://ethgasstation.info/ .

You can adjust both of these if needed: https://metamask.zendesk.com/hc/en-us/articles/360015488771-How-to-Adjust-Gas-Price-and-Gas-Limit-

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.