10

I'm trying to use geth --config <filename> to start geth.

My config file contains:

rpcport = 8555
networkid = 3

I get:

Fatal: /home/ravi/.ethereum/config-test, line 1: field 'rpcport' is not defined in main.gethConfig
  1. Where do I find the the list of sections and headings allowed, and a descripton of their formatting?

  2. Are they any examples of geth TOML files? The example given here does not parse.

Tom Hale
  • 3,107
  • 4
  • 20
  • 37

1 Answers1

10

You can use the dumpconfig option together with the command line parameters you would like use. geth will then create a config file for you which you can use, rather than creating it yourself.

In your case, that would be

geth --networkid 3 --rpcport 8555 dumpconfig

(you would probably add some more parameters, but I just used the ones you supplied in your question).

You will then get something like this:

[Eth]
NetworkId = 3
SyncMode = "fast"
LightPeers = 20
DatabaseCache = 128
GasPrice = 18000000000
EthashCacheDir = "ethash"
EthashCachesInMem = 2
EthashCachesOnDisk = 3
EthashDatasetDir = "..."
EthashDatasetsInMem = 1
EthashDatasetsOnDisk = 2
EnablePreimageRecording = false
[Eth.TxPool]
NoLocals = false
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 1
PriceBump = 10
AccountSlots = 16
GlobalSlots = 4096
AccountQueue = 64
GlobalQueue = 1024
Lifetime = 10800000000000
[Eth.GPO]
Blocks = 10
Percentile = 50
[Shh]
MaxMessageSize = 1048576
MinimumAcceptedPOW = 2e-01
[Node]
DataDir = ...
IPCPath = "geth.ipc"
HTTPPort = 8555
HTTPModules = ["net", "web3", "eth", "shh"]
WSPort = 8546
WSModules = ["net", "web3", "eth", "shh"]
[Node.P2P]
MaxPeers = 25
NoDiscovery = false
DiscoveryV5Addr = ":30304"
BootstrapNodes = [...]
BootstrapNodesV5 = [...]
StaticNodes = []
TrustedNodes = []
ListenAddr = ":30303"
EnableMsgEvents = false

You can find networkid in section [Eth] and rpcport in section [Node] as HTTPPort. Store this output to a file, which you can use as config file: geth --networkid 3 --rpcport 8555 dumpconfig > config.toml geth --config config.toml

Just a note: when I tried this, adding the networkid as number did not work, geth always connected to main net (I was using version 1.7.2). Identifying the network by its name (--testnet, --rinkeby), however, worked well for me.

gisdev_p
  • 1,801
  • 1
  • 9
  • 18
  • dumpconfig generates a rather big file, is there a way to remove all settings that where dumped into the file even when their values are the default ones? – rraallvv Oct 31 '18 at 17:44
  • I'm afraid not... but should not be an issue having a bigger config file? – gisdev_p Oct 31 '18 at 19:35
  • I think it's about not preventing updates to geth's defaults by configuring parts you're not changing. – CivFan Jan 22 '21 at 18:28