Skip to main content
Since The Merge, Geth is an execution layer client only. To participate in mainnet block validation you must also run a consensus client (such as Prysm, Lighthouse, Lodestar, Nimbus, or Teku) alongside Geth.

Connect to mainnet

Run Geth with no flags to connect to the Ethereum mainnet. Snap sync is used by default, which downloads more data in exchange for skipping the full historical replay — this is much faster than a full sync.
geth
Geth will begin discovering peers and syncing the chain. Logs are printed to stdout.

Connect to a testnet

Holesky is the primary Ethereum proof-of-stake testnet, suitable for validator and infrastructure testing.
geth --holesky
Data is stored in a separate subdirectory (~/.ethereum/holesky on Linux/macOS) so it does not conflict with mainnet data.
When attaching a console to a Holesky node on Linux or macOS, you must specify the IPC endpoint explicitly:
geth attach ~/.ethereum/holesky/geth.ipc

Attach an interactive console

Once Geth is running, open the built-in JavaScript console in a separate terminal:
geth attach
This connects to the running node via IPC. The console provides access to web3 methods and Geth’s management APIs.

Basic console commands

// Current block number
eth.blockNumber

// List accounts
eth.accounts

// Get balance of an address (in wei)
eth.getBalance("0xYourAddress")

Enable the HTTP JSON-RPC API

To expose an HTTP endpoint for programmatic access:
geth --http --http.api eth,net,web3
The server listens on http://localhost:8545 by default. Test it with:
curl http://localhost:8545 \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
Exposing the HTTP or WebSocket RPC interfaces to an untrusted network is a security risk. Only use --http.addr 0.0.0.0 in controlled environments, and restrict --http.api to only the namespaces you need.

Docker quick start

Start a node using the official Docker image:
docker run -d --name ethereum-node \
  -v /Users/alice/ethereum:/root \
  -p 8545:8545 -p 30303:30303 \
  ethereum/client-go
This starts Geth in snap-sync mode with a persistent data volume. Port 8545 is the HTTP JSON-RPC port and 30303 is the P2P port.

Use a config file

Instead of passing many flags on every invocation, you can export your current flag set to a TOML config file:
geth --your-flags dumpconfig > config.toml
Then start Geth using that file:
geth --config /path/to/config.toml

Next steps

Sync modes

Understand snap sync, full sync, and archive mode and choose the right one for your use case.

Configuration

Learn all available flags and TOML config options.

JSON-RPC API

Explore the full JSON-RPC API surface available over HTTP, WebSocket, and IPC.

Accounts & Clef

Manage keys securely with the built-in keystore or the standalone Clef signer.

Build docs developers (and LLMs) love