33 lines
1.1 KiB
Bash
33 lines
1.1 KiB
Bash
|
#!/bin/bash
|
||
|
|
||
|
# Exit on error
|
||
|
set -e
|
||
|
|
||
|
# Note: Needs to be run in a docker container with image cerc/laconic2d:local
|
||
|
|
||
|
CHAINID="laconic_9000-1"
|
||
|
STAGE1_MONIKER=localtestnet-stage-1
|
||
|
NODE_HOME="/root/.laconicd"
|
||
|
|
||
|
onboarding_state_file="$NODE_HOME/stage0-onboarding-state.json"
|
||
|
stage1_allocations_file="$NODE_HOME/stage1-allocations.json"
|
||
|
stage1_genesis_file="$NODE_HOME/config/genesis.json"
|
||
|
|
||
|
laconicd init $STAGE1_MONIKER --chain-id $CHAINID --default-denom photon
|
||
|
|
||
|
# Update onboarding module state with participants from stage0
|
||
|
participants=$(jq -c '.participants' $onboarding_state_file)
|
||
|
jq --argjson p "$participants" '.app_state.onboarding.participants = $p' "$stage1_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage1_genesis_file"
|
||
|
|
||
|
# Read and assign allocations
|
||
|
jq -c '.[]' "$stage1_allocations_file" | while IFS= read -r line; do
|
||
|
cosmos_address=$(jq -r '.cosmos_address' <<< "$line")
|
||
|
balance=$(jq -r '.balance' <<< "$line")
|
||
|
|
||
|
# Add a genesis account for participant's laconic address with required balance
|
||
|
laconicd genesis add-genesis-account $cosmos_address ${balance}photon
|
||
|
done
|
||
|
|
||
|
# Ensure that resulting genesis file is valid
|
||
|
laconicd genesis validate
|