Skip to content

Commit

Permalink
add testnode.sh script that allow to run locally chain with a cosmos …
Browse files Browse the repository at this point in the history
…sdk50 (#530)

add testnode.sh file that allow to run locally chain with a cosmos sdk50
  • Loading branch information
RustNinja authored Jun 7, 2024
1 parent 70dbbc1 commit cd88c4a
Showing 1 changed file with 23 additions and 37 deletions.
60 changes: 23 additions & 37 deletions scripts/testnode.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
#!/bin/bash

BINARY=$1
KEY="mykey"
CHAINID="localpica"
CHAINID="centauri-1"
MONIKER="localtestnet"
KEYALGO="secp256k1"
KEYRING="test"
Expand All @@ -11,57 +8,46 @@ LOGLEVEL="info"
#TRACE="--trace"
TRACE=""

HOME_DIR=~/.banksy
DENOM=${2:-ppica}

# validate dependencies are installed
command -v jq > /dev/null 2>&1 || { echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"; exit 1; }

# remove existing daemon
rm -rf ~/.banksy*
rm -rf ~/.banksy

# $BINARY config keyring-backend $KEYRING
# $BINARY config chain-id $CHAINID
picad config keyring-backend $KEYRING
picad config chain-id $CHAINID

# if $KEY exists it should be deleted
echo "decorate bright ozone fork gallery riot bus exhaust worth way bone indoor calm squirrel merry zero scheme cotton until shop any excess stage laundry" | $BINARY keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --recover

$BINARY init $MONIKER --chain-id $CHAINID > /dev/null 2>&1

update_test_genesis () {
# update_test_genesis '.consensus_params["block"]["max_gas"]="100000000"'
cat $HOME_DIR/config/genesis.json | jq "$1" > $HOME_DIR/config/tmp_genesis.json && mv $HOME_DIR/config/tmp_genesis.json $HOME_DIR/config/genesis.json
}

# Allocate genesis accounts (cosmos formatted addresses)
$BINARY genesis add-genesis-account $KEY 100000000000000000000000000ppica --keyring-backend $KEYRING
$BINARY add-genesis-account centauri1hj5fveer5cjtn4wd6wstzugjfdxzl0xpzxlwgs "1000000000000000000000${DENOM}" --keyring-backend $KEYRING --home $HOME_DIR
#echo "taste shoot adapt slow truly grape gift need suggest midnight burger horn whisper hat vast aspect exit scorpion jewel axis great area awful blind" | picad keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --recover
#echo "sense state fringe stool behind explain area quit ugly affair develop thumb clinic weasel choice atom gesture spare sea renew penalty second upon peace" | picad keys add k1 --keyring-backend $KEYRING --algo $KEYALGO --recover
echo "sense state fringe stool behind explain area quit ugly affair develop thumb clinic weasel choice atom gesture spare sea renew penalty second upon peace" | picad keys add $KEY --keyring-backend $KEYRING --algo $KEYALGO --recover

picad init $MONIKER --chain-id $CHAINID --default-denom pica

# Sign genesis transaction
$BINARY gentx $KEY 1000000000000000000000ppica --keyring-backend $KEYRING --chain-id $CHAINID
# Allocate genesis accounts (centauri formatted addresses)
picad add-genesis-account $KEY 10000000000000000000pica,10000000000000000000atom --keyring-backend $KEYRING
#picad add-genesis-account k1 10000000000000000000pica --keyring-backend $KEYRING

update_test_genesis '.app_state["gov"]["params"]["voting_period"]="20s"'
update_test_genesis '.app_state["mint"]["params"]["mint_denom"]="'$DENOM'"'
update_test_genesis '.app_state["gov"]["params"]["min_deposit"]=[{"denom":"'$DENOM'","amount": "0"}]'
update_test_genesis '.app_state["crisis"]["constant_fee"]={"denom":"'$DENOM'","amount":"1000"}'
update_test_genesis '.app_state["staking"]["params"]["bond_denom"]="'$DENOM'"'
# Sign genesis transaction centauri1594tdya20hxz7kjenkn5w09jljyvdfk8kx5rd6
picad gentx $KEY 100000000000000000pica --keyring-backend $KEYRING --chain-id $CHAINID

# Collect genesis tx
$BINARY collect-gentxs
picad collect-gentxs

# Run this to ensure everything worked and that the genesis file is setup correctly
$BINARY validate-genesis
picad validate-genesis

if [[ $1 == "pending" ]]; then
echo "pending mode is on, please wait for the first block committed."
fi

# update request max size so that we can upload the light client
# '' -e is a must have params on mac, if use linux please delete before run
sed -i'' -e 's/max_body_bytes = /max_body_bytes = 1/g' ~/.banksy/config/config.toml
sed -i'' -e 's/max_body_bytes = /max_body_bytes = 1000/g' ~/.banksy/config/config.toml
sed -i'' -e 's/max_tx_bytes = /max_tx_bytes = 1000/g' ~/.banksy/config/config.toml
#sed -i'' -e 's/max-recv-msg-size = /max-recv-msg-size = 1000/g' ~/.banksy/config/app.toml
cat $HOME/.banksy/config/genesis.json | jq '.app_state["gov"]["params"]["voting_period"]="45s"' > $HOME/.banksy/config/tmp_genesis.json && mv $HOME/.banksy/config/tmp_genesis.json $HOME/.banksy/config/genesis.json

# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
<<<<<<< HEAD
$BINARY start --pruning=nothing --minimum-gas-prices=0.0001ppica --rpc.laddr tcp://0.0.0.0:26657
=======
# centaurid start --pruning=nothing --minimum-gas-prices=0.0001ppica --rpc.laddr tcp://0.0.0.0:26657
>>>>>>> develop2
picad start --pruning=nothing --minimum-gas-prices=0pica \
--rpc.laddr tcp://127.0.0.1:36657 --p2p.laddr tcp://0.0.0.0:36656 --api.address tcp://localhost:2317 --rpc.pprof_laddr tcp://127.0.0.1:7060

0 comments on commit cd88c4a

Please sign in to comment.