2

I am working on a private blockchain using Parity. I have changed the gasLimit parameter to read "4712388" instead of the default (0x1388) and when I try to truffle migrate a contract, I get this error:

[-32010] Transaction cost exceeds current gas limit. Limit: 4700036, got: 4712388. Try decreasing supplied gas.

Q1: Where does this 4700036 value come from? Be specific. What actual chain spec parameter handles this?

Q2: Can you confirm that this is taken from a different place than the gasLimit parameter, which is set to 4712388?

EDIT: Weeks, later, I have a new issue. It's possible this relates to my other question:

Why would gasLimit be read as 4,700,036 instead of 4,712,388?

1 Answer 1

2

The genesis.json file provides the initial gas limit for the first block in the chain, but this can be adjusted a little bit with each block. By default Parity gradually adjusts in line with the amount of gas actually used in transactions, so if you have a barely-used private chain it will keep decreasing.

To prevent it dropping below 4712388, run Parity with --gas-floor-target 4712388.

4
  • This error is happening on the first transaction, and it still happens with the "--gas-floor-target 4712388" parameter on the command line. But thank you for trying.
    – stone.212
    Oct 17, 2017 at 5:01
  • What do you see when you connect to your blockchain over RPC and look at the current block with web3.eth.getBlock('latest')? You should see the block gas limit in the gasLimit parameter. Compare this to an earlier block and see if it's changing. Also, try stopping your blockchain and make sure truffle gives you a different error, to prove that truffle is connecting to the blockchain you think it's connecting to. Oct 17, 2017 at 5:22
  • I do get a different error if Parity is not running: "Could not connect to your Ethereum client." When I use web3 I get the following: > web3.eth.getBlock('latest'); Promise { _bitField: 0, _fulfillmentHandler0: undefined, _rejectionHandler0: undefined, _promise0: undefined, _receiver0: undefined } Does not look good but I don't know what any of those things mean so not sure where to start.
    – stone.212
    Oct 17, 2017 at 5:50
  • I have been reading about "--gas-floor-target" and it looks like that is a command for a Parity node that is running a miner. Is that correct?
    – stone.212
    Oct 17, 2017 at 7:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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