fixturenet-laconicd-stack/stack-orchestrator/stacks/fixturenet-laconicd/scripts/genesis.sh
Prathamesh Musale 78fcfff36a Add config for laconicd chain ID (#15)
Part of [Service provider auctions for web deployments](https://www.notion.so/Service-provider-auctions-for-web-deployments-104a6b22d47280dbad51d28aa3a91d75)

Co-authored-by: Nabarun <nabarun@deepstacksoft.com>
Reviewed-on: #15
Co-authored-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
Co-committed-by: Prathamesh Musale <prathamesh.musale0@gmail.com>
2024-10-09 12:02:25 +00:00

44 lines
1.8 KiB
Bash
Executable File

#!/bin/bash
# Exit on error
set -e
set -u
# Note: Needs to be run in a docker container with image cerc/laconicd:local
CHAINID=${CHAINID:-"laconic_9000-1"}
STAGE1_MONIKER=${MONIKER:-"localtestnet-stage-1"}
NODE_HOME="/root/.laconicd"
stage1_participants_file="$NODE_HOME/stage1-participants.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 alnt
# Update onboarding module state with participants
jq --argfile p "$stage1_participants_file" '.app_state.onboarding.participants = $p' "$stage1_genesis_file" > tmp.$$.json && mv tmp.$$.json "$stage1_genesis_file"
# Disable bank module transfers
# 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"
# Read and assign allocations
echo "Adding genesis accounts with 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}alnt
done
# Ensure that resulting genesis file is valid
laconicd genesis validate