7

I'm trying to change the settings for my truffle develop node, but the values in truffle.js don't seem to work. Here's what I have there:

  networks: {
    development: {
      host: "127.0.0.10",
      port: 95455,
      network_id: "*", // Match any network id
      gas: 47123880,
      gasPrice: 1000
    }
  }

Note that I tried to change the host and port values, but I still see Truffle Develop started at http://localhost:9545/ when I start truffle develop. So I suppose the gas value doesn't affect anything as well.

4 Answers 4

3
$ truffle develop

starts an interactive console that also starts a testnet locally on port 9545 for you with default accounts. This is for quick testing if you don't have any node running.

If you want to start an interactive console and attach to an already existing node:

$ truffle console

This will look for network 'development' in your configuration file, unless your specify the --network option. See reference here

2
  • so there's no way to change the configuration for the truffle develop node? like, change gasLimit?
    – ulu
    Commented Feb 18, 2018 at 15:00
  • pretty sure it reads gasLimit from your regular config file, github.com/trufflesuite/truffle-core/blob/…
    – Theo Port
    Commented Feb 20, 2018 at 15:32
2
truffle develop

will read "develop" section instead of "development" section in truffle-config.js.

From it's prompt:

truffle(develop)>

we should know it use network 'develop'.

You can make customization in "develop" section.

From:

https://github.com/trufflesuite/truffle/blob/develop/packages/core/lib/commands/develop.js#L69-L82

You can find available customization from "customConfig".

For some options, the name of customConfig is different from options.

    const ganacheOptions = {
      host: customConfig.host || "127.0.0.1",
      port: customConfig.port || 9545,
      network_id: customConfig.network_id || 5777,
      total_accounts: customConfig.accounts || 10,
      default_balance_ether: customConfig.defaultEtherBalance || 100,
      blockTime: customConfig.blockTime || 0,
      fork: customConfig.fork,
      mnemonic,
      gasLimit: customConfig.gas || 0x6691b7,
      gasPrice: customConfig.gasPrice || 0x77359400,
      noVMErrorsOnRPCResponse: true,
      time: config.genesis_time
    };
1

If your on Linux, type which truffle I get this /home/dave/.nvm/versions/node/v8.11.1/bin/truffle then open that file in a text editor, and find the variable called defaultEtherBalance, I found it on line 581569. Save and restart truffle develop!

1
  • you can also increase the block gas limit here, from the top of the file, i think its the first search result for gas:
    – Barrard
    Commented Mar 11, 2019 at 0:35
0

Now that our configuration is set up, we can now deploy to the live network. When deploying, we must specifically ask for the live network or else Truffle will fall back to the default configuration. To do so, we can deploy with the following command:

$ truffle migrate --networkid 13

This mines Ethereum public network . Ethereum public network create then network id change .

thanks

1
  • I was asking specifically about truffle develop. When I tried truffle migrate with these settings, it, predictably, failed.
    – ulu
    Commented Feb 18, 2018 at 14:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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