# Hypersign [jagrat]. after genesis 

By [chaingon | web3topia](https://paragraph.com/@chaingon) · 2022-09-27

---

Node setup
==========

If you want to setup fullnode manually follow the steps below

Setting up vars
---------------

Here you have to put name of your moniker (validator) that will be visible in explorer

    NODENAME=<YOUR_MONIKER_NAME_GOES_HERE>
    

Save and import variables into system

    HYPERSIGN_PORT=31
    echo "export NODENAME=$NODENAME" >> $HOME/.bash_profile
    if [ ! $WALLET ]; then
        echo "export WALLET=wallet" >> $HOME/.bash_profile
    fi
    echo "export HYPERSIGN_CHAIN_ID=jagrat" >> $HOME/.bash_profile
    echo "export HYPERSIGN_PORT=${HYPERSIGN_PORT}" >> $HOME/.bash_profile
    source $HOME/.bash_profile
    

### Update packages

    sudo apt update && sudo apt upgrade -y
    

### Install dependencies

    sudo apt install curl build-essential git wget jq make gcc tmux chrony -y
    

### Install go

    if ! [ -x "$(command -v go)" ]; then
      ver="1.18.2"
      cd $HOME
      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" >> ~/.bash_profile
      source ~/.bash_profile
    fi
    

### Download and build binaries

    cd $HOME
    git clone https://github.com/hypersign-protocol/hid-node.git
    cd hid-node
    make install
    

### Init app

    hid-noded init $NODENAME --chain-id $HYPERSIGN_CHAIN_ID
    

### Download genesis and addrbook

    wget -qO $HOME/.hid-node/config/genesis.json "https://raw.githubusercontent.com/hypersign-protocol/networks/master/testnet/jagrat/final_genesis.json"
    

### Set seeds and peers

    SEEDS=""
    PEERS="7991e99ee8c05906a2161d8b47d826240da5c5d2@network.jagart.hypersign.id:26656,4625d4f9aa5034579134bdd551b6b54ee2b48c6a@network.jagart.hypersign.id:26656"
    sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.hid-node/config/config.toml
    

### Set custom ports

    sed -i.bak -e "s%^proxy_app = \"tcp://127.0.0.1:26658\"%proxy_app = \"tcp://127.0.0.1:${HYPERSIGN_PORT}658\"%; s%^laddr = \"tcp://127.0.0.1:26657\"%laddr = \"tcp://127.0.0.1:${HYPERSIGN_PORT}657\"%; s%^pprof_laddr = \"localhost:6060\"%pprof_laddr = \"localhost:${HYPERSIGN_PORT}060\"%; s%^laddr = \"tcp://0.0.0.0:26656\"%laddr = \"tcp://0.0.0.0:${HYPERSIGN_PORT}656\"%; s%^prometheus_listen_addr = \":26660\"%prometheus_listen_addr = \":${HYPERSIGN_PORT}660\"%" $HOME/.hid-node/config/config.toml
    sed -i.bak -e "s%^address = \"tcp://0.0.0.0:1317\"%address = \"tcp://0.0.0.0:${HYPERSIGN_PORT}317\"%; s%^address = \":8080\"%address = \":${HYPERSIGN_PORT}080\"%; s%^address = \"0.0.0.0:9090\"%address = \"0.0.0.0:${HYPERSIGN_PORT}090\"%; s%^address = \"0.0.0.0:9091\"%address = \"0.0.0.0:${HYPERSIGN_PORT}091\"%" $HOME/.hid-node/config/app.toml
    

### Config pruning

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

### Set minimum gas price and timeout commit

    sed -i -e "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0uhid\"/" $HOME/.hid-node/config/app.toml
    

### Enable bad peers filter (optional)

    sed -i -e "s/^filter_peers *=.*/filter_peers = \"true\"/" $HOME/.hid-node/config/config.toml
    

### Enable snapshots (optional)

    snapshot_interval=1000 && \ sed -i.bak -e "s/^snapshot-interval *=.*/snapshot-interval = \"$snapshot_interval\"/" ~/.hid-node/config/app.toml```
    

### Enable prometheus

    sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.hid-node/config/config.toml
    

### Reset chain data

    hid-noded tendermint unsafe-reset-all --home $HOME/.hid-node
    

### Create service

    sudo tee /etc/systemd/system/hid-noded.service > /dev/null <<EOF
    [Unit]
    Description=hypersign
    After=network-online.target
    
    [Service]
    User=$USER
    ExecStart=$(which hid-noded) start --home $HOME/.hid-node
    Restart=on-failure
    RestartSec=3
    LimitNOFILE=65535
    
    [Install]
    WantedBy=multi-user.target
    EOF
    

### Register and start service

    sudo systemctl daemon-reload
    sudo systemctl enable hid-noded
    sudo systemctl restart hid-noded && sudo journalctl -u hid-noded -f -o cat
    

Validator-setup & post installation management
==============================================

Load variables into system

    source $HOME/.bash_profile
    

Next you have to make sure your validator is syncing blocks. You can use command below to check synchronization status

    hid-noded status 2>&1 | jq .SyncInfo
    

### Create wallet

To create new wallet you can use command below. Don’t forget to save the mnemonic

    hid-noded keys add $WALLET
    

(OPTIONAL) To recover your wallet using seed phrase

    hid-noded keys add $WALLET --recover
    

To get current list of wallets

    hid-noded keys list
    

### Save wallet info

Add wallet and valoper address into variables

    HYPERSIGN_WALLET_ADDRESS=$(hid-noded keys show $WALLET -a)
    

    HYPERSIGN_VALOPER_ADDRESS=$(hid-noded keys show $WALLET --bech val -a) 
    

    echo 'export HYPERSIGN_WALLET_ADDRESS='${HYPERSIGN_WALLET_ADDRESS} >> $HOME/.bash_profile echo 'export HYPERSIGN_VALOPER_ADDRESS='${HYPERSIGN_VALOPER_ADDRESS} >> $HOME/.bash_profile source $HOME/.bash_profile
    

### Fund your wallet

In order to create validator first you need to fund your wallet with testnet tokens.

    N/A
    

### Create validator

Before creating validator please make sure that you have at least 1 strd (1 strd is equal to 1000000 uhid) and your node is synchronized

To check your wallet balance:

    hid-noded query bank balances $HYPERSIGN_WALLET_ADDRESS
    

> If your wallet does not show any balance than probably your node is still syncing. Please wait until it finish to synchronize and then continue

To create your validator run command below

    hid-noded tx staking create-validator \
      --amount 100000000uhid \
      --from $WALLET \
      --commission-max-change-rate "0.01" \
      --commission-max-rate "0.2" \
      --commission-rate "0.1337" \
      --min-self-delegation "1" \
      --pubkey  $(hid-noded tendermint show-validator) \
      --moniker $NODENAME \
      --chain-id $HYPERSIGN_CHAIN_ID
    

Security
--------

To protect you keys please make sure you follow basic security rules

### Set up ssh keys for authentication

Good tutorial on how to set up ssh keys for authentication to your server can be found [here](https://www.digitalocean.com/community/tutorials/how-to-set-up-ssh-keys-on-ubuntu-20-04)

### Basic Firewall security

Start by checking the status of ufw.

    sudo ufw status
    

Sets the default to allow outgoing connections, deny all incoming except ssh and 26656. Limit SSH login attempts

    sudo ufw default allow outgoing
    sudo ufw default deny incoming
    sudo ufw allow ssh/tcp
    sudo ufw limit ssh/tcp
    sudo ufw allow ${HYPERSIGN_PORT}656,${HYPERSIGN_PORT}660/tcp
    sudo ufw enable
    

Usefull commands
----------------

### Check your validator key

    [[ $(hid-noded q staking validator $HYPERSIGN_VALOPER_ADDRESS -oj | jq -r .consensus_pubkey.key) = $(hid-noded status | jq -r .ValidatorInfo.PubKey.value) ]] && echo -e "\n\e[1m\e[32mTrue\e[0m\n" || echo -e "\n\e[1m\e[31mFalse\e[0m\n"
    

### Get list of validators

    hid-noded q staking validators -oj --limit=3000 | jq '.validators[] | select(.status=="BOND_STATUS_BONDED")' | jq -r '(.tokens|tonumber/pow(10; 6)|floor|tostring) + " \t " + .description.moniker' | sort -gr | nl
    

Get currently connected peer list with ids
------------------------------------------

    curl -sS http://localhost:${HYPERSIGN_PORT}657/net_info | jq -r '.result.peers[] | "\(.node_info.id)@\(.remote_ip):\(.node_info.listen_addr)"' | awk -F ':' '{print $1":"$(NF)}'
    

### Service management

Check logs

    journalctl -fu hid-noded -o cat
    

Start service

    sudo systemctl start hid-noded
    

Stop service

    sudo systemctl stop hid-noded
    

Restart service

    sudo systemctl restart hid-noded
    

### Node info

Synchronization info

    hid-noded status 2>&1 | jq .SyncInfo
    

Validator info

    hid-noded status 2>&1 | jq .ValidatorInfo
    

Node info

    hid-noded status 2>&1 | jq .NodeInfo
    

Show node id

    hid-noded tendermint show-node-id
    

### Wallet operations

List of wallets

    hid-noded keys list
    

Recover wallet

    hid-noded keys add $WALLET --recover
    

Delete wallet

    hid-noded keys delete $WALLET
    

Get wallet balance

    hid-noded query bank balances $HYPERSIGN_WALLET_ADDRESS
    

Transfer funds

    hid-noded tx bank send $HYPERSIGN_WALLET_ADDRESS <TO_HYPERSIGN_WALLET_ADDRESS> 10000000uhid
    

### Voting

    hid-noded tx gov vote 1 yes --from $WALLET --chain-id=$HYPERSIGN_CHAIN_ID
    

### Staking, Delegation and Rewards

Delegate stake

    hid-noded tx staking delegate $HYPERSIGN_VALOPER_ADDRESS 10000000uhid --from=$WALLET --chain-id=$HYPERSIGN_CHAIN_ID --gas=auto
    

Redelegate stake from validator to another validator

    hid-noded tx staking redelegate <srcValidatorAddress> <destValidatorAddress> 10000000uhid --from=$WALLET --chain-id=$HYPERSIGN_CHAIN_ID --gas=auto
    

Withdraw all rewards

    hid-noded tx distribution withdraw-all-rewards --from=$WALLET --chain-id=$HYPERSIGN_CHAIN_ID --gas=auto -y
    

Withdraw rewards with commision

    hid-noded tx distribution withdraw-rewards $HYPERSIGN_VALOPER_ADDRESS --from=$WALLET --commission --chain-id=$HYPERSIGN_CHAIN_ID -y
    

### Validator management

Edit validator

    hid-noded tx staking edit-validator \
      --moniker=$NODENAME \
      --identity=<your_keybase_id> \
      --website="<your_website>" \
      --details="<your_validator_description>" \
      --chain-id=$HYPERSIGN_CHAIN_ID \
      --from=$WALLET
    

Unjail validator

    hid-noded tx slashing unjail \
      --broadcast-mode=block \
      --from=$WALLET \
      --chain-id=$HYPERSIGN_CHAIN_ID \
      --gas=auto
    

### Delete node

This commands will completely remove node from server. Use at your own risk!

    sudo systemctl stop hid-noded
    sudo systemctl disable hid-noded
    sudo rm /etc/systemd/system/hypersign* -rf
    sudo rm $(which hid-noded) -rf
    sudo rm $HOME/.hid-node* -rf
    sudo rm $HOME/hid-node -rf
    sed -i '/HYPERSIGN_/d' ~/.bash_profile

---

*Originally published on [chaingon | web3topia](https://paragraph.com/@chaingon/hypersign-jagrat-after-genesis)*
