I'm trying to migrate my contracts to rinkeby using truffle (truffle migrate --network rinkeby), but it keeps telling me that I don't have enough funds:

Using network 'rinkeby'.

Running migration: 1_initial_migration.js Deploying Migrations...
... undefined Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: insufficient funds for gas * price + value

Here's my truffle.js:

module.exports = {
  networks: {
    rinkeby: {
      network_id: 4,
      host: '',
      port: 8545,
      gas: 4000,
      gasPrice: 200000,
      from:  "0x852c1e19114b1ff775c59a61b345cc839f3307fd"

The "from" address has 3ETH, this should be more than enough.

UPDATE: I tried to switch to a local light node running geth --networkid=4 --syncmode=light --datadir . --rpc --rpcapi="eth,web3,personal,net" (on Windows), but still get either insufficient funds or exceeds block gas limit error.

  • If you try to deploy abstract contract then this will throw an error. Abstract contract means, contract having abstract functions/no implemented functions. – Jitendra Kumar. Balla Feb 4 '18 at 17:57
  • No, the contract is concrete, truffle test passes all tests. – ulu Feb 4 '18 at 18:17
  • 2
    4000 gas is nowhere enough to deploy a contract, try gas: 4000000. And gasPrice is wrong too, gasPrice: 4000000000. – abb Feb 4 '18 at 19:40
  • It doesn't say "insufficient gas", it says "insufficient funds", so I thought making gas lower would make funds sufficient for sure. – ulu Feb 5 '18 at 11:40

You can determine the current GasLimit for Rinkeby by visiting Rinkeby Blocks and look into the GasLimit Column. In Truffle, your gas should below this value.

With the GasPrice, you can control how quickly a Miner will take your transaktion. The higher the value, the faster your transaction is included in a Block.

For me, these values are a good fit:

"gas":      6500000,
"gasPrice": 100000000000
  • 1
    Tried your values, it told me exceeds block gas limit. How can increasing gas price help me? I thought it can only make my transaction mined faster, but would require more funds to be spent, no? If I have insufficient funds with a low gas price, how can increasing it make funds sufficient? – ulu Feb 5 '18 at 11:45

I assumed that my account has funds that were sent to it. However, it turned out the node hasn't synced to the block that has that transaction, so it still thinks that the account has zero funds.

Moral: even if you're sure you got funds, always check it with the node you're working with. Also, the new "dry run" option in Truffle helps (this is how I discovered that I have zero ether).

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.