testnet-laconicd-stack/ops/stage1-to-stage2.md

3.8 KiB

Halt stage1 and start stage2

Login

  • Log in as dev user on the deployments VM

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

    cd /srv
    

Halt stage1

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

    # On stage1 deployment machine
    cd /srv/laconicd
    
    laconic-so deployment --dir stage1-deployment logs laconicd -f --tail 30
    
  • Stop the stage1 deployment:

    laconic-so deployment --dir stage1-deployment stop
    
    # Stopping this deployment marks the end of testnet stage1
    

Export stage1 state

  • Export the chain state:

    STAGE1_DEPLOYMENT=/srv/laconicd/stage1-deployment
    
    docker run -it \
      -v $STAGE1_DEPLOYMENT/data/laconicd-data:/root/.laconicd \
      cerc/laconicd:local bash -c "laconicd export | jq > /root/.laconicd/stage1-state.json"
    
  • Archive the state and node config and keys:

    sudo tar -czf /srv/laconicd/stage1-laconicd-export.tar.gz --exclude="./data" --exclude="./tmp" -C $STAGE1_DEPLOYMENT/data/laconicd-data .
    sudo chown dev:dev /srv/laconicd/stage1-laconicd-export.tar.gz
    
  • Get the exports locally:

    scp dev@<deployments-server-hostname>:/srv/laconicd/stage1-laconicd-export.tar.gz </path/to/local/directory>
    
    # These files are to be used in the next initialization step, scp them over to the stage2 deploment machine
    

Initialize stage2

  • Copy over the stage1 state and node export archive to stage2 deployment machine

  • Extract the stage1 state and node config to stage2 deployment dir:

    # On stage2 deployment machine
    cd /srv/laconicd
    
    # Unarchive
    tar -xzf stage1-laconicd-export.tar.gz -C stage2-deployment/data/laconicd-data
    
    # Verify contents
    ll stage2-deployment/data/laconicd-data
    
  • Initialize stage2 chain:

    DEPLOYMENT_DIR=$(pwd)
    
    cd ~/cerc/fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd
    
    STAGE2_CHAIN_ID=laconic_9000-2
    ./scripts/initialize-stage2.sh $DEPLOYMENT_DIR/stage2-deployment $STAGE2_CHAIN_ID LaconicStage2 os 1000000000000000
    
    # Enter the keyring passphrase for account from stage1 when prompted
    
    cd $DEPLOYMENT_DIR
    
    • Resets the node data (unsafe-reset-all)

    • Initializes the stage2-deployment node

    • Generates the genesis file for stage2 with stage1 state

      • Carries over accounts, balances and laconicd modules from stage1

      • Skips staking and validator data

Start stage2

  • Start the stage2 deployment:

    laconic-so deployment --dir stage2-deployment start
    
  • Check status of stage2 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 stage2-deployment logs laconicd -f
    
  • Get the node's peer adddress and stage2 genesis file to share with the participants:

    • Get the node id:

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

      scp dev@<deployments-server-hostname>:/srv/laconicd/stage2-deployment/data/laconicd-data/config/genesis.json </path/to/local/directory>
      
  • Now users can follow the steps to Upgrade to testnet stage2

Bank Transfer

  • Transfer tokens to an address:

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

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