Installation

v1.0.3

Minimum hardware Requirements #

CPU : 4x CPUs
Ram : 8GB RAM 
Storage: 100GB of storage (SSD or NVME)

Setting Variables

echo "export WALLET="wallet"" >> $HOME/.bash_profile
echo "export MONIKER="test"" >> $HOME/.bash_profile
echo "export swisstronik_CHAIN_ID="swisstronik_1291-1"" >> $HOME/.bash_profile
echo "export swisstronik_PORT="264"" >> $HOME/.bash_profile
echo "export DAEMON_NAME="swisstronikd"" >> $HOME/.bash_profile
echo "export DAEMON_HOME=$HOME/.swisstronik"" >> $HOME/.bash_profile
source $HOME/.bash_profile

Install dependencies

sudo apt update && sudo apt upgrade -y && sudo apt-get install make build-essential gcc git jq chrony lz4 tmux unzip bc -y && sudo apt install -y curl git jq lz4 build-essential unzip

INSTALL GO

ver="1.20.5" && \
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

# Adding Go's location to profile
cat <<'EOF' >>$HOME/.profile
export GOROOT=/usr/local/go
export GOPATH=$HOME/go
export GO111MODULE=on
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
EOF

source $HOME/.profile
go version

Download and build binary

# Download Pre-build Binary
cd $HOME
wget https://github.com/SigmaGmbH/swisstronik-chain/releases/download/testnet-v1.0.3/swisstronikd.zip
unzip swisstronikd.zip
sudo cp bin/libsgx_wrapper_v1.0.3.x86_64.so /usr/lib
cp bin/v1.0.3_enclave.signed.so $HOME/.swisstronik-enclave
cp swisstronikd $HOME/go/bin/


# Prepare binaries for Cosmovisor
mkdir -p $HOME/.swisstronik/cosmovisor/genesis/bin
mv build/swisstronikd $HOME/.swisstronik/cosmovisor/genesis/bin/
rm -rf build

# Create application symlinks
sudo ln -s $HOME/.swisstronik/cosmovisor/genesis $HOME/.swisstronik/cosmovisor/current -f
sudo ln -s $HOME/.swisstronik/cosmovisor/current/bin/swisstronikd /usr/local/bin/swisstronikd -f

Installing Cosmovisor

# Download and install Cosmovisor
go install github.com/cosmos/cosmos-sdk/cosmovisor/cmd/cosmovisor@latest

# Create service
sudo tee /etc/systemd/system/swisstronik.service > /dev/null << EOF
[Unit]
Description=swisstronik 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/.swisstronik"
Environment="DAEMON_NAME=swisstronikd"
Environment="UNSAFE_SKIP_BACKUP=true"


[Install]
WantedBy=multi-user.target
EOF

# Reload Daemon
sudo systemctl daemon-reload
sudo systemctl enable swisstronik.service

Initialize Node & Configuring Node Port

# Set node configuration
swisstronikd init $MONIKER --chain-id swisstronik_1291-1
swisstronikd config node tcp://localhost:26457
swisstronikd config keyring-backend file

# Set custom ports in client.toml
sed -i.bak -e "s%:26457%:${swisstronik_PORT}57%g"  $HOME/.swisstronik/config/client.toml

# Set custom ports in app.toml
sed -i.bak -e "s%:1317%:${swisstronik_PORT}17%g;
s%:8080%:${swisstronik_PORT}80%g;
s%:9090%:${swisstronik_PORT}90%g;
s%:9091%:${swisstronik_PORT}91%g;
s%:8545%:${swisstronik_PORT}45%g;
s%:8546%:${swisstronik_PORT}46%g;
s%:6065%:${swisstronik_PORT}65%g" $HOME/.swisstronik/config/app.toml

# Set custom ports in config.toml file
sed -i.bak -e "s%:26658%:${swisstronik_PORT}58%g;
s%:26657%:${swisstronik_PORT}57%g;
s%:6060%:${swisstronik_PORT}60%g;
s%:26656%:${swisstronik_PORT}56%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${swisstronik_PORT}56\"%;
s%:26660%:${swisstronik_PORT}60%g" $HOME/.swisstronik/config/config.toml

# Download genesis and addrbook
wget -O $HOME/.swisstronik/config/genesis.json https://files.nodeshub.online/testnet/swisstronik/genesis.json
wget -O $HOME/.swisstronik/config/addrbook.json https://files.nodeshub.online/testnet/swisstronik/addrbook.json

# Add Seeds and Peers
SEEDS="https://swisstronik.test.seeds.nodeshub.online:26456"
PEERS=""
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.swisstronik/config/config.toml

# Set minimum gas price
sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"7aswtr\"|" $HOME/.swisstronik/config/app.toml

# Set pruning and indexer to Null
sed -i -e "s/^pruning =./pruning = "custom"/" $HOME/.swisstronik/config/app.toml sed -i -e "s/^pruning-keep-recent =./pruning-keep-recent = "100"/"
$HOME/.swisstronik/config/app.toml sed -i -e "s/^pruning-interval =./pruning-interval = "50"/" $HOME/.swisstronik/config/app.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.swisstronik/config/config.toml
  
  

Download Snapshot

# Back up priv_validator_state.json if needed
cp ~/.swisstronik/data/priv_validator_state.json  ~/.swisstronik/priv_validator_state.json

# On some tendermint chains
swisstronikd unsafe-reset-all --home $HOME/.swisstronik --keep-addr-book

# On other tendermint chains
swisstronikd tendermint unsafe-reset-all --home $HOME/.swisstronik --keep-addr-book

curl https://files.nodeshub.online/testnet/swisstronik/snapshot/swisstronik_snap.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.swisstronik

mv $HOME/.swisstronik/priv_validator_state.json.backup $HOME/.swisstronik/data/priv_validator_state.json
sudo systemctl restart swisstronik && sudo journalctl -u swisstronik -f -o cat

Start service and check the logs

sudo systemctl start swisstronik.service && sudo journalctl -u swisstronik -f -o cat

Last updated