Divide generate genesis and create validator playbooks into build and start playbooks (#13)

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

Co-authored-by: Shreerang Kale <shreerangkale@gmail.com>
Reviewed-on: #13
Co-authored-by: shreerang <shreerang@noreply.git.vdb.to>
Co-committed-by: shreerang <shreerang@noreply.git.vdb.to>
This commit is contained in:
shreerang 2025-06-10 10:07:15 +00:00 committed by nabarun
parent 44ab959af5
commit edee217050
10 changed files with 166 additions and 165 deletions

View File

@ -1,5 +1,13 @@
# laconicd-stack
- Follow [run-first-validator.md](docs/run-first-validator.md) to run the first validator node
- Follow [cosmos-multisig-app playbook](./playbooks/cosmos-multisig-app/README.md) to run the Cosmos Multisig app
- Follow [run-validator.md](docs/run-validator.md) to run subsequent validator nodes
- This stack is used for running nodes to launch Laconic mainnet chain
- It allows you to export SAPO testnet state and start mainnet nodes
- To launch Laconic mainnet, follow these steps:
- **Run the First Validator Node:** Begin by setting up and running the initial validator node as detailed in [run-first-validator.md](docs/run-first-validator.md)
- **Deploy Cosmos Multisig App:** Integrate and run the Cosmos Multisig app using the playbook available at [cosmos-multisig-app playbook](./playbooks/cosmos-multisig-app/README.md)
- **Run Subsequent Validator Nodes:** Run subsequent validator nodes by following the instructions in [run-validator.md](docs/run-validator.md)

View File

@ -2,14 +2,42 @@
## Prerequisites
- [ansible](playbooks/README.md#ansible-installation)
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
- LPS distribution Google spreadsheet URL or CSV file path
- Install `zstd` using `sudo apt install zstd`
- Machine 1: Where the SAPO testnet node is already running
- Install `zstd` using `sudo apt install zstd`
- Machine 2: Where the mainnet first validator node is to be setup
- Machine 3: Where the genesis file is to be generated
- Install `zstd` using `sudo apt install zstd`
- LPS distribution Google spreadsheet URL or CSV file path
- Following tools are required in all machines:
- [ansible](playbooks/README.md#ansible-installation)
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
- laconicd-stack
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
## Build laconicd to generate genesis file
- Run the following steps in a secure machine (machine 3) separate from the one where the node is to be setup (machine 2)
- Run playbook to build laconicd container:
```bash
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/build-laconicd.yml
```
## Setup node
- Run the following steps in the machine where the mainnet node is to be setup
- Run the following steps in the machine where the mainnet node is to be setup (machine 2)
- Copy the example variables file if not already done:
@ -51,11 +79,11 @@
cerc/laconicd:local bash -c "laconicd tendermint show-validator"
```
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](#generate-mainnet-genesis-file)
## Export testnet state
- Run the following steps in machine where the testnet node is running
- Run the following steps in machine where the testnet node is already running (machine 1)
- Get your private key from testnet deployment:
@ -71,12 +99,6 @@
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
@ -87,13 +109,7 @@
## 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
```
- Run the following steps in machine where [the genesis file is to be generated (machine 3)](#build-laconicd-to-generate-genesis-file)
- Copy over compressed `testnet-state.zst` file to target machine
@ -110,9 +126,6 @@
# 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:
@ -140,8 +153,10 @@
- Edit `~/cerc/laconicd-stack/playbooks/first-validator/first-validator-vars.yml` with required values:
NOTE: Use the public key exported in [previous step](#setup-node)
```bash
# Use the public key exported in previous step (make sure to wrap it with single quotes [''])
# Make sure to wrap it with single quotes ('')
validator_pub_key: '<public-key-of-your-node>'
```
@ -162,7 +177,7 @@
## Run node
- Run the following steps in the machine where the mainnet node is setup
- Run the following steps in the machine where the mainnet node is setup (machine 2)
### Setup TMKMS (Optional but Recommended)
@ -318,19 +333,21 @@
## Publish required artifacts
- Copy the genesis file to [config](./config) folder:
- Run the following steps in machine where the genesis file and staking amount files are generated (machine 3)
```bash
cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ~/cerc/laconicd-stack/config/mainnet-genesis.json
```
- Copy the genesis file to [config](./config) folder:
- Copy the staking amount file to [config](./config) folder:
```bash
cp $DATA_DIRECTORY/output/genesis.json ~/cerc/laconicd-stack/config/mainnet-genesis.json
```
```bash
cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/tmp/staking-amount.json ~/cerc/laconicd-stack/config/staking-amount.json
```
- Copy the staking amount file to [config](./config) folder:
- Get your node's address:
```bash
cp $DATA_DIRECTORY/output/staking-amount.json ~/cerc/laconicd-stack/config/staking-amount.json
```
- Get your node's address by running following command in the machine where the mainnet node is running (machine 2):
```bash
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'echo $(laconicd cometbft show-node-id)@YOUR_PUBLIC_IP_ADDRESS:26656'

View File

@ -2,12 +2,31 @@
## Prerequisites
- [ansible](playbooks/README.md#ansible-installation)
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
- Machine 1: Where the SAPO testnet node is already running
## Setup Node
- Machine 2: Where the mainnet validator node is to be setup
- Run the following steps in the machine where the validator node is to be setup
- laconicd-stack
- [ansible](playbooks/README.md#ansible-installation)
- Machine 3: Where the create-validator transaction is to be signed
- 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
- To fetch laconicd-stack:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
```
## Stop SAPO testnet node
- Run the following steps in machine where the testnet node is already running (machine 1)
- Get your private key from testnet deployment:
@ -15,7 +34,7 @@
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
NOTE: Store this key securely as it is needed in [later steps](#create-validator)
- Stop the node for SAPO testnet:
@ -23,13 +42,19 @@
laconic-so deployment --dir <testnet-deployment-dir> stop
```
- Fetch the stack:
## Build laconicd to create validator
- Run the following steps in a secure machine (machine 3) separate from the one where the node is to be setup (machine 2)
- Run playbook to build laconicd container:
```bash
laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/build-laconicd.yml
```
This command clones the entire repository into the `~/cerc` folder, which includes the genesis file published by the first validator.
## Setup Node
- Run the following steps in the machine where the validator node is to be setup (machine 2)
- Copy the example variables file:
@ -161,13 +186,7 @@
## 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
```
- Run these steps in a machine from where [the create-validator transaction is to be signed (machine 3)](#build-laconicd-to-create-validator)
This command clones the entire repository into the `~/cerc` folder, which includes the genesis file published by the first validator.
@ -179,11 +198,13 @@
- Update `~/cerc/laconicd-stack/playbooks/validator/validator-vars.yml` with required values:
NOTE: Use the public key exported in [previous step](#start-node)
```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 [''])
# 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
@ -203,9 +224,9 @@
ansible-playbook -i localhost, -c local ~/cerc/laconicd-stack/playbooks/validator/create-validator.yml
```
- Input private key of the existing account that was exported in previous steps when prompted
- Input private key of the existing account that was exported in [previous steps](#stop-sapo-testnet-node) when prompted
- Run the following commands in the machine where the validator node is setup
- Run the following commands in the machine where the validator node is running (machine 2)
- Check the validator list:

View File

@ -5,36 +5,21 @@
- first-validator-vars.yml
vars:
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
gentx_genesis_dir: "{{data_directory}}/generate-gentx-genesis"
spec_file: "{{data_directory}}/laconicd-spec.yml"
connection: local
tasks:
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
- name: Fail if DATA_DIRECTORY env vars are not set
fail:
msg: >-
Required environment variables are not set.
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == ''
- name: Fetch repositories
ansible.builtin.shell:
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd setup-repositories --git-ssh --pull"
# TODO: Add a flag to control force rebuild
- name: Build containers
ansible.builtin.shell:
cmd: "laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers --force-rebuild"
- name: Copy exported testnet state file
ansible.builtin.copy:
src: "{{ exported_state_path }}"
dest: "~/cerc/laconicd-stack/testnet-state.json"
remote_src: true # Set to true if exported_state_path is on the target host
Please export both DATA_DIRECTORY before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == ''
- block:
- name: Run script to generate genesis file
ansible.builtin.shell:
cmd: "CHAIN_ID={{ cerc_chain_id }} EARLY_SUPPORTS_ACC_ADDRESS={{ early_supports_acc_address }} {{ ansible_env.HOME }}/cerc/laconicd-stack/scripts/generate-mainnet-genesis.sh {{ ansible_env.HOME }}/cerc/laconicd-stack/testnet-state.json {{ lps_distribution_path }}"
cmd: "CHAIN_ID={{ cerc_chain_id }} EARLY_SUPPORTS_ACC_ADDRESS={{ early_supports_acc_address }} {{ ansible_env.HOME }}/cerc/laconicd-stack/scripts/generate-mainnet-genesis.sh {{ exported_state_path }} {{ lps_distribution_path }}"
chdir: "{{ lookup('env', 'PWD') }}"
always:
- name: Clean up temporary genesis directory
@ -42,11 +27,6 @@
path: "{{ ansible_env.HOME }}/cerc/laconicd-stack/playbooks/first-validator/mainnet-genesis"
state: absent
- name: Remove temporary copied state file
ansible.builtin.file:
path: "~/cerc/laconicd-stack/testnet-state.json"
state: absent
- name: Display genesis file location
ansible.builtin.debug:
msg: "Mainnet genesis file generated at output/genesis.json"
@ -55,30 +35,34 @@
ansible.builtin.debug:
msg: "Staking amount written to output/staking-amount.json"
- name: Create deployment spec file
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
- name: Create deployment from spec file
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy create --spec-file {{ spec_file }} --deployment-dir {{data_directory}}/{{ mainnet_deployment_dir }}
- name: Ensure tmp directory exists inside laconicd-data
- name: Create data directory
file:
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
path: "{{ gentx_genesis_dir }}"
state: directory
mode: '0755'
- name: Copy staking amount file to laconicd-data tmp directory
- name: Ensure tmp directory exists inside gentx genesis directory
file:
path: "{{gentx_genesis_dir}}/tmp"
state: directory
mode: '0755'
- name: Ensure output directory exists inside gentx genesis directory
file:
path: "{{gentx_genesis_dir}}/output"
state: directory
mode: '0755'
- name: Copy staking amount file to gentx genesis tmp directory
copy:
src: "{{ lookup('env', 'PWD') }}/output/staking-amount.json"
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/staking-amount.json"
dest: "{{gentx_genesis_dir}}/tmp/staking-amount.json"
mode: '0644'
- name: Copy genesis file to laconicd-data tmp directory
- name: Copy genesis file to gentx genesis tmp directory
copy:
src: "{{ lookup('env', 'PWD') }}/output/genesis.json"
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/genesis.json"
dest: "{{gentx_genesis_dir}}/tmp/genesis.json"
mode: '0644'
- name: Prompt for validator private key
@ -97,8 +81,8 @@
- name: Run script to create and collect gentx
shell: |
docker run -i \
-v {{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
-v {{data_directory}}/{{ mainnet_deployment_dir }}/config/mainnet-laconicd:/scripts \
-v {{gentx_genesis_dir}}:/root/generate-gentx-genesis \
-v ~/cerc/laconicd-stack/stack-orchestrator/config/mainnet-laconicd:/scripts \
-e "PVT_KEY={{ private_key_input.user_input }}" \
-e "KEY_NAME={{ key_name }}" \
-e "CERC_MONIKER={{ cerc_moniker }}" \
@ -108,11 +92,11 @@
- name: Update genesis file in output
copy:
src: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/config/genesis.json"
src: "{{gentx_genesis_dir}}/output/genesis.json"
dest: "{{ lookup('env', 'PWD') }}/output/genesis.json"
mode: '0644'
- name: Clear tmp directory
file:
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
path: "{{gentx_genesis_dir}}/tmp"
state: absent

View File

@ -8,6 +8,7 @@
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
spec_file: "{{data_directory}}/laconicd-spec.yml"
spec_template: "./templates/specs/spec-template.yml.j2"
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
tasks:
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
fail:
@ -16,9 +17,6 @@
Please export both DATA_DIRECTORY and MAINNET_DEPLOYMENT_DIR before running the playbook.
when: lookup('env', 'DATA_DIRECTORY') == '' or lookup('env', 'MAINNET_DEPLOYMENT_DIR') == ''
- name: Fetch laconicd stack
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
- name: Setup required repositories
shell: >
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
@ -26,7 +24,7 @@
- name: Build container images
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers --force-rebuild
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers {{ build_args }}
- name: Create deployment spec file
shell: |

View File

@ -0,0 +1,15 @@
---
- name: Build Laconicd
hosts: localhost
connection: local
vars:
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
tasks:
- name: Setup required repositories
shell: >
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
setup-repositories --git-ssh --pull
- name: Build container images
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers {{ build_args }}

View File

@ -5,7 +5,7 @@
- validator-vars.yml
vars:
data_directory: "{{ lookup('env', 'DATA_DIRECTORY') }}"
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
create_validator_dir: "{{data_directory}}/create-validator"
spec_file: "{{data_directory}}/laconicd-validator-spec.yml"
tasks:
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
@ -22,46 +22,16 @@
Please set staking_amount_file in validator-vars.yml.
when: not staking_amount_file
- name: Fetch laconicd stack
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
- name: Setup required repositories
shell: >
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
setup-repositories --git-ssh --pull
- name: Build container images
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers
- name: Create deployment spec file
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy init --output {{ spec_file }}
- name: Create deployment from spec file
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd deploy create --spec-file {{ spec_file }} --deployment-dir {{data_directory}}/{{ mainnet_deployment_dir }}
- name: Create config.env
copy:
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/config.env"
content: |
CERC_MONIKER: "{{ cerc_moniker }}"
CERC_CHAIN_ID: "{{ cerc_chain_id }}"
MIN_GAS_PRICE: "{{ min_gas_price }}"
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
mode: '0777'
- name: Ensure tmp directory exists inside laconicd-data
file:
path: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp"
path: "{{create_validator_dir}}/tmp"
state: directory
mode: '0755'
- name: Copy staking amount file to laconicd-data tmp directory
copy:
src: "{{ staking_amount_file }}"
dest: "{{data_directory}}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/staking-amount.json"
dest: "{{create_validator_dir}}/tmp/staking-amount.json"
mode: '0644'
- name: Prompt for validator private key
@ -77,28 +47,10 @@
msg: "Private key is required for creating the gentx."
when: private_key_input.user_input | default('') | trim == ''
- name: Import private key in laconicd
shell: |
docker run -i \
-v {{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
--network=host \
cerc/laconicd:local \
laconicd keys import-hex {{ key_name }} {{ private_key_input.user_input }} --keyring-backend test \
- name: Get the key information
shell: |
docker run -i \
-v {{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
--network=host \
cerc/laconicd:local \
laconicd keys show {{ key_name }} --keyring-backend test
register: key_info
- name: Run create-validator script
shell: |
docker run -i \
-v {{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data:/root/.laconicd \
-v {{ data_directory }}/{{ mainnet_deployment_dir }}/data/laconicd-data/tmp/staking-amount.json:/scripts/staking-amount.json \
-v {{create_validator_dir}}:/root/create-validator \
-v ~/cerc/laconicd-stack/stack-orchestrator/config/mainnet-laconicd/create-validator.sh:/scripts/create-validator.sh \
-e "KEY_NAME={{ key_name }}" \
-e "NODE_URL={{ node_url }}" \
@ -106,6 +58,7 @@
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
-e "MIN_GAS_PRICE={{ min_gas_price }}" \
-e "VALIDATOR_PUB_KEY={{ validator_pub_key | to_json }}" \
-e "PVT_KEY={{ private_key_input.user_input }}" \
--network=host \
cerc/laconicd:local \
sh -c "/scripts/create-validator.sh"

View File

@ -8,6 +8,7 @@
mainnet_deployment_dir: "{{ lookup('env', 'MAINNET_DEPLOYMENT_DIR') }}"
spec_file: "{{data_directory}}/laconicd-validator-spec.yml"
spec_template: "./templates/specs/spec-template.yml.j2"
build_args: "{{ '--force-rebuild' if (lookup('env', 'FORCE_REBUILD') | default(omit, true)) not in [ 'false', 'False', '0' ] else '' }}"
tasks:
- name: Fail if DATA_DIRECTORY or MAINNET_DEPLOYMENT_DIR env vars are not set
fail:
@ -23,9 +24,6 @@
Please set genesis_file and staking_amount_file in validator-vars.yml.
when: not genesis_file or not staking_amount_file
- name: Fetch laconicd stack
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
- name: Setup required repositories
shell: >
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd
@ -33,7 +31,7 @@
- name: Build container images
shell: |
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers --force-rebuild
laconic-so --stack ~/cerc/laconicd-stack/stack-orchestrator/stacks/mainnet-laconicd build-containers {{ build_args }}
- name: Create deployment spec file
shell: |

View File

@ -3,6 +3,7 @@
set -e
NODE_HOME=/root/.laconicd
GENTX_DIR=/root/generate-gentx-genesis
genesis_file_path=$NODE_HOME/config/genesis.json
KEYRING="test"
@ -26,13 +27,13 @@ if [ -z "$VALIDATOR_PUB_KEY" ]; then
exit 1
fi
input_genesis_file=$NODE_HOME/tmp/genesis.json
input_genesis_file=$GENTX_DIR/tmp/genesis.json
if [ ! -f ${input_genesis_file} ]; then
echo "Genesis file not provided, exiting..."
exit 1
fi
staking_amount_file="$NODE_HOME/tmp/staking-amount.json"
staking_amount_file="$GENTX_DIR/tmp/staking-amount.json"
if [ ! -f "$staking_amount_file" ]; then
echo "staking-amount.json file not provided, exiting..."
exit 1
@ -79,5 +80,4 @@ laconicd genesis validate
chmod 777 $genesis_file_path
# Clear tmp directory
rm -rf $NODE_HOME/tmp
cp $genesis_file_path $GENTX_DIR/output

View File

@ -3,10 +3,10 @@ set -e
DENOM=alnt
NODE_HOME=/root/.laconicd
CREATE_VALIDATOR_DIR=/root/create-validator
KEYRING="test"
staking_amount_file="$NODE_HOME/tmp/staking-amount.json"
staking_amount_file="$CREATE_VALIDATOR_DIR/tmp/staking-amount.json"
if [ ! -f "$staking_amount_file" ]; then
echo "staking-amount.json file not provided, exiting..."
exit 1
@ -32,11 +32,18 @@ if [ -z "$VALIDATOR_PUB_KEY" ]; then
exit 1
fi
if [ -z "$PVT_KEY" ]; then
echo "PVT_KEY environment variable not set, exiting..."
exit 1
fi
laconicd keys import-hex "$KEY_NAME" "$PVT_KEY" --keyring-backend test
# Set staking amount
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
# Create validator.json file
validator_json="$NODE_HOME/tmp/validator.json"
validator_json="$CREATE_VALIDATOR_DIR/tmp/validator.json"
cat > "$validator_json" << EOF
{
"pubkey": $VALIDATOR_PUB_KEY,