[Ethereum] Deploying on contract on main net – Error: insufficient funds for gas * price + value

contract-deploymentout-of-gastruffletruffle-deployment

Running

geth v 1.7.3

truffle 4.0.5

truffle-config.js

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8545,
      network_id: "*" // Match any network id
    },
    live: {
      host: "localhost",
      port: 8545,
      network_id: "1",
      from: "0x2cd02c6bfb7d36be9c98be275c5c30aa8d3848b8",
      gas:5000000
    }
   }
};

1_initial_migration.js

var Migrations = artifacts.require("./Migrations.sol");

module.exports = function(deployer) {
  deployer.deploy(Migrations, {gas:7987299});
};

2_deploy_contracts.js

var DevContest = artifacts.require("./DevContest.sol");

module.exports = function(deployer) {

  deployer.deploy(DevContest, "0xf7B098298f7C69Fc14610bf71d5e02c60792894C", 4942901, 4977461, {gas:7987299});

};

The error I'm getting is in the migrations file it seems like –

mokn$ truffle migrate --network live --reset
Using network 'live'.

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 (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:41483:16)
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:330353:36
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:176198:11
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:326008:9
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:329052:7)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176427:18)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176717:12)
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176872:12)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176832:24)
    at IncomingMessage.emit (events.js:165:20)

I checked how much the contract should cost in Remix – no more than 3.5 million. Anyone know what's going on here? Thank you

UPDATE – Seems to have deployed the migrations but it's not completing the second contract. Is it possible I don't have enough eth in the account? The migrations contract is not very large and cost 300k gas.

Now I'm getting this issue –

mokn$ truffle migrate --network live --reset
Using network 'live'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... 0x92cc08d87aac4ea464d2b1bfe89a747fbb52e4cf8bdade1c5d992705cffcad3c
  Migrations: 0x12613c93ae25f51d956cf9fcd80edc05babdc2fc
Saving successful migration to network...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: insufficient funds for gas * price + value
    at Object.InvalidResponse (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:41483:16)
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:330353:36
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:176198:11
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:326008:9
    at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:329052:7)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176427:18)
    at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176717:12)
    at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176872:12)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:176832:24)
    at IncomingMessage.emit (events.js:165:20)

Best Answer

I am using infura and resolved the issue by combining the migrations code into 1_initial_migrations.js as follows :

var Migrations = artifacts.require("./Migrations.sol");
var Kratoken = artifacts.require("./Kratoken.sol");

module.exports = function(deployer) {
  deployer.deploy(Migrations)
    .then(() => Migrations.deployed())
    .then(kratoken => new Promise(resolve => setTimeout(() => resolve(kratoken), 60000)))
    .then(kratoken => deployer.deploy(Kratoken))
};
Related Topic