Add README instructions to run first validator node
This commit is contained in:
parent
2a05149a8a
commit
71d58c7c2c
@ -1 +1,3 @@
|
||||
# laconicd-stack
|
||||
|
||||
- Follow [run-first-validator.md](run-first-validator.md) to run the first validator node
|
||||
|
0
genesis/.gitkeep
Normal file
0
genesis/.gitkeep
Normal file
4
node-addresses.yml
Normal file
4
node-addresses.yml
Normal file
@ -0,0 +1,4 @@
|
||||
# Add your node addresses here
|
||||
# Example:
|
||||
# - node-1-id@node-1-host:26656
|
||||
# - node-2-id@node-2-host:26656
|
42
playbooks/README.md
Normal file
42
playbooks/README.md
Normal file
@ -0,0 +1,42 @@
|
||||
# Ansible Installation
|
||||
|
||||
- Install [Ansible](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-and-upgrading-ansible-with-pip)
|
||||
|
||||
- Add location of the directory containing the ansible binary to your `PATH`
|
||||
|
||||
- Set Locale Encoding to `UTF-8`
|
||||
|
||||
Ansible requires the locale encoding to be `UTF-8`. You can either use the `LANG` prefix when running Ansible commands or set the system-wide locale
|
||||
|
||||
- Option 1: Use `LANG` Prefix in Commands
|
||||
|
||||
If you prefer not to change the system-wide locale, you can use the `LANG` prefix when running Ansible commands:
|
||||
|
||||
```bash
|
||||
LANG=en_US.UTF-8 ansible-playbook your_playbook.yml
|
||||
```
|
||||
|
||||
- Option 2: Set System-Wide Locale
|
||||
|
||||
- Edit the `/etc/default/locale` file:
|
||||
|
||||
```bash
|
||||
sudo nano /etc/default/locale
|
||||
```
|
||||
|
||||
- Set the `LANG` variable to en_US.UTF-8:
|
||||
|
||||
```bash
|
||||
LANG="en_US.UTF-8"
|
||||
```
|
||||
|
||||
- Reboot your system or log out and log back in to apply the changes
|
||||
|
||||
- Reference: <https://udhayakumarc.medium.com/error-ansible-requires-the-locale-encoding-to-be-utf-8-detected-iso8859-1-6da808387f7d>
|
||||
|
||||
- Verify ansible installation by running the following command:
|
||||
|
||||
```bash
|
||||
ansible --version
|
||||
# ansible [core 2.17.2]
|
||||
```
|
@ -1,13 +1,7 @@
|
||||
cerc_moniker: "TestnetNode"
|
||||
cerc_chain_id: "laconic_9000-1"
|
||||
cerc_peers:
|
||||
cerc_moniker: "MainnetNode"
|
||||
cerc_chain_id: "laconic-mainnet"
|
||||
min_gas_price: 0.001
|
||||
cerc_loglevel: "info"
|
||||
# Token denomination (alnt or alps)
|
||||
denom: "alnt"
|
||||
# Validator key name
|
||||
key_name: "validator"
|
||||
# Private key in hex format (required for gentx)
|
||||
pvt_key: ""
|
||||
# Required files
|
||||
genesis_file:
|
||||
|
@ -52,10 +52,8 @@
|
||||
content: |
|
||||
CERC_MONIKER: "{{ cerc_moniker }}"
|
||||
CERC_CHAIN_ID: "{{ cerc_chain_id }}"
|
||||
CERC_PEERS: "{{ cerc_peers}}"
|
||||
MIN_GAS_PRICE: "{{ min_gas_price }}"
|
||||
CERC_LOGLEVEL: "{{ cerc_loglevel }}"
|
||||
DENOM: "{{ denom }}"
|
||||
KEY_NAME: "{{ key_name }}"
|
||||
mode: '0777'
|
||||
|
||||
@ -85,7 +83,6 @@
|
||||
-v {{data_directory}}/{{ mainnet_deployment_dir }}/config/mainnet-laconicd:/scripts \
|
||||
-e "PVT_KEY={{ pvt_key }}" \
|
||||
-e "KEY_NAME={{ key_name }}" \
|
||||
-e "DENOM={{ denom }}" \
|
||||
-e "CERC_MONIKER={{ cerc_moniker }}" \
|
||||
-e "CERC_CHAIN_ID={{ cerc_chain_id }}" \
|
||||
cerc/laconicd:local bash -c "/scripts/create-and-collect-gentx.sh"
|
||||
|
72
run-first-validator.md
Normal file
72
run-first-validator.md
Normal file
@ -0,0 +1,72 @@
|
||||
# Run First Validator Node
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- [ansible](playbooks/README.md#ansible-installation)
|
||||
- [laconic-so](https://github.com/cerc-io/stack-orchestrator/?tab=readme-ov-file#install)
|
||||
|
||||
## Generate mainnet genesis file
|
||||
|
||||
<!-- TODO: Add steps to generate genesis file -->
|
||||
|
||||
## Run node
|
||||
|
||||
- Update [run-first-validator-vars.yml](playbooks/first-validator/run-first-validator-vars.yml) with required values:
|
||||
|
||||
- Use the mainnet genesis file generated in the previous step
|
||||
|
||||
```bash
|
||||
# Private key of the existing account in hex format (required for gentx)
|
||||
pvt_key: ""
|
||||
|
||||
# Path to the generated mainnet genesis file
|
||||
genesis_file: "<path-to-generated-genesis-file>"
|
||||
|
||||
# Optional
|
||||
cerc_chain_id: "laconic-mainnet"
|
||||
cerc_moniker: "MainnetNode"
|
||||
min_gas_price: 0.001
|
||||
cerc_loglevel: "info"
|
||||
key_name: "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 the gentx and run the node:
|
||||
|
||||
```bash
|
||||
ansible-playbook -i localhost, -c local playbooks/first-validator/run-first-validator.yml
|
||||
```
|
||||
|
||||
- Check logs to ensure that node is running:
|
||||
|
||||
```bash
|
||||
laconic-so deployment --dir $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR logs laconicd -f
|
||||
```
|
||||
|
||||
## Publish Genesis File and Node Address
|
||||
|
||||
- Copy the genesis file to [genesis](./genesis) folder:
|
||||
|
||||
```bash
|
||||
sudo cp $DATA_DIRECTORY/$MAINNET_DEPLOYMENT_DIR/data/laconicd-data/config/genesis.json ./genesis/mainnet-genesis.json
|
||||
```
|
||||
|
||||
- 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 [node-addresses.yml](./node-addresses.yml)
|
||||
|
||||
- Submit a PR with this genesis file and node address so that it is available to other validators
|
@ -4,8 +4,8 @@ services:
|
||||
image: cerc/laconicd:local
|
||||
command: ["bash", "-c", "/opt/run-laconicd.sh"]
|
||||
environment:
|
||||
CERC_MONIKER: ${CERC_MONIKER:-TestnetNode}
|
||||
CERC_CHAIN_ID: ${CERC_CHAIN_ID:-laconic_9000-1}
|
||||
CERC_MONIKER: ${CERC_MONIKER:-MainnetNode}
|
||||
CERC_CHAIN_ID: ${CERC_CHAIN_ID:-laconic-mainnet}
|
||||
CERC_PEERS: ${CERC_PEERS}
|
||||
MIN_GAS_PRICE: ${MIN_GAS_PRICE:-0.001}
|
||||
CERC_LOGLEVEL: ${CERC_LOGLEVEL:-info}
|
||||
|
@ -21,21 +21,17 @@ if [ -z "$KEY_NAME" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$DENOM" ]; then
|
||||
echo "DENOM environment variable not set, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
input_genesis_file=$NODE_HOME/tmp/genesis.json
|
||||
if [ ! -f ${input_genesis_file} ]; then
|
||||
echo "Genesis file not provided, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
DENOM=alnt
|
||||
|
||||
# Strip leading and trailing quotes ("") if they exist
|
||||
export MONIKER=$(echo "$CERC_MONIKER" | sed -e 's/^["'\'']//g' -e 's/["'\'']$//g')
|
||||
export CHAIN_ID=$(echo "$CERC_CHAIN_ID" | sed -e 's/^["'\'']//g' -e 's/["'\'']$//g')
|
||||
export DENOM=$(echo "$DENOM" | sed -e 's/^["'\'']//g' -e 's/["'\'']$//g')
|
||||
|
||||
# Init
|
||||
laconicd config set client chain-id $CHAIN_ID --home $NODE_HOME
|
||||
@ -45,9 +41,10 @@ laconicd init $MONIKER --chain-id=$CHAIN_ID --home $NODE_HOME
|
||||
# Copy over provided genesis config
|
||||
cp $input_genesis_file $genesis_file_path
|
||||
|
||||
# Import private key passed via PVT_KEY
|
||||
# Import private key
|
||||
laconicd keys import-hex "$KEY_NAME" "$PVT_KEY" --keyring-backend $KEYRING
|
||||
|
||||
# Get account address corresponding to the imported key
|
||||
account_address=$(laconicd keys show "$KEY_NAME" --keyring-backend "$KEYRING" | grep 'address:' | awk -F': ' '{print $2}' | xargs)
|
||||
|
||||
if [ -z "$account_address" ]; then
|
||||
@ -56,6 +53,7 @@ if [ -z "$account_address" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Get balance of account
|
||||
stake_amount=$(jq -r --arg address "$account_address" --arg denom "$DENOM" '.app_state.bank.balances[] | select(.address == $address) | .coins[] | select(.denom == $denom) | .amount' $genesis_file_path)
|
||||
|
||||
# Create gentx with staked amount equal to allocated balance
|
||||
|
Loading…
Reference in New Issue
Block a user