Skip to main content

Installation

Minimum hardware requirement

4-8 Cores, 16G Ram, 500G NVME, Ubuntu 22.04 - 24.04

Installation of required packages

sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y

Installation GO

cd ~
VER="1.23.4" # Make sure that this version does not broke any other apps you run!
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"
[ ! -f ~/.bash_profile ] && touch ~/.bash_profile
echo "export PATH=$PATH:/usr/local/go/bin:~/go/bin" >> ~/.bash_profile
source $HOME/.bash_profile
[ ! -d ~/go/bin ] && mkdir -p ~/go/bin

echo "export SAFRO_PORT="36"" >> $HOME/.bash_profile
source $HOME/.bash_profile

Downloading and installing node

cd $HOME
git clone https://github.com/Safrochain-Org/safrochain-node.git
cd safrochain-node
git checkout release/v0.1.0
make install
safrochaind version

Set node configuration

safrochaind init NodeName --chain-id safro-testnet-1
sed -i "s/chain-id = .*/chain-id = \"safro-testnet-1\"/" $HOME/.safrochain/config/client.toml
sed -i "s/keyring-backend = .*/keyring-backend = \"os\"/" $HOME/.safrochain/config/client.toml
sed -i "s/node = .*/node = \"tcp:\/\/localhost:${SAFRO_PORT}657\"/" $HOME/.safrochain/config/client.toml

Downloading genesis and addressbook

curl -Ls https://snapshots.nodesync.top/Testnet/Safrochain/genesis.json > $HOME/.safrochain/config/genesis.json
curl -Ls https://snapshots.nodesync.top/Testnet/Safrochain/addrbook.json > $HOME/.safrochain/config/addrbook.json
# Set seeds and peers

peers="[email protected]:26656,[email protected]:26656,[email protected]:12656,[email protected]:50656,[email protected]:13656,[email protected]:57656,[email protected]:26656,[email protected]:13156,[email protected]:53656,[email protected]:33656,[email protected]:36656"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.safrochain/config/config.toml

# Set minimum gas price
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.001usaf"|g' $HOME/.safrochain/config/app.toml

# Set indexer
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.safrochain/config/config.toml

# Set pruning
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.safrochain/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.safrochain/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"50\"/" $HOME/.safrochain/config/app.toml

# Change ports
sed -i.bak -e "s%:1317%:${SAFRO_PORT}317%g;
s%:8080%:${SAFRO_PORT}080%g;
s%:9090%:${SAFRO_PORT}090%g;
s%:9091%:${SAFRO_PORT}091%g;
s%:8545%:${SAFRO_PORT}545%g;
s%:8546%:${SAFRO_PORT}546%g;
s%:6065%:${SAFRO_PORT}065%g" $HOME/.safrochain/config/app.toml
sed -i.bak -e "s%:26658%:${SAFRO_PORT}658%g;
s%:26657%:${SAFRO_PORT}657%g;
s%:6060%:${SAFRO_PORT}060%g;
s%:26656%:${SAFRO_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${SAFRO_PORT}656\"%;
s%:26660%:${SAFRO_PORT}660%g" $HOME/.safrochain/config/config.toml


# Download latest chain data snapshot
curl -L https://snapshots.nodesync.top/Testnet/Safrochain/safrochain_latest.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.safrochain

Creating service file

sudo tee /etc/systemd/system/safrochaind.service > /dev/null <<EOF
[Unit]
Description=safrochaind Service
After=network-online.target

[Service]
User=$USER
ExecStart=$(which safrochaind) start
Restart=always
RestartSec=3
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable safrochaind

Start node

sudo systemctl start safrochaind && sudo journalctl -fu safrochaind -o cat