1

I deployed my smart contract to the ropsten testnet and everything worked fine. Now I wand to deploy it to the mainnet and I always get an error. How is that possible? What can I do?

Setup

  • Truffle v4.0.4 (core: 4.0.4)
  • Solidity v0.4.18 (solc-js)
  • geth v1.7.3

Deployment

1. The Ethereum Node is up and running

geth --fast --cache=1048  --unlock "MyAddress" --rpc --rpcapi "eth,net,web3" --rpccorsdomain '*' --rpcaddr localhost --rpcport 8546

2. the truffle config

module.exports = {
    // See <http://truffleframework.com/docs/advanced/configuration>
    // for more about customizing your Truffle configuration!
    networks: {
        development: {
            host: "127.0.0.1",
            port: 7545,
            network_id: "*" // Match any network id
        },
        ropsten: {
            network_id: 3,
            host: "127.0.0.1",
            port: 8545,
            gas: 4700036
        },
        main: {
            network_id: 1,
            host: "127.0.0.1",
            port: 8546,
            gas: 4612388
        }
    },
    rpc: {
        host: '127.0.0.1',
        post: 8545
    }/*,
    solc: { optimizer: { enabled: true, runs: 200 } }*/
};

3. The migration with truffle

truffle migrate --reset --compile-all --network main

4. the log

Using network 'main'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: insufficient funds for gas * price + value
    at Object.InvalidResponse (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:41484:16)
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:329530:36
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:176186:11
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:325200:9
    at XMLHttpRequest.request.onreadystatechange (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:328229:7)
    at XMLHttpRequestEventTarget.dispatchEvent (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176415:18)
    at XMLHttpRequest._setReadyState (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176705:12)
    at XMLHttpRequest._onHttpResponseEnd (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176860:12)
    at IncomingMessage.<anonymous> (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176820:24)
    at emitNone (events.js:91:20)

What I already checked

  • Yes, the network is fully synced.
  • Yes, I have enough ETH on my account.

UPDATE

When I set gas: 359077 the error is different:

Using network 'main'.

Running migration: 1_initial_migration.js
  Deploying Migrations...
  ... 0x0296d1db2a914b4d09a37881a517c2cb6983867027fa058e3636cdd0e9b79526
  Migrations: 0x73f823c7638cd1a7adc5e746432fc1f9b503d2c4
Saving successful migration to network...
  ... 0x66e08450f3b6fa43dc10b4e4d0a0fa57c57b7713bb4786ad9892769efbbb77f5
Saving artifacts...
Running migration: 2_deploy_contracts.js
  Deploying MyCrowdsale...
  ... undefined
Error encountered, bailing. Network state unknown. Review successful transactions manually.
Error: intrinsic gas too low
    at Object.InvalidResponse (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:41484:16)
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:329530:36
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:176186:11
    at /opt/local/lib/node_modules/truffle/build/cli.bundled.js:325200:9
    at XMLHttpRequest.request.onreadystatechange (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:328229:7)
    at XMLHttpRequestEventTarget.dispatchEvent (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176415:18)
    at XMLHttpRequest._setReadyState (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176705:12)
    at XMLHttpRequest._onHttpResponseEnd (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176860:12)
    at IncomingMessage.<anonymous> (/opt/local/lib/node_modules/truffle/build/cli.bundled.js:176820:24)
    at emitNone (events.js:91:20)
  • It seems the configured gas is not enough for the main network. Try to change its value. – Rajesh Jan 3 '18 at 13:15
  • thank you. I've set it to 8003936 (from eth.getBlock("latest").gasLimit) and still get the same error message. – Nina Jan 3 '18 at 13:24
  • Also tryout as mentioned here ethereum.stackexchange.com/a/9044/20357 – Rajesh Jan 3 '18 at 13:34
  • Making the transaction as described in your link ethereum.stackexchange.com/q/9043/27547 works fine, when I use the geth console. – Nina Jan 3 '18 at 14:28

Your Answer

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

Browse other questions tagged or ask your own question.