1

I have 7 smart contracts to deploy on the Ropsten network.

I am using truffle-hdwallet-provider and below is the content of my truffle.js file:

module.exports = {
  solc: {
    optimizer: {
    enabled: true,
    runs: 200
 }
},
networks: {
 ropsten: {
  provider: function() {
    return new HDWalletProvider(
      process.env.MNENONIC,
      `https://ropsten.infura.io/v3/${process.env.INFURA_API_KEY}`
      );
    },
    gasPrice: 250000000000,
    network_id: 3
  }
 }
};

Then I run the following command:

truffle migrate --network ropsten

but I get the following response:

Error encountered, bailing. Network state unknown. Review successful transactions manually.insufficient funds for gas * price + value

Fine, it stated I have insufficient fund and my fund was 1.509 Ether at the time. So can I assume the cost to deploy all my contracts is more than 1.509 Ether (that's more than USD163!)?

Appreciate if someone can guide me.

  • Does the error appear if you try to deploy to ganache? How much is the block gas limit in your blockchain? Truffle used to have around 4.7M as default, if your chain is less it will fail. Another possible cause is if you have a library that is not linked. There're many errors that map to the same message. Add some way to try to reproduce the problem. – Ismael Dec 7 '18 at 3:20
0

Try this to find out Gas Usage : https://github.com/cgewecke/eth-gas-reporter

Also just try removing gasprice from truffle file and try again

  • Thanks sumit! I installed the eth-gas-reporter. I run truffle develop on one terminal window and truffle mocha on the other window. But I got "Could not connect to your Ethereum client". I guess I do not know how to use it. – Cryptocert Thuleen Dec 5 '18 at 16:15
  • I added the following in my truffle.js: mocha: { reporter: "eth-gas-reporter", reporterOptions: { currency: "USD", gasPrice: 21 }} ok now I get from terminal output: "Using network development" "Network is up to date" – Cryptocert Thuleen Dec 5 '18 at 16:34

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.