Unable to run truffle 2 1 2 migrate --network live Exceeds block gas limit

0 votes

I am using truffle@2.1.2 to deploy smart contracts against a localhost:8545 geth@1.5.9-stablerpc, using an account that is funded with Ether has been unlocked using personal.unlockAccounton the geth console.

I have also tried the same against a remote Parity node via RPC, but this is the latest which I am rather 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)"
    }
  }
};

truffle migrate --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 adjusting gas and gasPrice, but am unable to find values that have any affect.

How can I solve this problem?

Sep 24, 2018 in Blockchain by digger
• 26,740 points
1,755 views

4 answers to this question.

0 votes

I was able to solve this by simply setting gas: 3000000 in the network config.

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

It cost about 0.5 ETH to run migrations and took several minutes.

answered Sep 24, 2018 by slayer
• 29,370 points
0 votes

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 the balance is 0 mine some blocks or edit your genesis file.

answered Sep 28, 2018 by Balaji
0 votes

One solution is to indicate the network id when calling truffle,as:

truffle migrate --network live

and you should modify "from" tag in truffle.js with your unlocked account.

answered Sep 28, 2018 by Sumitra
0 votes

A simple solution to avoid this is:

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

You're Welcome ;-)

answered Sep 28, 2018 by Ludo

Related Questions In Blockchain

0 votes
1 answer

Intrinsic gas too low and exceeds block limit

If you are talking about the public ...READ MORE

answered Aug 29, 2018 in Blockchain by digger
• 26,740 points
3,049 views
0 votes
1 answer

Solidity Error: Exceeds block gas limit

Remove the line norpc:true and change the ...READ MORE

answered Jan 24, 2019 in Blockchain by Omkar
• 69,220 points
2,891 views
+1 vote
1 answer
0 votes
1 answer

What if Gas required in my program exceeds the limit of 3000000?

Going through your code, I noticed that  you ...READ MORE

answered May 29, 2018 in Blockchain by Perry
• 17,100 points
813 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
1,937 views
0 votes
1 answer

Solidity geth: Error encountered during contract execution [Bad instruction]

recipes is a dynamic storage array. You need ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 69,220 points
1,476 views
0 votes
2 answers

Why is network already up to date while trying to deploy a contract on truffle?

I guess you have ganache running already ...READ MORE

answered Apr 24, 2018 in Blockchain by Shashank
• 10,400 points
4,589 views
0 votes
1 answer

How can I deploy a HelloWorld contract on my testrpc network?

The problem lies in the command: truffle migrate Your truffle migrate command ...READ MORE

answered Apr 27, 2018 in Blockchain by Perry
• 17,100 points

edited Aug 10, 2018 by Omkar 2,877 views
0 votes
1 answer

How to set up Hyperledger Fabric v0.6 network without docker?

Hyperledger Fabric v0.6 does not provide any ...READ MORE

answered Jul 9, 2018 in Blockchain by slayer
• 29,370 points
1,384 views
0 votes
1 answer

AWS multichain network, "Couldn't connect to the seed node" error

The error says "please check multichaind is ...READ MORE

answered Jul 9, 2018 in Blockchain by slayer
• 29,370 points
1,502 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP