Defund – Testnet – Node Deployment Guide

Chain: defund-private-4

The guide is outdated.

System requirements: 4 CPU, 16GB RAM, 1TB SSD

Update server:

sudo apt update && sudo apt upgrade -y

Install additional packages:

sudo apt install make clang git pkg-config libssl-dev build-essential git gcc chrony curl jq ncdu bsdmainutils htop net-tools lsof fail2ban wget -y

Install GO and check version:

ver="1.19.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" && \
echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> $HOME/.bash_profile && \
source $HOME/.bash_profile && \
go version

Clone repository and build binary:

cd $HOME && rm -rf defund
git clone https://github.com/defund-labs/defund
cd defund
git checkout v0.2.2
make install
cd $HOME
defundd version

Update binary at height 2280048:

cd $HOME && rm -rf defund
git clone https://github.com/defund-labs/defund
cd defund
git checkout v0.2.4
make install
cd $HOME
defundd version

Update binary at height 6108687:

cd $HOME && rm -rf defund
git clone https://github.com/defund-labs/defund
cd defund
git checkout v0.2.5
make install
cd $HOME
defundd version

Move binary:

chmod +x /root/go/bin/defundd && sudo mv /root/go/bin/defundd /usr/local/bin/defundd
cd $HOME

Set variables (choose your node and wallet name):

DEFUND_CHAIN="defund-private-4"
DEFUND_MONIKER="your_node_name"
DEFUND_WALLET="your_wallet_name"

Add variables to bash profile:

echo 'export DEFUND_CHAIN='${DEFUND_CHAIN} >> $HOME/.bash_profile
echo 'export DEFUND_MONIKER='${DEFUND_MONIKER} >> $HOME/.bash_profile
echo 'export DEFUND_WALLET='${DEFUND_WALLET} >> $HOME/.bash_profile
source $HOME/.bash_profile

Initialize the node:

defundd init $DEFUND_MONIKER --chain-id $DEFUND_CHAIN

Set chain id in the config:

defundd config chain-id $DEFUND_CHAIN

Download genesis:

curl -s https://raw.githubusercontent.com/defund-labs/testnet/main/defund-private-4/genesis.json > ~/.defund/config/genesis.json

Set up pruning (optionally):

pruning="custom"
pruning_keep_recent="1000"
pruning_keep_every="0"
pruning_interval="50"

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

Turn off indexer (optionally):

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

Add seeds and peers:

[email protected]:26656,[email protected]:26656,[email protected]:56656,[email protected]:17000,[email protected]:45656,74e6425e7ec76e6eaef92643b6181c42d5b8a3b8@defund-testnet-seed.itrocket.net:443
sed -i.bak -e "s/^seeds *=.*/seeds = \"$SEEDS\"/" ~/.defund/config/config.toml

peers="[email protected]:40656,[email protected]:36656,[email protected]:45656,[email protected]:26656,[email protected]:26656,[email protected]:28656,[email protected]:10656,[email protected]:26656,[email protected]:26656,[email protected]:45656,[email protected]:26656"
sed -i -e "s|^persistent_peers *=.*|persistent_peers = \"$peers\"|" $HOME/.defund/config/config.toml

Set minimum gas price:

sed -i.bak 's/minimum-gas-prices =.*/minimum-gas-prices = "0.0025ufetf"/g' $HOME/.defund/config/app.toml

Create service:

sudo tee /etc/systemd/system/defund.service > /dev/null <<EOF
[Unit]
Description=Defund
After=network.target
[Service]
Type=simple
User=$USER
ExecStart=$(which defundd) start
Restart=on-failure
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF

Start service:

sudo systemctl restart systemd-journald
sudo systemctl daemon-reload
sudo systemctl enable defund
sudo systemctl restart defund

Check logs (node should start syncing):

sudo journalctl -u defund -f -o cat

Check status (wait catching_up: false):

curl localhost:26657/status

Create new wallet (save mnemonic in a safe place):

defundd keys add $DEFUND_WALLET

Recover old wallet (if exists):

defundd keys add $DEFUND_WALLET --recover

Add address to bash profile:

DEFUND_ADDR=$(defundd keys show $DEFUND_WALLET -a)
echo 'export DEFUND_ADDR='${DEFUND_ADDR} >> $HOME/.bash_profile
source $HOME/.bash_profile

Ask tokens from faucet and check balance:

defundd query bank balances $DEFUND_ADDR

Create validator:

defundd tx staking create-validator \
  --amount=1000000ufetf \
  --pubkey=$(defundd tendermint show-validator) \
  --moniker=$DEFUND_MONIKER \
  --chain-id=$DEFUND_CHAIN \
  --commission-rate="0.10" \
  --commission-max-rate="0.20" \
  --commission-max-change-rate="0.01" \
  --min-self-delegation="1" \
  --from=$DEFUND_WALLET \
  --fees 500ufetf

Add validator address to bash profile:

DEFUND_VALOPER=$(defundd keys show $DEFUND_WALLET --bech val -a)
echo 'export DEFUND_VALOPER='${DEFUND_VALOPER} >> $HOME/.bash_profile
source $HOME/.bash_profile

Check validator status:

defundd query staking validator $DEFUND_VALOPER

How to delegate your tokens to validator (leave some or commissions):

defundd tx staking delegate $DEFUND_VALOPER 1000000ufetf --from $DEFUND_WALLET --chain-id $DEFUND_CHAIN --fees 500ufetf

How to unjail your validator:

defundd tx slashing unjail --from $DEFUND_WALLET --chain-id $DEFUND_CHAIN --fees 500ufetf

How to remove node:

sudo systemctl stop defund
sudo systemctl disable defund
cd $HOME
rm /etc/systemd/system/defund.service
rm /usr/local/bin/defundd
rm -r defund/
rm -r .defund/

Share post: