I have encountered the Exceeds Gas Limit problem back when I was deploying to my local Ganache. I had to refactor my contracts and break it apart to several contracts. I got it to work.
Now, I'm encountering the same when trying to deploy to Ropsten via Infura.
I'm getting the Exceeds Gas Limit even when just deploying Migrations.sol. I have enough gas in my primary account.
My Truffle config is this:
// Allows us to use ES6 in our migrations and tests.
require('babel-register')
var HDWalletProvider = require("truffle-hdwallet-provider");
var infura_apikey = "... ...";
var mnemonic = "... ... ... ...";
module.exports = {
networks: {
development: {
host: 'localhost',
port: 8545,
network_id: '*' // Match any network id
},
ropsten: {
provider: new HDWalletProvider(mnemonic, "https://ropsten.infura.io/"+infura_apikey),
network_id: 3
}
}
}
Initial Migration JS is standard code.
var Migrations = artifacts.require("./Migrations.sol");
module.exports = function(deployer) {
deployer.deploy(Migrations, { gas: 4700000, //may be 21000 - 3000000
gasPrice: 20000000000});
};
What am I missing here? It is failing during initial migration.
Using network 'ropsten'.
Setting gas to 4,700,000 seems to be low. (How can this be? This is just the Migrations contract!)
Running migration: 1_initial_migration.js
Deploying Migrations...
... 0x6810b697ecf938b94a134ed62865b661dcd5f37ae53bd08dc575b8850de968ef
Migrations: 0x64e70064a0b59f8d2b789f7cb50e6a9465abaf35
Saving successful migration to network...
Error encountered, bailing. Network state unknown. Review successful transactions manually.
exceeds block gas limit
Setting it to 4,800,000 seems to exceed Ropsten's limit.
Running migration: 1_initial_migration.js
Deploying Migrations...
Error encountered, bailing. Network state unknown. Review successful
transactions manually. exceeds block gas limit
UPDATE
Eventually I gave up developing on Ropsten, and worked on Rinkeby instead. I didn't have such problems anymore.