0

My smart contract is really huge - it requires 5.6M of gas on deploy. I was able to deploy it once but smth has changed and i can't do it anymore.

I've tried to run miner with higher block gas limit with geth but still getting exceeds block gas limit: https://stackoverflow.com/questions/51437227/geth-targetgaslimit-not-working

How can i do it on Ropsten network (testnet)?

1
  • divide it in multiple contract
    – Badr Bellaj
    Jul 23, 2018 at 9:51

2 Answers 2

0

Ultimately, you will need to reduce the size of your contract as there is no way to bypass the gas limit for a single transaction.

You can do this a few ways:

  • Make sure you are writing your code to have reusable functions where possible
  • Make sure you are compiling the code with the solidity optimizer
  • Use existing, battle tested libraries where possible
  • Break apart your contract into multiple smaller contracts or libraries which reference one another to create transactions below the gas limit
4
  • Alternatively, put it on a testnet with a larger gas limit, like Kovan.
    – natewelch_
    Jul 23, 2018 at 13:57
  • > there is no way to bypass the gas limit for a single transaction. How did i do it once?
    – 4ntoine
    Jul 23, 2018 at 18:11
  • Ropsten gas limit isn't really fixed, but is 4.7M most of the time. If you're a miner you can raise the gas limit temporarily. That's probably what happened when your transaction got accepted. Definitely think about making your contact modular and versionable.
    – rustyx
    Jul 23, 2018 at 19:21
  • i can mine as for Ropsten it's not as difficult as for main net. > "If you're a miner you can raise the gas limit temporarily" I tried (stackoverflow.com/questions/51437227/…), how can i do it?
    – 4ntoine
    Jul 24, 2018 at 19:29
0

I have no idea on what's wrong but i was able to publish with Remix connected to local geth miner node:

$geth --verbosity "4" -rpc --nousb --ipcdisable --rpcaddr "127.0.0.1" --rpccorsdomain "" --rpcvhosts "" --syncmode "fast" --rpcapi="db,personal,eth,net,web3,admin" --cache=2048 --testnet --mine --targetgaslimit 7000000

https://ropsten.etherscan.io/tx/0x75139eb7f94e1a8769dee35b63f0492893da550e5538dfd67a889203d510c833

1
  • No idea, but i can't do it again. What does it depend on? Looks like some network limitation. As far as i understand block gas limit is determined by voting of nodes. Does it mean most miners should just vote for larger amount than default? How did it work few times for me?
    – 4ntoine
    Aug 21, 2018 at 6:26

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.