I am using Geth configuration files (*.toml) to manage configurations of my private network nodes. The command geth --config=config/<config-name>.toml is used to run nodes on each stack (dev, prod, etc.)

The prod stack is running against the Main Ethereum network, and in this case, the toml configuration is obvious (mostly, the default). However, for the dev stack, I need to provide a configuration that would run geth in the --testnet mode.

Which toml configuration should I give to run the node as if it was run with the --testnet flag?

I tried running geth --testnet dumpconfig but the only difference was really the network id, but it's not sufficient for running against Ropsten. Any pointers on how to define the testnet configuration in a TOML file? Thank you.


if you're planning on setting up your own private network, I believe you're better off starting from scratch i.e. with your own genesis file and node config. But that's not really the concerne here.

I spent quite some time trying everything with the config.toml file before giving up. Some parameters like the networkId were successfully initialized whereas others were not applied (no error returned). I guess, I am still missing some bits despite many trials.

However I can share what I've learned and maybe you'll figure it out. Here is a sample of my config.toml file

NetworkId = 1515
DataDir = '/home/jfo/privateNetworks/geth_PoA/node1'
HTTPHost = 'localhost'
HTTPPort = 8501
HTTPModules = ['personal','db','eth','net','web3']
    StaticNodes = ["enode://398e0338de829b887e050a1665bcaef2282ad7066054c8e1b8fe580e53e0fa36a8c62c4174b064a30f76ea26629317966a65100952d78e3ef5f6f176910fd322@"]
    ListenAddr = ':30311'

I have never been able to have my node finding my bootnode and I've tried every possible parameters as defined in p2p/server.go (link1, link2). Maybe the data type []*discover.Node is what causes issues.

how do I know about those fields ? By grepping the geth source code. This command

~/Downloads/go-ethereum-master$ grep -rwn "type Config struct" --exclude-dir=vendor/

will return you

p2p/server.go:60:type Config struct {
swarm/api/config.go:42:type Config struct {
console/console.go:52:type Config struct {
consensus/ethash/ethash.go:382:type Config struct {
core/vm/interpreter.go:30:type Config struct {
core/vm/runtime/runtime.go:34:type Config struct {
whisper/whisperv5/config.go:19:type Config struct {
whisper/whisperv6/config.go:20:type Config struct {
dashboard/config.go:29:type Config struct {
node/config.go:49:type Config struct {
eth/gasprice/gasprice.go:34:type Config struct {
eth/config.go:73:type Config struct {
eth/gen_config.go:19:   type Config struct {
eth/gen_config.go:60:   type Config struct {

for example in cmd/geth/config.go (link) you'll find

type gethConfig struct {
    Eth       eth.Config
    Shh       whisper.Config
    Node      node.Config
    Ethstats  ethstatsConfig
    Dashboard dashboard.Config

from there you can jump to eth/config.go (link) to find about [Eth] params

type Config struct {
    // The genesis block, which is inserted if the database is empty.
    // If nil, the Ethereum main net block is used.
    Genesis *core.Genesis `toml:",omitempty"`

    // Protocol options
    NetworkId uint64 // Network ID to use for selecting peers to connect to
    SyncMode  downloader.SyncMode

    // Light client options
    LightServ  int `toml:",omitempty"` // Maximum percentage of time allowed for serving LES requests
    LightPeers int `toml:",omitempty"` // Maximum number of LES client peers

    // Database options
    SkipBcVersionCheck bool `toml:"-"`
    DatabaseHandles    int  `toml:"-"`
    DatabaseCache      int

    // Mining-related options
    Etherbase    common.Address `toml:",omitempty"`
    MinerThreads int            `toml:",omitempty"`
    ExtraData    []byte         `toml:",omitempty"`
    GasPrice     *big.Int

    // Ethash options
    Ethash ethash.Config

    // Transaction pool options
    TxPool core.TxPoolConfig

    // Gas Price Oracle options
    GPO gasprice.Config

    // Enables tracking of SHA3 preimages in the VM
    EnablePreimageRecording bool

    // Miscellaneous options
    DocRoot string `toml:"-"`

the params for ropsten are definied in the source code as well

  • Yeah I started from scratch, and the network is working as such. However I started by providing the cmd arguments directly and it ended up being inconvenient so that's how I decided to use the config files instead. Notably, certain arguments like --testnet don't have the corresponding toml file equivalents. I think my best bet for now (if I stick to config files) is finding out the Ropsten genesis file and providing it in the toml file. – Alex M. Feb 8 '18 at 3:57
  • How did you go with this @AlexM. ? – tsujp Aug 21 '19 at 7:29

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.