What is the default network that truffle migrates to when the config has 2 networks?

0 votes

For the following truffle-config.js file, which has 2 networks listed in module.exports (development and ropsten), if I use the command truffle migrate in the terminal without explicitly saying --network development or --network ropsten, which network will the contract deploy to? Both?

require('dotenv').config();
const Web3 = require("web3");
const web3 = new Web3();
const WalletProvider = require("truffle-wallet-provider");
const Wallet = require('ethereumjs-wallet');

const ropstenPrivateKey = new Buffer(process.env.ROPSTEN_PRIVATE_KEY, "hex")
const ropstenWallet = Wallet.fromPrivateKey(ropstenPrivateKey);
const ropstenProvider = new WalletProvider(ropstenWallet, `https://ropsten.infura.io/${process.env.INFURA_ROPSTEN_ID}`);

module.exports = {
  networks: {
    development: {
      host: "127.0.0.1",
      port: 7545,
      network_id: "*" // Match any network id
    },
    ropsten: {
      provider: ropstenProvider,
      gas: 4600000,
      gasPrice: web3.utils.toWei('55', 'gwei'),
      network_id: "3"
    }
  }
};
Oct 15, 2018 in Blockchain by slayer
• 29,170 points
95 views

1 answer to this question.

0 votes

If --network is unspecified, it deploys to only development. You can confirm this by just running a migrate:

$ truffle migrate
Compiling .\contracts\SimpleContract.sol...
Writing artifacts to .\build\contracts

Using network 'development'.

Network up to date.
answered Oct 15, 2018 by Omkar
• 67,660 points

Related Questions In Blockchain

0 votes
1 answer

Why is it downloading the blocks when I am trying to deploy the ethereum private network?

Once you have installed the Ethereum wallet, ...READ MORE

answered May 3, 2018 in Blockchain by Shashank
• 10,350 points
44 views
+1 vote
1 answer
+1 vote
1 answer

How does a miner get to know that a transaction is verified by all the nodes?

Contrary to the popular belief, it is ...READ MORE

answered Mar 26, 2018 in Blockchain by Johnathon
• 9,080 points
84 views
0 votes
1 answer

Truffle tests not running after truffle init

This was a bug. They've fixed it. ...READ MORE

answered Sep 11, 2018 in Blockchain by Christine
• 15,790 points
169 views
0 votes
1 answer
0 votes
1 answer

Solidity geth: Error encountered during contract execution [Bad instruction]

recipes is a dynamic storage array. You need ...READ MORE

answered Oct 15, 2018 in Blockchain by Omkar
• 67,660 points
100 views
0 votes
2 answers
+1 vote
4 answers