1

In a private blockchain with Parity, what is the correct way to set the Block Gas Limit? When I go to "Transfer" and then specify an address in the "recipient" field, a red bar pops up that says:

the transaction execution will exceed the block gas limit

I don't know why the block gas limit is not the default! I am using my own chain spec file, but I copied these values from https://github.com/paritytech/parity/blob/master/ethcore/res/ethereum/foundation.json:

"gasLimit": "0x1388",

...

"minGasLimit": "0x1388",

The limit that the error is talking about appears to be 5000 (0x1388) because I get the error until I manually lower the gas (from 21000 default in the field) to 4999. But why is the limit set to 5000? Those two parameters don't have anything to do with the block gas limit, do they?

(And anyway, when I do lower the gas limit to anything below 5000, I I get this problem: Parity genesis file - How to set "minimal cost of the transaction" a.k.a. "Gtransaction" value?)

Really I just don't understand what I did to alter the Block Gas Limit. It should default to 21000, right? How did I manage to alter that?

  • In a private network, you can set the gas limit in the genesis file, the gas limit is dynamic and can be adjusted with --targetgaslimit parameter. – Prashant Prabhakar Singh Oct 8 '17 at 7:02
  • @Prashant Prabhakar Singh Are you sure? I thought that "targetgaslimit" referred to this: ethereum.stackexchange.com/questions/17469/…. That is for the miners to accept gas, not for the allowable Block Gas Limit. Also, is it a parameter in the genesis file because I have looked everywhere I find docs on the Parity chain spec and the geth genesis file and I have not seen this parameter. I think maybe it is only a geth command line parameter? For when you are mining? – stone.212 Oct 8 '17 at 21:49
  • My bad. I just didn't pay attention. The term you are looking for is gasLimit in genesis block. You can define gasLimit in genesis block and this will be adjust your block gas limit. – Prashant Prabhakar Singh Oct 10 '17 at 4:24
  • @Prashant Prabhakar Singh I am confused. In the default chain spec, "gasLimit" is set to 5000 (1388)! But that certainly is not the Block Gas Limit of ETH mainnet. See for yourself: github.com/paritytech/parity/blob/master/ethcore/res/ethereum/… – stone.212 Oct 15 '17 at 4:25
2

In private network you can increase block gas limit by using gasLimit parameter in genesis file.

"gasLimit": "0x8000000",

gasLimit in genesis file:

A scalar value equal to the current chain-wide limit of Gas expenditure per block. High in our case to avoid being limited by this threshold during tests. Note: this does not indicate that we should not pay attention to the Gas consumption of our Contracts.

You can read about other genesis params from What does each genesis.json parameter mean?

PS: I have not tried increasing block gas limit but I guess this should work. Although you can increase block gas limit but you should not (ideally). If this is for testing purpose then it's alright. But If your smart contract consumes gas more than block gas limit, this is a concern. You could try splitting contract.

  • What you are saying is that the "gasLimit" parameter in this file (github.com/paritytech/parity/blob/master/ethcore/res/ethereum/…) is the same as the Gtransaction value in the Yellow Paper? Do I understand you? – stone.212 Oct 11 '17 at 5:10
  • That link is not helpful. The actual chain spec uses "1388" for that value, and that equals 5000! But we know that that isn't actually the Block Gas Limit, so the link must be incomplete at best. – stone.212 Oct 15 '17 at 4:27
  • I am not very sure about the link you provided. Is that for the main chain? I need to look at this. Meanwhile, did you try increasing the gasLimit param in your genesis file? By the definition, this seems to be the thing that will work fine. Did you check? – Prashant Prabhakar Singh Oct 15 '17 at 11:13
  • It appears to be the main chain, yes. Did you look into it? Yes I increased gasLimit parameter to 4712388. The error has changed a little bit. It now says "Transaction cost exceeds current gas limit. Limit: 4700036, got: 4712388. Try decreasing supplied gas." Crazy, right?!? The gasLimit parameter is set to 4712388, so where is 4700036 coming from? I'm going to post a separate question actually. – stone.212 Oct 17 '17 at 3:21
0

The question was:

In a private blockchain with Parity, what is the correct way to set the Block Gas Limit?

The answer is:

  1. Set the initial Block Gas Limit with the gasLimit parameter in the Parity chain spec.

  2. Miners will re-set this as they vote to raise or lower this limit over time, with minGasLimit being the floor.

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.