0

While deploying contract to ropsten tesnet (truffle migrate --network ropsten) I am getting an error:

insufficient funds for gas * price + value

  ropsten: {
      network_id: 3,
      host: "localhost",
      port:  8545,
      gas:   4698712,
      gasPrice:   65000000000,
      from: '14e6b19304fb3c98a73acea5f80d2c056ee5c09f'

    }

The configuration in truffle.js is given above. I have 1 test ether in my wallet account. How can I fix this issue ?

1

For me this error has always meant that I have not been fully synced. I have thought that all is fine but when I've checked my account locally I've noticed that I have no balance.

So make sure you are all synced up. Your configuration looks ok.

3
  • Yeah. eth.syncing returns { currentBlock: 1820272, highestBlock: 3707312, knownStates: 3511302, pulledStates: 3509154, startingBlock: 538105 } How much time does it take to get completely synced. ?
    – Vivek Sadh
    Jul 25 '18 at 9:03
  • Depends largely on your setup. Might takes days or even a week. Or you can use a light node and get synced in a few minutes. If you have further questions about the sync process please ask a new question or check numerous other sync questions in this site Jul 25 '18 at 9:11
  • I am also facing same issue Dec 6 '18 at 9:33
0

If you encounter this error even though there is ETH on the account it is because your gasLimit and gas price exceeds the amount of ETH available.

For instance let's suppose that I have a gas limit of 8 000 000 (aka gas when you use sendtransaction ) and a gasPrice of 200Gwei that means that you will need to have 8000000×200000000000 wei = 1.6 ETH available on your account. Of course that doesn't mean your transaction will use all this gas but it needs to be there as you have to send it along even if it is a simple call to a transfer fonction of an ERC20. If we go down to 3000000 gas limit we would need only 0.6 ETH

So to make it short make sure that your gas limit is set to a reasonable amount in truffle config

ropsten: {
  provider: () =>
    new HDWalletProvider(
      mnemonic,
      `wss://ropsten.infura.io/ws/v3/`
    ),
  websockets: true, // (default: false)
  confirmations: 2, // (default: 0)
  network_id: 3, // ropsten's id
  networkCheckTimeout: 1000000000,
  gas: 3000000,

or directly in the sendTransaction

web3.eth.sendTransaction({
from: '0xde0B295669a9FD93d5F28D9Ec85E40f4cb697BAe',
to: '0x11f4d0A3c12e86B4b5F39B213F7E19D048276DAe',
value: '1000000000000000',
gas:'3000000'})

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.