1

I'm working on a private blockchain and I found out that I cannot deploy a contract larger than 34Kb which is pretty limiting for me. For comparision, cryptokitties are 40-47Kb so I cannot even deploy digital kitties!

Here is part of my chains.json that corresponds to the gas limits:

  "params": {
    "maximumExtraDataSize": "0x20",
    "minGasLimit": "0x1388",
    "networkID": "0x2323",  
    "gasLimitBoundDivisor": "0x400"
  },
  "genesis": {
    "seal": {
      "authorityRound": {
        "step": "0x0",
        "signature": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"
      }
    },
    "difficulty": "0x20000",
    "gasLimit": "0x165A0BC00"
  },

If I understand that correctly I have a limit 0x165A0BC00 which seems to be pretty big and non-limiting. However, in practice it doesn't work.

How can I enhance network settings to make it possible to upload contracts up to 50-60Kb? I currently send 4600000 gas for every transaction.


Error when I'm trying to supply more gas:

Message: Nethereum.JsonRpc.Client.RpcResponseException : Transaction cost exceeds current gas limit. Limit: 4700000, got: 46000000. Try decreasing supplied gas.

When I'm supply regular amount of gas

Message: Nethereum.RPC.Eth.Exceptions.ContractDeploymentException : Code not deployed succesfully

4
  • Cryptokitties was deployed using less than 4 million gas : see the transaction on etherscan. 0x165A0BC00 is 6 billion in decimal: this is more then enough and I suspect your error is elsewhere. Could you add more details of encountered errors?
    – Harold
    May 30, 2018 at 8:31
  • 1
    If yoru contract is too big, it's basically because you did not optimized it. I had the same problem, optimizing mine solved the solution. An other solution on private chain is to separate your contract into several contracts May 30, 2018 at 8:58
  • @Andromelus no, I optimized things a lot. I currently have just a one contract with bunch of fields and get/set methods. I can't separate fields (because they must be retrieved alltogether) and I cannot remove get or set methods. So this is why my question is it is: how to elminitate that limitation. There is contract on the interner (i.e. cryptokitties) that cannot be deployed on my network. If they deployed it successfully then it's nothing wrong with the contract itself, it's just up to proper configuration. May 30, 2018 at 9:00
  • If you have public fields, you don't need to write getters/setters to retrieve them individually. It's enerated by the EVM. It would be easier if we could check your code May 30, 2018 at 9:03

1 Answer 1

0

You supplied 46,000,000 gas whereas the limit is only 4,700,000 therefore the transaction is not valid ! It should work if you supply less than 4,700,000 gas.

The other error do not seem to be tied to a gas problem: it would probably say "Ran out of gas".

3
  • It doesn't answer a problem. I can't run out of gas because i pass the maximum value (having ~1000000 ethereum on the account). The problem is that neither value below 4.7m or above 4.7m can't make this contract to be deployed. May 30, 2018 at 13:42
  • In the case you supply 46m gas it tells you to decrease the gas supply. Have you more details on the error when you supply less than 4.7m gas ?
    – Harold
    May 30, 2018 at 14:03
  • I typically pass 4.6m gas. In this case it wasn't working. 4.7 wasn't enough too. When I just added one more zero to make it 46 it stopped work. I know that it's a limit. The main question is how to increase it. There is literally no way to deploy a contract if the amount of gas it requires is more than a maximum treshold. May 30, 2018 at 19:43

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.