Skip to content

Commit

Permalink
chore: refine local_setup.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jim380 committed Jan 4, 2024
1 parent aecd1fb commit e5380ec
Showing 1 changed file with 28 additions and 10 deletions.
38 changes: 28 additions & 10 deletions scripts/local_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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"

0 comments on commit e5380ec

Please sign in to comment.