Error encountered, bailing. Network state unknown. Review successful transactions manually. Error: The contract code couldn't be stored, please check your gas amount.
See original GitHub issue- I’ve asked for help in the Truffle Gitter before filing this issue.
Issue
I’ve created a simple Token.sol file, and a simple TokenCrowdsale.sol file, as well as a 2_deploy_contracts.js file. By simple, I mean I haven’t changed much from the default that I imported, and I followed this guide mostly: https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6
My issue is when I run truffle migrate --network development as I’ve defined in truffle.js, it gives me the error in the title. I’ve also set gas in truffle.js to 5000000. I’m using testrpc.
Steps to Reproduce
Follow this guide: https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6 Run truffle compile Set up a testrpc network Set gas in truffle.rpc to 5000000 Run truffle migrate
Expected Behavior
Truffle migrate should complete without errors, and successfully deploy my Smart Contract to my testrpc network.
Actual Results
It failed to run the command with this error:
truffle migrate --network development Compiling ./contracts/Migrations.sol... Writing artifacts to ./build/contracts Using network 'development'. Running migration: 1_initial_migration.js Replacing Migrations... ... 0x0fcfb99e1aabd106464c74ab56180d086472d1bfb5955a55cbdef00cde55e31f Migrations: 0xfc2e6fbeacf68cfe910f02dfcc53a61db55777aa Saving successful migration to network... ... 0xa80ecb06702cc81d525331c996d8039305e5335ab209d86803f314bdc92406ab Saving artifacts... Running migration: 2_deploy_contracts.js Deploying EonTokenCrowdsale... ... 0xbf89a4c6238feb52246f8c4ccad59bc2ebbe2ff2b08742f88c8daeb980aa0f0e 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/lib/node_modules/truffle/build/cli.bundled.js:329221:46) at /usr/lib/node_modules/truffle/build/cli.bundled.js:39618:25 at /usr/lib/node_modules/truffle/build/cli.bundled.js:331159:9 at /usr/lib/node_modules/truffle/build/cli.bundled.js:175492:11 at /usr/lib/node_modules/truffle/build/cli.bundled.js:314196:9 at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/cli.bundled.js:315621:13) at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/cli.bundled.js:70159:18) at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/cli.bundled.js:70449:12) at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/cli.bundled.js:70604:12) at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:70564:24)
Environment
- Operating System: Ubuntu 16.04 LTS
- Truffle version: 4.0.1
- Ethereum client: Testrpc?
- node version: 6.11.5
- npm version: 3.10.10
- Solidity Version: 0.4.18
Issue Analytics
- State:
- Created 6 years ago
- Reactions:18
- Comments:25 (2 by maintainers)
I am also facing the same issue in truffle 4. While trying to migrate a basic ICO smart contract. OS - Ubuntu, Finally it is working for me now. Try adding the max gas while deploying in 2_deploy_contracts.js deployer.deploy(Cont1, {gas: 6721975, from: “0xaddr”}); To get gaslimit 6721975, I used web3.eth.getBlock(“pending”).gasLimit.
@microdesign Thank you very mush, your scripts is running well, and I still have an error, as a matter of fact, I’ve seen this mistake many times before, but I don’t know why.
As you can see, Total two contracts, the first named
GustavoCoin
succeeded, but the secondGustavoCoinCrowdsale
failed.This error is importent for me, Thank you very much for helping me solve these difficulties. Thank you again.