EN
ENNA

Getting Started Guide

How to Install and Use Geth

This guide covers installing Geth (Go Ethereum), syncing the Ethereum blockchain, and querying accounts, transactions, and smart contracts.

Prerequisites

  • -100GB+ disk space (snap sync)
  • -Linux or macOS
  • -Stable internet connection
Official Documentation
1

Install Geth

Install Geth from package manager or download the binary.

macOS

brew install ethereum

Ubuntu PPA

sudo add-apt-repository -y ppa:ethereum/ethereum && sudo apt update && sudo apt install geth

Verify

geth version
2

Start Syncing

Start Geth in snap sync mode (fastest way to get a usable node).

Start with snap sync

geth --syncmode snap --http --http.api eth,net,web3

Check sync progress

geth attach --exec 'eth.syncing'

Note: Snap sync downloads block headers and state data in parallel. It's much faster than full sync. The --http flags enable the JSON-RPC API for querying.

3

Query the Blockchain

Use the Geth JavaScript console to query accounts, balances, and transactions.

Attach to running node

geth attach

Check balance (in Wei)

eth.getBalance('0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045')

Get transaction details

eth.getTransaction('0xTXHASH')

Get latest block

eth.getBlock('latest')

Note: Balances are returned in Wei (1 ETH = 10^18 Wei). Use web3.fromWei(balance, 'ether') to convert.

4

JSON-RPC API

Query Geth programmatically via the HTTP JSON-RPC API.

Get balance via curl

curl -X POST http://localhost:8545 -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045","latest"],"id":1}'

Get block number

curl -X POST http://localhost:8545 -H 'Content-Type: application/json' -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'

Note: The JSON-RPC API is how most tools (Ethers.js, Web3.py, Cast) communicate with Geth. Running your own node means you're not dependent on Infura or Alchemy rate limits.

Back to Geth (Go Ethereum)Full Documentation