Setup Ethereum Mainnet Full Node

Hardware requirement#

We suggest the following minimum spec for a self-hosted mainnet Ethereum node.

CPU: 4-core
Memory: 16Gb
Storage: 2Tb
Network: 5Gbps

This spec is equivalent to t3.xlarge type on AWS, and it provides a good balance for mixed usage including initial syncing and serving requests once syncing completes by utilizing multi-threading and memory cache.

Configuration#

We suggest using geth instead of turbogeth for balanced usage between CPU/memory and storage.

  1. Installation
# ubuntu
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum
# redhat
sudo dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
sudo yum install snapd
sudo systemctl enable --now snapd.socket
sudo snap install geth
  1. Systemd service config

Please double check and modify your user according to your instance info. You can do so by running sudo vi /etc/systemd/system/main-geth.service.

[Unit]
Description=main-geth
[Service]
WorkingDirectory=~
ExecStart=bash -c 'geth --syncmode=fast --cache=8192 --http --http.port=7777 --ws --ws.port=7778'
Type=simple
Restart=always
RestartSec=1
User=ubuntu
[Install]
WantedBy=multi-user.target
  1. Start service
sudo systemctl daemon-reload
sudo systemctl restart main-geth
journalctl -f -u main-geth
  1. Check sync progress
geth attach
# true: syncing, false: fully synced
eth.syncing
  1. Validate the RPC endpoint once your node is fully synced.
curl -X POST \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0xf0d54157c00de629862a011d2c8d45a6a66ef25be218908a283fb1764a2dc44a"],"id":1}' \
localhost:7777

Network interface#

Here is a over-simplified load balancer using caddy to test your geth nodes.
Expose ports 80 and 443 on the instance hosting caddy and start caddy with this config.

https://geth.example.com {
@websockets {
header Connection *Upgrade*
header Upgrade websocket
}
reverse_proxy @websockets 192.168.10.2:7778 192.168.10.3:7778
reverse_proxy 192.168.10.2:7777 192.168.10.3:7777
}
Last updated on