Failed to start truffle@2.1.2 migrate --network live. "Exceeds gas block limit"

I am using truffle@2.1.2 to deploy smart contracts with localhost:8545

geth@1.5.9-stable

rpc using an account that is funded with Ether, was unlocked with personal.unlockAccount

geth on the console.

I've also tried the same with a remote Parity node via RPC, but this is the last one I'm pretty stuck with.

truffle.js

module.exports = {
  build: {
    "index.html": "index.html",
    "app.js": [
      "javascripts/app.js"
    ],
    "app.css": [
      "stylesheets/app.css"
    ],
    "images/": "images/"
  },
  rpc: {
    host: "localhost",
    port: 8545
  },
  networks: {
    "ropsten": {
      network_id: 3,
      port: 8548, // ssh tunnelled to AWS geth/parity node localhost:8545
      from: "0x4f000Bcf4641E2fDcE85BF26A694b053996850D4"
    },
    "live": {
      network_id: 1,
      port: 8545,
      from: "0x00269400181f1B379784BD8cDF786bb20e91Bdef",
      gas: 4612388,
      gasPrice: 2776297000 // taken from Parity startup log message "Updated conversion rate to Ξ1 = US$42.88 (2776297000 wei/gas)"
    }
  }
};

      

migrate truffle --network live

Running migration: 1_initial_migration.js
  Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: Exceeds block gas limit
    at Object.module.exports.InvalidResponse (/home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/errors.js:35:16)
    at /home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/ether-pudding/node_modules/web3/lib/web3/requestmanager.js:86:36
    at request.onreadystatechange (/home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/web3/lib/web3/httpprovider.js:114:13)
    at dispatchEvent (/home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:591:25)
    at setState (/home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:610:14)
    at IncomingMessage.<anonymous> (/home/ubuntu/.nvm/versions/node/v6.2.1/lib/node_modules/truffle/node_modules/xmlhttprequest/lib/XMLHttpRequest.js:447:13)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:926:12)
    at _combinedTickCallback (internal/process/next_tick.js:74:11)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

      

I have tried to adjust the Gas and GasPrice, but cannot find the values ​​that might affect.

How can I solve this problem, or are there alternative methods for deploying contracts that I should look out for?

Sincerely.

+3


source to share


4 answers


I managed to fix this problem simply by setting gas: 3000000

to network config.

"live": {
  network_id: 1,
  port: 8545,
  from: "0x00269400181f1B379784BD8cDF786bb20e91Bdef",
  gas: 3000000
}

      



It cost about 0.5 ETH to start the migration and took a few minutes.

+3


source


In my case, the problem was generated by an empty user balance.

so check your balances using the following function:



function checkAllBalances() {
    var totalBal = 0;
    for (var acctNum in eth.accounts) {
        var acct = eth.accounts[acctNum];
        var acctBal = web3.fromWei(eth.getBalance(acct), "ether");
        totalBal += parseFloat(acctBal);
        console.log("  eth.accounts[" + acctNum + "]: \t" + acct + " \tbalance: " + acctBal + " ether");
    }
    console.log("  Total balance: " + totalBal + " ether");
};
 checkAllBalances();

      

if balance is 0 my blocks or edit genesis file.

+2


source


I solve the same problem by specifying the network id when calling the truffle, for example:

truffle migrate --network live

      

and you must change the "from" tag in the .js truffle with your unlocked account.

+1


source


Simple solution:: add gas: 500000, (remember to add the comma at the end) in the .js truffle

module.exports = {
  networks: {
    development: {
      host: "localhost",
      port: 8001,
      network_id: 1234, // Match any network id
      gas: 500000
    }
  }
};

      

+1


source







All Articles