I am new to writing smart contracts, in recent times I am having trouble in deploying the smart contracts couple of times so I need a solution for that.

I am using the truffle most of the time so limit of the gas is depended on the version of truffle like version 5 needs more gas or solidity version?

Is it depends on the parameter we pass in the argument?

What should be the ideal gas price needs to pass?


1 Answer 1

  • The compiler solc is responsible for the gas cost. It transform your source into a sequence of EVM opcodes called bytecode. New version of solc usually fix bugs so the bytecode generated might not be the same and the gas cost will vary between versions. Truffle should not affect, but it might change the default version of solc in an upgrade. So if you use the default compiler the gas cost might change.
  • It also affects the cost the data you send with the transaction. If you send more data it will increase the gas required. Also likely you will need to pay for more processing.
  • It depends on the code you write, the input data and the processing done. There are some tools that you can use to like remix to estimate gas costs.

Your Answer

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

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