ethereumsoliditysmartcontractstruffleerc20

How to fix "insufficient funds for gas * price + value"?


Windows 10 Home x64
bignumber.js@^7.2.1
openzeppelin-solidity@1.10.0
react@16.4.1
react-dom@16.4.1
truffle@4.1.13
web3@1.0.0-beta.34

Full version reference:
https://github.com/tooploox/ethereum-ico-examples/blob/master/package.json

I have done a lot of research. I found so many sources but none of them found a solution and some threads are not updated any more or probably they already found an answer but did not post it. Some people manage to fix it in Mac, but I am using Windows. Some people fix it 5 months ago but when I tried it, it did not work out, buy changing the gas higher a little bit and run again. I also have 6 Ether in my Ropsten account.

This is my truffle.js:

ropsten: {
  provider: new HDWalletProvider(mnemonic, "https://ropsten.infura.io/"+infura_apikey),
  network_id: 3,
  gas: 4000000
},  

when I truffle migrate --network ropsten:

it triggers this error:   
Running migration: 1_initial-migration.js
  Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
insufficient funds for gas * price + value

Github reference:
https://github.com/tooploox/ethereum-ico-examples
Instruction Reference:
https://www.tooploox.com/blog/create-and-distribute-your-erc20-token-with-openzeppelin


Solution

  • Try setting gas price in truffle.js file.

        gasPrice: 10000000000 // Something price like this
    

    Source

    Hope this helps!