#!/bin/bash set -e DENOM=alnt CREATE_VALIDATOR_DIR=/root/create-validator KEYRING="test" 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 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 if [ -z "$NODE_URL" ]; then echo "NODE_URL environment variable not set, exiting..." exit 1 fi if [ -z "$VALIDATOR_PUB_KEY" ]; then echo "VALIDATOR_PUB_KEY environment variable not set, exiting..." 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="$CREATE_VALIDATOR_DIR/tmp/validator.json" cat > "$validator_json" << EOF { "pubkey": $VALIDATOR_PUB_KEY, "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 \ --node $NODE_URL \ --yes