Add scripts to initialize stage2 testnet #16
@ -1,19 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Exit on error
|
|
||||||
set -e
|
|
||||||
set -u
|
|
||||||
|
|
||||||
# Run in docker container with mounted stage1 data
|
|
||||||
|
|
||||||
NODE_HOME="$HOME/.laconicd"
|
|
||||||
stage1_state="$NODE_HOME/stage1-state.json"
|
|
||||||
|
|
||||||
# Export state
|
|
||||||
laconicd export | jq > $stage1_state
|
|
||||||
|
|
||||||
# Remove data but keep keys
|
|
||||||
laconicd cometbft unsafe-reset-all
|
|
||||||
|
|
||||||
rm -r $NODE_HOME/config/gentx
|
|
||||||
rm $NODE_HOME/config/genesis.json
|
|
@ -45,13 +45,19 @@ remove_module_accounts () {
|
|||||||
jq --arg NEW_SUPPLY "$new_supply" '(.app_state.bank.supply[] | select(.denom == "alnt") | .amount) |= $NEW_SUPPLY' $stage2_genesis_file > tmp.$$.json && mv tmp.$$.json $stage2_genesis_file
|
jq --arg NEW_SUPPLY "$new_supply" '(.app_state.bank.supply[] | select(.denom == "alnt") | .amount) |= $NEW_SUPPLY' $stage2_genesis_file > tmp.$$.json && mv tmp.$$.json $stage2_genesis_file
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Remove existing data but keep keys
|
||||||
|
laconicd cometbft unsafe-reset-all
|
||||||
|
|
||||||
|
# Remove existing genesis file and gentxs
|
||||||
|
rm -r $NODE_HOME/config/gentx || true
|
||||||
|
rm $stage2_genesis_file || true
|
||||||
|
|
||||||
# Initialize node with given chain id and moniker
|
# Initialize node with given chain id and moniker
|
||||||
laconicd config set client chain-id $CHAINID
|
laconicd config set client chain-id $CHAINID
|
||||||
laconicd init $STAGE2_MONIKER --chain-id $CHAINID --default-denom alnt
|
laconicd init $STAGE2_MONIKER --chain-id $CHAINID --default-denom alnt
|
||||||
|
|
||||||
# Import required module state
|
# Import required module state
|
||||||
jq --slurpfile nested $stage1_state '.app_state.auth = $nested[0].app_state.auth' "$stage2_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage2_genesis_file"
|
jq --slurpfile nested $stage1_state '.app_state.auth = $nested[0].app_state.auth' "$stage2_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage2_genesis_file"
|
||||||
jq --slurpfile nested $stage1_state '.app_state.auction = $nested[0].app_state.auction' "$stage2_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage2_genesis_file"
|
|
||||||
jq --slurpfile nested $stage1_state '.app_state.bank = $nested[0].app_state.bank' "$stage2_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage2_genesis_file"
|
jq --slurpfile nested $stage1_state '.app_state.bank = $nested[0].app_state.bank' "$stage2_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage2_genesis_file"
|
||||||
jq --slurpfile nested $stage1_state '.app_state.bond = $nested[0].app_state.bond' "$stage2_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage2_genesis_file"
|
jq --slurpfile nested $stage1_state '.app_state.bond = $nested[0].app_state.bond' "$stage2_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage2_genesis_file"
|
||||||
jq --slurpfile nested $stage1_state '.app_state.onboarding = $nested[0].app_state.onboarding' "$stage2_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage2_genesis_file"
|
jq --slurpfile nested $stage1_state '.app_state.onboarding = $nested[0].app_state.onboarding' "$stage2_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage2_genesis_file"
|
||||||
|
@ -3,25 +3,23 @@
|
|||||||
# Exit on error
|
# Exit on error
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# Prerequisite: stage1 exported state present at $STAGE2_DEPLOYMENT/data/laconicd-data/stage1-state.json
|
||||||
|
|
||||||
# Check args
|
# Check args
|
||||||
if [ "$#" -lt 2 ]; then
|
if [ "$#" -lt 2 ]; then
|
||||||
echo "Usage: $0 <stage2-deployment-dir> <stage2-chain-id> [node-staking-amount]"
|
echo "Usage: $0 <stage2-deployment-dir> <stage2-chain-id> <node-moniker> <node-keyring-backend> [node-staking-amount]"
|
||||||
echo "Example: $0 /srv/stage2-deployment laconic_9000-2 1000000000000000"
|
echo "Example: $0 /srv/stage2-deployment laconic_9000-2 LaconicStage2 os 1000000000000000"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
STAGE2_DEPLOYMENT=$1
|
STAGE2_DEPLOYMENT=$1
|
||||||
CHAINID=$2
|
CHAINID=$2
|
||||||
STAKING_AMOUNT=$3
|
MONIKER=$3
|
||||||
|
KEYRING=$4
|
||||||
# Export state from current data
|
STAKING_AMOUNT=$5
|
||||||
docker run -it \
|
|
||||||
-v $STAGE2_DEPLOYMENT/data/laconicd-data:/root/.laconicd \
|
|
||||||
-v ./scripts:/scripts \
|
|
||||||
cerc/laconicd-stage1:local bash -c "/scripts/export-state.sh"
|
|
||||||
|
|
||||||
# Generate genesis file for state2 chain and init node
|
# Generate genesis file for state2 chain and init node
|
||||||
docker run -it \
|
docker run -it \
|
||||||
-v $STAGE2_DEPLOYMENT/data/laconicd-data:/root/.laconicd \
|
-v $STAGE2_DEPLOYMENT/data/laconicd-data:/root/.laconicd \
|
||||||
-v ./scripts:/scripts \
|
-v ./scripts:/scripts \
|
||||||
cerc/laconicd:local bash -c "CHAINID=$CHAINID MONIKER=LaconicStage2 STAKING_AMOUNT=$STAKING_AMOUNT /scripts/generate-stage2-genesis.sh"
|
cerc/laconicd:local bash -c "CHAINID=$CHAINID MONIKER=$MONIKER KEYRING=$KEYRING STAKING_AMOUNT=$STAKING_AMOUNT /scripts/generate-stage2-genesis.sh"
|
||||||
|
Loading…
Reference in New Issue
Block a user