testnet-laconicd-stack/ops/stage0-to-stage1.md
Prathamesh Musale 8c672c0966 Add a script to generate stage1 participants and allocations with given validators (#25)
Part of [laconicd testnet validator enrollment](https://www.notion.so/laconicd-testnet-validator-enrollment-6fc1d3cafcc64fef8c5ed3affa27c675)
Requires cerc-io/fixturenet-laconicd-stack#14

Reviewed-on: cerc-io/testnet-laconicd-stack#25
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-08-19 10:12:29 +00:00

4.6 KiB

Halt stage0 and start stage1

Once all the participants have completed their onboarding, stage0 laconicd chain can be halted and stage1 chain can be initialized and started

Login

  • Log in as dev user on the deployments VM

  • All the deployments are placed in the /srv directory:

    cd /srv
    

Halt stage0

  • Confirm the the currently running node is for stage0 chain:

    cd /srv/laconicd
    
    laconic-so deployment --dir stage0-deployment logs laconicd -f --tail 30
    
  • Stop the stage0 deployment:

    laconic-so deployment --dir stage0-deployment stop
    

Start stage1

  • Rebuild laconicd container with >=v0.1.7 to enable slashing module:

    # laconicd source
    cd ~/cerc/laconicd
    
    # Pull latest changes
    git pull
    
    # Confirm the latest commit hash
    git log
    
    # Rebuild the containers
    cd /srv/laconicd
    
    laconic-so --stack ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd build-containers --force-rebuild
    
  • Fetch the generated genesis file with stage1 participants and token allocations:

    # Place in stage1 deployment directory
    wget -O /srv/laconicd/stage1-deployment/data/genesis-config/genesis.json https://git.vdb.to/cerc-io/testnet-laconicd-stack/raw/branch/main/ops/stage1/genesis-accounts.json
    
  • Start the stage1 deployment:

    laconic-so deployment --dir stage1-deployment start
    
  • Check status of stage1 laconicd:

    # List down the container and check health status
    docker ps -a | grep laconicd
    
    # Follow logs for laconicd container, check that new blocks are getting created
    laconic-so deployment --dir stage1-deployment logs laconicd -f
    
  • Query the list of registered participants in stage1 laconicd:

    laconic-so deployment --dir stage1-deployment exec laconicd "laconicd query onboarding list"
    
    # Confirm that all onboarded participants on stage0 appear in the list
    
  • Get the node's peer adddress and stage1 genesis file to share with the participants:

    • Get the node id:

      echo $(laconic-so deployment --dir stage1-deployment exec laconicd "laconicd cometbft show-node-id")@laconicd.laconic.com:26656
      
    • Get the genesis file:

      scp dev@<deployments-server-hostname>:/srv/laconicd/stage1-deployment/data/laconicd-data/config/genesis.json </path/to/local/directory>
      
  • Now users can follow the steps to Join as a validator on stage1

Bank Transfer

  • Transfer tokens to an address:

    cd /srv/laconicd
    
    RECEIVER_ADDRESS=
    AMOUNT=
    
    laconic-so deployment --dir stage1-deployment exec laconicd "laconicd tx bank send alice ${RECEIVER_ADDRESS} ${AMOUNT}alnt --from alice --fees 1000000alnt"
    
  • Check balance:

    laconic-so deployment --dir stage1-deployment exec laconicd "laconicd query bank balances ${RECEIVER_ADDRESS}"
    

Generating stage1 genesis

  • Following steps to be run on a local machine

  • Clone repos:

    git clone git@git.vdb.to:cerc-io/testnet-laconicd-stack.git
    
    git clone git@git.vdb.to:cerc-io/fixturenet-laconicd-stack.git
    
  • Create stage1 participants and allocations using provided validators list:

    • Prerequisite: validators.csv file with list of laconic addresses, example:

      laconic13ftz0c6cg6ttfda7ct4r6pf2j976zsey7l4wmj
      laconic1he4wjpfm5atwfvqurpg57ctp8chmxt9swf02dx
      laconic1wpsdkwz0t4ejdm7gcl7kn8989z88dd6wwy04np
      ...
      
    • Build

      # Change to scripts dir
      cd testnet-laconicd-stack/scripts
      
      # Install dependencies and build
      yarn && yarn build
      
    • Run script

      yarn participants-with-filtered-validators --validators-csv ./validators.csv --participant-alloc 200000000000 --validator-alloc 1000200000000000 --output stage1-participants-$(date +"%Y-%m-%dT%H%M%S").json --output-allocs stage1-allocs-$(date +"%Y-%m-%dT%H%M%S").json
      
      # This should create two json files with stage1 participants and allocations
      
  • Create stage1 genesis file:

    # Change to fixturenet-laconicd stack dir
    cd fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd
    
    # Generate genesis file
    # Provide absolute paths to generated stage1-participants and stage1-allocs files
    ./scripts/generate-stage1-genesis-from-json.sh /path/to/testnet-laconicd-stack/scripts/stage1-participants.json /path/to/testnet-laconicd-stack/scripts/stage1-allocs.json
    
    # This should generate the required genesis file at output/genesis.json