2

Problem: I've upgraded my geth node to the latest version (1.9.0-unstable). The block gasLimit of the node is fixed at 5000:

eth.getBlock("latest").gasLimit

5000

When I try to send a transaction, I get the following error:

Error: exceeds block gas limit

Attempted fixes: I have tried to alter the default gasLimit value in the genesis.json:

"gasLimit": "0xffffffff"

From geth node command line option:

--targetgaslimit '9000000000000'

Point to note: On previous versions, i.e, before upgrading, the block gasLimit returned by the node was much higher and it let me deploy contracts and perform transactions.

eth.getBlock("latest").gasLimit

4286582786
4
+25

As @fixanoid stated in his answer you can change the gas limit in the genesis.json.

But this isn't an optimal solution in my opinion. You are better off using a specific flag for your miner.

Geth has the --targetgaslimit flag that will cause your miner(s) to move step by step towards a given gas limit. Only a certain increase is allowed per block. Typically prev limit/1024. So it might take some time to get it where you want it to be. Obviously a larger change results in the block not being accepted.

Besides specifying the --targetgaslimit flag you also have to make your node --mine in your private blockchain (Obviously).

EDIT: How are you sending the transactions? What gas limit are you currently specifying? The minimum for a transaction is 21000. If you are invoking a contract with a fallback function even more gas is needed. Make sure you have enough ETH to pay for the gas.

The problem might be that the error message is flawed.

| improve this answer | |
  • As stated in the question, neither genesis.json gasLimit setting nor miner flag is working with last go-ethereum version – Juan Ignacio Pérez Sacristán Oct 30 '19 at 8:15
  • You started mining? – Niklas Feurstein Oct 30 '19 at 9:23
  • Take a look at my edit as well. I am quite certain that the problem isn't really with you block gas limit directly. – Niklas Feurstein Oct 30 '19 at 10:14
1

3 things to try:

  • Avoid using unstable versions, switch to the last stable Elasa (v1.9.6)
  • You may have to increase the gas a bit when deploying contracts, because of new versions of solidity where gas calculation changes
  • Using a gas price oracle is sometimes needed
| improve this answer | |
0

One way to do this is to set very high limit for gas in the genesis config file like so: "gasLimit": "0xE0000000". Alternatively, run a client optimized for private nets: https://github.com/jpmorganchase/quorum. Default gas limit is in billions.

| improve this answer | |

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.