0

I am trying to deploy contracts using truffle framework. I have multiple contracts, all of them are linked appropriately.

Example:

Governance contract is the main contract. There are other individual contracts which are imported and used in Governance contract.

Infrastructure:

1) geth version - 1.6 2) truffle version - 3.3.1

I am using a private chain to deploy a contract.I have purposely set a higher

gas limit in genesis JSON file
    "gasLimit": "900000000000",


While deploying - in truffle.js I have set very high gas limit as 

    staging: {
      host: "192.168.100.5",
      port: 8001,   // Different than the default below
      network_id: 1407,
      gas:799999999999
//      gasPrice:1000000000000
     }

In spite of high gas limit, truffle deployment fails with following error. I am not sure how to proceed

Using network 'staging'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  Migrations: 0x15dce2e6ad79f7d6bc7d40c746b1f9604f7d2566
Saving successful migration to network...
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying Purchase...
  Purchase: 0x2c0b177a1e272a3cc939c8a3d96482e44742e90e
  Deploying SellerWarehouse...
  SellerWarehouse: 0x73f628469da45dd241034c7c1f2bca4236e3cf98
  Deploying AdvisingBankRegistry...
  AdvisingBankRegistry: 0x09b2f07473b578d85945c42cef7d6681a5aa28de
  Deploying IssuingBankRegistry...
  IssuingBankRegistry: 0xa59de5dced25f414be5eb982ed4d52d01349e8b9
  Deploying BuyerRegistry...
  BuyerRegistry: 0x665c371ef610e64035536e812938363044d7c113
  Deploying CarrierRegistry...
  CarrierRegistry: 0x822fd29dfb933a7e2bf2f0710b52bdca4d0ef474
  Deploying Governance...
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:204860:46)
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:31793:25
    at /usr/lib/node_modules/truffle/build/cli.bundled.js:206693:9
    at XMLHttpRequest.request.onreadystatechange (/usr/lib/node_modules/truffle/build/cli.bundled.js:205469:13)
    at XMLHttpRequestEventTarget.dispatchEvent (/usr/lib/node_modules/truffle/build/cli.bundled.js:207342:18)
    at XMLHttpRequest._setReadyState (/usr/lib/node_modules/truffle/build/cli.bundled.js:207632:12)
    at XMLHttpRequest._onHttpResponseEnd (/usr/lib/node_modules/truffle/build/cli.bundled.js:207787:12)
    at IncomingMessage.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:207747:24)
    at emitNone (events.js:91:20)
    at IncomingMessage.emit (events.js:185:7)
    at endReadableNT (_stream_readable.js:974:12)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)
1

One fix could be - Breaking your migration file into multiple. For instance, in this case, 2_deploy_contracts.js seems to have 7 contracts deployments.

I've faced the similar issue before and breaking migration files into multiple fixes this issue in some cases.

Hope this helps.

1

If anyone else is getting the error:

Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: VM Exception while processing transaction: out of gas

Delete the ./build directory and enable the solc optimizer in truffle.js:

module.exports = {
    networks: {
        development: {
            host: "localhost",
            port: 8545, // Using ganache as development network
            network_id: "*",
            gas: 4698712,
            gasPrice: 25000000000
        }
    },
    solc: {
        optimizer: {
            enabled: true,
            runs: 200
        }
    }
};

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.