4

I'm trying to deploy a smart contract in a test network, using a [meteor DApp][1]. I have this parameters for the genesis block:

gasLimit: "0x1388"

However, any time I try to deploy any single contract I get the following error:

Error: Exceeds block gas limit

Any idea of what I can do here?

5

Since you are doing this on a test network, you can modify your genesis block to have a gas limit of 0x2fefd8 which is the same as the main network (3,141,592 gas). You will also need to reset that test chain since you'll be changing the genesis block.

3

The block gas limit of PI million can be encountered during deployment of some contracts.

Here's a process that can help and try redeploying after each step.

  1. A quick-fix attempt is to use Solidity's --optimize flag.
  2. If further investigation is needed, try to see how much over the block gas limit your deployment is. Start with commenting out parts of the contract, and check to see if any parts can actually be removed.
  3. If there's any logic that is shared, make sure to refactor it as a function, as this will reduce the size of the bytecode and will mean lower gas cost during deployment.
  4. If the contract has too much logic, then it is necessary to split up the contract. Splitting into libraries may help. Splitting into multiple contracts, where each contract only has a couple of functions may also need to be done.
  • I get this error with any single contract, no matter its complexity. I've just set up this network, so I could have done something wrong when configuring it – Buendiadas Feb 29 '16 at 14:53

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.