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(
    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, 2018 at 3:20

1 Answer 1


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. Dec 5, 2018 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" Dec 5, 2018 at 16:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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