Manual Installation
Let's explore the manual installation process as we set up a node with Cosmovisor!
Install Dependencies
Update system package and install build tools
sudo apt -q update
sudo apt -qy install curl git jq lz4 unzip build-essential fail2ban ufw unzip
sudo apt -qy install gcc protobuf-compiler pkg-config libssl-dev
sudo apt -qy upgrade
Secure Setup
π’
This step is optional, and you can choose to skip ahead to configure moniker.
Setup ssh for swisstronik user replace YOUR_PUBLIC_SSH_KEY with your own!
sudo adduser swisstronik --disabled-password -q
sudo usermod -aG sudo swisstronik
sudo -u swisstronik bash -c 'mkdir -p ~/.ssh && echo "YOUR_PUBLIC_SSH_KEY" >> ~/.ssh/authorized_keys && chmod 700 ~/.ssh && chmod 600 ~/.ssh/authorized_keys'
Install SGX Driver
Install sgx driver for Ubuntu 22.04
wget https://download.01.org/intel-sgx/sgx-linux/2.22/distro/ubuntu22.04-server/sgx_linux_x64_driver_2.11.54c9c4c.bin
chmod +x sgx_linux_x64_driver_2.11.54c9c4c.bin
sudo ./sgx_linux_x64_driver_2.11.54c9c4c.bin
Install AESM
Install the required aesm packages
echo "deb https://download.01.org/intel-sgx/sgx_repo/ubuntu $(lsb_release -cs) main" | sudo tee -a /etc/apt/sources.list.d/intel-sgx.list >/dev/null
curl -sSL "https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key" | sudo -E apt-key add -
sudo apt update
sudo apt install sgx-aesm-service libsgx-aesm-launch-plugin libsgx-aesm-epid-plugin
sudo systemctl status aesmd.service
Enable Intel SGX
Enable Intel SGX repository.
echo "deb https://download.01.org/intel-sgx/sgx_repo/ubuntu $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/intel-sgx.list >/dev/null
curl -sSL "https://download.01.org/intel-sgx/sgx_repo/ubuntu/intel-sgx-deb.key" | sudo -E apt-key add -
sudo apt update
sudo apt install libsgx-launch libsgx-urts libsgx-epid libsgx-quote-ex sgx-aesm-service libsgx-aesm-launch-plugin libsgx-aesm-epid-plugin libsgx-quote-ex libsgx-dcap-ql libsnappy1v5
Install Rust
Install rust and build sgx tools
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
cargo install sgxs-tools
sudo $(which sgx-detect)
When everything is working correctly, you should receive output similar to the following
Detecting SGX, this may take a minute...
β SGX instruction set
β CPU support
β CPU configuration
β Enclave attributes
β Enclave Page Cache
SGX features
β SGX2 β EXINFO β ENCLV β OVERSUB β KSS
Total EPC size: 92.8MiB
β Flexible launch control
β CPU support
οΌ CPU configuration
β Able to launch production mode enclave
β SGX system software
β SGX kernel device (/dev/isgx)
β libsgx_enclave_common
β AESM service
β Able to launch enclaves
β Debug mode
β Production mode
β Production mode (Intel whitelisted)
Configure Moniker
Replace <your-moniker-name> with your own validator name
MONIKER="<your-moniker-name>"
Install Go
install go version 1.21.4
sudo rm -rf /usr/local/go
curl -Ls https://go.dev/dl/go1.21.4.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local
eval $(echo 'export PATH=$PATH:/usr/local/go/bin' | sudo tee /etc/profile.d/golang.sh)
eval $(echo 'export PATH=$PATH:$HOME/go/bin' | tee -a $HOME/.profile)
Build Binaries
Cloning project repository & Compile binaries
cd $HOME
wget https://github.com/SigmaGmbH/swisstronik-chain/releases/download/v1.0.1/swisstronikd.deb.zip
unzip swisstronikd.deb.zip
sudo dpkg -i swisstronik_1.0.1-updated-binaries_amd64.deb
Latest commit : N/A
Prepare binaries for cosmovisor
mkdir -p $HOME/.swisstronik/cosmovisor/genesis/bin
mv /usr/local/bin/swisstronikd $HOME/.swisstronik/cosmovisor/genesis/bin/
rm -rf build
Create 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
Create Enclave Folder
Create enclave folder & copy enclave.signed.so file for generating master key
sudo mkdir -p $HOME/.swisstronik-enclave/
sudo cp /usr/lib/enclave.signed.so $HOME/.swisstronik-enclave/enclave.signed.so
Obtain Master Key
Before starting your node, you should obtain master key.
swisstronikd enclave request-master-key rpc.testnet.swisstronik.com:46789
The command above will pass Remote Attestation, during which, another node checks whether the correct software and hardware are used. If the command returns you same output as shown below, it means your node is ready to work.
[Enclave] Seed successfully sealed
Remote Attestation passed. Node is ready for work
Cosmovisor Setup
Install cosmovisor
go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0
Create Service
Create a systemd 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"
Environment="PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$HOME/.swisstronik/cosmovisor/current/bin"
[Install]
WantedBy=multi-user.target
EOF
Enable Service
Enable swisstronik systemd service
sudo systemctl daemon-reload
sudo systemctl enable swisstronik
Initialize Node
Setting node configuration
swisstronikd config chain-id swisstronik_1291-1
swisstronikd config keyring-backend test
swisstronikd config node tcp://localhost:23757
Initialize node
swisstronikd init $MONIKER --chain-id swisstronik_1291-1
Download Genesis & Addrbook
Download genesis & addrbook file
curl -Ls https://snap.nodex.one/swisstronik-testnet/genesis.json > $HOME/.swisstronik/config/genesis.json
curl -Ls https://snap.nodex.one/swisstronik-testnet/addrbook.json > $HOME/.swisstronik/config/addrbook.json
sha256sum genesis.json
: c6eab9cc2860d7e7245e60ec51cec6a5e5c2806fcc2276cbaa6a12a241e9d892
Configure Seeds
Setting up a seed peers
sed -i -e "s|^seeds *=.*|seeds = \"d1d43cc7c7aef715957289fd96a114ecaa7ba756@testnet-seeds.nodex.one:23710\"|" $HOME/.swisstronik/config/config.toml
Configure Gas Prices
Setting up a gas prices
sed -i -e "s|^minimum-gas-prices *=.*|minimum-gas-prices = \"7uswtr\"|" $HOME/.swisstronik/config/app.toml
Pruning Setting
Configure 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/.swisstronik/config/app.toml
Custom Port
Please note that updating the port is optional!
Configure a custom port
sed -i -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:23758\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:23757\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:23760\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:23756\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":23766\"%" $HOME/.swisstronik/config/config.toml
sed -i -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:23717\"%; s%^address = \":8080\"%address = \":23780\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:23790\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:23791\"%; s%:8545%:23745%; s%:8546%:23746%; s%:6065%:23765%" $HOME/.swisstronik/config/app.toml
Download Snapshots
Download latest chain snapshot
curl -L https://snap.nodex.one/swisstronik-testnet/seda-latest.tar.lz4 | tar -Ilz4 -xf - -C $HOME/.swisstronik
[[ -f $HOME/.swisstronik/data/upgrade-info.json ]] && cp $HOME/.swisstronik/data/upgrade-info.json $HOME/.swisstronik/cosmovisor/genesis/upgrade-info.json
Start Service
Letss f*cking goooo!
sudo systemctl start swisstronik