I'm connected to the "Rinkeby" network on MetaMask. I've imported the private key into Geth. Thereby, I unlocked the account using geth --rpc --networkid 4 --unlock <account_address>. Thereafter, I'm trying to deploy my smart contract using truffle. I'm using the following command to deploy the migrations: truffle migrate --reset --network rinkeby --compile-all. But I receive the following error -

Error: insufficient funds for gas * price + value

Inside truffle.js, I've configured to connect to Rinkeby as follows -

 host: "localhost", 
 port: 8545,
 from: "<account_address>",
 network_id: "4",
 gas: 4000000, 
 gasPrice: 20000000000

I have 3 ETH in my account from the Rinkeby Authenticated Faucet.

Where exactly am I going wrong?

  • Is you local node synced with the network? Did you check the balance from your node's console -> eth.getBalance(<account_address>)?
    – ivicaa
    Commented Feb 23, 2018 at 12:04
  • @ivicaa Based on your comments, I imported the address into the keystore (specified a new datadir), unlocked the account and started a local node. Within the console (geth attach), if I try running eth.fromWei(eth.getBalance(<account_address>), "ether"), I'm getting Error: invalid address.
    – Anji P
    Commented Feb 23, 2018 at 15:37
  • Okay, @ivicaa, I was typing a wrong command. It should have been web3.fromWei. It returns 0. So you are saying that the local node needs to be synced with Rinkeby?
    – Anji P
    Commented Feb 23, 2018 at 16:06
  • I would say yes, if you're not sending raw transactions. Did you try it after the sync?
    – ivicaa
    Commented Feb 23, 2018 at 17:48
  • Hey @ivicaa I initialized the synchronization. Now I'm getting the following error: Error: exceeds block gas limit. The command web3.fromWei(eth.getBalance(<account_address>), "ether") returns 0.
    – Anji P
    Commented Feb 24, 2018 at 8:05

1 Answer 1


You would set your gas to 6712390 at truffle configuration. Hope it helps.

  • I tried with gas: 6712390 within truffle.js. This doesn't work.
    – Anji P
    Commented Feb 24, 2018 at 6:27

Your Answer

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

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