bash <(curl -s https://raw.githubusercontent.com/UnityNodes/scripts/main/selfchain/install-selfchain.sh)
1️⃣ Installation packeges and dependencies
# Install dependencies for building from source
sudo apt update
sudo apt install -y lz4 jq make git gcc build-essential curl chrony unzip gzip snapd tmux bc
# Install Go
sudo rm -rf /usr/local/go
curl -L https://go.dev/dl/go1.21.6.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bash_profile
source .bash_profile
# Install selfchain through binary
cd $HOME
wget https://github.com/hotcrosscom/Self-Chain-Releases/releases/download/mainnet-v1.0.1/selfchaind-linux-amd64
chmod +x selfchaind-linux-amd64
mv selfchaind-linux-amd64 $HOME/go/bin/selfchaind
# Initialize the node
selfchaind init "NODE_MONIKER" --chain-id self-1
# Download genesis and addrbook files
curl -Ls https://snapshots-mainnet.unitynodes.com/selfchain-mainnet/genesis.json > $HOME/.selfchain/config/genesis.json
curl -Ls https://snapshots-mainnet.unitynodes.com/selfchain-mainnet/addrbook.json > $HOME/.selfchain/config/addrbook.json
# Set minimum gas price
sed -i 's|^minimum-gas-prices *=.*|minimum-gas-prices = "0.005uself"|g' $HOME/.selfchain/config/app.toml
# Set pruning
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 = "10"|' \
$HOME/.selfchain/config/app.toml
# Download latest chain data snapshot
curl https://snapshots-mainnet.unitynodes.com/selfchain-mainnet/selfchain-mainnet-latest.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.selfchain
# Create a service
sudo tee /etc/systemd/system/selfchaind.service > /dev/null <<EOF
[Unit]
Description=selfchain node
After=network-online.target
[Service]
User=$USER
ExecStart=$(which selfchaind) start
Restart=always
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
# Start the service and check the logs
sudo systemctl daemon-reload
sudo systemctl enable selfchaind
sudo systemctl start selfchaind.service
sudo journalctl -u selfchaind.service -f -o cat
selfchaind keys add wallet
2️⃣ View your wallet balance
selfchaind keys q bank balances "address"
3️⃣ View the sync status of your node
selfchaind status | jq | grep "catching_up"
selfchaind tx staking create-validator \
--amount "1000000uself" \
--pubkey $(selfchaind tendermint show-validator) \
--moniker "NODE_MONIKER" \ #Validator name, displayed in explorers.
--identity "" \ #Use your KeyBase ID. If you don't have one, leave it empty.
--details "" \ #Any details about your validator.
--website "" \ #Your website/github etc
--chain-id self-1 \
--commission-rate "0.05" \
--commission-max-rate "0.2" \
--commission-max-change-rate "0.01" \
--min-self-delegation "1" \
--broadcast-mode sync \
--gas="87578" \
--gas-adjustment="1.2" \
--gas-prices="0.5uslf" \
--from=wallet \
-y
5️⃣ Save priv_validator_key.json
cat $HOME/.selfchain/config/priv_validator_key.json