I have an ERC20 token contract with one more function. But when I run the function, I got

Gas required exceeds limit: 3000000. An important gas estimation might also be the sign of a problem in the contract code. Please check loops and be sure you did not sent value to a non payable function (that's also the reason of strong gas estimation).


function checkValue() public payable returns (bool) {
      require(msg.value == 10000000000000000);
      return true;
  • 2
    I would assume that you're not sending exactly that amount of ether to the function. Can you show the code you're using to call the function? (Or describe what tool you're using to call it and how you've specified how much ether to send with the transaction?) – user19510 Feb 14 '18 at 10:54
  • As per this function, you always need to send 1 ETH while calling this function. FYI, the functions that do not modify state should be constant. – Prashant Prabhakar Singh Feb 14 '18 at 11:33
  • Thank you both, that solved it! :-) I used in the example checkValue but the real check has much more options and does also change variables. BTW: What would happen if I did not send a transaction from Remix but for example from MyEtherWallet? Does it also directly give an error or will a transaction be created and only the ether refunded (except of gas)? – dkb Feb 14 '18 at 13:01

Your Answer

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

Browse other questions tagged or ask your own question.