Skip to content

Instantly share code, notes, and snippets.

@ruanbekker
Last active March 15, 2022 04:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ruanbekker/8bd86dc7d11c77a2560113d371103f65 to your computer and use it in GitHub Desktop.
Save ruanbekker/8bd86dc7d11c77a2560113d371103f65 to your computer and use it in GitHub Desktop.
Boostrap Geth Ropsten Installation
#!/usr/bin/env bash
export GOVERSION="1.17.2"
export GETHVERSION="1.10.9"
apt update
apt install wget tar locales-all -y
touch /var/lib/cloud/instance/locale-check.skip
mkdir -p /blockchain/ethereum/data
mkdir -p /usr/local/geth/${GETHVERSION}/bin
wget https://golang.org/dl/go${GOVERSION}.linux-amd64.tar.gz
tar -C /usr/local -xzf go${GOVERSION}.linux-amd64.tar.gz
cat > /etc/profile.d/go.sh << EOF
export GOROOT=/usr/local/go
export GOPATH=\$HOME/go
export PATH=\$PATH:\$GOROOT/bin
EOF
source /etc/profile.d/go.sh
wget https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-${GETHVERSION}-eae3b194.tar.gz
tar -xvf geth-linux-amd64-${GETHVERSION}-eae3b194.tar.gz
mv geth-linux-amd64-${GETHVERSION}-eae3b194/geth /usr/local/geth/${GETHVERSION}/bin/geth
ln -s /usr/local/geth/${GETHVERSION} /usr/local/geth/current
cat > /etc/profile.d/geth.sh << EOF
export PATH=\$PATH:/usr/local/geth/current/bin
EOF
source /etc/profile.d/geth.sh
cat > /etc/systemd/system/geth.service << EOF
[Unit]
Description=Geth Ropsten Node
After=network.target auditd.service
Wants=network.target
[Service]
Type=simple
WorkingDirectory=/root
ExecStart=/usr/local/geth/current/bin/geth \\
--ropsten \\
--datadir /blockchain/ethereum/data \\
--datadir.minfreedisk 1024 \\
--cache 1024 \\
--syncmode 'fast' \\
--http --http.addr 0.0.0.0 --http.port 8545 \\
--http.api 'admin,debug,eth,net,personal,txpool,web3' \\
--http.corsdomain '*' --allow-insecure-unlock \\
--metrics --metrics.addr 0.0.0.0 --metrics.port 6060 \\
--whitelist 10920274=0xfd652086d220d506ae5b7cb80fde97d2f3f7028d346cc7d9d384a83d3d638532
User=root
Group=root
Restart=on-failure
RestartSec=120s
KillMode=process
KillSignal=SIGINT
TimeoutStopSec=600
[Install]
WantedBy=multi-user.target
Alias=geth.service
EOF
fallocate -l 4G /swapfile
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
systemctl daemon-reload
systemctl restart geth
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment