testnet-laconicd-stack/testnet-onboarding-validator.md
Prathamesh Musale eef72ec9c3 Add instructions for testnet2 deployment ops (#31)
Part of [Create a public laconicd testnet](https://www.notion.so/Create-a-public-laconicd-testnet-896a11bdd8094eff8f1b49c0be0ca3b8)

- Add instructions to setup stage2 laconicd deployment
- Add instructions for stage1 to stage2 migration
- Add a script and instructions for users to upgrade their nodes to testnet stage2

Reviewed-on: #31
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-30 12:05:54 +00:00

11 KiB

testnet-onboarding-validator

Onboard as a participant / validator on stage0

  • Visit https://wallet.laconic.com/ and click on Create wallet

    • Save the mnemonic for further usage
  • Register your laconic address as a participant using the Onboarding App

    • Read and accept the Terms and Conditions

    • On next page, enter your email to register to join the LORO testnet

    • Visit the confirmation link sent on the registered email (email delivery might take a few minutes)

    • Connect testnet-onboarding app to the wallet:

      • Click on CONNECT WALLET button on the testnet-onboarding app

      • Click on the WalletConnect icon on the top right corner in the wallet

        • If using the wallet website, enter WalletConnect URI for pairing
    • In the onboarding app, choose your nitro and laconicd account to onboard

    • Sign using the nitro key

      • Approve sign request on Wallet
    • Select the desired participant role (Validator or Participant) and accept the onboarding terms and conditions

    • In the next step, fund your laconic account by clicking on the REQUEST TOKENS FROM FAUCET button; ensure that the displayed balance is updated

    • Send transaction request to the wallet

      • From wallet, approve and send transaction to stage0 laconicd chain

Join as a validator on stage1

Prerequisites

  • Minimum hardware requirements:

    RAM: 8-16GB
    Disk space: 200GB
    CPU: 2 cores
    
  • Testnet genesis file and peer node address

  • Mnemonic from the wallet

  • Participant onboarded on stage0

Setup

  • Clone the stack repo:

    laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack
    
    # See stack documentation stack-orchestrator/stacks/testnet-laconicd/README.md for more details
    
  • Clone required repositories:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd setup-repositories --pull
    
    # If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories and re-run the command
    
  • Build the container images:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd build-containers
    

    This should create the following docker images locally:

    • cerc/laconicd

Create a deployment

  • Create a spec file for the deployment:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd deploy init --output testnet-laconicd-spec.yml
    
  • Edit network in the spec file to map container ports to host ports as required:

    # testnet-laconicd-spec.yml
    ...
    network:
      ports:
        laconicd:
          - '6060:6060'
          - '26657:26657'
          - '26656:26656'
          - '9473:9473'
          - '9090:9090'
          - '1317:1317'
    
  • Create the deployment from the spec file:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd deploy create --spec-file testnet-laconicd-spec.yml --deployment-dir testnet-laconicd-deployment
    
  • Copy over the published testnet genesis file (.json) to data directory in deployment (testnet-laconicd-deployment/data/laconicd-data/tmp):

    # Example
    mkdir -p testnet-laconicd-deployment/data/laconicd-data/tmp
    cp genesis.json testnet-laconicd-deployment/data/laconicd-data/tmp/genesis.json
    

Configuration

  • Inside the testnet-laconicd-deployment deployment directory, open config.env file and set following env variables:

    CERC_CHAIN_ID=laconic_9000-1
    
    # Comma separated list of nodes to keep persistent connections to
    # Example: "node-1-id@laconicd.laconic.com:26656"
    # Use the provided node id
    CERC_PEERS=""
    
    # A custom human readable name for this node
    CERC_MONIKER=
    

Start the deployment

laconic-so deployment --dir testnet-laconicd-deployment start

Check status

  • To list down and monitor the running containers:

    # With status
    docker ps -a
    
    # Follow logs for laconicd container
    laconic-so deployment --dir testnet-laconicd-deployment logs laconicd -f
    
  • Check the sync status of your node:

    laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd status | jq .sync_info"
    
    # `catching_up: false` indicates that node is completely synced
    
  • After the node has caught up, view current list of validators:

    laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd query staking validators"
    
    • Confirm that in the list of validators, your node moniker does not exist

Join as testnet validator

  • Open the wallet: https://wallet.laconic.com/

  • Create a validator from the onboarding app:

    • Visit the validator creation page

      • If required, connect testnet-onboarding app to the wallet with which onboarding was done on stage0
    • Select the Laconic account (same as the one used while onboarding) using which you wish to send the create validator request

      • This should display the details of your onboarded participant

      • You can proceed if the participant has validator role

    • Enter your node's moniker (use the same one used while configuring the testnet-laconicd-deployment)

    • Fetch and enter your validator's pubkey:

      laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd cometbft show-validator" | jq -r .key
      
    • Send the transaction request to wallet

      • From wallet, approve and send transaction to stage1 laconicd chain

  • Alternatively, create a validator using the laconicd CLI:

    • Import a key pair:

      KEY_NAME=alice
      CHAIN_ID=laconic_9000-1
      
      # Restore existing key with mnemonic seed phrase
      # You will be prompted to enter mnemonic seed
      laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd keys add $KEY_NAME --recover"
      
      # Query the keystore for your account's address
      laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd keys show $KEY_NAME -a"
      
    • Check balance for your account:

      laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd query bank balances <account-address>"
      
    • Create required validator configuration:

      # Note:
      # Edit the staking amount and other fields as required
      # Replace <your-node-moniker> with your node's moniker in command below
      
      laconic-so deployment --dir testnet-laconicd-deployment exec laconicd 'cat <<EOF > my-validator.json
      {
        "pubkey": $(laconicd cometbft show-validator),
        "amount": "1000000000000000alnt",
        "moniker": "<your-node-moniker>",
        "commission-rate": "0.1",
        "commission-max-rate": "0.2",
        "commission-max-change-rate": "0.01",
        "min-self-delegation": "1"
      }
      EOF'
      
    • Create a validator:

      laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd tx staking create-validator my-validator.json \
      --fees 500000alnt \
      --chain-id=$CHAIN_ID \
      --from $KEY_NAME"
      
  • View validators:

    laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd query staking validators"
    
    • Check that in the list of validators <your-node-moniker> exists
  • View validator set:

    laconic-so deployment --dir testnet-laconicd-deployment exec laconicd "laconicd query consensus comet validator-set"
    

Clean up

  • Stop all testnet-laconicd services running in the background:

    # Stop the docker containers
    laconic-so deployment --dir testnet-laconicd-deployment stop
    
  • To stop all services and also delete data:

    # Stop the docker containers
    laconic-so deployment --dir testnet-laconicd-deployment stop --delete-volumes
    
    # Remove deployment directory (deployment will have to be recreated for a re-run)
    sudo rm -r testnet-laconicd-deployment
    

Upgrade to SAPO testnet

Prerequisites

  • SAPO testnet (testnet2) genesis file and peer node address

  • A testnet stage1 node

    • For setting up a fresh testnet2 node, follow Join as a validator instead, but use testnet2 chain id (laconic-testnet-2)

Setup

  • Stop the stage1 node:

    # In dir where stage1 node deployment (`testnet-laconicd-deployment`) exists
    
    TESTNET_DEPLOYMENT=$(pwd)/testnet-laconicd-deployment
    
    laconic-so deployment --dir testnet-laconicd-deployment stop --delete-volumes
    
  • Clone / pull the stack repo:

    laconic-so fetch-stack git.vdb.to/cerc-io/testnet-laconicd-stack --pull
    
  • Clone / pull the required repositories:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd setup-repositories --pull
    
    # If this throws an error as a result of being already checked out to a branch/tag in a repo, remove the repositories and re-run the command
    

    Note: Make sure the latest cerc-io/laconicd changes have been pulled

  • Build the container images:

    laconic-so --stack ~/cerc/testnet-laconicd-stack/stack-orchestrator/stacks/testnet-laconicd build-containers --force-rebuild
    

    This should create the following docker images locally with latest changes:

    • cerc/laconicd

Create a deployment

  • The existing stage1 deployment can be used for testnet2

  • Copy over the published testnet2 genesis file (.json) to data directory in deployment (testnet-laconicd-deployment/data/laconicd-data/tmp-testnet2):

    # Example
    mkdir -p $TESTNET_DEPLOYMENT/data/laconicd-data/tmp-testnet2
    cp genesis.json $TESTNET_DEPLOYMENT/data/laconicd-data/tmp-testnet2/genesis.json
    
  • Run script to reset node data and upgrade for testnet2:

    cd ~/cerc/testnet-laconicd-stack
    
    docker run -it \
      -v $TESTNET_DEPLOYMENT/data/laconicd-data:/root/.laconicd \
      -v ./ops/stage2:/scripts \
      cerc/laconicd:local bash -c "/scripts/upgrade-node-to-testnet2.sh"
    
    cd -
    

Configuration

  • Inside the testnet-laconicd-deployment deployment directory, open config.env file and set following env variables:

    CERC_CHAIN_ID=laconic-testnet-2
    
    # Comma separated list of nodes to keep persistent connections to
    # Example: "node-1-id@laconicd-sapo.laconic.com:36656"
    # Use the provided node id
    CERC_PEERS=""
    
    # A custom human readable name for this node
    CERC_MONIKER=
    

Start the deployment

laconic-so deployment --dir testnet-laconicd-deployment start

See Check status to follow sync status of your node

See Join as testnet validator to join as a validator using laconicd CLI (use chain id laconic-testnet-2)

Clean up

Troubleshooting

  • If you face any issues in the onboarding app or the web-wallet, clear your browser cache and reload