Refer to the following:

rinkeby: {
  host: "localhost",
  port: 8545,
  from: "my address",
  network_id: 4,
  gas: 4800000,
  gaslimit: 2100000000000

When I set the gas to 4700000, I received the following error when deploying my contract.

Error: insufficient funds for gas * price + value

When I set the gas to 4800000, I received the following error instead:

Error: exceeds block gas limit

Trust me, any value in between will result with either one of the error above.

May I know what can I do? Is this mean my contract is too complicated for Rinkeby?

------ Additional notes: ------

This is how I start my Rinkeby's node.

geth --datadir rinkeby console --rinkeby --rpc --rpcapi db,eth,net,web3,personal --rpcaddr "" --rpccorsdomain "*"

May I know if there is any mistakes, because after starting, I use the following command to check the account (with plenty of ETH in Metamask). It always returns 0.

 eth.getBalance("<public key>");

2 Answers 2


Deploy it first on http://remix.ethereum.org using Javascript VM. Then you can look up actual gas usage for deployment.

enter image description here


I think you should try deploying your contract using Remix + Metamask. See if works. If it works, problem is with your setup. It seems you are using Truffle and geth/parity to deploy your contract, right? Make sure your account is unlocked (you have to pay for the gas).

And this tool is very helpful if you want to see how much gas your contract is spending: https://github.com/cgewecke/eth-gas-reporter

  • I think I noticed something strange. Am I starting my node correctly? geth --datadir rinkeby console --rinkeby --rpc --rpcapi db,eth,net,web3,personal --rpcaddr "" --rpccorsdomain "*" After that I use: eth.getBalance("<address>"). This is an Rinkeby account with lots of ether, but the result returned is 0.
    – s k
    Jul 19, 2018 at 14:18
  • And if you expose personal, for mainnet, you are toasted (Security) Jul 19, 2018 at 16:44
  • Did you import account to your local directory? Jul 19, 2018 at 16:44
  • Yes, I did import my account and unlocked it. So you mean I should remove personal right?
    – s k
    Jul 19, 2018 at 21:20
  • I have been syncing for one whole day, but eth.syncing still shows that I am a few hundreds block behind current, and getbalance still shows my account has 0, but metamask shows there are few hundreds in it.
    – s k
    Jul 19, 2018 at 21:33

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.