Use calculated staking amount for running first val node
This commit is contained in:
parent
8240145227
commit
619cd4bb74
33
demo.md
33
demo.md
@ -64,12 +64,6 @@
|
|||||||
- '3317:1317'
|
- '3317:1317'
|
||||||
```
|
```
|
||||||
|
|
||||||
- Update permission for `genesis/mainnet-genesis.json`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
sudo chmod 777 ~/cerc/laconicd-stack/genesis/mainnet-genesis.json
|
|
||||||
```
|
|
||||||
|
|
||||||
- Run ansible playbook to set up and start your validator node:
|
- Run ansible playbook to set up and start your validator node:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@ -81,3 +75,30 @@
|
|||||||
```bash
|
```bash
|
||||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
|
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Create Validator
|
||||||
|
|
||||||
|
- Export required env vars:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# private key of the existing account
|
||||||
|
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>
|
||||||
|
```
|
||||||
|
|
||||||
|
- Run ansible playbook to create validator on running chain:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ansible-playbook -i localhost, -c local playbooks/validator/create-validator.yml
|
||||||
|
```
|
||||||
|
|
||||||
|
- Check the validator list:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR exec laconicd 'laconicd query staking validators'
|
||||||
|
```
|
||||||
|
@ -79,14 +79,18 @@
|
|||||||
# Private key of the existing account in hex format (required for gentx)
|
# Private key of the existing account in hex format (required for gentx)
|
||||||
pvt_key: ""
|
pvt_key: ""
|
||||||
|
|
||||||
# Path to the generated mainnet genesis file generated in the previous step
|
# Path to the generated mainnet genesis file
|
||||||
genesis_file: "<path-to-generated-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
|
# Set custom moniker for the node
|
||||||
cerc_moniker: "LaconicMainnetNode"
|
cerc_moniker: "LaconicMainnetNode"
|
||||||
|
|
||||||
# Set desired key name
|
# Set desired key name
|
||||||
key_name: "validator"
|
key_name: "laconic-validator"
|
||||||
```
|
```
|
||||||
|
|
||||||
- Export the data directory and mainnet deployment directory as environment variables:
|
- Export the data directory and mainnet deployment directory as environment variables:
|
@ -5,3 +5,4 @@ cerc_loglevel: "info"
|
|||||||
key_name: "validator"
|
key_name: "validator"
|
||||||
pvt_key: ""
|
pvt_key: ""
|
||||||
genesis_file:
|
genesis_file:
|
||||||
|
staking_amount_file:
|
||||||
|
@ -20,8 +20,9 @@
|
|||||||
fail:
|
fail:
|
||||||
msg: >-
|
msg: >-
|
||||||
Required key files are not defined.
|
Required key files are not defined.
|
||||||
Please set genesis_file in first-validator-vars.yml.
|
Please set genesis_file and staking_amount_file in first-validator-vars.yml.
|
||||||
when: not genesis_file
|
when: not genesis_file or not staking_amount_file
|
||||||
|
|
||||||
- name: Fetch laconicd stack
|
- name: Fetch laconicd stack
|
||||||
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
shell: laconic-so fetch-stack git.vdb.to/cerc-io/laconicd-stack --git-ssh --pull
|
||||||
|
|
||||||
@ -62,6 +63,12 @@
|
|||||||
state: directory
|
state: directory
|
||||||
mode: '0755'
|
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"
|
||||||
|
mode: '0644'
|
||||||
|
|
||||||
- name: Copy genesis file to laconicd-data tmp directory
|
- name: Copy genesis file to laconicd-data tmp directory
|
||||||
copy:
|
copy:
|
||||||
src: "{{ genesis_file }}"
|
src: "{{ genesis_file }}"
|
||||||
|
@ -4,6 +4,7 @@ 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
|
||||||
@ -27,6 +28,12 @@ if [ ! -f ${input_genesis_file} ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
staking_amount_file="$NODE_HOME/tmp/staking-amount.json"
|
||||||
|
if [ ! -f "$staking_amount_file" ]; then
|
||||||
|
echo "staking-amount.json file not provided, exiting..."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
DENOM=alnt
|
DENOM=alnt
|
||||||
|
|
||||||
# Strip leading and trailing quotes ("") if they exist
|
# Strip leading and trailing quotes ("") if they exist
|
||||||
@ -53,8 +60,8 @@ if [ -z "$account_address" ]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# TODO: Use staking amount from output/staking-amount.json
|
# Set staking amount
|
||||||
stake_amount=900000000
|
stake_amount=$(jq -r '.amount' "$staking_amount_file")
|
||||||
|
|
||||||
# Create gentx with staked amount equal to allocated balance
|
# Create gentx with staked amount equal to allocated balance
|
||||||
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID --keyring-backend $KEYRING
|
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID --keyring-backend $KEYRING
|
||||||
|
Loading…
Reference in New Issue
Block a user