[Ethereum] Maximum gas consumption of calling a contract method

contract-developmentgas-estimategas-limitsolidity

I want to evaluate the maximum gas consumption (minimum safe gas limit that will not fail) that calling a specific contract method would consume given that I have the contract source code / byte code.

I remember a few months ago seeing a website where you can enter the solidity code and it calculates how much gas this code would consume, but I can't find this website anywhere.

Just to clarify – I know there's a method in the API that can estimate gas consumption of transaction which is only an estimate since it's based on the variables that can change (such as block number etc), but I'm talking about maximum gas consumption given the contract source code / byte code is known.

Is there a website that calculates this?

UPDATE WITH USE CASE:

For EtherDelta's contract (link) how can I determine what would be the maximum possible gas consumption for calling a specific method (say: the 'approve' method), so that I can tell what is the minimum safe gas limit that would never fail?

Best Answer

I think you may be alluding to the online remix compiler for Solidity. This will allow you to see easily how much gas a transaction to a function will need/spent.

If you execute a state changing function then inspect the details of the transaction you'll get more information. Please see the example below:

enter image description here

Here we can see trasaction cost & execution cost. Everything you need. Hope this helps.

Related Topic