Empowering Your Blockchain Journey with Reliable Validation.
# install dependencies, if needed
sudo apt update && sudo apt upgrade -y
sudo apt install curl git wget htop tmux build-essential jq make lz4 gcc unzip -y
# install go, if needed
cd $HOME
VER="1.23.1"
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
# set vars
echo "export WALLET="wallet"" >> $HOME/.bash_profile
echo "export MONIKER="test"" >> $HOME/.bash_profile
echo "export GALACTICA_CHAIN_ID="galactica_9302-1"" >> $HOME/.bash_profile
echo "export GALACTICA_PORT="46"" >> $HOME/.bash_profile
source $HOME/.bash_profile
# download binary
cd $HOME
rm -rf bin
mkdir bin
cd $HOME/bin
wget https://github.com/Galactica-corp/galactica/releases/download/v0.2.4/galacticad_v0.2.4-linux_amd64.zip
unzip galacticad_v0.2.4-linux_amd64.zip
chmod +x $HOME/bin/galacticad
sudo mv $HOME/bin/galacticad $HOME/go/bin
# config and init app
galacticad config node tcp://localhost:${GALACTICA_PORT}657
galacticad config keyring-backend os
galacticad config chain-id galactica_9302-1
galacticad init "test" --chain-id galactica_9302-1
# download genesis and addrbook
wget -O $HOME/.galactica/config/genesis.json https://server-4.itrocket.net/testnet/galactica/genesis.json
wget -O $HOME/.galactica/config/addrbook.json https://server-4.itrocket.net/testnet/galactica/addrbook.json
# set seeds and peers
SEEDS="52ccf467673f93561c9d5dd4434def32ef2cd7f3@galactica-testnet-seed.itrocket.net:46656"
PEERS="c9993c738bec6a10cfb8bb30ac4e9ae6f8286a5b@galactica-testnet-peer.itrocket.net:11656,c217be3b7bc65fd74d9c3fa59e593518b8211012@[2a01:4f8:262:121c::2]:13156,4313c88bb2d7a4afe4a58f87a0f282eee96fbdba@65.109.182.72:46656,7175e583832c56d259a5b02098302798b0205dc4@65.108.206.118:60656,f3cd6b6ebf8376e17e630266348672517aca006a@46.4.5.45:27456,9990ab130eac92a2ed1c3d668e9a1c6e811e8f35@148.251.177.108:27456,6f5ea6dbdd258ab7ae6b30c76b5053993beb068f@65.109.52.156:46656,8cd53a018c07b02793cfc40fe8dec334f55139b2@65.109.24.155:27456,a30e3886e3c71d30c8c5fe2a38792935bd21843c@5.189.175.174:26656,6d99e9240a78a7f214b1766bbed13afbc6894a2b@65.108.232.48:46656,5956d05ceb5ef855b5c2f39c48b33cd869f094b1@65.21.232.175:57656"
sed -i -e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*seeds *=.*/seeds = \"$SEEDS\"/}" \
-e "/^\[p2p\]/,/^\[/{s/^[[:space:]]*persistent_peers *=.*/persistent_peers = \"$PEERS\"/}" $HOME/.galactica/config/config.toml
# set custom ports in app.toml
sed -i.bak -e "s%:1317%:${GALACTICA_PORT}317%g;
s%:8080%:${GALACTICA_PORT}080%g;
s%:9090%:${GALACTICA_PORT}090%g;
s%:9091%:${GALACTICA_PORT}091%g;
s%:8545%:${GALACTICA_PORT}545%g;
s%:8546%:${GALACTICA_PORT}546%g;
s%:6065%:${GALACTICA_PORT}065%g" $HOME/.galactica/config/app.toml
# set custom ports in config.toml file
sed -i.bak -e "s%:26658%:${GALACTICA_PORT}658%g;
s%:26657%:${GALACTICA_PORT}657%g;
s%:6060%:${GALACTICA_PORT}060%g;
s%:26656%:${GALACTICA_PORT}656%g;
s%^external_address = \"\"%external_address = \"$(wget -qO- eth0.me):${GALACTICA_PORT}656\"%;
s%:26660%:${GALACTICA_PORT}660%g" $HOME/.galactica/config/config.toml
# config pruning
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.galactica/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.galactica/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"19\"/" $HOME/.galactica/config/app.toml
# set minimum gas price, enable prometheus and disable indexing
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "10agnet"|g' $HOME/.galactica/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.galactica/config/config.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.galactica/config/config.toml
# create service file
sudo tee /etc/systemd/system/galacticad.service > /dev/null << EOF
[Unit]
Description=Galactica Node
After=network-online.target
[Service]
User=$USER
ExecStart=$(which galacticad) start --home $HOME/.galactica --chain-id galactica_9302-1
WorkingDirectory=$HOME/.galactica
Restart=on-failure
RestartSec=3
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
# reset and download snapshot
galacticad tendermint unsafe-reset-all --home $HOME/.galactica
if curl -s --head curl https://server-4.itrocket.net/testnet/galactica/galactica_2024-11-21_3375909_snap.tar.lz4 | head -n 1 | grep "200" > /dev/null; then
curl https://server-4.itrocket.net/testnet/galactica/galactica_2024-11-21_3375909_snap.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.galactica
else
echo "no snapshot found"
fi
# enable and start service
sudo systemctl daemon-reload
sudo systemctl enable galacticad
sudo systemctl restart galacticad && sudo journalctl -u galacticad -f