Geth

Installing and configuring Go-Ethereum as a systemd service.

Geth (Go-Ethereum)

Geth is the official Golang implementation of the Ethereum protocol. It is the most widely used client due to its stability, extensive documentation, and tooling support.

🛡️ Role: Geth will connect to the peer-to-peer network to download block data and execute transactions. It will expose an Engine API that allows the Consensus Client (Step 4) to control it.


1. Install Geth

We recommended installing Geth via the official Personal Package Archive (PPA). This ensures you can easily update the node with a simple apt update in the future.

Bash

# 1. Enable the PPA
sudo add-apt-repository -y ppa:ethereum/ethereum

# 2. Update package lists
sudo apt update

# 3. Install Geth
sudo apt install -y geth

# 4. Verify installation
geth version

2. Configure Systemd Service

We will run Geth as a background service using systemd. This ensures the node starts automatically on reboot and runs as the dedicated ethereum user we created in Step 2.

Create the service file:

Bash

sudo nano /etc/systemd/system/geth.service

Paste the following configuration:

Ini, TOML

[Unit]
Description=Geth Execution Client
After=network.target

[Service]
User=ethereum
Group=ethereum
Type=simple
Restart=always
RestartSec=5

# Execution Command
ExecStart=/usr/bin/geth \
  --networkid 1 \
  --datadir /home/ethereum/execution \
  --authrpc.jwtsecret /home/ethereum/jwt/jwt.hex \
  --authrpc.addr 127.0.0.1 \
  --authrpc.port 8551 \
  --authrpc.vhosts localhost \
  --http \
  --http.addr 0.0.0.0 \
  --http.port 8545 \
  --http.api eth,net,engine,admin \
  --state.scheme path

# Resource Limits
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target

🔍 Flag Explanation:

  • --datadir: Points to the folder we created in Step 2.

  • --authrpc.jwtsecret: The critical token allowing the Consensus Client to talk to Geth.

  • --http: Enables the JSON-RPC API (for your dApps or wallets).

  • --http.addr 0.0.0.0: Listens on all interfaces (Safe because we configured UFW Firewall in Step 2).


3. Start the Service

Reload the systemd daemon to read the new file, then enable and start Geth.

Bash

# Reload systemd
sudo systemctl daemon-reload

# Enable Geth to start on boot
sudo systemctl enable geth

# Start Geth immediately
sudo systemctl start geth

4. Verify Status

Geth should now be running. However, it will not start syncing properly yet because it is waiting for a Consensus Client (Step 4) to tell it what the "head" of the chain is.

Check the logs to ensure it started correctly:

Bash

sudo journalctl -fu geth

Expected Output: You should see logs indicating:

  1. Starting Geth on Ethereum mainnet...

  2. UDP listener up (P2P Networking active)

  3. Warning: You might see Post-merge network, but no beacon client seen. This is normal until we complete Step 4.

Last updated