Skip to content

Commit

Permalink
use segwit address as default validator address
Browse files Browse the repository at this point in the history
  • Loading branch information
liangping committed Apr 28, 2024
1 parent d2830ec commit b0af076
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions local_node.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,18 @@

KEYS=("dev0" "dev1" "dev2")
CHAINID="taproot-1"
MONIKER="freebird"
MONIKER="Side Labs"
BINARY="$HOME/go/bin/sided"
DENOM_STR="uside,uatom,ubtc.ueth,uusdc,uusdt"
DENOM_STR="uside,uatom,ubtc,ueth,uusdc,uusdt"
# DENOMS=$(echo $DENOM_STR | tr "," "\n")
DENOMS=(${DENOM_STR//,/ })
# DENOMS=(${DENOM_STR//,/ })

set -f
IFS=,
DENOMS=($DENOM_STR)

IFS=";"


INITIAL_SUPPLY="100000000000000000000"
BLOCK_GAS=10000000
Expand All @@ -16,7 +23,8 @@ MAX_GAS=10000000000
# otherwise your balance will be wiped quickly
# The keyring test does not require private key to steal tokens from you
KEYRING="test"
KEYALGO="secp256k1"
#KEYALGO="secp256k1"
KEYALGO="segwit"
LOGLEVEL="info"
# Set dedicated home directory for the $BINARY instance
HOMEDIR="$HOME/.side"
Expand Down Expand Up @@ -88,21 +96,13 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then
# Allocate genesis accounts (cosmos formatted addresses)
for KEY in "${KEYS[@]}"; do
BALANCES=""
for DENOM in $DENOMS; do
BALANCES+=",${INITIAL_SUPPLY}$DENOM"
for key in "${!DENOMS[@]}"; do
BALANCES+=",${INITIAL_SUPPLY}${DENOMS[$key]}"
done
# echo $BALANCES
echo ${BALANCES:1}
$BINARY add-genesis-account "$KEY" ${BALANCES:1} --keyring-backend $KEYRING --home "$HOMEDIR"
done

# Adjust total supply
for DENOM in $DENOMS; do
total_supply=$(echo "${#KEYS[@]} * $INITIAL_SUPPLY" | bc)
if ! jq -e --arg denom "$DENOM" '.app_state["bank"]["supply"] | any(.denom == $denom)' "$GENESIS" >/dev/null; then
jq -r --arg total_supply "$total_supply" --arg denom "$DENOM" '.app_state["bank"]["supply"] += [{"denom": $denom, "amount": $total_supply}]' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
fi
done

# Sign genesis transaction
echo $INITIAL_SUPPLY${DENOMS[0]}
$BINARY gentx "${KEYS[0]}" $INITIAL_SUPPLY${DENOMS[0]} --keyring-backend $KEYRING --chain-id $CHAINID --home "$HOMEDIR"
Expand Down

0 comments on commit b0af076

Please sign in to comment.