0

I am using truffle 5.0.30 and I want to create a development blockchain where I can run and test my contracts. This is the truffle-config.js that I am using:

module.exports = {
  networks: {
    mynet: {
      host: "127.0.0.1",     // Localhost (default: none)
      port: 8547,            // Standard Ethereum port (default: none)
      network_id: "*",       // Any network (default: none)
      gas: 8700000, 
      gasLimit: 8900000
    }
  },

  mocha: {
    // timeout: 100000
  },

  // Configure your compilers
  compilers: {
    solc: {
       //version: "0.6.4",    // Fetch exact version from solc-bin (default: truffle's version)
      // docker: true,        // Use "0.5.1" you've installed locally with docker (default: false)
       settings: {          // See the solidity docs for advice about optimization and evmVersion
        optimizer: {
          enabled: true,
          runs: 100
        },
        //evmVersion: "byzantium"
       }
    }
  }
}

When I start the network with the command truffle develop --network mynet I get this output:

Warning: possible unsupported (undocumented in help) command line option: --network
Connected to existing Truffle Develop session at http://127.0.0.1:9545/
truffle(mynet)>

Which indicates that it has created a blockchain with default values instead of using the ones specified in the mynet configuration. How can I force truffle to use the settings in mynet?

  • 1
    develop is not a valid command-line option, perhaps you wanted to run truffle console --network mynet instead. – Ismael Mar 30 at 21:13
0

If you want to create your own network you should use ganache, ganache-cli or test-rpc. Those are local blockchain test networks you can configure.

After setting up and running your network you should add the network config to your truffle-config.js:

module.exports = {
  networks: {
    development: {
      host: "localhost", // your if
      port: 8545, // Your port
      network_id: "5777" //
      // ...other config
    }
  }
}

Then you can interact with your network via truffle console --network development or migrate contracts via truffle migrate --network development.

| improve this answer | |
0

You can create you own simulated blockchain by running Ganache in a separate process. In the truffle-config.js you can change the specifications of the development network and then just run truffle test it will use development by default. In your case it would probably look like this

development: {
  host: '127.0.0.1', // This might be different for you
  port: 8545, // This might be different for you
  network_id: YOUR_GANACHE_NETWORK_ID,
  gas: 8700000, 
  gasLimit: 8900000
}

or you could probably set the gasLimit when spinning up ganache like so: ganache-cli --gasLimit: 8900000

| improve this answer | |

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.