Cronos POS Chain Mainnet: Running a Validator
This is detailed documentation for setting up a Validator on Cronos POS Chain mainnet. Note that while anyone can set up a validator, only the top 100 validators are considered "active" and eligible to receive rewards. See FAQs for more info.
Step 0: Notes on network upgrades
There are two ways to set up a node:
For the host who would like to build a Validator with complete blockchain data from scratch,
Note that there were several breaking network upgrades, requiring upgrading at designated block heights. For more details on upgrading, we refer to this guide on running a full node.
Once you have a complete synced node, you can revisit this page and jump to the step of joining the networking as a validator.
For hosts who would like to join the network and start validating quickly, one can:
Begin with the binary
v3.3.9
and join the network bySTATE-SYNC
To simplify this guide, we will be covering the second case here in this guide, and guide you to begin with binary v3.3.9
and join the network by STATE-SYNC
.
Pre-requisites
Supported OS
We officially support macOS, Windows and Linux only. Other platforms may work, but there is no guarantee. We will extend our support to other platforms after we have stabilized our current architecture.
Prepare your machine
For Cronos POS Chain mainnet, you will need a machine with the following minimum requirements to run different types of nodes:
Archive Node (setting pruning = nothing)
RAM: 64GB (Rocksdb)
Disk: 3.4TB
CPU: 4 cores
Default Full Node (setting pruning = default)
RAM: 64GB (Rocksdb) or 16GB (goleveldb)
Disk: 1.2TB (From quick sync)
CPU: 4 cores
Pruned Node (setting pruning = everything)
RAM: 64GB (Rocksdb) or 16GB (goleveldb)
Disk: 40GB (From quick sync)
CPU: 4 cores
Please note that the size of snapshots from Quicksync will keep growing.
Step 1. Get the Cronos POS Chain Mainnet binary
To simplify the following step, we will be using Linux for illustration. Binary for Mac and Windows are also available.
There are two options to install chain-maind
:
Option 1 - Install chain-maind
released binaries from GitHub
chain-maind
released binaries from GitHubTo install Cronos POS Chain binaries from Github:
$ curl -LOJ https://github.com/crypto-org-chain/chain-main/releases/download/v3.3.9/chain-main_3.3.9_Linux_x86_64.tar.gz $ tar -zxvf chain-main_3.3.9_Linux_x86_64.tar.gz
You can verify the installation by checking the version of the chain-maind, the current version is
3.3.9
.# check the version of chain-maind $ ./chain-maind version 3.3.9
OR
Option 2 - Install chain-maind
by homebrew
chain-maind
by homebrewTo install binaries in Homebrew for macOS X or Linux
Homebrew is a free and open-source package management system for macOS X. Install the official Chain-maind formula from the terminal.
First, install the
crypto-org-chain
tap, a repository of our Homebrewchain-maind
package:
# tap the repo
$ brew tap crypto-org-chain/chain-maind
Now, install the
chain-maind
with crypto-org-chain/chain-maind# install the chain-maind CLI tool $ brew install chain-maind
You can verify the installation by checking the version of the
chain-maind
# check the version of chain-maind $ chain-maind version 3.3.9
Step 2. Configure chain-maind
chain-maind
Before kick-starting your node, we will have to configure the node so that it connects to the Cronos POS Chain mainnet
Step 2-1. Initialize chain-maind
chain-maind
First of all, you can initialize chain-maind by:
$ ./chain-maind init [moniker] --chain-id crypto-org-chain-mainnet-1
This
moniker
will be the displayed ID of your node when connected to the Cronos POS Chain network. When providing the moniker value, make sure you drop the square brackets since they are not needed.
Step 2-2. Configure chain-maind
Download and replace the Cronos POS Chain mainnet
genesis.json
by:$ curl https://raw.githubusercontent.com/crypto-org-chain/mainnet/main/crypto-org-chain-mainnet-1/genesis.json > ~/.chain-maind/config/genesis.json
Verify sha256sum checksum of the downloaded
genesis.json
. You should seeOK!
if the sha256sum checksum matches.$ if [[ $(sha256sum ~/.chain-maind/config/genesis.json | awk '{print $1}') = "d299dcfee6ae29ca280006eaa065799552b88b978e423f9ec3d8ab531873d882" ]]; then echo "OK"; else echo "MISMATCHED"; fi; OK!
In
~/.chain-maind/config/app.toml
, update minimum gas price to avoid transaction spamming$ sed -i.bak -E 's#^(minimum-gas-prices[[:space:]]+=[[:space:]]+)""$#\1"0.025basecro"#' ~/.chain-maind/config/app.toml
Step 2-3. Enable STATE-SYNC
With STATE-SYNC your node will download data related to the head or near the head of the chain and verify the data. This leads to drastically shorter times for joining a network for validators. For the validator, it will be amazingly fast to sync the near head of the chain and join the network.
Cautious
Blocks before state-sync trust height
will NOT be queryable. If you want to run a full node or a validator with complete blockchain data; It is not suggested to use state-sync.
Kindly refer to this guide on building a node with complete data.
Follow the below steps to enable state-sync:
For state-sync configuration, in
~/.chain-maind/config/config.toml
, please modify the configurations under [statesync]enable
,rpc_servers
,trust_height
andtrust_hash
and addpersistent_peers
by:$ sed -i.bak -E 's#^(persistent_peers[[:space:]]+=[[:space:]]+).*$#\1"[email protected]:26656,[email protected]:26656,[email protected]:26656"#' ~/.chain-maind/config/config.toml $ sed -i.bak -E 's#^(seeds[[:space:]]+=[[:space:]]+).*$#\1""#' ~/.chain-maind/config/config.toml $ LATEST_HEIGHT=$(curl -s https://rpc.mainnet.cronos-pos.org:443/block | jq -r .result.block.header.height); \ BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000)); \ TRUST_HASH=$(curl -s "https://rpc.mainnet.cronos-pos.org:443/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) $ sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ; \ s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"https://rpc.mainnet.cronos-pos.org:443,https://rpc.mainnet.cronos-pos.org:443\"| ; \ s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ; \ s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ; \ s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" ~/.chain-maind/config/config.toml
Step 3. Run everything
Step 3-1. Run everything
Once the chain-maind
has been configured, we are ready to start the node and sync the blockchain data:
Start
chain-maind
, e.g.:
$ ./chain-maind start
OR
(Optional for Linux) If you would like to have it running in the background, you can start
chain-maind
withsystemd
service, e.g.:
$ git clone https://github.com/crypto-org-chain/chain-main.git && cd chain-main
$ ./networks/create-service.sh
$ sudo systemctl start chain-maind
# view log
$ journalctl -u chain-maind -f
It should begin fetching blocks from the other peers. Please wait until it is synced before moving onto the next step.
# /etc/systemd/system/chain-maind.service
[Unit]
Description=Chain-maind
ConditionPathExists=/usr/local/bin/chain-maind
After=network.target
[Service]
Type=simple
User=ubuntu
WorkingDirectory=/usr/local/bin
ExecStart=/usr/local/bin/chain-maind start --home /home/ubuntu/.chain-maind
Restart=on-failure
RestartSec=10
LimitNOFILE=50000
[Install]
WantedBy=multi-user.target
Step 3-2. Joining the network as a validator: Send a create-validator
transaction
create-validator
transactionOnce the node is synced, we are now ready to send a create-validator
transaction and join the network, for example:
$ ./chain-maind tx staking create-validator \
--from=[name_of_your_key] \
--amount=[amount of cro, e.g. 1000cro] \
--pubkey='{"@type":"/cosmos.crypto.ed25519.PubKey","key":[validator_public_key]}' \
--moniker="[The_id_of_your_node]" \
--security-contact="[security contact email/contact method]" \
--chain-id="crypto-org-chain-mainnet-1" \
--commission-rate="[The_commission_rate_of_your_node, e.g. 0.1 (10%)]" \
--commission-max-rate="[The_maximum_commission_rate_of_your_node e.g. 0.2 (20%)]" \
--commission-max-change-rate="[The_maximum_change_of_commission_rate_per_day e.g. 0.01 (1%)]" \
--min-self-delegation="1" \
--gas 8000000 \
--gas-prices 0.1basecro
{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator"...}
confirm transaction before signing and broadcasting [y/N]: y
Step 3-3. Check your validator status
Once the create-validator
transaction completes, you can check if your validator has been added to the validator set:
$ ./chain-maind tendermint show-address
## [crocnclcons... address] ##
$ ./chain-maind query tendermint-validator-set | grep -c [crocnclcons...]
## 1 = Yes; 0 = Not yet added ##
You can also check your public key by:
$ ./chain-maind tendermint show-validator
## [crocnclconspub... address] ##
To further check if the validator is signing blocks, kindly run this script, for example:
$ curl -sSL https://raw.githubusercontent.com/crypto-org-chain/chain-docs/master/docs/getting-started/assets/signature_checking/check-validator-up.sh | bash -s -- \
--tendermint-url https://rpc.mainnet.cronos-pos.org:443 \
--pubkey $(cat ~/.chain-maind/config/priv_validator_key.json | jq -r '.pub_key.value')
The validator is in the active validator set under the address <YOUR_VALIDATOR_ADDRESS>
The validator is signing @ Block#<BLOCK_HEIGHT> 👍
Congratulations! You've successfully set up a mainnet node and performed some basic transactions! You may refer to Wallet Management for more advanced operations and transactions.
Basic Transactions and queries
query bank balances
- Check your transferable balance
query bank balances
- Check your transferable balanceYou can check your transferable balance with the balances
command under the bank module.
tx bank send
- Transfer operation
tx bank send
- Transfer operationTransfer operation involves the transfer of tokens between two addresses.
Send Funds [tx bank send <from_key_or_address> <to_address> <amount> <network_id>
]
tx bank send <from_key_or_address> <to_address> <amount> <network_id>
]tx staking
- Staking operations
tx staking
- Staking operationsStaking operations involve the interaction between an address and a validator. It allows you to create a validator and lock/unlocking funds for staking purposes.
Delegate your funds to a validator [tx staking delegate <validator-addr> <amount>
]
tx staking delegate <validator-addr> <amount>
]To bond funds for staking, you can delegate funds to a validator by the delegate
command. Note that you can look up validators and their operator address by the validator list on the explorer.
$ ./chain-maind tx staking delegate crocncl16kqr009ptgken6qsxnzfnyjfsq6q97g3uedcer 100cro --from Default --chain-id "crypto-org-chain-mainnet-1" --gas-prices 0.1basecro
## Transactions payload##
{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgDelegate"....}
confirm transaction before signing and broadcasting [y/N]: y
Unbond your delegated funds [tx staking unbond <validator-addr> <amount>
]
tx staking unbond <validator-addr> <amount>
]On the other hand, we can create an Unbond
transaction to unbond the delegated funds
Reward-related transactions and queries
After you have delegated or created a validator, the reward will be accumulated, you can check/ withdraw it by:
query distribution validator-outstanding-rewards
- Query un-withdrawn rewards for a validator
query distribution validator-outstanding-rewards
- Query un-withdrawn rewards for a validatorWe can check the distribution outstanding (un-withdrawn) rewards for a validator and all of their delegations by operator address.
tx distribution validator-outstanding-rewards
- Query un-withdrawn rewards for a validator
tx distribution validator-outstanding-rewards
- Query un-withdrawn rewards for a validatorWe can check the distribution outstanding (un-withdrawn) rewards for a validator and all of their delegations by operator address.
Slashing related transaction
tx slashing unjail
- Unjail a validator
tx slashing unjail
- Unjail a validatorValidator could be punished and jailed due to network misbehaviour, we can check the jailing status of a validator, for example:
$ ./chain-maind query staking validators -o json | jq
................................
"operator_address": "crocncl1hct8ye56gk80qjxvrx299yu9v98aqaxe0y5kvg",
"consensus_pubkey": {
"@type": "/cosmos.crypto.ed25519.PubKey",
"key": "P1/aHuScW5myVs+xH10R8yFT2u0wwaCKXfDKSuVTl60="
},
"jailed": true,
................................
Where "jailed": true
implies that the validator has been jailed. After the jailing period has passed, one can broadcast a unjail
transaction to unjail the validator and resume its normal operations by
$ ./chain-maind tx slashing unjail --from [key_name] --chain-id crypto-org-chain-mainnet-1 --gas-prices 0.1basecro
{"body":{"messages":[{"@type":"/cosmos.slashing.v1beta1.MsgUnjail"...}]}
confirm transaction before signing and broadcasting [y/N]: y
Last updated