Skip to main content

Running a Validator Node

This guide shows how to setup a node, run that node and create your validator.

You will need to use the Networks page to find information like the ${CHAIN_ID} and ${RPC_URL} of the network you would like to connect to.

Running your validator

The first step is to run a node. See the Node Installation and Joining a Network guides for instructions on how to get your node up and running.

After your node is running and synced, you can create a validator by staking tokens.

docker run --rm -it -v ~/.archway:/root/.archway archwaynetwork/archwayd:$NETWORK_NAME \
tx staking create-validator \
--from ${MY_VALIDATOR_ACCOUNT} \
--amount 1000000000udenom \
--min-self-delegation 1000000000udenom \
--commission-rate 0.01 \
--commission-max-rate 0.1 \
--commission-max-change-rate 0.1 \
--pubkey "$(archwayd tendermint show-validator)" \
--chain-id ${CHAIN_ID}

Run validator pre-genesis

Initialize node

First, we will initialize the genesis.json file that is required to establish a network by running the below command.

The genesis.json holds the information of the initial state of the blockchain.

See this example genesis file for the Constantine testnet.

docker run --rm -it -v ~/.archway:/root/.archway archwaynetwork/archwayd:$NETWORK_NAME \
init my-validator --chain-id ${CHAIN_ID}

Initialize account

Next, create a key to hold your account:

docker run --rm -it -v ~/.archway:/root/.archway archwaynetwork/archwayd:$NETWORK_NAME \
keys add my-validator-account

After you run this command, you are prompted with a password dialogue. Enter a new password for your account.

Now, set the number of coins to stake:

docker run --rm -it -v ~/.archway:/root/.archway archwaynetwork/archwayd:$NETWORK_NAME \
add-genesis-account "${VALIDATOR_ADDRESS}" 1000000000stake,1000000000ARCH
info

Note: Your account must have an equal amount of coins that match the bond denomination ("bond_denom") in your genesis file.

// genesis.json
"staking": {
"params": {
"unbonding_time": "1814400s",
"max_validators": 100,
"max_entries": 7,
"historical_entries": 10000,
"bond_denom": "uconst" // "uconst" is the bond denomination of Constantine testnet
},
}

Create your validator

To make the node into a validator, you need to create a validator transaction by running the commande below:

docker run --rm -it -v ~/.archway:/root/.archway archwaynetwork/archwayd:$NETWORK_NAME \
gentx my-validator-account 1000000000stake \
--commission-rate 0.01 \
--commission-max-rate 0.1 \
--commission-max-change-rate 0.1 \
--pubkey "$(archwayd tendermint show-validator)" \
--chain-id ${CHAIN_ID}

Add transaction to genesis file

Add the generated bonding transaction to the genesis file:

docker run --rm -it -v ~/.archway:/root/.archway archwaynetwork/archwayd:$NETWORK_NAME \
collect-gentxs

Start validator node

Now, start your validator node in the local Archway network:

docker run --rm -it -v ~/.archway:/root/.archway archwaynetwork/archwayd:$NETWORK_NAME \
start
tip

Note: If you have multiple nodes running on the same machine, errors like already in use ports are returned.

To proceed, run each node in isolated environments (Docker containers) or edit the app.toml and conf.toml files to setup different port numbers.

Run a validator post-genesis

Init config

Initialize your validator config:

docker run --rm -it -v ~/.archway:/root/.archway archwaynetwork/archwayd:$NETWORK_NAME \
init ${VALIDATOR_MONIKER} --chain-id ${CHAIN_ID}

The ${VALIDATOR_MONIKER} is the name of your validator that you can choose and will show up in the explorer.

Retrieve the genesis file

To retrieve the genesis file, install jq (lightweight and flexible command-line JSON processor). Run the below command to retrive the genesis file:

curl -s "${RPC_URL}/genesis" | jq '.result.genesis' > ~/.archway/config/genesis.json

This will replace the default genesis file with the one connected to the network you are joining.

Run your node

Start your node in the Docker container:

docker run --rm -it -v ~/.archway:/root/.archway archwaynetwork/archwayd:$NETWORK_NAME \
start --p2p.seeds [email protected]_Name_orIPN:PORT --x-crisis-skip-assert-invariants

Create your validator

After your node is running and synced, you can create a validator by staking tokens.

note

If you ran the previous command in interactive mode, you must run the following command in a separate terminal window.

docker run --rm -it -v ~/.archway:/root/.archway archwaynetwork/archwayd:$NETWORK_NAME \
tx staking create-validator \
--from ${MY_VALIDATOR_ACCOUNT} \
--amount 1000000000udenom \
--min-self-delegation 1000000000udenom \
--commission-rate 0.01 \
--commission-max-rate 0.1 \
--commission-max-change-rate 0.1 \
--pubkey "$(archwayd tendermint show-validator)" \
--chain-id ${CHAIN_ID}