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

  • Build container image

    # Fetch laconicd repo specified in stack
    laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd setup-repositories --git-ssh --pull
    
    # Build image
    laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers
    
  • Copy the generated exported state from earlier

    cp <path-to-exported-testnet-state> ~/cerc/laconicd-stack/testnet-state.json
    
  • Run script to generate genesis file using the exported state

    ~/cerc/laconicd-stack/scripts/generate-mainnet-genesis.sh ~/cerc/laconicd-stack/testnet-state.json
    
    • Genesis file will generated in output/genesis.json

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