laconicd-stack/docs/run-validator.md

3.5 KiB

Run Validator Node

Prerequisites

Run node

  • Get your private key from testnet deployment:

    laconic-so deployment --dir <testnet-deployment-dir> exec laconicd "laconicd keys export <key-name> --unarmored-hex --unsafe"
    

    NOTE: Store this key securely as it is needed in later steps

  • Stop the node for SAPO testnet:

    laconic-so deployment --dir <testnet-deployment-dir> stop
    
  • Fetch the stack:

    laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
    

    This command clones the entire repository into the ~/cerc folder, which includes the genesis file published by the first validator.

  • Copy the example variables file:

    cp ~/cerc/laconicd-stack/playbooks/validator/validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml
    
  • Update ~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml with required values:

    # Set custom moniker for the node
    cerc_moniker: "<your-moniker>"
    
    genesis_file: "~/cerc/laconicd-stack/config/mainnet-genesis.json"
    staking_amount_file: "~/cerc/laconicd-stack/config/staking-amount.json"
    
    # Set persistent peers (comma-separated list of node IDs and addresses)
    # You can find the list of available peers in https://git.vdb.to/cerc-io/laconicd-stack/src/branch/main/node-addresses.yml
    cerc_peers: "<node-id>@<node-host>:26656,<node-id>@<node-host>:26656"
    
  • Export the data directory and mainnet deployment directory as environment variables:

    # Parent directory where the deployment directory will live
    export DATA_DIRECTORY=
    
    # Set mainnet deployment directory
    # for eg: mainnet-laconicd-deployment
    export MAINNET_DEPLOYMENT_DIR=
    
  • Run ansible playbook to set up and start your validator node:

    ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/run-validator.yml
    
  • Check logs to ensure that node is running:

    laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
    

Create Validator

  • Run these steps in a machine different from the one where the node is running

  • Export required env vars:

    # desired key name
    export KEY_NAME=<key-name>
    
    export DATA_DIRECTORY=<data-directory>
    export MAINNET_DEPLOYMENT_DIR=<mainnet-deployment-dir>
    
    # Set the public IP address of the machine where your node is running
    export NODE_URL="tcp://PUBLIC_IP_ADDRESS:26657"
    
  • Run ansible playbook to create validator on running chain:

    ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/create-validator.yml
    
    • Input private key of the existing account that was exported in previous steps when prompted
  • Check the validator list:

    laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators'
    

Register Your Node

  • Run these steps in a machine where the node is running

  • Get your node's address:

    laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'echo $(laconicd cometbft show-node-id)@YOUR_PUBLIC_IP_ADDRESS:26656'
    
  • Add your node's address to the ~/cerc/laconicd-stack/node-addresses.yml file

  • Submit a PR to add your node address to the repository