2024-07-08 05:27:30 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# Exit on error
|
|
|
|
set -e
|
2024-07-23 12:26:14 +00:00
|
|
|
set -u
|
2024-07-08 05:27:30 +00:00
|
|
|
|
2024-07-23 12:26:14 +00:00
|
|
|
# Note: Needs to be run in a docker container with image cerc/laconicd:local
|
2024-07-08 05:27:30 +00:00
|
|
|
|
2024-10-09 12:02:25 +00:00
|
|
|
CHAINID=${CHAINID:-"laconic_9000-1"}
|
|
|
|
STAGE1_MONIKER=${MONIKER:-"localtestnet-stage-1"}
|
2024-07-08 05:27:30 +00:00
|
|
|
NODE_HOME="/root/.laconicd"
|
|
|
|
|
2024-08-16 14:52:08 +00:00
|
|
|
stage1_participants_file="$NODE_HOME/stage1-participants.json"
|
2024-07-08 05:27:30 +00:00
|
|
|
stage1_allocations_file="$NODE_HOME/stage1-allocations.json"
|
|
|
|
stage1_genesis_file="$NODE_HOME/config/genesis.json"
|
|
|
|
|
2024-07-30 11:53:03 +00:00
|
|
|
laconicd init $STAGE1_MONIKER --chain-id $CHAINID --default-denom alnt
|
2024-07-08 05:27:30 +00:00
|
|
|
|
2024-08-16 14:52:08 +00:00
|
|
|
# Update onboarding module state with participants
|
2024-08-19 09:57:54 +00:00
|
|
|
jq --argfile p "$stage1_participants_file" '.app_state.onboarding.participants = $p' "$stage1_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage1_genesis_file"
|
2024-07-08 05:27:30 +00:00
|
|
|
|
2024-07-11 13:49:27 +00:00
|
|
|
# Disable bank module transfers
|
2024-08-19 09:57:54 +00:00
|
|
|
# jq '.app_state["bank"]["params"]["default_send_enabled"]=false' "$stage1_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage1_genesis_file"
|
|
|
|
|
|
|
|
# Update staking module params
|
|
|
|
jq '.app_state["staking"]["params"]["max_validators"]=100' "$stage1_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage1_genesis_file"
|
|
|
|
|
|
|
|
# Update slashing module params
|
|
|
|
jq '.app_state["slashing"]["params"]["signed_blocks_window"]="2400"' "$stage1_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage1_genesis_file"
|
|
|
|
jq '.app_state["slashing"]["params"]["min_signed_per_window"]="0.5"' "$stage1_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage1_genesis_file"
|
2024-07-11 13:49:27 +00:00
|
|
|
|
2024-07-08 05:27:30 +00:00
|
|
|
# Read and assign allocations
|
2024-08-19 09:57:54 +00:00
|
|
|
echo "Adding genesis accounts with allocations..."
|
2024-07-08 05:27:30 +00:00
|
|
|
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
|
2024-07-30 11:53:03 +00:00
|
|
|
laconicd genesis add-genesis-account $cosmos_address ${balance}alnt
|
2024-07-08 05:27:30 +00:00
|
|
|
done
|
|
|
|
|
|
|
|
# Ensure that resulting genesis file is valid
|
|
|
|
laconicd genesis validate
|