Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Become To Validator

ludete edited this page Aug 19, 2020 · 3 revisions

If the node wants to be a validator, follow the command below, so you can broadcast a CreateValidator tx to setup your node as Validator.

  • The following conditions are required:
    • Prepare a CoinEx Chain account so that it can be used to identity validator operator in transactions
    • The account should have enough CET to make the initial self delegation (at least 1 million CET for mainnet)

Retrieve Node Consensus Pubkey

Prepare command to export consensus pubkey of node, for further use

echo "export VALIDATOR_CONSENSUS_PUBKEY=$(${RUN_DIR}/cetd tendermint show-validator --home=${RUN_DIR}/.cetd)"

example output: (testnet prefix is cettestvalconspub, mainnet prefix is coinexvalconspub)

export VALIDATOR_CONSENSUS_PUBKEY=cettestvalconspub1zcjduepqn926zz0lqt9dt83xfn9vflnxhrem644ep4k4qkgz2fjpef3402mqeuf2yz



  • No need to operate on your cloud server for subsequent steps, which setup you node as a Validator
    • so that the account's private key will not appear on the cloud server.

CreateValidator Transactions

  1. Switch to your personal computer before following steps (assume also use Ubuntu 18.04).

    • export validator node ip, so that we can send Create Validator tx to it

      #export Node Name, e.g.: MyAwesomeNode. (please keep the ' marks)
      export VALIDATOR_MONIKER='<your_moniker_name>'
      #export Node's public IP
      export VALIDATOR_PUBLIC_IP=<validator_public_ip>
      export CHAIN_ID=chain-id

    • Check exported variables:

      [ "${VALIDATOR_PUBLIC_IP}" != "" ] && echo "OK" || echo "ERROR"
      [ "${CETCLI_URL}" != "" ] && echo "OK" || echo "ERROR"
      [ "${VALIDATOR_MONIKER}" != "" ] && echo "OK" || echo "ERROR"
      [ "${CHAIN_ID}" != "" ] && echo "OK" || echo "ERROR"

  2. Download cetcli and connect to node in cloud.

    Follow the step to download cetcli

    Setup the connection with validator node.

    chmod a+x ./cetcli
    ./cetcli config node ${VALIDATOR_PUBLIC_IP}:26657
    # check connection
    ./cetcli status | grep ${VALIDATOR_PUBLIC_IP} && echo "OK" || echo "ERROR"

  3. Create account for validator operator

    Create new account by cetcli
    NOTES: >>>your mnemonic passphrase will print out by this command, store it safely<<<
    NOTES: >>>your private keystore will be in folder: ~/.cetcli, PLEASE DO BACKUP<<<
    NOTES: >>>in order to continue using the corresponding account, please remember passphrase<<<

    export KEY_NAME=<replace_with_your_local_key_name>
    ./cetcli keys add ${KEY_NAME}

    example output:
    j@j ~ $ export KEY_NAME=bob
    j@j ~ $ ./cetcli keys add ${KEY_NAME}
    Enter a passphrase to encrypt your key to disk:
    Repeat the passphrase:
    
    - name: bob
    type: local
    address: cettest1wrl8lzre3u05msrlagxkx7e4q0szp4usjpcy0z
    pubkey: cettestpub1addwnpepqwrxg3amuqzmnrc6m3rlx26z5y63zlwcfu8zdqa4nmsr2zr2ez35kdxwc9e
    mnemonic: ""
    threshold: 0
    pubkeys: []
    
    **Important** write this mnemonic phrase in a safe place.
    It is the only way to recover your account if you ever forget your password.
    
    pelican someone great yard electric quick embark hazard surprise yard picture draft student tilt volume solve charge price grit jealous problem door rent evolve
    j@j ~ $
    



  4. Withdraw CET from CoinEx Exchange to your new created account address

    # get account address of validator operator
    export VALIDATOR_OPERATOR_ADDR=$(./cetcli keys show ${KEY_NAME} -a)
    [ "${VALIDATOR_OPERATOR_ADDR}" != "" ] && echo "OK" || echo "ERROR"
    echo ${VALIDATOR_OPERATOR_ADDR}

    For testnet, you can get the test token on faucet

  5. [Optional] Query balance:

    ./cetcli q account $(./cetcli keys show ${KEY_NAME} -a) --chain-id=${CHAIN_ID}

    If shows "account ... does not exist", then the address not exist on chain or your node is not synced up to the latest height.

    EXAMPLE:
    j@j ~ $ ./cetcli q account $(./cetcli keys show ${KEY_NAME} -a) --chain-id=${CHAIN_ID}
    account: |
    address: cettest1wrl8lzre3u05msrlagxkx7e4q0szp4usjpcy0z
    coins:
    - denom: cet
        amount: "1499900000000"
    

    NOTES: All tokens' precision are fixed at 8 decimal digits,
    so in previous example 1499900000000cet on chain means 14999CET
    One CET will be charged as account activation feature fee

  6. prepare validator identity, so we can see your customized validator icon in chain explorer

    • please create a new account in https://keybase.io

    • upload your icon

    • also get your identity

      • e.g.: the identity of ViaWallet in testnet is 9A30CBDA5872CED8

        identity example

        example_identity

    • export bash variables:

      export VALIDATOR_IDENTITY=<REPLACE_WITH_YOUR_IDENTITY>
      [ "${VALIDATOR_IDENTITY}" != "" ] && echo "OK" || echo "ERROR"

  7. Send CreateValidator tx to become a validator

    7.1 Prepare to send the CreateValidator transaction

    [ "${VALIDATOR_CONSENSUS_PUBKEY}" != "" ] && echo "OK" || echo "ERROR"

    7.2 Send transaction

    ./cetcli tx staking create-validator \
    --amount=100000000000000cet \
    --pubkey=${VALIDATOR_CONSENSUS_PUBKEY} \
    --moniker=${VALIDATOR_MONIKER} \
    --identity=${VALIDATOR_IDENTITY} \
    --chain-id=${CHAIN_ID} \
    --commission-rate=0.1 \
    --commission-max-rate=0.2 \
    --commission-max-change-rate=0.01 \
    --min-self-delegation=100000000000000 \
    --from $(./cetcli keys show ${KEY_NAME} -a) \
    --gas 40000 \
    --fees 800000cet

    need self delegate 10000CET for testnets:

    ./cetcli tx staking create-validator \
    --amount=1000000000000cet \
    --pubkey=${VALIDATOR_CONSENSUS_PUBKEY} \
    --moniker=${VALIDATOR_MONIKER} \
    --identity=${VALIDATOR_IDENTITY} \
    --chain-id=${CHAIN_ID} \
    --commission-rate=0.1 \
    --commission-max-rate=0.2 \
    --commission-max-change-rate=0.01 \
    --min-self-delegation=1000000000000 \
    --from $(./cetcli keys show ${KEY_NAME} -a) \
    --gas 300000 \
    --fees 6000000cet



    cetcli tx staking create-validator --help:
    create new validator initialized with a self-delegation to it
    Flags:
        --amount string                       Amount of coins to bond
        --commission-max-change-rate string   The maximum commission change rate percentage (per day)
        --commission-max-rate string          The maximum commission rate percentage
        --commission-rate string              The initial commission rate percentage
        --details string                      The validator's (optional) details
        --from string                         Name or address of private key with which to sign
        --gas string                          gas limit; set to "auto" to calculate required gas automatically
        --identity string                     The optional identity signature (ex. Keybase)
        --memo string                         Memo to send along with transaction
        --min-self-delegation string          The minimum self delegation required on the validator
        --moniker string                      The validator's name
        --pubkey string                       The Bech32 encoded PubKey of the validator
        --website string                      The validator's (optional) website
        --chain-id string                     Chain ID of tendermint node
    

    The description and identity can be changed by edit-validator command

    ./cetcli tx staking edit-validator --help



    • notes, gas can be estimated by using --dry-run (without --gas and --fees parameter)

      • All tokens' precision are fixed at 8 decimal digits.
      • so 200000000cet on chain means 2CET
      • current network min gas price is 20cet/gas on chain.
      • means 0.0000002CET/gas
    • NOTES: Choose your Commission rate wisely:

      • --amount string
        • initial self delegation amount
        • need greater or equal to network-minimum-self-delegation-parameters, which is 5 million CET
      • --commission-rate=0.1
        • current commission rate, 0.1 indicates 10%
      • --commission-max-rate=0.2
        • max commission rate in future, CAN NOT BE CHANGED AFTERWARDS
      • --commission-max-change-rate=0.01
        • max commission rate adjust amount in 24hours (0.01 indicates the max adjust value is 1% every 24hours)
        • can only adjust once every 24hours
      • --min-self-delegation=100000000000000
        • self specified min-self-delegation amount
        • if self-delegation less than this --min-self-delegation value after undelegate, the node will be set to unbonding status by chain
        • need greater or equal to network-minimum-self-delegation-parameters, which is 1 million CET
  8. Query Validator Status

    Query Validator status:
    • Check your validator status in CoinEx DEX Chain Explorer

    • testnet explorer link

    • Get your validator operator address

      ./cetcli keys show ${KEY_NAME} --bech val

      NAME:	TYPE:	ADDRESS:					
      fullnode_user1	local	coinexvaloper1kg3e5p2rc2ejppwts6qwzrcgndvgeyztudujdz	
      
      #coinexvaloper1kg3e5p2rc2ejppwts6qwzrcgndvgeyztudujdz is your validator operator address
      
    • Query all validators

      ./cetcli q staking validators --chain-id=${CHAIN_ID}

      Validator
      Operator Address:           coinexvaloper1kg3e5p2rc2ejppwts6qwzrcgndvgeyztudujdz
      Validator Consensus Pubkey: coinexvalconspub1zcjduepqagvj8plupgura2vt08xlm3tpur5u0vw89cw8ut9j8a55xq2jetgswccuwt
      Jailed:                     false
      Status:                     Bonded
      Tokens:                     100000000000000
      Delegator Shares:           100000000000000.000000000000000000
      Description:                {fullnode1   }
      Unbonding Height:           0
      Unbonding Completion Time:  1970-01-01 00:00:00 +0000 UTC
      Minimum Self Delegation:    100000000000000
      Commission:                 rate: 0.050000000000000000, maxRate: 0.200000000000000000, maxChangeRate: 0.010000000000000000, updateTime: 2019-06-23 
      
      ...
      
    • It is recommended to complete the following two item verification for node
      NOTES: Need to execute on your server and after your server is synced up
      your node is synced up when result of command "{RUN_DIR}/cetcli status" contains "catching_up":false

      • CHECK 1 : Do I in validator set?

      ./cetcli q tendermint-validator-set --chain-id=${CHAIN_ID} | grep $(./cetd tendermint show-validator --home=${RUN_DIR}/.cetd ) && echo "in validator set" || echo "not in validator set"

      if shows "in validator set", then your node is validator now.

      • CHECK 2 : Do I participates in the consensus?

      ./cetcli q block --chain-id=${CHAIN_ID} | grep $(grep address ${RUN_DIR}/.cetd/config/priv_validator_key.json | grep -o ": .*" | grep -o '[0-9a-zA-Z]{40}') && echo "participates in the consensus" || echo "not participates in the consensus"

      if shows "participates in the consensus", then your node is participates in the consensus now.

    • How to unjail my validator?

      cetcli tx slashing unjail --from ${KEY_NAME} --chain-id=${CHAIN_ID} --gas=100000 --fees=2000000cet
      
    • CHECK 3: Check on BlockChain Explorer

      • check that the "Uptime (Last 100 Blocks)" field is increase and up to 100% (normal).

      example_identity






So far, the deployment of stand-alone validator has been completed.

  • for further enhanced solutions, it is recommended to deploy and exercised on testnet before deploy on mainnet.
Clone this wiki locally