Comprehensive Guide to Geth Command-Line Options for Ethereum Nodes
This article provides a detailed reference of the official Geth client’s command‑line flags, covering general commands, Ethereum‑specific options, developer mode, API and console settings, mining parameters, gas‑price controls, logging/debug features, deprecated flags, and a link to the official documentation.
Command‑line Options Overview
Geth is the official Go implementation of an Ethereum node. Its command‑line interface (CLI) is used to start, configure, and control a node, as well as to perform administrative tasks such as account management, data import/export, and debugging.
Name
geth –go‑ethereum command‑line interfaceVersion Information
1.7.3‑stableCommand Usage
geth [options] command [command‑options] [arguments…]Core Sub‑Commands
accountManage accounts (e.g., list addresses). attach Connect to a running node and open an interactive JavaScript console. bug Open the GitHub Issues page to report bugs. console Start a JavaScript console directly (not recommended for production). copydb Create a local chain from a specified chaindata directory. dump Analyze a specific block (see geth dump –help for details). dumpconfig Print the node’s default configuration values. export Export the blockchain to a file (see geth export –help). import Import a blockchain file. init Initialize a new genesis block from a JSON configuration. js Execute one or more JavaScript files. license Show licensing information. makecache Generate an ethash verification cache (testing). makedag Generate an ethash mining DAG (testing). monitor Monitor and visualize node metrics. removedb Delete the blockchain and state databases. version Print the client version. wallet Manage an Ethereum wallet. help, h Show a list of commands or detailed help for a specific command.
Ethereum‑Specific Flags
--config <file>Load a TOML configuration file. --datadir <path> Directory for the database and keystore. --keystore <path> Keystore directory (defaults to datadir). --nousb Disable USB hardware‑wallet support. --networkid <int> Network identifier (1=Frontier, 2=Morden (deprecated), 3=Ropsten, 4=Rinkeby, default=1). --testnet Shortcut to use the Ropsten test network. --rinkeby Shortcut to use the Rinkeby POA test network. --syncmode <fast|full|light> Choose the synchronization mode. --ethstats <node:secret@host:port> Report node statistics to an ethstats service. --identity <name> Custom node name. --lightserv <0‑90> Maximum percentage of LES requests (default 0). --lightpeers <int> Maximum number of LES peers (default 20). --lightkdf Reduce KDF CPU/RAM usage for light clients.
Developer (Mode) Flags
--devRun a POA development network with a pre‑allocated account and automatic mining. --dev.period <int> Mining period in dev mode (0 = mine on pending transactions, default 0).
API and Console Flags
--rpcEnable the HTTP‑RPC server. --rpcaddr <host> RPC server bind address (default "localhost"). --rpcport <port> RPC server listening port (default 8545). --rpcapi <list> Comma‑separated list of APIs exposed over HTTP‑RPC. --ws Enable the WebSocket RPC server. --wsaddr <host> WebSocket server bind address (default "localhost"). --wsport <port> WebSocket server listening port (default 8546). --wsapi <list> APIs exposed over WebSocket. --wsorigins <list> Allowed origins for WebSocket connections. --ipcdisable Disable the IPC‑RPC server. --ipcpath <path> Path to the IPC socket file inside datadir. --rpccorsdomain <list> Comma‑separated list of CORS domains. --jspath <dir> Root directory for loading JavaScript files (default "."). --exec <code> Execute a JavaScript statement (usable with console or attach). --preload <files> Comma‑separated list of JavaScript files preloaded into the console.
Miner Flags
--mineEnable mining. --minerthreads <int> Number of CPU threads for mining (default 8). --etherbase <address> Mining reward address (default first account). --targetgaslimit <int> Target gas limit (default 4712388). --gasprice <int> Minimum gas price accepted for mining. --extradata <data> Extra data field for mined blocks (default client version).
Gas‑Price Flags
--gpoblocks <int>Number of recent blocks examined for gas price estimation (default 10). --gpopercentile <int> Percentile of recent gas prices to suggest (default 50).
Logging and Debugging Flags
--metricsEnable metrics collection and reporting. --fakepow Disable proof‑of‑work verification (testing). --verbosity <0‑5> Log verbosity level (0=silent, 1=error, 2=warn, 3=info, 4=debug, 5=detail; default 3). --vmodule <pattern=level,…> Per‑module log level overrides. --backtrace <pattern> Request stack traces for matching log entries. --debug Highlight call locations in logs (file and line number). --pprof Enable the pprof HTTP server. --pprofaddr <host> pprof server bind address (default 127.0.0.1). --pprofport <port> pprof server listening port (default 6060). --memprofilerate <int> Memory profiling frequency (default 524288). --blockprofilerate <int> Block profiling frequency (default 0). --cpuprofile <file> Write CPU profile to the specified file. --trace <file> Write execution trace to the specified file.
Deprecated Flags
--fastFast sync (now the default on first start; subsequent starts use full). --light Enable light client mode.
Official Documentation
https://github.com/ethereum/go-ethereum/wiki/Command-Line-Options
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Senior Brother's Insights
A public account focused on workplace, career growth, team management, and self-improvement. The author is the writer of books including 'SpringBoot Technology Insider' and 'Drools 8 Rule Engine: Core Technology and Practice'.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
