Update playbooks to sign txs on a separate machine from the one running laconicd node (#5)

Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e

Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
Reviewed-on: #5
Co-authored-by: shreerang <shreerang@noreply.git.vdb.to>
Co-committed-by: shreerang <shreerang@noreply.git.vdb.to>
This commit was merged in pull request #5.
This commit is contained in:
2025-06-09 12:37:50 +00:00
committed by nabarun
co-authored by Shreerang Kale
parent 7a94eb2a03
commit 44ab959af5
10 changed files with 375 additions and 155 deletions
+105 -67
View File
@@ -7,8 +7,56 @@
- LPS distribution Google spreadsheet URL or CSV file path
- Install `zstd` using `sudo apt install zstd`
## Setup node
- Run the following steps in the machine where the mainnet node is to be setup
- Copy the example variables file if not already done:
```bash
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:
```bash
# 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:
```bash
# Parent directory where the deployment directory will live
export DATA_DIRECTORY=
# Set mainnet deployment directory
export MAINNET_DEPLOYMENT_DIR=mainnet-laconicd-deployment
```
- Run ansible playbook to setup the node:
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/setup-first-validator.yml
```
- Get the public key of your node:
```bash
docker run -it \
-v $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data:/root/.laconicd \
cerc/laconicd:local bash -c "laconicd tendermint show-validator"
```
NOTE: This public key is required in next step to generate the genesis file
## Export testnet state
- Run the following steps in machine where the testnet node is running
- Get your private key from testnet deployment:
```bash
@@ -39,7 +87,9 @@
## Generate mainnet genesis file
- If mainnet node is to be setup in a new machine, fetch the stack again:
- Run the following steps in secure machine separate from the one where the node is setup
- Fetch the stack:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
@@ -47,10 +97,28 @@
- Copy over compressed `testnet-state.zst` file to target machine
- Extract the testnet-state JSON file
- Set envs:
```bash
# Path where exported testnet state JSON file will be created
export EXPORTED_STATE_PATH=<absolute-path-to-be-exported-testnet-state-json>
# Path where LPS distribution JSON file will be created
export LPS_DISTRIBUTION_PATH=<absolute-path-to-be-generated-distribution-json>
export EARLY_SUPPORTS_ACC_ADDR=<account-address-controlled-by-laconic-foundation>
# Parent directory where the deployment directory will live
export DATA_DIRECTORY=
# Set mainnet deployment directory
export MAINNET_DEPLOYMENT_DIR=mainnet-laconicd-deployment
```
zstd -dc <path-to-compressed-file>/testnet-state.zst > testnet-state.json
- Extract the testnet-state JSON file:
```bash
zstd -dc <path-to-compressed-file>/testnet-state.zst > $EXPORTED_STATE_PATH
# Remove zst folder
rm -rf <path-to-compressed-file>/testnet-state.zst
@@ -59,20 +127,10 @@
- Generate LPS lockup distribution JSON file
```bash
~/cerc/laconicd-stack/scripts/generate-lps-lock.sh -i "<lps-distribution-spreadsheet-url-or-file-path>" -d "<destination-folder-for-json-file>"
~/cerc/laconicd-stack/scripts/generate-lps-lock.sh -i "<lps-distribution-spreadsheet-url-or-csv-file-path>" -o $LPS_DISTRIBUTION_PATH
```
- This will generate the `distribution.json` file
- Copy over the LPS lockup distribution `distribution.json` file to target machine
- Set envs:
```bash
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>
```
- This will generate the `distribution.json` file at `$LPS_DISTRIBUTION_PATH`
- Copy the example variables file:
@@ -80,12 +138,21 @@
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:
- Edit `~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml` with required values:
```bash
# Use the public key exported in previous step (make sure to wrap it with single quotes [''])
validator_pub_key: '<public-key-of-your-node>'
```
- Run playbook to use exported state for generating mainnet genesis file with gentx:
```bash
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"
```
- Input private key of the existing account that was exported in previous steps when prompted
- Genesis file will be generated in output directory along with a file specifying the staking amount
```bash
@@ -93,50 +160,9 @@
ls -l output
```
## Setup node
## Run node
- Copy the example variables file if not already done:
```bash
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:
```bash
# Use the private key of the existing account that was exported in previous steps
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:
```bash
# 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 gentx and setup the node:
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/first-validator/setup-first-validator.yml
```
- Run the following steps in the machine where the mainnet node is setup
### Setup TMKMS (Optional but Recommended)
@@ -156,6 +182,7 @@
```
- Update the TMKMS configuration file `$TMKMS_HOME/tmkms.toml`:
```toml
[[chain]]
id = "laconic-mainnet"
@@ -186,40 +213,44 @@
- Place the validator key file in TMKMS config directory at `$TMKMS_HOME/secrets/`
- Import the private validator key into tmkms:
```bash
tmkms softsign import $TMKMS_HOME/secrets/priv_validator_key.json $TMKMS_HOME/secrets/priv_validator_key
```
- Remove the JSON key file
```bash
rm $TMKMS_HOME/secrets/priv_validator_key.json
```
- Start TMKMS:
```bash
tmkms start --config $TMKMS_HOME/tmkms.toml
```
- Expected example output:
```bash
INFO tmkms::commands::start: tmkms 0.14.0 starting up...
INFO tmkms::keyring: [keyring:softsign] added consensus Ed25519 key: {"@type":"/cosmos.crypto.ed25519.PubKey","key":"T24No1A1FmetNRVCOSg2G2XAKWh97oBXuELdAD6DFgw="}
INFO tmkms::connection::tcp: KMS node ID: 7f5fd8dae8953e964e7e56edd4700f597ea0d45c
ERROR tmkms::client: [laconic-mainnet@tcp://localhost:26659] I/O error: Connection refused (os error 111)
```
NOTE: The errors dissapear once the laconicd node starts
- Note the pubkey logged at start for comparing later with validator pubkey on chain
- Enable TMKMS in the laconicd node configuration:
```bash
# Set TMKMS_ENABLED to true in the node's config.env
echo "TMKMS_ENABLED=true" >> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env
```
- Remove the validator key from node deployment as it is no longer required
- Remove the validator key from node deployment as it is no longer required:
```bash
rm $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
@@ -227,9 +258,15 @@
NOTE: Store it safely offline in case of an emergency
## Run node
### Start node
- Command to run node
- Copy the genesis file to the mainnet deployment tmp directory:
```bash
cp <absolute-path-to-genesis-json> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/tmp/genesis.json
```
- Command to run node:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
@@ -241,14 +278,15 @@
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
```
- If TMKMS has been configured verify that validator and TMKMS pubkeys match
- If TMKMS has been configured verify that validator and TMKMS pubkeys match:
- Get validator pubkey on chain
```bash
# Check consensus_pubkey in output
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators -o json | jq .validators'
```
- Compare it with the pubkey noted from logs in TMKMS
- Check bonds list to confirm that testnet state was transferred properly:
+63 -21
View File
@@ -7,6 +7,8 @@
## Setup Node
- Run the following steps in the machine where the validator node is to be setup
- Get your private key from testnet deployment:
```bash
@@ -53,8 +55,7 @@
export DATA_DIRECTORY=
# Set mainnet deployment directory
# for eg: mainnet-laconicd-deployment
export MAINNET_DEPLOYMENT_DIR=
export MAINNET_DEPLOYMENT_DIR=mainnet-validator-deployment
```
- Run ansible playbook to set up your validator node deployment:
@@ -81,6 +82,7 @@
```
- Update the TMKMS configuration file `$TMKMS_HOME/tmkms.toml`:
```toml
[[chain]]
id = "laconic-mainnet"
@@ -111,23 +113,25 @@
- Place the validator key file in TMKMS config directory at `$TMKMS_HOME/secrets/`
- Import the private validator key into tmkms:
```bash
tmkms softsign import $TMKMS_HOME/secrets/priv_validator_key.json $TMKMS_HOME/secrets/priv_validator_key
```
- Remove the JSON key file
```bash
rm $TMKMS_HOME/secrets/priv_validator_key.json
```
- Start TMKMS:
```bash
tmkms start --config $TMKMS_HOME/tmkms.toml
```
- Enable TMKMS in the laconicd node configuration:
```bash
# Set TMKMS_ENABLED to true in the node's config.env
echo "TMKMS_ENABLED=true" >> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env
@@ -136,28 +140,61 @@
## Start Node
- Start the laconicd node:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR start
```
- Check logs to ensure that node is running:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
```
- Get the public key of your node:
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd "laconicd tendermint show-validator"
```
NOTE: This public key is required in next step to create validator
## Create Validator
- Run these steps in a secure machine separate from the one where the node is setup
- Fetch the stack:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
This command clones the entire repository into the `~/cerc` folder, which includes the genesis file published by the first validator.
- Copy the example variables file:
```bash
cp ~/cerc/laconicd-stack/playbooks/validator/validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml
```
- Update `~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml` with required values:
```bash
# Same moniker as set above
cerc_moniker: "<your-moniker>"
# Use the public key exported in previous step (make sure to wrap it with single quotes [''])
validator_pub_key: '<public-key-of-your-node>'
# Set the public IP address of the machine where your node is running
node_url: "tcp://NODE_PUBLIC_IP_ADDRESS:26657"
```
- Export required env vars:
```bash
# Use the private key of the existing account that was exported in previous steps
export PVT_KEY=<private-key-in-hex-format>
# desired key name
export KEY_NAME=<key-name>
export DATA_DIRECTORY=<data-directory>
export MAINNET_DEPLOYMENT_DIR=<mainnet-deployment-dir>
export MAINNET_DEPLOYMENT_DIR=mainnet-validator-deployment
```
- Run ansible playbook to create validator on running chain:
@@ -166,18 +203,23 @@
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/create-validator.yml
```
- Check the validator list:
- Input private key of the existing account that was exported in previous steps when prompted
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators'
```
- Run the following commands in the machine where the validator node is setup
- If TMKMS has been configured, remove the validator key from node deployment as it is no longer required:
```bash
rm $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
```
- Check the validator list:
NOTE: Store it safely offline in case of an emergency
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators'
```
- If TMKMS has been configured, remove the validator key from node deployment as it is no longer required:
```bash
rm $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
```
NOTE: Store it safely offline in case of an emergency
## Register Your Node