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,370 points
1,647 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
• 69,220 points

Related Questions In Blockchain

0 votes
0 answers
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,400 points
654 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 27, 2018 in Blockchain by Johnathon
• 9,090 points
2,838 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
1,922 views
0 votes
1 answer

Hyperledger Sawtooth vs Quorum in concurrency and speed Ask

Summary: Both should provide similar reliability of ...READ MORE

answered Sep 26, 2018 in IoT (Internet of Things) by Upasana
• 8,620 points
1,451 views
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
• 69,220 points
1,464 views
0 votes
2 answers

Why is network already up to date while trying to deploy a contract on truffle?

I guess you have ganache running already ...READ MORE

answered Apr 24, 2018 in Blockchain by Shashank
• 10,400 points
4,565 views
+1 vote
4 answers
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP