From 3cf8d7a9daacb57726dc4bc565156dcd5c57e36d Mon Sep 17 00:00:00 2001 From: Nabarun Date: Wed, 18 Jun 2025 10:55:04 +0000 Subject: [PATCH] Update docs to setup TMKMS optionally for subsequent validator nodes (#25) Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e - Use laconicd mainnet release `v1.0.0` in stack Reviewed-on: https://git.vdb.to/cerc-io/laconicd-stack/pulls/25 Co-authored-by: Nabarun Co-committed-by: Nabarun --- docs/run-first-validator.md | 6 +- docs/run-validator.md | 115 +++++++++--------- .../stacks/mainnet-laconicd/stack.yml | 2 +- 3 files changed, 64 insertions(+), 59 deletions(-) diff --git a/docs/run-first-validator.md b/docs/run-first-validator.md index eca3e45..a7575dc 100644 --- a/docs/run-first-validator.md +++ b/docs/run-first-validator.md @@ -194,7 +194,7 @@ ### Start TMKMS -- Run these steps in the machine where [the TMKMS service is setup (machine 1)](#setup-tmkms) +- Run these steps in the machine where [the TMKMS service is setup (machine 1)](#setup-tmkms-deployment) - Copy the example variables file: @@ -204,7 +204,7 @@ - Update `~/cerc/laconicd-stack/playbooks/tmkms/tmkms-vars.yml` with required values: - NOTE: Use the `priv_validator_key.json` file copied from the node setup machine (Machine 2) in [previous step](#setup-node) + NOTE: Use the `priv_validator_key.json` file copied from the node setup machine (Machine 2) in [previous step](#setup-bootstrap-node-deployment) ```yaml # Absolute path to the node's private validator key file @@ -244,7 +244,7 @@ ### Start laconicd node -- Run the following steps in the machine where [the mainnet node is setup (machine 2)](#setup-node) +- Run the following steps in the machine where [the mainnet node is setup (machine 2)](#setup-bootstrap-node-deployment) - Remove the validator key from node deployment as it is no longer required: diff --git a/docs/run-validator.md b/docs/run-validator.md index 38b928d..cec6258 100644 --- a/docs/run-validator.md +++ b/docs/run-validator.md @@ -2,13 +2,15 @@ ## Prerequisites +- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install) is required in all machines listed below + - To fetch laconicd-stack: ```bash laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull ``` -- Machine 1: Where the SAPO testnet node is already running +- Machine 1: Where your SAPO testnet node is already running - Machine 2: Where the mainnet validator node is to be setup @@ -24,19 +26,16 @@ - [ansible](playbooks/README.md#ansible-installation) - - Staking amount file in [config](./config) folder - -- Machine 4: Where the TMKMS service is to be setup +- Machine 4: Where the TMKMS service is to be setup (Optional) - laconicd-stack - [ansible](playbooks/README.md#ansible-installation) -- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install) is required in all machines ## Stop SAPO testnet node -- Run the following steps in machine where the testnet node is already running (machine 1) +- Run the following steps in machine where your SAPO testnet validator node is already running (machine 1) - Get your private key from testnet deployment: @@ -44,7 +43,7 @@ laconic-so deployment --dir exec laconicd "laconicd keys export --unarmored-hex --unsafe" ``` - NOTE: Store this key securely as it is needed in [later steps](#create-validator) + NOTE: Store this key securely as it is needed in [later steps](#create-validator). It should be the private key of the account that was used to create validator in SAPO testnet. - Stop the node for SAPO testnet: @@ -62,9 +61,26 @@ ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/build-laconicd.yml ``` -## Setup Node +## Setup TMKMS (Optional) -- Run the following steps in the machine where the validator node is to be setup (machine 2) +- For integrating TMKMS with laconicd, follow steps below in the machine where the TMKMS service is to be setup (machine 4) + +- Export the data directory as environment variable: + + ```bash + # Parent directory where the deployment directory will live + export DATA_DIRECTORY= + ``` + +- Run ansible playbook to setup the TMKMS service: + + ```bash + ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/setup-tmkms.yml + ``` + +## Setup laconicd Node + +- Run the following steps in the machine where the validator node is to be setup for mainnet (machine 2) - Copy the example variables file: @@ -82,8 +98,9 @@ # You can find the list of available peers in https://git.vdb.to/cerc-io/laconicd-stack/src/branch/main/node-addresses.yml cerc_peers: "@:26656,@:26656" - # Enable TMKMS - tmkms_enabled: true + # Enable TMKMS (Set to true or false) + # NOTE: Enabling TMKMS is optional and can be set to `true` if you are following the optional steps to setup TMKMS + tmkms_enabled: ``` - Export the data directory and mainnet deployment directory as environment variables: @@ -102,36 +119,25 @@ ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/setup-validator.yml ``` -- Copy over the `priv_validator_key.json` located at `$DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json` to the machine where the TMKMS service is to be setup (machine 4) - +- To get path to the deployment + ```bash - # Example command to transfer file from machine 2 to machine 4 (run on machine 2) - scp -C $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json @: + echo $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR ``` -## Setup TMKMS +## Start Deployments -- For integrating TMKMS with laconicd, follow steps below in the machine where the TMKMS service is to be setup (machine 4) - -- Export the data directory as environment variable: - - ```bash - # Parent directory where the deployment directory will live - export DATA_DIRECTORY= - ``` - -- Run ansible playbook to setup the TMKMS service: - - ```bash - ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/tmkms/setup-tmkms.yml - ``` - -## Run Node - -### Start TMKMS +### Start TMKMS (Optional) - Run the following steps in the machine where [the TMKMS service is setup (Machine 4)](#setup-tmkms) +- Copy over the `priv_validator_key.json` from the machine where [mainnet laconicd node was setup](#setup-laconicd-node) (machine 2) to a suitable place in the TMKMS machine (path to file needs to be specified in playbook vars in next step) + + ```bash + # Example command to transfer file from machine 2 (run on machine 2) + scp -C @:/data/laconicd-data/config/priv_validator_key.json + ``` + - Copy the example variables file: ```bash @@ -140,10 +146,9 @@ - Update `~/cerc/laconicd-stack/playbooks/tmkms/tmkms-vars.yml` with required values: - NOTE: Use the `priv_validator_key.json` file copied from the node setup machine (Machine 2) in [previous step](#setup-node) - ```yaml # Absolute path to the node's private validator key file + # Use the priv_validator_key.json file copied from the node setup machine (Machine 2) in previous step priv_validator_key_file_path: "" # Set the IP address of the machine where the laconicd node is setup @@ -178,9 +183,9 @@ - Note the pubkey logged at start for comparing later with validator pubkey on chain -### Start Node +### Start laconicd Node -- Run the following steps in the machine where [the validator node is setup (machine 2)](#setup-node) +- Run the following steps in the machine where [the laconicd node is setup (machine 2)](#setup-node) - Start the laconicd node: @@ -216,7 +221,7 @@ - Update `~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml` with required values: - NOTE: Use the public key exported in [previous step](#start-node) + NOTE: Use the public key exported in [previous step](#start-laconicd-node) ```bash # Set the public IP address of the machine where your node is running @@ -226,7 +231,7 @@ # Make sure to wrap it with single quotes ('') validator_pub_key: '' - # Same moniker as set above + # Same moniker as set during setup of laconicd node cerc_moniker: "" ``` @@ -252,7 +257,7 @@ laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators' ``` - - Remove the validator key from node deployment as TMKMS is configured: + - (Optional) If TMKMS is configured and running, remove the validator key from node deployment: NOTE: Store it safely offline in case of an emergency @@ -260,6 +265,20 @@ rm -rf $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json ``` +## Register Your Node + +- Run the following steps in the machine where the mainnet node is setup (machine 2) + +- Get your node's address: + + ```bash + 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 the [node-addresses.yml](../node-addresses.yml) file + +- Submit a PR to add your node address to the [laconicd-stack repository](https://git.vdb.to/cerc-io/laconicd-stack) + ## Update config - Run following steps to update the config for TMKMS and node @@ -347,17 +366,3 @@ ```bash laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start ``` - -## Register Your Node - -- Run the following steps in the machine where the mainnet node is setup (machine 2) - -- Get your node's address: - - ```bash - 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 the [node-addresses.yml](../node-addresses.yml) file - -- Submit a PR to add your node address to the repository diff --git a/stack-orchestrator/stacks/mainnet-laconicd/stack.yml b/stack-orchestrator/stacks/mainnet-laconicd/stack.yml index acfb443..2578c67 100644 --- a/stack-orchestrator/stacks/mainnet-laconicd/stack.yml +++ b/stack-orchestrator/stacks/mainnet-laconicd/stack.yml @@ -2,7 +2,7 @@ version: "1.0" name: mainnet-laconicd description: "Laconicd full node" repos: - - git.vdb.to/cerc-io/laconicd@mainnet # TODO: Use a release + - git.vdb.to/cerc-io/laconicd@v1.0.0 containers: - cerc/laconicd pods: