laconicd-stack/docs/run-first-validator.md

4.9 KiB

Run First Validator Node

Prerequisites

Generate mainnet genesis file

  • 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 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 <absolute-path-to-testnet-deployment>
    
    • The file will be generated in <absolute-path-to-testnet-deployment>/export/testnet-state.json
  • If mainnet node is to be setup in a 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

  • Copy over the LPS lockup distribution distribution.json file to target machine

  • Set envs:

    export EXPORTED_STATE_PATH=<absolute-path-to-exported-testnet-state-json>
    export LPS_DISTRIBUTION_PATH=<absolute-path-to-distribution-json>
    export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation>
    
  • Copy the example variables file:

    cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
    
  • 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 "lps_distribution_path=$LPS_DISTRIBUTION_PATH" -e "early_supports_acc_address=$EARLY_SUPPORTS_ACC_ADDR"
    
  • Genesis file will be generated in output directory along with a file specifying the staking amount

    # List files in output directory - genesis.json and staking-amount.json
    ls -l output
    

Run node

  • Copy the example variables file if not already done:

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

    # Private key of the existing account in hex format (required for gentx)
    pvt_key: "<private-key>"
    
    # Path to the generated mainnet genesis file
    # Use the absolute path of generated output directory in the previous steps
    genesis_file: "<absolute-path-to-generated-output-dir>/genesis.json"
    
    # Path to staking-amount.json generated in previous steps
    staking_amount_file: "<absolute-path-to-generated-output-dir>/staking-amount.json"
    
    # Set custom moniker for the node
    cerc_moniker: "LaconicMainnetNode"
    
    # Set desired key name
    key_name: "laconic-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 ~/cerc/laconicd-stack/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
    
  • Check bonds list to confirm that testnet state was transferred properly:

    laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query bond list'
    

Publish required artifacts

  • Copy the genesis file to config folder:

    cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ~/cerc/laconicd-stack/config/mainnet-genesis.json
    
  • Copy the staking amount file to config folder:

    cp <absolute-path-to-generated-output-dir>/staking-amount.json ~/cerc/laconicd-stack/config/staking-amount.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, staking amount file and node address so that it is available to other validators