Refactor TMKMS setup instructions
This commit is contained in:
parent
d6bd1731bb
commit
5685c622e1
@ -34,8 +34,7 @@
|
|||||||
export DATA_DIRECTORY=
|
export DATA_DIRECTORY=
|
||||||
|
|
||||||
# Set mainnet deployment directory
|
# Set mainnet deployment directory
|
||||||
# for eg: mainnet-laconicd-deployment
|
export MAINNET_DEPLOYMENT_DIR=mainnet-laconicd-deployment
|
||||||
export MAINNET_DEPLOYMENT_DIR=
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- Run ansible playbook to setup the node:
|
- Run ansible playbook to setup the node:
|
||||||
@ -54,6 +53,117 @@
|
|||||||
|
|
||||||
NOTE: This public key is required in next step to generate the genesis file
|
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
|
||||||
|
laconic-so deployment --dir <testnet-deployment-dir> exec laconicd "laconicd keys export <key-name> --unarmored-hex --unsafe"
|
||||||
|
```
|
||||||
|
|
||||||
|
NOTE: Store this key securely as it is needed in later steps
|
||||||
|
|
||||||
|
- Stop the node for SAPO testnet:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so deployment --dir <testnet-deployment-dir> stop
|
||||||
|
```
|
||||||
|
|
||||||
|
- Fetch the stack in machine where the testnet chain node is running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||||
|
```
|
||||||
|
|
||||||
|
- Run script to export state from testnet chain:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/cerc/laconicd-stack/scripts/export-testnet-state.sh <absolute-path-to-testnet-deployment>
|
||||||
|
```
|
||||||
|
|
||||||
|
- The compressed zst file will be generated at `<absolute-path-to-testnet-deployment>/export/testnet-state.zst`
|
||||||
|
|
||||||
|
## Generate mainnet genesis file
|
||||||
|
|
||||||
|
- 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
|
||||||
|
```
|
||||||
|
|
||||||
|
- Copy over compressed `testnet-state.zst` file to target machine
|
||||||
|
|
||||||
|
- 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
|
||||||
|
```
|
||||||
|
|
||||||
|
- 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
|
||||||
|
```
|
||||||
|
|
||||||
|
- Generate LPS lockup distribution JSON file
|
||||||
|
|
||||||
|
```bash
|
||||||
|
~/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 at `$LPS_DISTRIBUTION_PATH`
|
||||||
|
|
||||||
|
- Copy the example variables file:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
- 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
|
||||||
|
# List files in output directory - genesis.json and staking-amount.json
|
||||||
|
ls -l output
|
||||||
|
```
|
||||||
|
|
||||||
|
## Run node
|
||||||
|
|
||||||
|
- Run the following steps in the machine where the mainnet node is setup
|
||||||
|
|
||||||
### Setup TMKMS (Optional but Recommended)
|
### Setup TMKMS (Optional but Recommended)
|
||||||
|
|
||||||
<!-- Reference: https://docs.osmosis.zone/osmosis-core/keys/tmkms/#setup-tmkms -->
|
<!-- Reference: https://docs.osmosis.zone/osmosis-core/keys/tmkms/#setup-tmkms -->
|
||||||
@ -140,121 +250,15 @@
|
|||||||
echo "TMKMS_ENABLED=true" >> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env
|
echo "TMKMS_ENABLED=true" >> $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/config.env
|
||||||
```
|
```
|
||||||
|
|
||||||
## Export testnet state
|
|
||||||
|
|
||||||
- Run the following steps in machine where the testnet node is running
|
|
||||||
|
|
||||||
- Get your private key from testnet deployment:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir <testnet-deployment-dir> exec laconicd "laconicd keys export <key-name> --unarmored-hex --unsafe"
|
|
||||||
```
|
|
||||||
|
|
||||||
NOTE: Store this key securely as it is needed in later steps
|
|
||||||
|
|
||||||
- Stop the node for SAPO testnet:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so deployment --dir <testnet-deployment-dir> stop
|
|
||||||
```
|
|
||||||
|
|
||||||
- Fetch the stack in machine where the testnet chain node is running:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run script to export state from testnet chain:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
~/cerc/laconicd-stack/scripts/export-testnet-state.sh <absolute-path-to-testnet-deployment>
|
|
||||||
```
|
|
||||||
|
|
||||||
- The compressed zst file will be generated at `<absolute-path-to-testnet-deployment>/export/testnet-state.zst`
|
|
||||||
|
|
||||||
## Generate mainnet genesis file
|
|
||||||
|
|
||||||
- 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
|
|
||||||
```
|
|
||||||
|
|
||||||
- Copy over compressed `testnet-state.zst` file to target machine
|
|
||||||
|
|
||||||
- Extract the testnet-state JSON file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
zstd -dc <path-to-compressed-file>/testnet-state.zst > testnet-state.json
|
|
||||||
|
|
||||||
# Remove zst folder
|
|
||||||
rm -rf <path-to-compressed-file>/testnet-state.zst
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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>"
|
|
||||||
```
|
|
||||||
|
|
||||||
- This will generate the `distribution.json` file
|
|
||||||
|
|
||||||
- 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>
|
|
||||||
|
|
||||||
# Parent directory where the deployment directory will live
|
|
||||||
export DATA_DIRECTORY=
|
|
||||||
|
|
||||||
# Set mainnet deployment directory
|
|
||||||
# for eg: mainnet-laconicd-deployment
|
|
||||||
export MAINNET_DEPLOYMENT_DIR=
|
|
||||||
```
|
|
||||||
|
|
||||||
- Copy the example variables file:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cp ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.example.yml ~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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
|
|
||||||
# List files in output directory - genesis.json and staking-amount.json
|
|
||||||
ls -l output
|
|
||||||
```
|
|
||||||
|
|
||||||
- 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:
|
||||||
|
|
||||||
- Run the following command in the machine where the validator node is setup
|
```bash
|
||||||
|
rm $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/priv_validator_key.json
|
||||||
```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
|
NOTE: Store it safely offline in case of an emergency
|
||||||
|
|
||||||
## Run node
|
### Start node
|
||||||
|
|
||||||
- Copy the genesis file to the mainnet deployment tmp directory:
|
- Copy the genesis file to the mainnet deployment tmp directory:
|
||||||
|
|
||||||
|
@ -55,8 +55,7 @@
|
|||||||
export DATA_DIRECTORY=
|
export DATA_DIRECTORY=
|
||||||
|
|
||||||
# Set mainnet deployment directory
|
# Set mainnet deployment directory
|
||||||
# for eg: mainnet-laconicd-deployment
|
export MAINNET_DEPLOYMENT_DIR=mainnet-validator-deployment
|
||||||
export MAINNET_DEPLOYMENT_DIR=
|
|
||||||
```
|
```
|
||||||
|
|
||||||
- Run ansible playbook to set up your validator node deployment:
|
- Run ansible playbook to set up your validator node deployment:
|
||||||
@ -195,7 +194,7 @@
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
export DATA_DIRECTORY=<data-directory>
|
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:
|
- Run ansible playbook to create validator on running chain:
|
||||||
|
@ -4,7 +4,7 @@ set -e
|
|||||||
|
|
||||||
# Default values
|
# Default values
|
||||||
INPUT=""
|
INPUT=""
|
||||||
OUTPUT_DIR="."
|
OUTPUT_FILE="./distribution.json"
|
||||||
|
|
||||||
# Parse command line arguments
|
# Parse command line arguments
|
||||||
while [[ $# -gt 0 ]]; do
|
while [[ $# -gt 0 ]]; do
|
||||||
@ -13,13 +13,13 @@ while [[ $# -gt 0 ]]; do
|
|||||||
INPUT="$2"
|
INPUT="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
-d|--dir)
|
-o|--output)
|
||||||
OUTPUT_DIR="$2"
|
OUTPUT_FILE="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
echo "Unknown option: $1"
|
echo "Unknown option: $1"
|
||||||
echo "Usage: $0 -i|--input <input_url_or_path> [-d|--dir <output_directory>]"
|
echo "Usage: $0 -i|--input <input_url_or_path> [-o|--output <output_file_path>]"
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@ -28,13 +28,10 @@ done
|
|||||||
# Check if input is provided
|
# Check if input is provided
|
||||||
if [ -z "$INPUT" ]; then
|
if [ -z "$INPUT" ]; then
|
||||||
echo "Error: Input URL or path is required"
|
echo "Error: Input URL or path is required"
|
||||||
echo "Usage: $0 -i|--input <input_url_or_path> [-d|--dir <output_directory>]"
|
echo "Usage: $0 -i|--input <input_url_or_path> [-o|--output <output_file_path>]"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Create output directory if it doesn't exist
|
|
||||||
mkdir -p "$OUTPUT_DIR"
|
|
||||||
|
|
||||||
venv_dir="$PWD/venv-lps-lock"
|
venv_dir="$PWD/venv-lps-lock"
|
||||||
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
@ -50,7 +47,7 @@ fi
|
|||||||
echo "Running LPS lock generation script..."
|
echo "Running LPS lock generation script..."
|
||||||
"$venv_dir/bin/python" "$script_dir/generate-lps-distribution-json.py" \
|
"$venv_dir/bin/python" "$script_dir/generate-lps-distribution-json.py" \
|
||||||
--input "$INPUT" \
|
--input "$INPUT" \
|
||||||
--output "$OUTPUT_DIR/distribution.json"
|
--output "$OUTPUT_FILE"
|
||||||
|
|
||||||
# Clean up venv
|
# Clean up venv
|
||||||
echo "Cleaning up..."
|
echo "Cleaning up..."
|
||||||
|
@ -4,7 +4,6 @@ set -e
|
|||||||
|
|
||||||
NODE_HOME=/root/.laconicd
|
NODE_HOME=/root/.laconicd
|
||||||
genesis_file_path=$NODE_HOME/config/genesis.json
|
genesis_file_path=$NODE_HOME/config/genesis.json
|
||||||
# TODO: Set to OS keyring backend
|
|
||||||
KEYRING="test"
|
KEYRING="test"
|
||||||
|
|
||||||
if [ -f "$genesis_file_path" ]; then
|
if [ -f "$genesis_file_path" ]; then
|
||||||
|
Loading…
Reference in New Issue
Block a user