Install

Install Dependencies

Update system package and install build tools
sudo apt -q update
sudo apt -qy install curl git jq lz4 build-essential fail2ban ufw
sudo apt -qy upgrade

Secure Setup

Setup ssh for user replace YOUR_PUBLIC_SSH_KEY with your own!
Setup ssh for side user replace YOUR_PUBLIC_SSH_KEY with your own!
sudo adduser self --disabled-password -q
sudo usermod -aG sudo self
sudo -u self bash -c 'mkdir -p ~/.ssh && echo "YOUR_PUBLIC_SSH_KEY" >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys'
Granting sudo privileges for alignedlayer user
echo "self ALL=(ALL) NOPASSWD:ALL" | sudo tee -a /etc/sudoers
Disable root login, password auth, and enforce SSH key authentication
su - self -c 'sudo sed -i "s|^PermitRootLogin .*|PermitRootLogin no|" /etc/ssh/sshd_config'
su - self -c 'sudo sed -i "s|^ChallengeResponseAuthentication .*|ChallengeResponseAuthentication no|" /etc/ssh/sshd_config'
su - self -c 'sudo sed -i "s|^#PasswordAuthentication .*|PasswordAuthentication no|" /etc/ssh/sshd_config'
su - self -c 'sudo sed -i "s|^#PermitEmptyPasswords .*|PermitEmptyPasswords no|" /etc/ssh/sshd_config'
su - self -c 'sudo sed -i "s|^#PubkeyAuthentication .*|PubkeyAuthentication yes|" /etc/ssh/sshd_config'
sudo systemctl restart sshd
Configure firewall setting
sudo apt install -y ufw
sudo ufw default deny incoming
sudo ufw default allow outgoing
sudo ufw allow ssh
sudo ufw enable

Set Moniker

Replace <your-moniker-name> with your own validator name
MONIKER="<your-moniker-name>"

Install Go (check version)

Go version 1.22.2
cd $HOME && \
ver="1.22.2" && \
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

Build Binaries

cd $HOME
wget https://validator.wiki/selfchaind
chmod +x selfchaind
mkdir -p $HOME/.selfchain/cosmovisor/genesis/bin
mv selfchaind $HOME/.selfchain/cosmovisor/genesis/bin/
sudo ln -s $HOME/.selfchain/cosmovisor/genesis $HOME/.selfchain/cosmovisor/current -f
sudo ln -s $HOME/.selfchain/cosmovisor/current/bin/selfchaind /usr/local/bin/selfchaind -f

Cosmovisor Setup

go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0

Create a systemd service

sudo tee /etc/systemd/system/selfchaind.service > /dev/null << EOF
[Unit]
Description=selfchain node service
After=network-online.target
 
[Service]
User=$USER
ExecStart=$(which cosmovisor) run start
Restart=on-failure
RestartSec=10
LimitNOFILE=65535
Environment="DAEMON_HOME=$HOME/.selfchain"
Environment="DAEMON_NAME=selfchaind"
Environment="UNSAFE_SKIP_BACKUP=true"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.selfchain/cosmovisor/current/bin"
 
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable selfchaind

Initialize Node

selfchaind config chain-id self-dev-1
selfchaind config keyring-backend file
selfchaind config node tcp://localhost:22057
selfchaind init $MONIKER --chain-id self-dev-1

Genesis & Addrbook

curl -Ls https://snap.validator.wiki/self-testnet/genesis.json > $HOME/.selfchain/config/genesis.json
curl -Ls https://snap.validator.wiki/self-testnet/addrbook.json > $HOME/.selfchain/config/addrbook.json
sed -i -e "s|^seeds *=.*|seeds = \"c7c7aef715957289fd96a114ecaa7ba756@testnet-seeds.validato.wiki:23810\"|" $HOME/.side/config/config.toml

Configure Gas Prices

sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"0.005uself\"|" $HOME/.selfchain/config/app.toml

Pruning Setting

sed -i \
  -e 's|^pruning *=.*|pruning = "custom"|' \
  -e 's|^pruning-keep-recent *=.*|pruning-keep-recent = "100"|' \
  -e 's|^pruning-keep-every *=.*|pruning-keep-every = "0"|' \
  -e 's|^pruning-interval *=.*|pruning-interval = "19"|' \
  $HOME/.selfchain/config/app.toml

Custom Port (optional)

sed -i -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:22058\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:22057\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:22060\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:22056\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":22066\"%" $HOME/.selfchain/config/config.toml
sed -i -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:22017\"%; s%^address = \":8080\"%address = \":22080\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:22090\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:22091\"%; s%:8545%:22045%; s%:8546%:22046%; s%:6065%:22065%" $HOME/.selfchain/config/app.toml

Start Service

sudo systemctl start selfchaind && \
journalctl -u selfchaind -f -o cat

Last updated