Add playbook to send create-validator tx for subsequent nodes (#3)
Part of https://www.notion.so/Create-stacks-for-mainnet-1f2a6b22d4728034be4be2c51decf94e of cerc-io/laconicd#66 - Use calculated staking amount for running validator nodes Co-authored-by: Shreerang Kale <shreerangkale@gmail.com> Co-authored-by: Nabarun <nabarun@deepstacksoft.com> Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com> Reviewed-on: #3 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 #3.
This commit is contained in:
@@ -12,6 +12,7 @@ services:
|
||||
volumes:
|
||||
- laconicd-data:/root/.laconicd
|
||||
- ../config/mainnet-laconicd/run-laconicd.sh:/opt/run-laconicd.sh
|
||||
- ../config/mainnet-laconicd/create-validator.sh:/scripts/create-validator.sh
|
||||
ports:
|
||||
- "6060"
|
||||
- "26657"
|
||||
|
||||
@@ -4,6 +4,7 @@ set -e
|
||||
|
||||
NODE_HOME=/root/.laconicd
|
||||
genesis_file_path=$NODE_HOME/config/genesis.json
|
||||
# TODO: Set to OS keyring backend
|
||||
KEYRING="test"
|
||||
|
||||
if [ -f "$genesis_file_path" ]; then
|
||||
@@ -27,6 +28,12 @@ if [ ! -f ${input_genesis_file} ]; then
|
||||
exit 1
|
||||
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
|
||||
|
||||
# Strip leading and trailing quotes ("") if they exist
|
||||
@@ -53,8 +60,8 @@ if [ -z "$account_address" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# TODO: Use staking amount from output/staking-amount.json
|
||||
stake_amount=900000000
|
||||
# Set staking amount
|
||||
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
||||
|
||||
# Create gentx with staked amount equal to allocated balance
|
||||
laconicd genesis gentx $KEY_NAME $stake_amount$DENOM --chain-id $CHAIN_ID --keyring-backend $KEYRING
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
DENOM=alnt
|
||||
|
||||
NODE_HOME=/root/.laconicd
|
||||
KEYRING="test"
|
||||
|
||||
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
|
||||
|
||||
if [-z "$KEY_NAME" ]; then
|
||||
echo "KEY_NAME environment variable not set, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -z "$CERC_MONIKER" ]; then
|
||||
echo "CERC_MONIKER environment variable not set, exiting..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set staking amount
|
||||
stake_amount=$(jq -r '.common_staking_amount' "$staking_amount_file")
|
||||
|
||||
# Create validator.json file
|
||||
validator_json="$NODE_HOME/tmp/validator.json"
|
||||
cat > "$validator_json" << EOF
|
||||
{
|
||||
"pubkey": $(laconicd tendermint show-validator),
|
||||
"amount": "${stake_amount}${DENOM}",
|
||||
"moniker": "${CERC_MONIKER}",
|
||||
"commission-rate": "0.0",
|
||||
"commission-max-rate": "0.0",
|
||||
"commission-max-change-rate": "0.0",
|
||||
"min-self-delegation": "1"
|
||||
}
|
||||
EOF
|
||||
|
||||
# Create validator using the JSON file
|
||||
laconicd tx staking create-validator "$validator_json" \
|
||||
--chain-id "$CERC_CHAIN_ID" \
|
||||
--gas auto \
|
||||
--gas-adjustment 1.5 \
|
||||
--gas-prices $MIN_GAS_PRICE$DENOM \
|
||||
--from $KEY_NAME \
|
||||
--keyring-backend $KEYRING \
|
||||
--yes
|
||||
@@ -53,7 +53,6 @@ else
|
||||
sed -i 's/prometheus = false/prometheus = true/g' $NODE_HOME/config/config.toml
|
||||
fi
|
||||
|
||||
|
||||
echo "Starting laconicd node..."
|
||||
laconicd start \
|
||||
--api.enable \
|
||||
|
||||
Reference in New Issue
Block a user