0

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

  • 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 '18 at 8:31
  • 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 – Florian Castelain May 30 '18 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. – Alex Zhukovskiy May 30 '18 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 – Florian Castelain May 30 '18 at 9:03
  • gist.github.com/Pzixel/a2c4af9241d03d4634fcd6e3884bd557 - here is the current code. Note that it's performance critical so splitting one contract into several would lead to proportional speed decrase which is unaccetpable. – Alex Zhukovskiy May 30 '18 at 9:47
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".

  • 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. – Alex Zhukovskiy May 30 '18 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 '18 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. – Alex Zhukovskiy May 30 '18 at 19:43

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.