1

When I want to migrate a contract to rinkeby network using the command:

truffle.cmd migrate --network rinkeby

I get the error:

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 at Object.InvalidResponse (C:\Users\korys\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.js:38:1) at C:\Users\korys\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:86:1 at C:\Users\korys\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-core\~\truffle-migrate\index.js:225:1 at C:\Users\korys\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-provider\wrapper.js:134:1 at XMLHttpRequest.request.onreadystatechange (C:\Users\korys\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\httpprovider.js:128:1) at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\korys\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:64:1) at XMLHttpRequest._setReadyState (C:\Users\korys\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:354:1) at XMLHttpRequest._onHttpResponseEnd (C:\Users\korys\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:509:1) at IncomingMessage. (C:\Users\korys\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:469:1) at emitNone (events.js:111:20) at IncomingMessage.emit (events.js:208:7) at endReadableNT (_stream_readable.js:1064:12) at _combinedTickCallback (internal/process/next_tick.js:138:11) at process._tickCallback (internal/process/next_tick.js:180:9)

My truffle.js code:

 module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    },
    rinkeby: {
      host: "localhost", // Connect to geth on the specified
      port: 8545,
      from: "0x9eb9afe773757fa175116ae1ba10a23a87fa8f52", // default address to use for any transaction Truffle makes during migrations
      network_id: 4,
      gas: 4612388 // Gas limit used for deploys
    },
    mainnet: {
      host: "localhost", // Connect to geth on the specified
      port: 8545,
      from: "0x0", // default address to use for any transact$
      network_id: 1,
      gas: 4712388, // Gas limit used for deploys
      gasPrice: 100000000000
    }
  }
};
JustinZ
  • 183
  • 7

1 Answers1

0

You don't have enough Rinkeby test ether in your account. Make sure that the account deploying them has some money to spend. Here's a faucet: https://faucet.rinkeby.io/

thefett
  • 3,873
  • 5
  • 26
  • 48
  • How much ether is enough? I currently have 1.5 test ether in my account https://ibb.co/e7PkVo – JustinZ May 21 '18 at 17:57
  • That should be good for a basic contract deployment. Are you passing in gas / gasprice in your truffle.js file? https://github.com/trufflesuite/truffle/issues/660 – thefett May 21 '18 at 18:02
  • My truffle.js code: – JustinZ May 21 '18 at 19:56
  • are you actually running a ropsten node? I would highly recommend infura: http://truffleframework.com/tutorials/using-infura-custom-provider – thefett May 21 '18 at 20:25
  • im running rinkeby node – JustinZ May 22 '18 at 04:41
  • I have also unlocked the account while migrating – JustinZ May 22 '18 at 04:52
  • Can you give the infura a try? If it works there then it has something to do with your client – thefett May 22 '18 at 14:22
  • I have another question I would like you to answer. Do I need to import rinkeby accounts into geth somehow different or the same as I import the main net accounts? Because when I import rinkeby accounts into geth using this tutorial: https://ethereum.stackexchange.com/questions/465/how-to-import-a-plain-private-key-into-geth-or-mist for some reson it puts it's private keys into main net folder and not into the "rinkeby" folder. Because I have the suspicion that the way I imported the account is the main cause of the problem. – JustinZ May 23 '18 at 17:04
  • I use the hdwalletproivider (see the infura link). That way you just get to set a mnemonic. Then you can always just get the private key and import it into metamask for getting some test ether – thefett May 24 '18 at 15:55