Is there any advantage is setting higher gas-limit (not gasprice --> gas-limit)? I know you have to set at least as much as that the smart contract needs to execute, but isn't this amount always the same?

1 Answer 1


A mining client can be written to customize which transactions should be selected for mining. The eth_newPendingTransactionFilter method can filter pending transactions based on any of the transaction attributes, including gas limit. So, theoretically, it COULD be a factor. However, I don't think any of the popular mining clients factor in gas limit.

but isn't this amount always the same?

Why would it be the same? The gas limit is specified by the client. If you're writing the client that makes the call, you would either specify your own amount (and hopefully customizing the amount based on the transaction you're invoking), or you're probably using a library that will determine what value to use based on the results from estimateGas.

  • Doesen't the gas limit depend on the opcodes that the smart contract needs? So a node has no way to manipulate the gas-limit that a smart contract needs or can the node be malicious?
    – Ini
    Jan 20, 2018 at 20:33
  • I mean for one particular smart contract the gas-limit is always the same or not?
    – Ini
    Jan 20, 2018 at 20:34
  • 1
    "Doesen't the gas limit depend on the opcodes that the smart contract needs?". Yes. But, your contract can have loops and conditions that cause more/different opcodes to be executed. In one call, a loop may perform 10 iterations, in the next invocation, it may loop 10,000 times. More iterations = more opcodes. Jan 20, 2018 at 20:39
  • I understand. Are loops required in a smart contract for an ICO or do you know a smart contract for an ICO with a loop?
    – Ini
    Jan 20, 2018 at 21:06
  • 1
    I don't see how that's relevant. The point is that the way a contract is coded will cause it to execute different logic based on the parameters passed in and the current state of the contract, which makes the gas consumed variable. It's fundamental programming with the only difference that you have to pay for the resources used to execute the code (via gas). Jan 20, 2018 at 21:33

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.