-1

This question already has an answer here:

My smart contract has lot's of functions, events, etc. Remix evaluates contract gas requirements as:

"Creation": "47213 + 5396800\n"

I can deploy it in my private blockchain with increased in genesis block gas limit. As far as i know most miners in production blockchain use default block gas limit 4712388.

How can my contract be deployed in the future? I expect error messages like that transaction gas requirement exceeds block limit.

Obviously my original intention was to split it into few contracts, but after some review i decided it just has very complex business logics and nothing can be separated. So i'd prefer to leave it as-is if possible. Any options?

Update:

On https://ethstats.net/ i can see gas limit is about 6718946. Does it mean non-default value ( > 4712388) is set at the moment for the most of miners?

marked as duplicate by eth Nov 17 '17 at 9:34

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

0

You will have to split up your contract into multiple, smaller contracts which can be deployed separately but can be linked and operate with each other.

Here is an example: split token example

You can also look into using libraries: Library driven development, where a separate library contract has all of the functions but no state, but the functions can be called by the main contract that stores the state.

  • As i've noted there is no obvious way to split it (there are no logical "parts"). Any other options? I'll try to use Libraries approach. – 4ntoine Nov 17 '17 at 10:42
  • There is no other way than splitting your contract, except waiting for the gas limit per block to increase until your old contract fits (since the gas limit is dynamic and can be voted up/down by miners). – xgabrielx Nov 22 '17 at 6:16
  • i've updated the question (see "Update:"), can you comment it? – 4ntoine Nov 27 '17 at 7:40

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