Gitopia (mainnet)

# Website: https://gitopia.com/
# Github: https://github.com/gitopia
# Explorer: Ping.pub
# Our Validator: F-Staking
# Chain-id: gitopia
# Type: mainnet

Endpoints:

https://api-gitopia.f-staking.com/
https://rpc-gitopia.f-staking.com/
https://grpc-gitopia.f-staking.com/

Files:

# Snapshots (every 12 hours): https://snapshots.f-staking.com/gitopia/mainnet/
# Address Book: https://snapshots.f-staking.com/gitopia/mainnet/addrbook.json
# Genesis: https://snapshots.f-staking.com/gitopia/mainnet/genesis.json

Snapshot:

# Set variables
PROJECT_NAME=gitopia
PROJECT_TYPE=mainnet
PROJECT_SERVICE=gitopiad
PROJECT_BINARY=gitopiad
PROJECT_FOLDER=~/.gitopia

# Install lz4
sudo apt update
sudo apt-get install snapd lz4 -y

# Disable State Sync
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1false|" ${PROJECT_FOLDER}/config/config.toml

# Stop and reset node
sudo systemctl stop ${PROJECT_SERVICE}
cp ${PROJECT_FOLDER}/data/priv_validator_state.json ${PROJECT_FOLDER}/priv_validator_state.json.backup
rm -rf ${PROJECT_FOLDER}/data
${PROJECT_BINARY} tendermint unsafe-reset-all --home ${PROJECT_FOLDER} --keep-addr-book

# Download Snapshot
SNAPSHOT_NAME=$(curl -s https://snapshots.f-staking.com/${PROJECT_NAME}/${PROJECT_TYPE}/ | egrep -o ">snapshot.*\.tar.lz4" | tr -d ">" | tail -n 1)
curl -o - -L https://snapshots.f-staking.com/${PROJECT_NAME}/${PROJECT_TYPE}/${SNAPSHOT_NAME}  | lz4 -c -d - | tar -x -C ${PROJECT_FOLDER}

# Restart Node
sudo systemctl restart ${PROJECT_SERVICE}
journalctl -u ${PROJECT_SERVICE} -f

State Sync:

# Set variables
PROJECT_NAME=gitopia
PROJECT_TYPE=mainnet
PROJECT_SERVICE=gitopiad
PROJECT_BINARY=gitopiad
PROJECT_FOLDER=~/.gitopia
SNAP_RPC="https://rpc-gitopia.f-staking.com:443"
SNAP_PEER="a2d725392ea4cb4d596555bb6e56a073d140037b@peer-gitopia.f-staking.com:26656"

# Stop and reset node
sudo systemctl stop ${PROJECT_SERVICE}
cp ${PROJECT_FOLDER}/data/priv_validator_state.json ${PROJECT_FOLDER}/priv_validator_state.json.backup
rm -rf ${PROJECT_FOLDER}/data
${PROJECT_BINARY} tendermint unsafe-reset-all --home ${PROJECT_FOLDER} --keep-addr-book

# Configure State Sync
LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height); \
BLOCK_HEIGHT=$((LATEST_HEIGHT - 2000)); \
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash)
sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ; \
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \
s|^(persistent_peers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_PEER\"| ; \
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"|" ${PROJECT_FOLDER}/config/config.toml

# Restart Node
sudo systemctl restart ${PROJECT_SERVICE}
journalctl -u ${PROJECT_SERVICE} -f