laconicd-stack/run-first-validator.md

3.1 KiB

Run First Validator Node

Prerequisites

Generate mainnet genesis file

  • Fetch the stack in machine where the testnet chain node is running

    laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
    
  • Run script to export state from testnet chain

    ~/cerc/laconicd-stack/scripts/export-testnet-state.sh <path-to-testnet-deployment>
    
    • The file will be generated in <path-to-testnet-deployment>/export/testnet-state.json
  • If mainnet node will be setup in new machine, fetch the stack again

    laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
    
  • Copy over the exported testnet-state.json file to target machine

  • Set envs

    export EXPORTED_STATE_PATH=<absolute-path-to-exported-testnet-state-json>
    export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation>
    
    
  • Run playbook to use exported state for generating mainnet genesis

    ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/generate-genesis.yml -e "exported_state_path=$EXPORTED_STATE_PATH" -e "early_supports_acc_address=$EARLY_SUPPORTS_ACC_ADDR"
    

Run node

  • Update run-first-validator-vars.yml with required values:

    # Private key of the existing account in hex format (required for gentx)
    pvt_key: ""
    
    # Path to the generated mainnet genesis file generated in the previous step
    genesis_file: "<path-to-generated-genesis-file>"
    
    # Set custom moniker for the node
    cerc_moniker: "MainnetNode"
    
    # Set desired key name 
    key_name: "validator"
    
  • 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 submit the gentx and run the node:

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

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

Publish Genesis File and Node Address

  • Copy the genesis file to genesis folder:

    sudo cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ./genesis/mainnet-genesis.json
    
  • 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 node-addresses.yml

  • Submit a PR with this genesis file and node address so that it is available to other validators