9

Gas Price has an obvious impact on how long it takes for the transaction to be mined, but does the Gas Limit have any bearing on transaction time?

Based on my understanding it shouldn't, as Gas Limit just determines how much you're willing to pay to complete the transaction, but would miners prioritize transactions with a higher limit if the Gas Price of both transactions were the same?

If that is in fact the case, would it not be generally faster to set an absurdly high Gas Limit for all of your transactions if you were wanting the fastest transaction, so long as you are actually willing to pay the entire Gas Limit if a transaction were to consume it?

This was posted here after being asked in the MyEtherWallet Support Slack (conversation below):

limitless76 [6:09 PM] Does changing the Gas Limit have any bearing at all on the speed of the transaction? I know increasing the Gas Price will speed it up, but my understanding is the Gas Limit simply determines how much Gas you're willing to pay to process the transaction, so it should not affect speed, is that right?

tayvano [6:10 PM] @limitless76 not really. Gas price is the primary. Miners will go after bigger fees which is limit * price

tayvano [6:10] So technically limit does play a role

tayvano [6:11] However excess gas limit is returned to you so sending a standard tx with a higher limit isn't going to actually net the miners more

tayvano [6:11] That would be an excellent question for Ethereum stack exchange tho. I really recommend you ask there as I would love to have someone pull all the details

14

Yes, a transaction's gas limit can have an effect on the time it takes to get mined into a block.

Larger gas limits can be more enticing to miners since their potential fee is gas limit * gas price. However, this is a potential fee, since unused gas is refunded. Thus, it is possible that transactions with very high gas limits, can be prioritized lower by miners and take longer to get included in a block.

Consider the case where there's 11 transactions:

  • 1 transaction T has a gas limit equal to the block gas limit.
  • 10 other transactions have a gas limit that's 1/10th of the block gas limit
  • All 11 transactions have equal gas price

If you're the miner, which of the transactions would you include first?

By choosing T first, you have reached the block gas limit and cannot include any other transactions in the block. If T actually only used 1/10th of the gas, you lost the opportunity to include other transactions and collect their fees. In this limited example, there is more likelihood of getting more fees by including the 10 transactions first.

That's some theory and the default behavior of clients like Geth and Parity would require examining their code. But miners can choose to modify the default behavior.

  • Thank you for your detailed response, it is much appreciated. The information you've shared brings up a follow-on question- If this is the case, then what would be the most effective method to ensure that you are the first transaction mined, or at least very early, assuming you are willing to pay a very high transaction fee? More specifically, if the Ethereum network were under an extremely heavy load, what would be the best strategy for having your transaction mined first before the others, albeit more expensive? – Chris P May 22 '17 at 23:29
  • After setting a high gas price (perhaps analyze previous congestions and see how high prices were), the other main factor could be your connectivity to the network/miners: how many peers you have and who they are connected to. Running multiple nodes around the world might help. (The ideal might be to have direct relationships with miners for your transaction.) – eth May 23 '17 at 9:14
  • 1
    It would be awesome if someone could share a link to the code (for example, in go-ethereum) where gasLimit actually influences the sorting order of transactions in the pool. Thanks! – ZitRo May 20 '18 at 14:24
  • @ZitRo That seems like a reasonable question to ask as a new question. Including where you've tried looking, could also help others help you. – eth Jun 3 '18 at 17:04

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.