What does gas limit mean? Are there two meanings of gas limit?

  1. gas limit in a transaction
  2. block gas limit
up vote 17 down vote accepted

Yes. Each transaction has a gas limit. For example, there could be 5 unmined transactions where each has a gas limit of 10, 20, 30, 40, 50. The block gas limit determines how many transactions can fit in a block. For example, if the block gas limit is 100, then the first four transactions can fit in the block. Miners decide which transactions to include in a block. A different miner could try including the last 2 transactions in the block (50+40), and they only have space to include the first transaction (10).

Every person who creates a transaction can decide what their transaction's gas limit is: but it would not make sense for them to specify something higher than the block gas limit, so Geth and other clients would prevent them from setting too high. It is a gas limit because it is the maximum amount of gas the person creating the transaction is willing to use: they do not pay for any extra gas that is not used. But if they set the limit too low, their transaction can run out of gas and they pay for all of it to the miner.

With the block gas limit, miners are the ones who decide. The bigger it is the more they can get from transaction fees, but the more bandwidth and computing they would have to do. Miners cannot change the block gas limit too much within one block: they can only change it by a factor of 1/1024.

The transaction gas limit is the gas property in a transactionObject. The block gas limit is a parameter in the genesis file created (it is client dependent and typically means the minimum block gas limit: a block with a gas limit smaller than it will not be accepted by the nodes on that blockchain).

  • Can you explain where these two things are defined/modified? Are the in the genesis file? I want to play with them for a private blockchain. – stone212 Oct 8 '17 at 6:45
  • @stone212 Yes, the block gas limit is in the genesis file (might be client dependent the name used). The gas limit for a transaction is in each transaction: it's typically the gas value in a transactionObject. – eth Oct 10 '17 at 9:07
  • I am more confused than before. Can you tell me which parameter refers to the block gas limit here: github.com/paritytech/parity/blob/master/ethcore/res/ethereum/…. And are any of the other gas parameters in that file part of the transaction? minGasLimit, maybe? If so then maybe I am starting to understand. I am confused because I think one value is the minimum transaction gas limit and the other is the genesis file gas limit, but neither one is the block gas limit. But I can't get a straight answer on this and so my testing is really confusing to me. – stone212 Oct 11 '17 at 5:06
  • @stone212 I'm not familiar with those Parity parameters. I think you asked a question on this, and if you tag it with Parity, it may catch the attention of some of the people working on Parity: a reason why tagging and titles are important. If you're lucky, you might also try 5chdn at chat.stackexchange.com/rooms/34620/whisper – eth Oct 17 '17 at 8:08
  • the problem I have is that you say "With the block gas limit, miners are the ones who decide" but (a) there exists the "gasLimit" parameter and everything tells me that this is block gas limit. If you can include an explanation in your answer, I will mark it correct. – stone212 Oct 18 '17 at 0:01

Your Answer

 

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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