当配置有2个网络时,松露会将哪些网络迁移到默认状态?

时间:2018-06-01 04:13:29

标签: ethereum solidity truffle

对于以下truffle-config.js文件,其中有module.exports(开发和ropsten)中列出的2个网络,如果我在终端中使用命令 truffle migrate 而没有明确说明 - 网络开发 - network ropsten ,合同将部署到哪个网络?既?

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"
    }
  }
};

1 个答案:

答案 0 :(得分:0)

如果未指定--network,则仅部署development。您只需运行迁移即可确认:

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

Using network 'development'.

Network up to date.