1

I would like to understand the gas incurred in contract creation and in sending the transaction to the contract.

Is there an easy way to debug this?

1 Answer 1

1

There is this document: https://docs.google.com/spreadsheets/d/1m89CVujrQe5LAFJ8-YAUCcNK950dUzMQPMJBxRtGCqs/edit#gid=0

which you could use to try estimating which part of your smart contract is the most expensive. You could try calculating total cost yourself per operation and byte of data stored.

Also here are the gas costs used in cost calculation by go-ethereum: https://github.com/ethereum/go-ethereum/blob/develop/params/protocol_params.go#L14

and the same for cpp-ethereum: https://github.com/ethereum/solidity/blob/054bc2a6ac4857f3aa9d7b5f0ec23ec5a3ee109b/libevmasm/GasMeter.h

1
  • Thanks. The difficult part is to map these gas costs based on opcodes to the contract code. I would hope that one day it becomes visually a lot easier to inspect the code with a tool and be able to estimate gas for the steps involved. Jun 17, 2016 at 18:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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