***

Setup Server

# Update Packages
sudo apt update && apt upgrade -y
sudo apt install curl git jq lz4 build-essential unzip fail2ban ufw -y

# Set Firewall
sudo apt install -y ufw
sudo ufw default allow outgoing
sudo ufw default deny incoming
sudo ufw allow ssh
sudo ufw allow 9100

# Enable Firewall
sudo ufw enable

# Install Go
ver="1.19.9"
wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz"
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz"
rm "go$ver.linux-amd64.tar.gz"
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
go version

Node Installation (Manual)

# Download and install binary
cd $HOME
rm -rf sge
git clone https://github.com/sge-network/sge
cd sge
git checkout v1.1.0
make install

# Set Configuration for your node
sged config chain-id sgenet-1
sged config keyring-backend file


# Init your node
# You can change "MyNode" to anything you like
sged init MyNode --chain-in sgenet-1


# Add Genesis File and Addrbook
curl -Ls https://snapshots.indonode.net/sge/genesis.json > $HOME/.sge/config/genesis.json
curl -Ls https://snapshots.indonode.net/sge/addrbook.json > $HOME/.sge/config/addrbook.json

#Configure Seeds and Peers
PEERS="$(curl -sS https://rpc.sge.indonode.net/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr)"' | awk -F ':' '{print $1":"$(NF)}' | sed -z 's|\n|,|g;s|.$||')"
sed -i -e "s|^persistent_peers *=.*|persistent_peers = \"$PEERS\"|" $HOME/.sge/config/config.toml


# Set Pruning, Enable Prometheus, Gas Prices, and Indexer
PRUNING="custom"
PRUNING_KEEP_RECENT="100"
PRUNING_INTERVAL="19"

sed -i -e "s/^pruning *=.*/pruning = \"$PRUNING\"/" $HOME/.sge/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \
\"$PRUNING_KEEP_RECENT\"/" $HOME/.sge/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \
\"$PRUNING_INTERVAL\"/" $HOME/.sge/config/app.toml
sed -i -e 's|^indexer *=.*|indexer = "null"|' $HOME/.sge/config/config.toml
sed -i 's|^prometheus *=.*|prometheus = true|' $HOME/.sge/config/config.toml
sed -i -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.025usge\"/" $HOME/.sge/config/app.toml

# Set Service file
sudo tee /etc/systemd/system/sged.service > /dev/null <<EOF
[Unit]
Description=sge node
After=network-online.target
[Service]
User=$USER
ExecStart=$(which sged) start
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable sged

# Download Latest Snapshot
curl -L https://snapshots.indonode.net/sge/sge-latest.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.sge
[[ -f $HOME/.sge/data/upgrade-info.json ]] && cp $HOME/.sge/data/upgrade-info.json $HOME/.sge/cosmovisor/genesis/upgrade-info.json

# Start the Node
sudo systemctl restart sged
sudo journalctl -fu sged -o cat

Last updated