0

I have following truffle-config.js file

const fs = require('fs');
const HDWalletProvider = require("truffle-hdwallet-provider");
const secrets = JSON.parse(
  fs.readFileSync("abc.txt").toString().trim()
);

module.exports = {
  networks: {
    ropsten: {
      provider: () =>
        new HDWalletProvider(
          secrets.seed,
          `https://ropsten.infura.io/v3/${secrets.projectId}`
        ),
      network_id: 3 
    }
  }
}

but when i run this command truffle(develop)> migrate --reset --network ropsten, i am facing following error;

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

Unknown network "ropsten". See your Truffle configuration file for available networks.

in my abc.txt file i have

{
  "projectId": "7fb0bdc97cbe419fbdf9690......",
  "seed": "affair rally mail snake clever pony also hundred....."
}
1

I think I know what the problem with this is, just in the place of network_id: 3 put it as network_id:'3', and I think this should start working.

AFAIK the problem is that truffle identifies networks based on network id and it is not able to parse your network_id in a proper way.

Please upvote and accept if it helps. Thanks!!!

Reference: https://www.trufflesuite.com/docs/truffle/reference/configuration

  • perfect .. it works for me .. thanks – Amir Ali Dec 24 '19 at 7:55

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.