echo "alias base-log='cd ~/node; docker compose logs -f --tail 100'" >> ~/.bashrc
echo "alias base-start='cd ~/node; docker compose up -d'" >> ~/.bashrc
echo "alias base-stop='cd ~/node; docker compose down'" >> ~/.bashrc
echo "alias base-restart='cd ~/node; docker compose down; docker compose up -d'" >> ~/.bashrc
echo "alias base-config='cd ~/node; vim docker-compose.yml'" >> ~/.bashrc
source ~/.bashrc
Dependency - Install Docker
Configure the firewall.
BASE_GETH_P2P_PORT= # Default: 30303
BASE_NODE_P2P_PORT= # Default: 9222
sudo ufw allow ${BASE_GETH_P2P_PORT} comment 'Allow Base Geth P2P in'
sudo ufw allow ${BASE_NODE_P2P_PORT} comment 'Allow Base Node P2P in'
git clone https://github.com/base-org/node.git
mkdir ~/base-snapshot-download
cd ~/base-snapshot-download
tmux new -s base-snapshot-download
wget https://mainnet-full-snapshots.base.org/$(curl https://mainnet-full-snapshots.base.org/latest)
base-stop
sudo rm -rf ~/node/geth-data/geth
sudo mv ~/base-snapshot-download/snapshots/mainnet/download/geth ~/node/geth-data/geth
docker compose up -d
docker compose logs -f
docker compose logs -f geth
docker compose logs -f node
timestamp=$(curl -d '{"id":0,"jsonrpc":"2.0","method":"optimism_syncStatus"}' \
-H "Content-Type: application/json" http://localhost:7545 | \
jq -r '.result.unsafe_l2.timestamp')
if [[ -z "$timestamp" ]]; then
echo "Failed to retrieve timestamp"
else
echo
echo
echo Latest synced block behind by: $((($(date +%s) - timestamp) / 60 / 60 / 24)) days
echo
echo
fi