🏗️Maintenance

Notes on how to maintain and update a Geth Client.

Go - Update

Find the latest version of Go here: https://go.dev/doc/install

GO_LATEST_VERSION=    # Add the latest Go version here

cd ~/
wget https://go.dev/dl/go${GO_LATEST_VERSION}.linux-amd64.tar.gz
sudo rm -rf /usr/local/go && sudo tar -C /usr/local -xzf go${GO_LATEST_VERSION}.linux-amd64.tar.gz
export PATH=$PATH:/usr/local/go/bin
echo 'PATH="$PATH:/usr/local/go/bin"' >> ~/.profile

Geth - Update Client

geth-update

Geth - Update geth.service

geth-stop
geth-config

# MAKE ANY CHANGES TO THE CONFIG

daemon-reload
geth-start
geth-status

Geth - Rollback Chain to Previous Block Number

This was needed for a bug introduced in Geth v.1.10.22 that required a rollback to a previous block

Add debug flag to --http.api

geth-stop
geth-config

# Add "debug" to http.api
# --http.api="engine,eth,web3,net,debug"

daemon-reload
geth-start
geth-attach

In the Geth console set the new block head e.g. debug.setHead("0xEAC1A8").

debug.setHead("0x<BLOCK_NUMBER_IN_HEX>")

Once re-sync has been completed, go back and remove the debug flag from the --http.api argument.

Geth - Resync after an Unexpected Shutdown

To avoid duplication these details can be found on the EthStaker Knowledge Base.

Geth - Pruning

geth-stop

tmux new -s prune-geth
sudo /usr/local/bin/geth --datadir /var/lib/goethereum snapshot prune-state

exit
sudo chown -R goeth:goeth /var/lib/goethereum
geth-start

Last updated