# Join The Public Testnet

## Hardware Requirements

* **Minimal**
  * 4GB RAM
  * 300GB SSD
  * 2 vCPU
* **Recommended**
  * 8GB RAM
  * 600GB SSD
  * 4 vCPU

## Installation Steps

Install dependencies:

```shell
cd $HOME
sudo apt update
sudo apt install make clang pkg-config libssl-dev build-essential git jq ncdu bsdmainutils -y < "/dev/null"
```

Install Go:

```shell
cd $HOME
wget -O go1.20.3.linux-amd64.tar.gz https://go.dev/dl/go1.20.3.linux-amd64.tar.gz
rm -rf /usr/local/go && tar -C /usr/local -xzf go1.20.3.linux-amd64.tar.gz && rm go1.20.3.linux-amd64.tar.gz
echo 'export GOROOT=/usr/local/go' >> $HOME/.bashrc
echo 'export GOPATH=$HOME/go' >> $HOME/.bashrc
echo 'export GO111MODULE=on' >> $HOME/.bashrc
echo 'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin' >> $HOME/.bashrc && . $HOME/.bashrc
go version
```

Clone git repository:

```shell
git clone --branch public-testnet https://github.com/stafihub/stafihub
```

Install:

```shell
cd $HOME/stafihub && make install
```

Download genesis (replace `YOUR_NODE_NAME`):

```shell
stafihubd init YOUR_NODE_NAME --chain-id stafihub-testnet-1
wget -O $HOME/.stafihub/config/genesis.json "https://raw.githubusercontent.com/stafihub/network/main/testnets/stafihub-testnet-1/genesis.json"
stafihubd tendermint unsafe-reset-all --home ~/.stafihub
```

Configure your node:

```shell
sed -i.bak -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.01ufis\"/" $HOME/.stafihub/config/app.toml
sed -i '/\[grpc\]/{:a;n;/enabled/s/false/true/;Ta};/\[api\]/{:a;n;/enable/s/false/true/;Ta;}' $HOME/.stafihub/config/app.toml
peers="4e2441c0a4663141bb6b2d0ea4bc3284171994b6@46.38.241.169:26656,79ffbd983ab6d47c270444f517edd37049ae4937@23.88.114.52:26656"
sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.stafihub/config/config.toml
```

Start the node in the background:

```shell
stafihubd start
```

Or install service to run the node:

```shell
echo "[Unit]
Description=StaFiHub Node
After=network.target

[Service]
User=$USER
Type=simple
ExecStart=$(which stafihubd) start
Restart=on-failure
LimitNOFILE=65535

[Install]
WantedBy=multi-user.target" > $HOME/stafihubd.service
sudo mv $HOME/stafihubd.service /etc/systemd/system
sudo tee <<EOF >/dev/null /etc/systemd/journald.conf
Storage=persistent
EOF
sudo systemctl restart systemd-journald
sudo systemctl daemon-reload
sudo systemctl enable stafihubd
sudo systemctl restart stafihubd
```

Check your node logs:

```shell
journalctl -u stafihubd -f
```

## Generate keys

```shell
stafihubd keys add YOUR_WALLET_NAME --keyring-backend file
```

You can recover your keys with `--recover` flag if you have mnemonic

## Faucet

You can ask for tokens in the [#faucet](https://discord.gg/KXMt24cb) Discord channel.

```shell
!faucet send YOUR_WALLET_ADDRESS
```

## Create validator

Use the following command (do not forget to replace `YOUR_NODE_NAME` and `YOUR_WALLET_NAME`):

```shell
stafihubd tx staking create-validator -y --amount=1000000ufis --pubkey=$(stafihubd tendermint show-validator) --moniker=YOUR_NODE_NAME --website="<website>" --details="<details>" --commission-rate=0.10 --commission-max-rate=0.20 --commission-max-change-rate=0.01 --min-self-delegation=1 --from=YOUR_WALLET_NAME --chain-id=stafihub-testnet-1 --gas-prices=0.025ufis --keyring-backend file
```

## Edit Validator Description <a href="#edit-validator-description" id="edit-validator-description"></a>

You can edit your validator's public description. This info is to identify your validator, and will be relied on by delegators to decide which validators to stake to. Make sure to provide input for every flag below. If a flag is not included in the command the field will default to empty, if the field has never been set or remain the same if it has been set in the past.

The \<YOUR\_WALLET\_NAME> specifies which validator you are editing. If you choose to not include some of the flags below, remember that the --from flag **must** be included to identify the validator to update.

The `--identity` can be used as to verify identity with systems like Keybase or UPort. When using Keybase, `--identity` should be populated with a 16-digit string that is generated with a [keybase.io (opens new window)](https://keybase.io/)account. It's a cryptographically secure method of verifying your identity across multiple online networks. The Keybase API allows us to retrieve your Keybase avatar. This is how you can add a logo to your validator profile.

```
stafihubd tx staking edit-validator --new-moniker=YOUR_NODE_NAME --website="<website>" --details="<details>" --commission-rate="0.10" --gas="auto" --gas-prices=0.025ufis --from=YOUR_WALLET_NAME  --chain-id=stafihub-testnet-1  --keyring-backend file
```

**Warning:** Please note that some parameters such as `commission-max-rate` and `commission-max-change-rate` cannot be changed once your validator is up and running.

**Note:** The `commission-rate` value must adhere to the following rules:

* Must be between 0 and the validator's `commission-max-rate`
* Must not exceed the validator's `commission-max-change-rate` which is maximum % point change rate **per day**. In other words, a validator can only change its commission once per day and within `commission-max-change-rate` bounds.

## Unjail Validator <a href="#unjail-validator" id="unjail-validator"></a>

When a validator is "jailed" for downtime, you must submit an `Unjail` transaction from the operator account in order to be able to get block proposer rewards again (depends on the zone fee distribution).

```
stafihubd tx slashing unjail --from=YOUR_WALLET_NAME --chain-id=stafihub-testnet-1 --gas-prices=0.025ufis --keyring-backend file
```

## Explorer

Explorer available [here](https://testnet-explorer.stafihub.io).
