← Back to Cosmos Documentation

Republic Installation

TESTNET • republic-testnet

Installation

Install Dependencies

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

Go Version

cd $HOME
sudo rm -rf /usr/local/go
VER="1.25.5"
curl -Ls https://go.dev/dl/go$VER.linux-amd64.tar.gz | sudo tar -xzf - -C /usr/local
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile
source $HOME/.bash_profile
mkdir -p ~/go/bin
go version

Install Binary

cd $HOME
mkdir -p ~/go/bin
wget https://github.com/RepublicAI/networks/raw/refs/heads/main/testnet/releases/v0.3.0/republicd-linux-amd64 -O republicd 
chmod +x republicd 
mv republicd ~/go/bin/

Initialize Node

republicd init "Your_Validator_Name" --chain-id republic-testnet --home $HOME/.republic

Download Genesis and Addrbook

wget -O $HOME/.republic/config/genesis.json https://backup.codeblocklabs.com/republic/genesis.json 
wget -O $HOME/.republic/config/addrbook.json https://backup.codeblocklabs.com/republic/addrbook.json

Configure Pruning

pruning="custom"
pruning_keep_recent="100" 
pruning_keep_every="0" 
pruning_interval="19" 
sed -i -e "s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.republic/config/app.toml 
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.republic/config/app.toml 
sed -i -e "s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.republic/config/app.toml 
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.republic/config/app.toml

Set Minimum Gas Price

sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "2500000000arai"|g' $HOME/.republic/config/app.toml

Configure Indexer

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

Create Service

sudo tee /etc/systemd/system/republicd.service > /dev/null <<EOF
[Unit] 
Description=Republic node 
After=network-online.target 
[Service] 
User=$USER 
WorkingDirectory=$HOME/.republic 
ExecStart=$(which republicd) start --home $HOME/.republic 
Restart=on-failure 
RestartSec=5 
LimitNOFILE=65535 
[Install] 
WantedBy=multi-user.target 
EOF
mkdir -p $HOME/.republic/cosmovisor/genesis/bin
mv $HOME/go/bin/republicd $HOME/.republic/cosmovisor/genesis/bin/ 
sudo ln -s $HOME/.republic/cosmovisor/genesis $HOME/.republic/cosmovisor/current -f 
sudo ln -s $HOME/.republic/cosmovisor/current/bin/republicd /usr/local/bin/republicd -f 

go install cosmossdk.io/tools/cosmovisor/cmd/[email protected] 

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

[Service] 
User=$USER 
ExecStart=$(which cosmovisor) run start --home $HOME/.republic 
Restart=on-failure 
RestartSec=10 
LimitNOFILE=65535 
Environment="DAEMON_HOME=$HOME/.republic" 
Environment="DAEMON_NAME=republicd" 
Environment="UNSAFE_SKIP_BACKUP=true" 

[Install] 
WantedBy=multi-user.target 
EOF

Enable and Start Service

sudo systemctl daemon-reload 
sudo systemctl enable republicd 
sudo systemctl restart republicd && sudo journalctl -u republicd -f

Create Wallet

# Create new wallet
republicd keys add wallet --home $HOME/.republic 

# Restore existing wallet
republicd keys add wallet --recover --home $HOME/.republic 

# Check sync status (false = fully synced)
republicd status --home $HOME/.republic 2>&1 | jq .sync_info

Create Validator

Create validator.json

tee $HOME/validator.json > /dev/null <<EOF
{
  "pubkey": $(republicd comet show-validator), 
  "amount": "1000000000000000000arai", 
  "moniker": "CodeBlockLabs", 
  "identity": "E1ADDC27DCE641C2", 
  "website": "https://codeblocklabs.com", 
  "details": "Join Our Community on Telegram @CodeBlockLabs", 
  "commission-rate": "0.05", 
  "commission-max-rate": "0.2", 
  "commission-max-change-rate": "0.1", 
  "min-self-delegation": "1" 
}
EOF

Create Validator

republicd tx staking create-validator $HOME/validator.json --from wallet --chain-id republic-testnet --home $HOME/.republic --gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai -y

Delete Node

sudo systemctl stop republicd 
sudo systemctl disable republicd 
sudo rm -rf /etc/systemd/system/republicd.service 
sudo rm $(which republicd) 
sudo rm -rf $HOME/.republic

Service Operations

Check logs

sudo journalctl -u republicd -f

Sync info

republicd status --home $HOME/.republic 2>&1 | jq .sync_info

Node info

republicd status --home $HOME/.republic 2>&1 | jq .node_info

Your node peer

# CometBFT
echo $(republicd comet show-node-id --home $HOME/.republic)'@'$(wget -qO- eth0.me)':'$(cat $HOME/.republic/config/config.toml | sed -n '/Address to listen for incoming connection/{n;p;}' | sed 's/.*://; s/".*//')
# Tendermint (legacy)
# echo $(republicd tendermint show-node-id --home $HOME/.republic)'@'$(wget -qO- eth0.me)':'$(cat $HOME/.republic/config/config.toml | sed -n '/Address to listen for incoming connection/{n;p;}' | sed 's/.*://; s/".*//')

Key Management

Add New Wallet

republicd keys add wallet --home $HOME/.republic

Restore existing wallet

republicd keys add wallet --recover --home $HOME/.republic

List All Wallets

republicd keys list --home $HOME/.republic

Delete wallet

republicd keys delete wallet --home $HOME/.republic

Check Balance

republicd q bank balances $(republicd keys show wallet -a --home $HOME/.republic) --home $HOME/.republic

Export Key (save to wallet.backup)

republicd keys export wallet --home $HOME/.republic

Export Key to EVM

republicd keys export wallet --unarmored-hex --unsafe --home $HOME/.republic

Import Key (restore from wallet.backup)

republicd keys import wallet wallet.backup --home $HOME/.republic

Tokens

Withdraw all rewards

republicd tx distribution withdraw-all-rewards --from wallet --chain-id republic-testnet --home $HOME/.republic --gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai -y

Withdraw rewards and commission from your validator

republicd tx distribution withdraw-rewards $(republicd keys show wallet --bech val -a --home $HOME/.republic) --from wallet --commission --chain-id republic-testnet --home $HOME/.republic --gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai -y

Delegate to Yourself

republicd tx staking delegate $(republicd keys show wallet --bech val -a --home $HOME/.republic) 1000000000000000000arai --from wallet --chain-id republic-testnet --home $HOME/.republic --gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai -y

Delegate to Other Validator

republicd tx staking delegate <TO_VALOPER_ADDRESS> 1000000000000000000arai --from wallet --chain-id republic-testnet --home $HOME/.republic --gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai -y

Redelegate Stake to Another Validator

republicd tx staking redelegate $(republicd keys show wallet --bech val -a --home $HOME/.republic) <TO_VALOPER_ADDRESS> 1000000000000000000arai --from wallet --chain-id republic-testnet --home $HOME/.republic --gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai -y

Unbond

republicd tx staking unbond $(republicd keys show wallet --bech val -a --home $HOME/.republic) 1000000000000000000arai --from wallet --chain-id republic-testnet --home $HOME/.republic --gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai -y

Transfer Funds

republicd tx bank send $(republicd keys show wallet -a --home $HOME/.republic) <TO_WALLET_ADDRESS> 1000000000000000000arai --chain-id republic-testnet --home $HOME/.republic --gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai -y

Validator Operations

Edit Existing Validator

republicd tx staking edit-validator \
--commission-rate 0.1 \
--new-moniker "$MONIKER" \
--identity "" \
--details "I am validator" \
--from wallet \
--chain-id republic-testnet \
--home $HOME/.republic \
--gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai  \
-y

Validator info

republicd status --home $HOME/.republic 2>&1 | jq .validator_info

Validator Details

republicd q staking validator $(republicd keys show wallet --bech val -a --home $HOME/.republic) --home $HOME/.republic

Jailing info

# CometBFT
republicd q slashing signing-info $(republicd comet show-validator --home $HOME/.republic) --home $HOME/.republic# Tendermint (legacy)
# republicd q slashing signing-info $(republicd tendermint show-validator --home $HOME/.republic) --home $HOME/.republic

Slashing parameters

republicd q slashing params --home $HOME/.republic

Unjail validator

republicd tx slashing unjail --from wallet --chain-id republic-testnet --home $HOME/.republic --gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai -y

Active Validators List

republicd q staking validators -oj --limit=2000 --home $HOME/.republic | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " 	 " + .description.moniker' | sort -gr | nl

Check Validator key

# CometBFT
[[ $(republicd q staking validator $(republicd keys show wallet --bech val -a --home $HOME/.republic) -oj --home $HOME/.republic | jq -r .consensus_pubkey.key) = $(republicd status --home $HOME/.republic 2>&1 | jq -r .ValidatorInfo.PubKey.value) ]] && echo -e "Your key status is ok" || echo -e "Your key status is error"
# Tendermint (legacy)
# [[ $(republicd q staking validator $(republicd keys show wallet --bech val -a --home $HOME/.republic) -oj --home $HOME/.republic | jq -r .consensus_pubkey.key) = $(republicd status --home $HOME/.republic 2>&1 | jq -r .ValidatorInfo.PubKey.value) ]] && echo -e "Your key status is ok" || echo -e "Your key status is error"

Signing info

# CometBFT
republicd q slashing signing-info $(republicd comet show-validator --home $HOME/.republic) --home $HOME/.republic# Tendermint (legacy)
# republicd q slashing signing-info $(republicd tendermint show-validator --home $HOME/.republic) --home $HOME/.republic

Governance

Create New Text Proposal

republicd tx gov submit-proposal \
--title "" \
--description "" \
--deposit 1000000000000000000arai \
--type Text \
--from wallet \
--home $HOME/.republic \
--gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai  \
-y

Proposals List

republicd query gov proposals --home $HOME/.republic

View proposal

republicd query gov proposal 1 --home $HOME/.republic

Vote

republicd tx gov vote 1 yes --from wallet --chain-id republic-testnet --home $HOME/.republic --gas auto --gas-adjustment 1.5 --gas-prices 2500000000arai -y