0

I try deploy a contract to rotten network with truffle. I checked the last gas limit value in ropsten and I give the gas limit value of the last block But I get this error:

"Migrations" exceeded the block limit (with a gas value you set).

then I increase the gas value, I get an error again:

ran out of gas (using a value you set in your network config or deployment parameters.

can I automatically get the gas value in truffle-config file for ropsten?

thank you

4
  • Is it possible to see the details of your truffle-config ? – clement Aug 21 '20 at 14:44
  • hi, the ropsten settings in the truffle-config.js: ropsten: { provider: ()=> new HDWalletProvider(process.env.TEST_WALLET_PRIVATE_KEY, ${process.env.INFURA_ROPSTEN_ADDRESS}${process.env.INFURA_ROPSTEN_KEY}), network_id: process.env.ROPSTEN_NETWORKID, gas: 64716347 // gas limit of last block on ropsten //gasPrice: 10000000000 } – sollover Aug 21 '20 at 15:09
  • Ok, do you have sufficiant funds to deploy your contract ? gasUsed * gasPrice has to be greater than the amount of ropsten faucets you own. – clement Aug 21 '20 at 15:18
  • yes I have enough amount. – sollover Aug 21 '20 at 16:16
0

The gas limit is higher than the maximum block gas limit currently. At the time of writing, it is around 50,000,000, while you set the gas limit to 64,716,347. The block gas limit can fluctuate a lot from block to block, so you should use a gas limit that is quite a bit lower than the block gas limit. Something like 10,000,000 should be more than enough for any contract deployments.

1
  • I set a gas limit that is quite a bit lower than the block gas limit but I get an error again in that: ran out of gas (using a value you set in your network config or deployment parameters. what should I do ? – sollover Aug 22 '20 at 16:42

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.