[Ethereum] Does Gas Limit have any bearing on transaction/mining time

gasgas-limit

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

Best Answer

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.

Related Topic