0

When I try to migrate contract to Ropsten Network (truffle migrate --network ropsten) it keeps migrating the contract on the net with id 4447 unless Ropsten is the only network configured in truffle.js file.

Here is my configuration

module.exports = {
  networks: {
  ropsten: {
    network_id: 3,    
    host: "localhost",
    port: 9545,
    gas: 6712388,
    gasPrice: 65000000000
  }
},
optimizer: {
  "enabled": true,
  "runs": 200
}
};

Snippet of the generated JSON of my contract after truffle migrate --network ropsten

"networks": {
    "4447": {
      "events": {},
      "links": {},
      "address": "0xf204a4ef082f5c04bb89f7d5e6568b796096735a",
      "transactionHash": 
"0x35abaaed14ab37937fdcf38551ee1b6068c5950ad4d59b8df65a6ad852892b13"
    }
  },

Version

-> % truffle version
Truffle v4.1.11 (core: 4.1.11)
Solidity v0.4.24 (solc-js)

Configuration with multiple network as requested by @Roman Frolov

module.exports = {
  networks: {
      development: {
      host: "localhost",
      port: 9545,
      network_id: "*",
      gas: 6712388,
      gasPrice: 65000000000
    }
  ropsten: {
    network_id: 3,    
    host: "localhost",
    port: 9545,
    gas: 6712388,
    gasPrice: 65000000000
  }
},
optimizer: {
      "enabled": true,
      "runs": 200
    }
    };
  • 2
    Can you please provide an example of your truffle.js with multiple networks configuration? – Roman Frolov Jun 22 '18 at 9:58
  • Added to the original question – Takeda925 Jun 22 '18 at 10:13
  • Why are there two lines which say networks: {? Is that correct? There don't seem to be enough }... There are six { but only five } Also, the indentation of both of the configurations seems wrong - although that is only a presentation issue. – Greenonline Jun 22 '18 at 11:56
  • 1
    Yes it is... My fault! Now it's correct! – Takeda925 Jun 22 '18 at 12:05

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.