Skip to content

Instantly share code, notes, and snippets.

@bussyjd
Last active January 11, 2025 08:17
Show Gist options
  • Save bussyjd/523ff69aa0b3ebc9ac2461263704c871 to your computer and use it in GitHub Desktop.
Save bussyjd/523ff69aa0b3ebc9ac2461263704c871 to your computer and use it in GitHub Desktop.
Obol Stack One-Line Installer (reth + charon + lighthouse) - Simple Version
#!/bin/sh
set -e
# Default configuration
CHAIN=${1:-mainnet} # Default to mainnet if not specified
case "$CHAIN" in
mainnet|holesky|sepolia) ;;
*) echo "Unsupported chain: $CHAIN. Use mainnet, holesky or sepolia." && exit 1 ;;
esac
# Versions
ERIGON_VERSION="v2.61.0"
CHARON_VERSION="v1.2.0"
# Architecture detection
ARCH=$(uname -m)
case "$ARCH" in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
*) echo "Unsupported architecture: $ARCH" && exit 1 ;;
esac
echo "Installing for $CHAIN network..."
# Create base directories
rm -rf /opt/obol/erigon/*
rm -rf /opt/obol/charon/*
mkdir -p /opt/obol/erigon
mkdir -p /opt/obol/charon
# Create temp directory
TMPDIR=$(mktemp -d)
cd $TMPDIR
# Download and install erigon
echo "Installing erigon..."
wget "https://github.com/erigontech/erigon/releases/download/${ERIGON_VERSION}/erigon_${ERIGON_VERSION}_linux_${ARCH}.tar.gz"
tar xzf "erigon_${ERIGON_VERSION}_linux_${ARCH}.tar.gz"
rm -rf "/opt/obol/erigon/erigon_${ERIGON_VERSION}_linux_${ARCH}"
mv "erigon_${ERIGON_VERSION}_linux_${ARCH}" "/opt/obol/erigon/"
# Download and install charon
echo "Installing charon..."
# Install Go and build dependencies
apt-get update && apt-get install -y --no-install-recommends build-essential git wget ca-certificates unzip golang-1.23
export PATH=$PATH:/usr/lib/go-1.23/bin
# Download and build charon
wget -O charon.zip "https://github.com/ObolNetwork/charon/archive/refs/tags/${CHARON_VERSION}.zip"
unzip charon.zip
cd "charon-${CHARON_VERSION#v}"
go build -o charon .
mv charon /opt/obol/charon/
cd ..
rm -rf charon.zip "charon-${CHARON_VERSION#v}"
# Cleanup
cd /
rm -rf $TMPDIR
# Create systemd services
cat > /etc/systemd/system/erigon.service << EOF
[Unit]
Description=Erigon Execution Client with Caplin Consensus
After=network.target
[Service]
Type=simple
User=erigon
ExecStart=/opt/obol/erigon/erigon_${ERIGON_VERSION}_linux_${ARCH}/erigon --datadir=/opt/obol/erigon/data --chain=${CHAIN} --http --ws --http.api=eth,debug,net,trace,web3,erigon --beacon.api=beacon,builder,config,node,validator
Restart=always
RestartSec=5
WorkingDirectory=/opt/obol/erigon
[Install]
WantedBy=multi-user.target
EOF
cat > /etc/systemd/system/charon.service << EOF
[Unit]
Description=Charon Client
After=network.target
[Service]
Type=simple
User=charon
ExecStart=/opt/obol/charon/charon run
Restart=always
RestartSec=5
WorkingDirectory=/opt/obol/charon
[Install]
WantedBy=multi-user.target
EOF
# Create system users
useradd -r -s /sbin/nologin erigon || true
useradd -r -s /sbin/nologin charon || true
# Set permissions
chown -R erigon:erigon /opt/obol/erigon
chown -R charon:charon /opt/obol/charon
# Enable and start services
systemctl daemon-reload
systemctl enable erigon charon
systemctl start erigon charon
echo "Installation complete! Services have been started for $CHAIN network."
echo "Check status with: systemctl status erigon charon"
echo "Usage: $0 [mainnet|holesky]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment