Run a Validator
The codebase is currently not public. We will be sharing more details about the validator's role and functionality soon. We appreciate your patience and interest. Thank you for your understanding and continued support.
By following these steps, you should be able to successfully set up and start a Nubit Validator. If you encounter any issues, please provide detailed information, and further assistance will be provided.
Set up the Validator
Install the Validator
Download the Necessary Repositories
First, download the required repositories from the RiemaLabs GitHub.
git clone -b nubit-alphatestnet-1 [email protected]:RiemaLabs/nubit-validator.git
cd nubit-validator
Install the nubit-validator
CLI
nubit-validator
CLIIn the cloned repository directory, run the following command to install the nubit-validator
CLI:
make install
Set up the Environment
Set Network and Custom Variables
Customize the VALIDATOR_NAME
as desired, and then replace BTCRPC
with your own Bitcoin RPC endpoint if you have one.
The BTCRPC
is used for accessing Bitcoin network data, which is crucial for the validator to function correctly. Ensure the BTCRPC
you use can process transactions and produce blocks normally. If you don't have your own, you can use the provided default public RPC (https://bitcoin-mainnet.public.blastapi.io).
Set up the other environment variables using the following commands:
export NUBIT_VALIDATOR_HOME="$HOME/.nubit-validator"
export VALIDATOR_NAME=your_desired_validator_name # Replace VALIDATOR_NAME with your desired one
export CHAIN_ID=nubit-alphatestnet-1
export BTCRPC=https://bitcoin-mainnet.public.blastapi.io # This is a default public BTCRPC, but we recommend using your own.
export PERSISTENT_PEERS=900a00a618f20a2e4867b26585b15108c728b523@validator-1.nubit-alphatestnet-1.com:26656,e0cf2c93177eae5cf0bb360710725aee34a44732@validator-2.nubit-alphatestnet-1.com:26656
Clear Existing Data
Use the following command to remove any previous data:
rm -rf $NUBIT_VALIDATOR_HOME
Initialize the Validator
Initiate the validator with the following command, which will create the necessary configuration files and directories:
nubit-validatord init $VALIDATOR_NAME --chain-id $CHAIN_ID
Download the genesis.json
File
To download the genesis.json
file from the nubit-chain-config
repository, use this command:
nubit-validatord download-genesis $CHAIN_ID
Create and List Keys
Create a New Wallet Key
Generate a new wallet key with the following command. Make sure to save the MNEMONIC securely as it will only appear once:
nubit-validatord keys add my-wallet --keyring-backend test
List All Keys
List all keys using:
nubit-validatord keys list
Synchronize with the Latest Block
To quickly sync to the latest block, a snapshot is provided and updated every 12 hours. Follow these steps:
Remove Old Data Directory
rm -rf $NUBIT_VALIDATOR_HOME/data
Download the Snapshot
Download the snapshot using wget
. Ensure you have enough disk space (approximately 44.2GB):
wget https://nubit-cdn.com/nubit-data/validator_data.tgz
Extract the Snapshot
Extract the downloaded snapshot to update your node's data:
tar -zxf validator_data.tgz -C $NUBIT_VALIDATOR_HOME && rm -rf validator_data.tgz
This will update your node to a recent state. Keep it running to ensure it syncs to the latest block. For the most current block information, please visit the chain explorer at explorer.nubit.org.
Start the Validator
Start the validator by the following command:
nubit-validatord start --btc-rpc="${BTCRPC}" --rpc.laddr tcp://0.0.0.0:26657 --grpc.address 0.0.0.0:9090 --grpc.enable --p2p.persistent_peers=$PERSISTENT_PEERS
The successful response will be like this:
6:20PM INF service start impl="Peer{MConn{44.236.43.189:26656} 97d2260cb63873183943e331c6986ce4a63d8796 out}" module=p2p msg={} peer={"id":"97d2260cb63873183943e331c6986ce4a63d8796","ip":"44.236.43.189","port":26656}
6:20PM INF service start impl=MConn{44.236.43.189:26656} module=p2p msg={} peer={"id":"97d2260cb63873183943e331c6986ce4a63d8796","ip":"44.236.43.189","port":26656}
6:20PM INF service start impl="Peer{MConn{35.82.227.214:26656} 77862897002df6adb65b81b64319116423186ccf out}" module=p2p msg={} peer={"id":"77862897002df6adb65b81b64319116423186ccf","ip":"35.82.227.214","port":26656}
6:20PM INF service start impl=MConn{35.82.227.214:26656} module=p2p msg={} peer={"id":"77862897002df6adb65b81b64319116423186ccf","ip":"35.82.227.214","port":26656}
6:20PM INF app: start Process Proposal height=1 proposer=40F0D18D0454EF72DADBE564962E88EFEC3C148E
6:20PM INF executed block height=1 module=state num_invalid_txs=1 num_valid_txs=0
6:20PM INF committed state app_hash=098724484DBF0E9BB9208D467B65541C6310A2ACF5A78C03A5D2175D9D79FC85 height=1 module=state num_txs=1
6:20PM INF app: start Process Proposal height=2 proposer=83592AD6A18494E38970AC673E150A986B717C35
6:20PM INF indexed block exents height=1 module=txindex
6:20PM INF minted coins from module account amount=350587034956unub from=mint module=x/bank
6:20PM INF executed block height=2 module=state num_invalid_txs=1 num_valid_txs=0
6:20PM INF committed state app_hash=5D57E8E05952DB21CFCB85B40902ED3D170DE358D6901961AF6FEC2A54EC15D5 height=2 module=state num_txs=1
6:20PM INF app: start Process Proposal height=3 proposer=9D40034936981454FC48AA642304E6A7A69D0D20
6:20PM INF indexed block exents height=2 module=txindex
6:20PM INF minted coins from module account amount=2963430686unub from=mint module=x/bank
6:20PM INF executed block height=3 module=state num_invalid_txs=1 num_valid_txs=0
6:20PM INF committed state app_hash=A6AA34EE9BF40674B655BAB3B12379D33C12D3AFADA911371F7596A81E91CB2F height=3 module=state num_txs=1
6:20PM INF indexed block exents height=3 module=txindex
When running the validator node, you can check your validator's status information using the following command:
nubit-validatord status
You will receive a response similar to this:
{"NodeInfo":{"protocol_version":{"p2p":"8","block":"11","app":"1"},"id":"570398faa723fc2cf59b1550d1f156375e80ffb2","listen_addr":"tcp://0.0.0.0:26656","network":"nubit-alphatestnet-1","version":"0.1.0-rc.3-7-gc84199e","channels":"40202122233038606100","moniker":"lewis","other":{"tx_index":"on","rpc_address":"tcp://0.0.0.0:26657"}},"SyncInfo":{"latest_block_hash":"FC8EC5B7005CC75B6E63E8D47B877571BC1314611375DC65787B9BF9D35FCE92","latest_app_hash":"5FF4C451C1D0968E22CB022C8D061509505706ECF936122DA3A5FA4282195951","latest_block_height":"442735","latest_block_time":"2024-07-25T10:09:02.920062769Z","earliest_block_hash":"AD1DB79213CA0EA005F82FACC395E34BE3CFCC086CD5C25A89FC64F871B3ABAE","earliest_app_hash":"E3B0C44298FC1C149AFBF4C8996FB92427AE41E4649B934CA495991B7852B855","earliest_block_height":"1","earliest_block_time":"2024-05-25T02:50:05.683274808Z","catching_up":false},"ValidatorInfo":{"Address":"8C0D175D70A77B4359D6651F33BAF72C25BD4B1B","PubKey":{"type":"tendermint/PubKeyEd25519","value":"2KV3P2VgREZr+clfV/X4BJ7G3KNsB4jpDrYJ99prprQ="},"VotingPower":"0"}}
This response indicates that the validator is running successfully. It shows the continuous process of validating and committing blocks, minting coins, and processing transactions.
The synchronization completion signal is found in the SyncInfo
section under the catching_up
field. When this field is false
, it indicates that the node is fully synchronized.
For example, when catching_up
shows false
:
"SyncInfo": {
...
"catching_up": false
}
This means the validator node is fully synced with the latest blocks, and you can proceed with delegating stake.
Delegate Stake to the validator
After your validator has synced with the latest blocks, you can delegate stake to it. Follow these steps to complete the process:
List All Local Keys
First, check all your local keys with the following command:
nubit-validatord keys list
The output will look similar to this:
- address: nubit1whqq0ny69fyvea2n0x9emfetgc2flhtr6x92z9
name: my-wallet
pubkey: '{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Agyz8ccHMNzvX0QFhe4gsQcrMGslBbkvAXvLQvsIY823"}'
type: local
You can use any of your local keys for staking.
Get NUB and Check your Balance
Before staking you will need to get some token from faucet, please refer to Get NUB.
After obtaining tokens, check your key's balance with the following command, replacing <your-address>
with your actual address:
nubit-validatord q bank balances <your-address>
The output will be like this:
balances:
- amount: "40000"
denom: unub
pagination:
next_key: null
total: "0"
Get the Validator Address
Before staking, you need to know the nubitvaloper
address of the validator. Run the following command to get it, replacing <your-address>
with your actual address:
nubit-validatord keys show <your-address> --bech val -a
The output will look like this:
nubitvaloper1whqq0ny69fyvea2n0x9emfetgc2flhtrq82d6p
Create the Validator
Use the following command to create your validator. Replace <your-amount>
with the amount you want to stake, <your-moniker>
with your chosen validator name, and <your-address>
with your actual address:
nubit-validatord tx staking create-validator \
--amount=<your-amount>unub \
--pubkey=$(nubit-validatord tendermint show-validator) \
--moniker="<your-moniker>" \
--chain-id=nubit-alphatestnet-1 \
--commission-rate=0.10 \
--commission-max-rate=0.20 \
--commission-max-change-rate=0.01 \
--min-self-delegation=1 \
--fees=500unub \
--from=<your-address>
You will receive an output like this, including a transaction hash which you can use to check the transaction result at Nubit Alpha Testnet Explorer (https://explorer.nubit.org):
auth_info:
fee:
amount:
- amount: "500"
denom: unub
gas_limit: "210000"
granter: ""
payer: ""
signer_infos: []
tip: null
body:
extension_options: []
memo: ""
messages:
- '@type': /cosmos.staking.v1beta1.MsgCreateValidator
commission:
max_change_rate: "0.010000000000000000"
max_rate: "0.200000000000000000"
rate: "0.100000000000000000"
delegator_address: nubit1whqq0ny69fyvea2n0x9emfetgc2flhtr6x92z9
description:
details: ""
identity: ""
moniker: lewis
security_contact: ""
website: ""
min_self_delegation: "1"
pubkey:
'@type': /cosmos.crypto.ed25519.PubKey
key: 2KV3P2VgREZr+clfV/X4BJ7G3KNsB4jpDrYJ99prprQ=
validator_address: nubitvaloper1whqq0ny69fyvea2n0x9emfetgc2flhtrq82d6p
value:
amount: "10000"
denom: unub
non_critical_extension_options: []
timeout_height: "0"
signatures: []
confirm transaction before signing and broadcasting [y/N]: y
code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: 30F1ED38FB8C28964A6B35A3A7683E386747D17F2DB0CC1A397159BF046B9D49
Verify Your Validator
Check the status of your validator using the following command, replacing <your-validator-address>
with your actual validator address:
nubit-validatord query staking validator <your-validator-address>
When you see an output similar to the following, it means you have successfully created your validator:
commission:
commission_rates:
max_change_rate: "0.010000000000000000"
max_rate: "0.200000000000000000"
rate: "0.100000000000000000"
update_time: "2024-07-25T10:38:02.661182017Z"
consensus_pubkey:
'@type': /cosmos.crypto.ed25519.PubKey
key: 2KV3P2VgREZr+clfV/X4BJ7G3KNsB4jpDrYJ99prprQ=
delegator_shares: "10000.000000000000000000"
description:
details: ""
identity: ""
moniker: your-moniker
security_contact: ""
website: ""
jailed: false
min_self_delegation: "1"
operator_address: nubitvaloper1whqq0ny69fyvea2n0x9emfetgc2flhtrq82d6p
status: BOND_STATUS_UNBONDED
tokens: "10000"
unbonding_height: "0"
unbonding_time: "1970-01-01T00:00:00Z"
You can also check the status of your validator at Nubit Alpha Testnet Explorer: https://explorer.nubit.org/validators.
Delegate Tokens
Now you can delegate tokens to your validator. Use the following command, replacing <your-validator-address>
, <amount>
, and <your-address>
with the appropriate values:
nubit-validatord tx staking delegate <your-validator-address> <amount>unub \
--from=<your-address> \
--chain-id=nubit-alphatestnet-1 \
--fees=500unub \
--gas=200000
You will see an output like this:
auth_info:
fee:
amount:
- amount: "500"
denom: unub
gas_limit: "200000"
granter: ""
payer: ""
signer_infos: []
tip: null
body:
extension_options: []
memo: ""
messages:
- '@type': /cosmos.staking.v1beta1.MsgDelegate
amount:
amount: "100"
denom: unub
delegator_address: nubit1whqq0ny69fyvea2n0x9emfetgc2flhtr6x92z9
validator_address: nubitvaloper1whqq0ny69fyvea2n0x9emfetgc2flhtrq82d6p
non_critical_extension_options: []
timeout_height: "0"
signatures: []
confirm transaction before signing and broadcasting [y/N]: y
code: 0
codespace: ""
data: ""
events: []
gas_used: "0"
gas_wanted: "0"
height: "0"
info: ""
logs: []
raw_log: '[]'
timestamp: ""
tx: null
txhash: 0E51190E9ED18A6DC02ED0AA90315670C3D0ED76A2F65BF3F25950BA7B632B15
Input y
to send the delegating transaction. Wait some time for the transaction to be confirmed on the chain. You can check the status of your validator on the official explorer: https://explorer.nubit.org/validators.
Last updated