question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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:closed
  • Created 6 years ago
  • Reactions:18
  • Comments:25 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
SSPggcommented, Dec 30, 2017

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.

1reaction
ccpwcncommented, Jun 19, 2018

@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.

Running migration: 4_deploy_contracts.js
  Running step...
  Replacing GustavoCoin...
  ... 0x90e4ed09904ac9dc6f98dc60bd1d4833e41205e2142e493fcda0c457a28fa6d7
  GustavoCoin: 0x5657e26deed4899e34e57e66d7bd4f91e8fc802f
  Replacing GustavoCoinCrowdsale...
  ... 0x81c9640c7f1188c58fef21cc84b11c28641722082c3e287fd78566c56524ffc0
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: VM Exception while processing transaction: revert
    at Object.InvalidResponse (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\errors.js:38:1)
    at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\requestmanager.js:86:1
    at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-migrate\index.js:225:1
    at C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\truffle-provider\wrapper.js:134:1
    at XMLHttpRequest.request.onreadystatechange (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\web3\lib\web3\httpprovider.js:128:1)
    at XMLHttpRequestEventTarget.dispatchEvent (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:64:1)
    at XMLHttpRequest._setReadyState (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:354:1)
    at XMLHttpRequest._onHttpResponseEnd (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:509:1)
    at IncomingMessage.<anonymous> (C:\Users\mslw_\AppData\Roaming\npm\node_modules\truffle\build\webpack:\~\xhr2\lib\xhr2.js:469:1)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)

As you can see, Total two contracts, the first named GustavoCoin succeeded, but the second GustavoCoinCrowdsale failed.

This error is importent for me, Thank you very much for helping me solve these difficulties. Thank you again.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error encountered, bailing. Network state unknown. ...
To deploy your contracts, you need to create a file in migrations/2_deploy_contracts.js that contains the deployment part of TestCrowsale.
Read more >
How to solve network state unknown Review successful ...
Network state unknown. Review successful transactions manually. Error: The contract code couldn't be stored, please check your gas amount.
Read more >
provable/ethereum-api
Network state unknown. Review successful transactions manually. Error: The contract code couldn't be stored, please check your gas amount.
Read more >
Please check your gas amount - Learn. Share. Improve
Network state unknown. Review successful transactions manually. Error: The contract code couldn't be stored, please check your gas amount.
Read more >
Truffle error: Error encountered, bailing. Network state ...
Do you also see an error this error. Error: insufficient funds for gas * price + value. In that case, the ethereum account...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found