Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Error encountered, bailing. Network state unknown. Gas is 4700000 #660

Closed
1 task done
dcnl1980 opened this issue Nov 2, 2017 · 63 comments
Closed
1 task done

Error encountered, bailing. Network state unknown. Gas is 4700000 #660

dcnl1980 opened this issue Nov 2, 2017 · 63 comments
Labels

Comments

@dcnl1980
Copy link

dcnl1980 commented Nov 2, 2017


Issue

What the issue is, in broad strokes.

Error encountered, bailing. Network state unknown.

Running migration: 2_deploy_contracts.js
Deploying NEXTTokenCrowdsale...
... 0x3b22b5c2795c0a9f53a5295cca84af1ddcaafd363120738fa126af8be0b256fa
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.
at Object.callback (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:329221:46)
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:39618:25
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:331159:9
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:175492:11
at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:314196:9
at XMLHttpRequest.request.onreadystatechange (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:315621:13)
at XMLHttpRequestEventTarget.dispatchEvent (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70159:18)
at XMLHttpRequest._setReadyState (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70449:12)
at XMLHttpRequest._onHttpResponseEnd (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70604:12)
at IncomingMessage. (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:70564:24)

Steps to Reproduce

Please provide the shortest amount of steps to reproduce your issue.

With every contract deployment on Ropsten or private blockchain we get this error after running the command:

truffle deploy --network='ropsten' --reset

Yesterday everything worked!

Expected Behavior

What you expected to happen.

No deployments of contracts possible.

Actual Results

What actually happened. Please give examples and support it with screenshots, copied output or error messages.

Environment

  • Operating System: MacOS High Sierra
  • Truffle version: 4.0.1
  • Ethereum client: Geth 1.7.2-stable
  • node version: 8.4.0
  • npm version: 5.5.1
@gnidan
Copy link
Contributor

gnidan commented Nov 3, 2017

The problem is likely that the optimizer is now disabled by default in Truffle 4, and I believe Ropsten's block gas limit may be too low.

You can find background on why we disabled the optimizer in trufflesuite/truffle-compile#5, and instructions for re-enabling it in the docs. Let me know if you try that and if it works. Thanks!

@Bowfish
Copy link

Bowfish commented Nov 5, 2017

I enabled the optimizer according your the description in the docs. Here is my truffle.js file:

module.exports = {
	networks: {
		development: {
			host: "localhost",
			port: 8545,
			network_id: "*"
		}
	},
	rpc: {
		host: "localhost",
		gas: 4712388,
		port: 8545
	},
	solc: {
		optimizer: {
			enabled: true,
			runs: 200
		}
	},
};

If I run:
$ truffle migrate --reset

I get the following error:

Using network 'development'.

Running migration: 1_initial_migration.js
Deploying Migrations...
... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: Error: Exceeds block gas limit
.
.
.

$ truffle version
Truffle v4.0.1 (core: 4.0.1)
Solidity v0.4.18 (solc-js)

Do you have any idea what is going wrong there?

@aliniacb
Copy link

aliniacb commented Nov 5, 2017

I'm getting the same errors after updating to latest truffle and testrpc. If I set a gas param in truffle.js I get
screenshot from 2017-11-05 10-56-07
image

This never happened before updating. Nothing's changed in my contracts. Only updated truffle and testrpc. On the other hand if I run truffle develop and then migrate everything works fine.
Updating also affected deploy to rinkeby where I get out of gas error.

@wzbbbb
Copy link

wzbbbb commented Nov 6, 2017

I got the same problem as @Bowfish

@DOkwufulueze
Copy link

From this issue, you may need to split up your contracts into smaller contracts so they get easily deployed with a gas amount that is within the block limit, as enabling solc optimizer may not be exactly what you want to do [you may begin to have bytecodes that behave differently from your source code].

Visit the truffle release page to see security concerns associated with enabling solc optimizer.

Hope this helps.

@Bowfish
Copy link

Bowfish commented Nov 7, 2017

Unfortunately this doesn't help. I tested it with the default Metacoin.sol contract which is created with truffle init. Therefore the bug must be somewhere else.

@DOkwufulueze
Copy link

Oh! Then the bug must be somewhere else for sure. I'll keep checking for a working solution and inform here if possible.

@aliniacb
Copy link

aliniacb commented Nov 7, 2017

There's an issue with this version of truffle for sure. Did a clean ubuntu install with latest node, truffle, testrpc and I get out of gas in any situation. So having optimization flag enabled in truffle.js does not help. I've used for this test some really simple contracts. For example https://github.com/LindaHealthcareICO/linda-crowdsale used to work with previous truffle version. Please note if you test those contracts there's a typo in their package.json file (a trailing coma in the scripts section) so you should fix that before installing.

@Bowfish
Copy link

Bowfish commented Nov 7, 2017

I installed truffle 4.0.0-beta.0 and everything is working fine.

@aliniacb
Copy link

aliniacb commented Nov 7, 2017

Worked for me too. Downgrading fixed the issue!

@tcoulter
Copy link
Contributor

tcoulter commented Nov 7, 2017

Hi everyone. Thanks for the feedback.

Are you all using the TestRPC? If so, try using truffle develop instead, and let us know if the issues disappear. Please refer to the 4.0 release notes for more information about truffle develop.

@aliniacb
Copy link

aliniacb commented Nov 7, 2017

@tcoulter Hi, yes, I'm on testrpc. As previously mentioned truffle develop works fine but I've chosen testrpc because I couldn't get the created accounts private keys nor set a custom balance for each account.
Thanks!

@Bowfish
Copy link

Bowfish commented Nov 7, 2017

I'm on testrpc too.

@Bowfish
Copy link

Bowfish commented Nov 8, 2017

I tested it on truffle develop and everything is working fine. This is much more convenient than testrpc. Great job!

Is it possible to create more than 10 accounts in truffle develop in the same way as with testrpc --accounts 20 ?

@sorccu
Copy link

sorccu commented Nov 9, 2017

It seems that gas and gasPrice from truffle.js are not getting passed to TestRPC anymore, though I don't know how and when exactly they were passed earlier. Starting TestRPC with --gasLimit 6721975 --gasPrice 100000000000 (to mimic the hardcoded default values in truffle-core) made our tests work again.

@danielnovy
Copy link

Just to reinforce the thread, I was facing the same issue. Downgrading truffle to 4.0.0-beta.0 fixed the issue.

@ButSoft
Copy link

ButSoft commented Nov 10, 2017

Ubuntu 16.04
sudo npm uninstall -g truffle
sudo npm install -g truffle@beta
truffle deploy
Error encountered, bailing. Network state unknown.

@Bowfish
Copy link

Bowfish commented Nov 10, 2017

I had the same error, but with truffle develop it works perfect. You can use truffle develop instead of testrpc. With truffle develop you have the same functionality as with testrpc but with some additional cool features.

@aliniacb
Copy link

What about migrating to a remote test network. Are you sure the issue won't be there? Truffle develop works for me too but when I try to migrate the code to rinkeby I get the same out of gas error.

@safouanenac
Copy link

Same problem, I solve it by forcing --gasLimit to a high value "9999999999"

@antony
Copy link

antony commented Nov 14, 2017

Same error on Ubuntu with Truffle 4.0.1, using testrpc

setting gas limit does not help.

downgrading to @beta works fine.

@camelscript
Copy link

camelscript commented Nov 15, 2017

Having the same issue, downgrading did'nt help. Everything works on local TestRpc, but if I try to publish it to Ropsten or Rinkeby via Geth it wont work.
Ubuntu 16.04
Truffle v4.0.0-beta.0
Geth 1.7.2-stable-1db4ecdc

@nabgilby
Copy link

I second sorccu, used testrpc -p 8546 --gasLimit 6721975 --gasPrice 100000000000 and contract migrations worked with [email protected]

@msturlesi
Copy link

Had the same issue with truffle 4.0.1 and testrpc and had to set gas limit and price as advised. Just updated testrpc to latest version (EthereumJS TestRPC v6.0.3 (ganache-core: 2.0.2)) and it works for me without setting gas. Haven't tried deploying on test networks yet. If it still doesn't work on those, does anyone in truffle support have an idea when it will be fixed please?

@demisstif
Copy link

same issue:I use truffle+infura
ubuntu 16.04
truffle V3.4.9

@ghost
Copy link

ghost commented Dec 10, 2017

Same issue:
Mac OSx High Sierra
truffle V4.0.1
testrpc

Everything works using the solution provided by sorccu

@habdelra
Copy link

Same issue:
Mac OSx High Sierra
truffle V4.0.4
ganache-cli: V6.0.3

Sorccu's suggestion above also resolved this issue for me

@SSPgg
Copy link

SSPgg commented Dec 30, 2017

Try adding the max gas while deploying in 2_deploy_contracts.js
deployer.deploy(Con1, {gas: 6721975, from: "0xaddr"});
To get gaslimit 6721975, I used web3.eth.getBlock("pending").gasLimit. This is working for me in ubuntu , truffle4.0.0

@MeHighP
Copy link

MeHighP commented Mar 1, 2018

How does your migration file look like?

@quantumproducer
Copy link

truffle deploy --network live is failing for me with:

module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*", // Match any network id
      from: "0xa281cd2ba15dc43f8110ddaee837274800931f7e",
      gas: 5000
    },
    live: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*",
      from: "0xa281cd2ba15dc43f8110ddaee837274800931f7e"
    },
    kovan: {
      network_id: 42,
      host: "127.0.0.1",
      port: 8545,
      from: "0x33dbe8478805cf734184aeD8737607656252D804",
      gas: 5000000
    }
  }
};

@MeHighP
Copy link

MeHighP commented Mar 2, 2018

Ok, but what about the file that deploys the actual contracts? (e.g. 2_deploy_contracts.js) I got the error "The contract code couldn't be stored, please check your gas amount" when this file was not correct.

@chevdor
Copy link

chevdor commented Mar 7, 2018

I ran into the same issue with truffle 4.1.0 using ganache.
I tried adding rpc and solc options to truffle.js => no improvement.

I downgraded to 4.0.7 => no improvement
I downgraded to 4.0.5 (npm i -g [email protected]) => problem solved.
4.0.6 fails as well.

@cgewecke
Copy link
Contributor

cgewecke commented Mar 8, 2018

@chevdor Apologies, could you provide any additional context or information - for example your truffle.js? Is the project you're working on public?

There was quite a bit added in the 4.0.6 release - if you've managed to isolate that as a source of problems it would be nice to resolve them.

@quantumproducer
Copy link

quantumproducer commented Mar 8, 2018

I updated geth & truffle today.

Now I'm getting "Transaction not found after 50 blocks" when trying to deploy to mainnet.

I tried setting my gas higher than anything on http://ethgasstation.info/ , still with no publication of the contract.

truffle.js:

live: { host: "127.0.0.1", port: 8545, network_id: "*", from: "0xa281cd2ba15dc43f8110ddaee837274800931f7e", gasPrice: 9, gas: 200000 },

(I also tried with gasPrice: 1, 2 and 3)

and here's the log from truffle migrate --network=live --verbose-rpc

"jsonrpc": "2.0",

"id": 5, "method": "eth_sendTransaction", "params": [ { "from": "0xa281cd2ba15dc43f8110ddaee837274800931f7e", "gas": "0x30d40", "gasPrice": "0x204876e800", "data": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820d665cc9568c7a7748b83ea660894eb49b5ca37bea613615823cc9fdd35ac51260029" } ] }

eth.getBalance(eth.accounts[1])
100000000000000000

which is plenty more than gas * gasPrice.

/geth version
Geth
Version: 1.8.2-stable
Architecture: amd64
Protocol Versions: [63 62]
Network Id: 1
Go Version: go1.10
Operating System: darwin
GOPATH=/Users/quantum/code/go
GOROOT=/usr/local/Cellar/go/1.10/libexec
~/truffle version
Truffle v4.0.6 (core: 4.0.6)
Solidity v0.4.19 (solc-js)

and to the end..

  >   "jsonrpc": "2.0",
   >   "id": 1568,
   >   "method": "eth_uninstallFilter",
   >   "params": [
   >     "0xbe6517333d9e36227699e900b12523bc"
   >   ]
   > }
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: Contract transaction couldn't be found after 50 blocks
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/contract.js:112:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/filter.js:128:1
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/filter.js:127:1
    at Array.forEach (<anonymous>)
    at Object.onMessage [as callback] (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/filter.js:125:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:259:1
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:258:10
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-migrate/index.js:225:1

@habdelra
Copy link

habdelra commented Mar 8, 2018

@quantumproducer the gasPrice in your truffle.js is in units of wei, so setting a gas price of "9" is basically like not providing any gas. probably you meant 9 gwei which i think is 9000000000

@quantumproducer
Copy link

Ah I read ina blog post that gas was done in GWei, I see now that's just how it's referred to but the vlaues are in wei.
@habdelra I tried with 7000000000 Same result.
https://ethgasstation.info/ says gas price is 3 Gwei

@mradkov
Copy link

mradkov commented Mar 8, 2018

I have the same problem. And none of the solutions helps.

Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: The contract code couldn't be stored, please check your gas amount.

image

@quantumproducer
Copy link

quantumproducer commented Mar 8, 2018

@mradkov edit, nvm re: gas

@mradkov
Copy link

mradkov commented Mar 8, 2018

@quantumproducer The strange thing is the contract is working just fine when published by web3 or in remix. (Tested on Ropsten).

@quantumproducer
Copy link

I'm still getting this issue on mainnet. Btw Mradkov how did you calculate the gas usage exactly for your contract deployment? (Something in truffle?)

@litch
Copy link

litch commented Mar 8, 2018

I'm having a similar issue, though specifically with mainnet:

I'm trying to only deploy the Migrations.sol

module.exports = {
  solc: {
    optimizer: {
      enabled: true,
      runs: 200
    }
  },
  networks: {
    development: {
      host: 'localhost',
      port: 8545,
      network_id: '*' // Match any network id
    },
    rinkeby: {
      host: "localhost",
      port: 8545,
      network_id: "4",
      from: '...',
      gas: 4500000,
      gasPrice: 21000000000
    },
    mainnet: {
      network_id: 1,
      from: '...',
      host: "localhost",
      port: 8546   // Different than the default
    }
  }
}

I've tried lots of combinations of gas and gasPrice. Very confusing.

truffle migrate --network mainnet -f 1 --reset
Using network 'mainnet'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: exceeds block gas limit

geth version 1.8.2
truffle version 4.1.0 and 4.1.3

It works swimmingly on rinkeby and testrpc.

Any suggestions?

@quantumproducer
Copy link

@mradkov I'm able to deploy to kovan fine. I need to deploy to the main net.
Remix gives me the error: https://github.com/ethereum/remix/issues/716

@litch
Copy link

litch commented Mar 9, 2018

BTW, my issue here wound up being that my node was not fully synced. I should probably create a new issue, "When trying to deploy to a node that is not fully synced, an error about gas limit is given, rather than something that makes sense"

@quantumproducer
Copy link

Agreed, the same error confused me to. It wasn't clear from the error that you had to sync to deploy.
I get this error now, after syncing.

Here's my truffle migrate --network=live --verbose-rpc log:

  >   "jsonrpc": "2.0",
   >   "id": 5,
   >   "method": "eth_sendTransaction",
   >   "params": [
   >     {
   >       "from": "0xa281cd2ba15dc43f8110ddaee837274800931f7e",
   >       "gas": "0x3d0900",
   >       "gasPrice": "0x218711a00",
   >       "data": "0x6060604052341561000f57600080fd5b336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102db8061005e6000396000f300606060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100a05780638da5cb5b146100c9578063fdacd5761461011e575b600080fd5b341561007257600080fd5b61009e600480803573ffffffffffffffffffffffffffffffffffffffff16906020019091905050610141565b005b34156100ab57600080fd5b6100b3610224565b6040518082815260200191505060405180910390f35b34156100d457600080fd5b6100dc61022a565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b341561012957600080fd5b61013f600480803590602001909190505061024f565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415610220578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b151561020b57600080fd5b6102c65a03f1151561021c57600080fd5b5050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102ac57806001819055505b505600a165627a7a72305820d665cc9568c7a7748b83ea660894eb49b5ca37bea613615823cc9fdd35ac51260029"
   >     }
   >   ]
   > }
 <   {
 <     "jsonrpc": "2.0",
 <     "id": 5,
 <     "result": "0x4afc5333a0c12c03b5d0866e819a909ed5fa37f94d583824f14d4d97f8ec0272"
 <   }
  ... 0x4afc5333a0c12c03b5d0866e819a909ed5fa37f94d583824f14d4d97f8ec0272
   > {
module.exports = {
  solc: {
    optimizer: {
      enabled: true,
      runs: 2000
    }
  },
  // See <http://truffleframework.com/docs/advanced/configuration>
  networks: {
    development: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*", // Match any network id
      from: "0xa281cd2ba15dc43f8110ddaee837274800931f7e",
      gas: 5000
    },
    live: {
      host: "127.0.0.1",
      port: 8545,
      network_id: "*",
      from: "0xa281cd2ba15dc43f8110ddaee837274800931f7e",
      gasPrice: 9000000000,
      gas: 4000000
    },
    kovan: {
      network_id: 42,
      host: "127.0.0.1",
      port: 8545,
      from: "0x33dbe8478805cf734184aeD8737607656252D804",
      gas: 5000000
    }
  }
};

"Contract couldn't be found after 50 blocks"

Why? I'm offering 9 GWEI for gas. Why does this happen?

I've tried without the optimizer, too. geth is 1.8.2

Truffle v4.0.6 (core: 4.0.6)
Solidity v0.4.19 (solc-js)

I'm unable to deploy my smart contract while this is happening.

@quantumproducer
Copy link

Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: Contract transaction couldn't be found after 50 blocks
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/contract.js:112:1
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/filter.js:128:1
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/filter.js:127:1
    at Array.forEach (<anonymous>)
    at Object.onMessage [as callback] (/usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/filter.js:125:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:259:1
    at Array.forEach (<anonymous>)
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/web3/lib/web3/requestmanager.js:258:10
    at /usr/local/lib/node_modules/truffle/build/webpack:/~/truffle-migrate/index.js:225:1

@res-Q
Copy link

res-Q commented Mar 20, 2018

I am experiencing the same issue...

Truffle v4.1.3 (core: 4.1.3)
Solidity v0.4.19 (solc-js)

The contract deploys just fine to Ganache development network.
The contract fails to upload to Ropsten test network.

My truffle.js source:

module.exports = {
networks: {
development: {
host: "127.0.0.1",
port: 7545,
network_id: "*" // Match any network id
},

    ropsten: {
        host: "127.0.0.1",
        port: 8545,
        network_id: 3,
        gas: 4698712,
        //gasPrice: 100000000000,
        from: "0x689bb9068f12BfaCEF6aeeC6f37d9fa5963d4bd7" //<your unlocked ropsten account address>
    },
},

};

@res-Q
Copy link

res-Q commented Mar 21, 2018

Following up from my post yesterday... was able to deploy successfully using the GAS Limit specified in Ropsten Etherscan.

How I did it...

  1. Deployed a small contract to Ropsten successfully
  2. Viewed the contract in https://ropsten.etherscan.io.
  3. Clicked on the 'Transaction Hash' of the deployed contract to reveal information about the network.
  4. Gas Limit displays as: 1828127 (provided screenshot)

image

  1. Modified 'truffle.js' to the following...
ropsten: {
        host: "127.0.0.1",
        port: 8545,
        network_id: 3,
        gas: 1828127,  // <- new GAS LIMIT value
        //gasPrice: 100000000000,
        from: "0x689bb9068f12BfaCEF6aeeC6f37d9fa5963d4bd7" //<your unlocked ropsten account address>
    },
  1. Deleted build folder from truffle project
  2. Ran command: truffle compile
  3. Ran command: truffle migrate --network ropsten

output:

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... 0x3f70c4a4a5edb7e36d6912029f25e03b2d0d89272fa4e8d18245c2994ef73eb5
  Migrations: 0xfbd7c346839fe9715bedb9003a01986802f229f0
Saving successful migration to network...
  ... 0xc2a0c7670c91f45a7c498fbc9595fde62c8b6f61e060eb4c12e443af73eb118e
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying Adoption...
  ... 0x380c2e0761120168f2031f869d6aa7bf48e3c3affeb8f41fea9798403aa3555f
  Adoption: 0x9b91cf236739a0c2e61c08c0ee481224b9c02cdd
Saving successful migration to network...
  ... 0x539c94a23026196c18cf6c31848fc8a8c2273c1c8787165f89ddec263da20051
Saving artifacts...

='s Success :)

@sidsverma
Copy link

What worked for me is:
truffle migrate --clean --network ropsten

@stale
Copy link

stale bot commented Nov 30, 2018

Thank you for raising this issue! It has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. If you would like to keep this issue open, please respond with information about the current state of this problem.

@stale stale bot added the stale label Nov 30, 2018
@stale
Copy link

stale bot commented Dec 8, 2018

There has been no new activity on this issue since it was marked as stale 7 days ago, so it is being automatically closed. If you'd like help with this or a different problem, please open a new issue. Thanks!

@JackBekket
Copy link

Error 'The contract code couldn't be stored, please check your gas amount.'

As I just learned - if you get this error while deploing to private network - it could signal, that remote node have wrong evm version

@JackBekket
Copy link

Also truffle could try to compile and deploy contracts for petersburg at byzantine network and give only
Error 'The contract code couldn't be stored, please check your gas amount.

You can check difference your local ganache evm version and version of other chain you want to deploy to

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests