Search…
Run a Node
This guide assumes you're running on Ubuntu 22.04 LTS - the commands will probably work just fine on 20.04 LTS or Debian.

Basic machine setup

  1. 1.
    SSH into your node
  2. 2.
    Update your machine (Answer yes / ok to the prompts)
1
sudo apt update && sudo apt dist-upgrade -y
Copied!
  1. 1.
    Install required tools
1
sudo apt install build-essential git unzip curl wget
Copied!

Prepare testnet environment

Create the kuji user and switch to it
1
sudo useradd -m kuji
2
sudo su -s /bin/bash -l kuji
Copied!

Install Golang

  1. 1.
    Download go 1.18.x
1
# remove old go version
2
sudo rm -rvf /usr/local/go/
3
4
# download recent go version
5
wget https://golang.org/dl/go1.18.3.linux-amd64.tar.gz
6
7
# install go
8
sudo tar -C /usr/local -xzf go1.18.3.linux-amd64.tar.gz
9
10
# remove unneeded installer
11
rm go1.18.3.linux-amd64.tar.gz
12
13
# source go
14
cat <<EOF >> ~/.profile
15
export GOROOT=/usr/local/go
16
export GOPATH=$HOME/go
17
export GO111MODULE=on
18
export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin
19
EOF
20
source ~/.profile
21
go version
Copied!

Now we build!

  1. 1.
    Download the project code and checkout to testnet branch
1
git clone https://github.com/Team-Kujira/core $HOME/kujira-core
2
cd $HOME/kujira-core
3
git checkout v0.4.0
Copied!
  1. 1.
    Build and install kujirad (using the kuji user created above)
1
make install
Copied!
  1. 1.
    Verify your binary is working
1
kujirad version
Copied!

Running the node

If the build succeed you should now have the kujirad cli in your path (of the kuji user).
Try invoking with kujirad and you should see output like
1
Stargate CosmosHub App
2
3
Usage:
4
kujirad [command]
5
6
Available Commands:
7
add-genesis-account Add a genesis account to genesis.json
8
collect-gentxs Collect genesis txs and output a genesis.json file
9
config Create or query an application CLI configuration file
10
debug Tool for helping with debugging your application
11
export Export state to JSON
12
gentx Generate a genesis tx carrying a self delegation
13
help Help about any command
14
....
Copied!

Join the testnet

Now we can initialize the node and join the network.
  1. 1.
    Initialize node's configuration files
1
export CHAIN_ID=harpoon-4
2
export MONIKER_NAME="<moniker name>"
Copied!
1
kujirad init "${MONIKER_NAME}" --chain-id ${CHAIN_ID}
Copied!
Replace the <moniker name> with your desired validator name.
  1. 1.
    Fetch the genesis genesis.json file
1
wget https://raw.githubusercontent.com/Team-Kujira/networks/master/testnet/harpoon-4.json -O $HOME/.kujira/config/genesis.json
Copied!
  1. 1.
    Download the addrbook.json file
1
wget https://raw.githubusercontent.com/Team-Kujira/networks/master/testnet/addrbook.json -O $HOME/.kujira/config/addrbook.json
Copied!
Fix your gas fee settings in $HOME/.kujira/config/app.toml
1
sed -i "s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0.00125ukuji\"/;" $HOME/.kujira/config/app.toml
Copied!
And update the commit times in $HOME/.kujira/config/config.toml
1
sed -i "s/^timeout_commit *=.*/timeout_commit = \"1500ms\"/;" $HOME/.kujira/config/config.toml
Copied!
Now start the node
1
$ kujirad start
2
3
[email protected]:~$ kujirad start
4
12:22PM INF starting node with ABCI Tendermint in-process
5
12:22PM INF Starting multiAppConn service impl=multiAppConn module=proxy
6
12:22PM INF Starting localClient service connection=query impl=localClient module=abci-client
7
12:22PM INF Starting localClient service connection=snapshot impl=localClient module=abci-client
8
12:22PM INF Starting localClient service connection=mempool impl=localClient module=abci-client
9
12:22PM INF Starting localClient service connection=consensus impl=localClient module=abci-client
Copied!
And then watch a whole bunch of log messages while your node is catching up. After making sure that it works, it's time to install it as a system level service so it always starts with the machine.

Register the node as a service

Drop out of the kuji user if you're still in that terminal session. Write exit or type ctrl+d on your keyboard.
  1. 1.
    Create a service definition file in /etc/systemd/system/kujirad.service. Example file that fits with our kuijrad install and kuji runtime user
1
[Unit]
2
Description=Kujira Daemon
3
After=network.target
4
5
[Service]
6
Type=simple
7
User=kuji
8
ExecStart=/home/kuji/go/bin/kujirad start --log_level error
9
Restart=on-abort
10
LimitNOFILE=65535
11
12
[Install]
13
WantedBy=multi-user.target
Copied!
  1. 1.
    Reload your systemctl and enable the service:
1
sudo systemctl daemon-reload
2
sudo systemctl enable kujirad
Copied!
  1. 1.
    And finally start the service:
1
sudo systemctl start kujirad
Copied!
  1. 1.
    Check the status of the service:
1
systemctl status kujirad.service
Copied!
It should return something like
1
● kujirad.service - Kujira Daemon
2
Loaded: loaded (/etc/systemd/system/kujirad.service; enabled; vendor preset: enabled)
3
Active: active (running) since Tue 2022-05-24 12:34:26 UTC; 5s ago
4
Main PID: 18490 (kujirad)
5
Tasks: 11 (limit: 4541)
6
Memory: 65.4M
7
CPU: 4.430s
8
CGroup: /system.slice/kujirad.service
9
└─18490 /home/kuji/go/bin/kujirad start
10
...
Copied!
  1. 1.
    Check kujirad service logs
1
journalctl -u kujirad -f -o cat
Copied!
And the sync status (make sure jq is installed)
1
kujirad status 2>&1 | jq .SyncInfo
Copied!

Create the validator

Once your node has synced, it's time to create a validator. It can be done on a separate machine if preferred.
Create a key that will be the validators key.
1
kujirad keys add <wallet name>
Copied!
Replace the <wallet name> with your desired validator wallet name.
Copy the seed phrase and put it somewhere safe.
You will need to make note of the address kujira... and use that in the faucet to get some coins. You can check your balance via
1
kujirad query bank balances kujira....
Copied!
The next part is associating your node with your account, creating the validator
1
export PUBKEY=$(kujirad tendermint show-validator)
2
export CHAIN_ID=harpoon-4
3
export MONIKER_NAME="<your moniker>"
Copied!
1
kujirad tx staking create-validator \
2
--moniker="${MONIKER_NAME}" \
3
--amount=1000000ukuji \
4
--gas-prices=1ukuji \
5
--pubkey=$PUBKEY \
6
--from=validator \
7
--yes \
8
--node=tcp://localhost:26657 \
9
--chain-id=${CHAIN_ID} \
10
--commission-max-change-rate=0.01 \
11
--commission-max-rate=0.20 \
12
--commission-rate=0.10 \
13
--min-self-delegation=1
Copied!
Now your node should be present
1
kujirad query staking validator $(kujirad keys show $KUJIRA_WALLET_ADDRESS --bech val -a)
Copied!
or JSON output
1
kujirad query staking validators --limit 1000000 -o json | jq '.validators[] | select(.description.moniker=="${MONIKER_NAME}")'
Copied!
Please remember to also back up $HOME/.kujira/config/priv_validator_key.json. If you lose this, you are toast.

Tips

Disk utilization

To help manage the disk size you can prune the blocks being kept. for this I use prime numbers pick your own in app.toml
1
pruning = "custom"
2
3
# These are applied if and only if the pruning strategy is custom.
4
pruning-keep-recent = "809"
5
pruning-keep-every = "0"
6
pruning-interval = "43"
Copied!
You should also check what you are indexing
1
index-events = ["tx.hash", "tx.height"]
Copied!

Adding more peers

You should modify /etc/security/limits.conf and add
1
* soft nofile 65535
2
* hard nofile 65535
Copied!
You can then modify the config.toml to increase connections. This may cost you more in ingress/egress charges.
1
max_open_connections = 1900
2
max_num_inbound_peers = 50
3
max_num_outbound_peers = 50
Copied!