Skip to main content
Geth can be configured with command-line flags or a TOML configuration file. The two approaches can be combined: the file sets defaults that individual flags can override.

Configuration file

Pass a TOML configuration file with --config:
geth --config /path/to/config.toml

Generating a config file

The easiest way to produce a valid starting configuration is to export the current defaults with dumpconfig:
# Print defaults to stdout
geth dumpconfig

# Write defaults to a file
geth dumpconfig > config.toml

# Combine with flags to capture a customised baseline
geth --syncmode full --http dumpconfig > config.toml
The output is valid TOML that can be edited and passed back with --config.

Example TOML snippet

[Eth]
SyncMode = "snap"
NetworkId = 1

[Node]
DataDir = "/var/lib/geth"
HTTPHost = "127.0.0.1"
HTTPPort = 8545
HTTPModules = ["eth", "net", "web3"]
WSHost = "127.0.0.1"
WSPort = 8546
WSModules = ["eth", "net", "web3"]

[Node.P2P]
MaxPeers = 50
ListenAddr = ":30303"

[Node.HTTPTimeouts]
ReadTimeout = 30000000000
WriteTimeout = 30000000000
IdleTimeout = 120000000000

Flag reference

FlagDefaultDescription
--identity(empty)Custom human-readable name advertised over the p2p network
--datadir~/.ethereumRoot directory for databases and the keystore
--port30303TCP/UDP network listening port
--networkid0 (auto)Network ID; 0 means use the chain ID. For testnets use --sepolia, --holesky, or --hoodi
FlagDefaultDescription
--syncmodesnapBlockchain sync mode — snap or full
--gcmodefullGarbage-collection mode — full (prune old state) or archive (retain all state)
--state.scheme(auto)State storage scheme — hash or path
--history.state90000Number of recent blocks for which state history is kept (path scheme only, 0 = entire chain)
--history.transactions2350000Number of recent blocks with a transaction index (0 = entire chain)
--snapshottrueEnable snapshot-database mode
FlagDefaultDescription
--bootnodes(network default)Comma-separated enode URLs for P2P discovery bootstrap
--maxpeers50Maximum number of network peers (0 disables networking)
--natanyNAT port mapping mechanism (any, none, upnp, pmp, extip:<IP>, stun:<IP:PORT>)
--nodiscoverfalseDisable automatic peer discovery (add peers manually)
--netrestrict(empty)Restrict peer communication to specific IP ranges (CIDR)
--discovery.dns(network default)DNS discovery entry points
--discovery.port30303UDP port for P2P discovery
FlagDefaultDescription
--txpool.pricelimit1Minimum gas price tip (in wei) for acceptance into the pool
--txpool.pricebump10Price bump percentage required to replace an existing transaction
--txpool.accountslots16Minimum executable transaction slots guaranteed per account
--txpool.globalslots5120Maximum executable transaction slots across all accounts
--txpool.accountqueue64Maximum queued (non-executable) slots per account
--txpool.globalqueue1024Maximum queued (non-executable) slots across all accounts
--txpool.lifetime3h0m0sMaximum time a non-executable transaction stays queued
--txpool.journaltransactions.rlpDisk journal file for local transactions
--txpool.nolocalsfalseDisable priority treatment for locally submitted transactions
FlagDefaultDescription
--httpfalseEnable the HTTP-RPC server
--http.addrlocalhostHTTP-RPC listening interface
--http.port8545HTTP-RPC listening port
--http.apieth,net,web3APIs exposed over HTTP
--http.corsdomain(empty)Comma-separated domains allowed to make cross-origin requests
--http.vhostslocalhostComma-separated virtual hostnames accepted by the server
--http.rpcprefix(empty)HTTP path prefix for JSON-RPC (use / to serve on all paths)
FlagDefaultDescription
--wsfalseEnable the WebSocket-RPC server
--ws.addrlocalhostWebSocket-RPC listening interface
--ws.port8546WebSocket-RPC listening port
--ws.apieth,net,web3APIs exposed over WebSocket
--ws.origins(empty)Origins from which WebSocket requests are accepted
--ws.rpcprefix(empty)HTTP path prefix for WebSocket JSON-RPC
FlagDefaultDescription
--ipcdisablefalseDisable the IPC-RPC server
--ipcpathgeth.ipcFilename for the IPC socket/pipe inside the datadir
FlagDefaultDescription
--authrpc.addrlocalhostListening address for the authenticated Engine API
--authrpc.port8551Listening port for the authenticated Engine API
--authrpc.jwtsecret(required)Path to the JWT secret file used to authenticate consensus-layer connections
--authrpc.vhostslocalhostVirtual hostnames accepted by the authenticated API server
FlagDefaultDescription
--verbosity3Log verbosity level: 0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail
--log.formatterminalLog output format: terminal, json, or logfmt
--log.file(stderr)Write logs to a file instead of (or in addition to) stderr
--log.rotatefalseEnable automatic log file rotation
--log.vmodule(empty)Per-package verbosity overrides, e.g. eth/*=5,p2p=4

Common configuration patterns

1

Generate a baseline config

Export the current defaults so you have a complete starting point:
geth dumpconfig > /etc/geth/config.toml
2

Edit the config file

Open the file and adjust the sections relevant to your deployment. At minimum you will probably want to set DataDir, the HTTP/WS endpoints, and the SyncMode.
3

Start Geth with the config

geth --config /etc/geth/config.toml
Flags passed on the command line override values in the file.

Build docs developers (and LLMs) love