Geth implements the Ethereum JSON-RPC specification and exposes additional management APIs. Clients communicate with the node by sending JSON-encoded requests and receiving JSON-encoded responses.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ethereum/go-ethereum/llms.txt
Use this file to discover all available pages before exploring further.
Transports
Geth supports three transport mechanisms. Each must be explicitly enabled (except IPC, which is on by default).- HTTP
- WebSocket
- IPC
HTTP is a stateless, request-response transport. It is the most common choice for
dapps and tooling.Additional flags:
| Flag | Description |
|---|---|
--http.addr | Interface to listen on (default 127.0.0.1) |
--http.port | Port to listen on (default 8545) |
--http.api | Comma-separated list of API namespaces to expose |
--http.corsdomain | Comma-separated list of allowed CORS origins |
--http.vhosts | Comma-separated list of allowed virtual hostnames |
API namespaces
Geth groups its methods into namespaces. Each namespace must be listed in the--http.api, --ws.api, or --authrpc.api flags to be accessible over the
corresponding transport. All namespaces are always available over IPC.
| Namespace | Description |
|---|---|
eth | Core Ethereum API: blocks, transactions, accounts, state, filters |
net | Network information: peer count, listening status, network ID |
web3 | Utility methods: unit conversion, hashing |
txpool | Transaction pool inspection: pending and queued transactions |
debug | Low-level debugging: tracing, state dumps, profiling |
admin | Node management: peer management, chain export, server control |
miner | Mining control: start/stop, gas price, coinbase (PoW networks only) |
Example requests
The examples below usecurl to send requests to an HTTP endpoint. All
requests follow the JSON-RPC 2.0 format.
eth_blockNumber:
Engine API and JWT authentication
The Engine API is a separate authenticated endpoint used by the consensus layer client (e.g. Prysm, Lighthouse) to drive block production after the Merge. Enable it with a JWT secret file:Authorization: Bearer <token>
header. The token is a signed JWT that uses the HS256 algorithm with the shared
secret and must contain an iat (issued-at) claim within 60 seconds of the
current time.
Both Geth and your consensus client must be configured with the same JWT
secret file. Mismatched secrets are the most common cause of Geth failing to
follow the chain head after the Merge.
WebSocket subscriptions
WebSocket connections supporteth_subscribe, which pushes events to the
client as they occur rather than requiring polling.
eth_unsubscribe:
| Subscription type | Description |
|---|---|
newHeads | New block headers as they are added to the chain |
logs | Log entries matching an optional address and topics filter |
newPendingTransactions | Transaction hashes as they enter the transaction pool |
syncing | Node sync status changes |
Subscriptions are only supported over WebSocket and IPC connections.
HTTP connections receive an error if
eth_subscribe is called.