3

I've found plenty of information on how to do this using Truffle and Web3, but nothing regarding how to achieve this in the Remix IDE.

Examples would be very much appreciated.

5

If you put the cursor on the name of the function in Remix, on the top right of the screen you will see the required gas.

enter image description here

Hope this helps

4
  • 3
    That helps a bit, I never noticed that before. But what about for functions where the execution cost is infinite? Is there a way to input arguments into a certain function to see the gas estimate? Jun 9 '18 at 20:48
  • 2
    In most cases, this means that this cannot be estimated. Most of the time is because the function involves dynamic arrays in general, bytes or string who's length the compiler doesn't know in advance. Also if you are calling other contracts the compiler will show infinite gas. You could just call the function and check the consumed gas. In particular, you can use the java script VM environment in the run tab which runs locally and can tell you the gas.
    – Jaime
    Jun 9 '18 at 20:52
  • 1
    Do you know how to do the same functionality in the console window? Just curious, that also might be helpful. Jun 10 '18 at 7:17
  • 1
    You mean in geth?, maybe you should create a new question and give more details.
    – Jaime
    Jun 10 '18 at 7:22

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.