From e5380ecaaf133fcb605ff048fabeca105711cd6e Mon Sep 17 00:00:00 2001 From: Jay Jie Date: Wed, 3 Jan 2024 16:46:19 -0800 Subject: [PATCH] chore: refine local_setup.sh --- scripts/local_setup.sh | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/scripts/local_setup.sh b/scripts/local_setup.sh index fb122fdf..a1fc79cb 100755 --- a/scripts/local_setup.sh +++ b/scripts/local_setup.sh @@ -2,16 +2,33 @@ set -e set -x +BIN=./build/seda-chaind +CONFIG_PATH=$HOME/.seda-chain/config + +function add_key_and_account() { + local name=$1 + local amount=$2 + $BIN keys add $name --keyring-backend test + $BIN add-genesis-account $name $amount --keyring-backend test +} + # # Local Single-node Setup # # NOTE: Run this script from project root. # + +# build the binary make build -BIN=./build/seda-chaind +# reset the chain $BIN tendermint unsafe-reset-all -rm -rf ~/.seda-chain +rm -rf ~/.seda-chain || true + +# configure seda-chaind +$BIN config set client chain-id sedachain + +# initialize the chain $BIN init new node0 cat $HOME/.seda-chain/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="30s"' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json @@ -20,14 +37,15 @@ cat $HOME/.seda-chain/config/genesis.json | jq '.app_state["gov"]["params"]["exp cat $HOME/.seda-chain/config/genesis.json | jq '.consensus["params"]["validator"]["pub_key_types"]=["secp256k1"]' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json cat $HOME/.seda-chain/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="100000000"' > $HOME/.seda-chain/config/tmp_genesis.json && mv $HOME/.seda-chain/config/tmp_genesis.json $HOME/.seda-chain/config/genesis.json -$BIN keys add satoshi --keyring-backend test -ADDR=$($BIN keys show satoshi --keyring-backend test -a) -$BIN add-genesis-account $ADDR 100000000000000000seda --keyring-backend test -$BIN gentx satoshi 10000000000000000seda --keyring-backend test --chain-id sedachain +# update genesis +add_key_and_account "satoshi" "100000000000000000seda" +add_key_and_account "acc1" "100000000000000000seda" -$BIN keys add acc1 --keyring-backend test -ADDR=$($BIN keys show acc1 --keyring-backend test -a) -$BIN add-genesis-account $ADDR 100000000000000000seda --keyring-backend test +# create a default validator +$BIN gentx satoshi 10000000000000000seda --keyring-backend test +# collect genesis txns $BIN collect-gentxs -$BIN start --log_level debug + +# start the chain +$BIN start --log_level debug || echo "Failed to start the chain" \ No newline at end of file