Skip to content

Commit

Permalink
Merge pull request #1078 from scrtlabs/fix-startup-script
Browse files Browse the repository at this point in the history
Fixed startup script to be a bit friendlier. By default will run ./se…
  • Loading branch information
Cashmaney authored Aug 22, 2022
2 parents 7b06ca0 + d026f8a commit 7b04756
Showing 1 changed file with 17 additions and 20 deletions.
37 changes: 17 additions & 20 deletions scripts/start-node.sh
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,32 @@

set -o errexit

CHAINID=$1
GENACCT=$2
SECRETD=${1:-./secretd}
SECRETD_HOME=${2:-$HOME/.secretd_local}
CHAINID=${3:-secretdev-1}
GENACCT=$4

if [ -z "$1" ]; then
echo "Need to input chain id..."
exit 1
fi

rm -rf ~/.secretd
rm -rf $SECRETD_HOME

# Build genesis file incl account for passed address
coins="10000000000uscrt,100000000000stake"
secretd init --chain-id $CHAINID $CHAINID
secretd keys add validator --keyring-backend="test"
secretd add-genesis-account $(secretd keys show validator -a --keyring-backend="test") $coins
$SECRETD init --chain-id $CHAINID $CHAINID --home $SECRETD_HOME
$SECRETD keys add validator --keyring-backend="test" --home $SECRETD_HOME
$SECRETD add-genesis-account $($SECRETD keys show validator -a --keyring-backend="test" --home $SECRETD_HOME) $coins --home $SECRETD_HOME

if [ ! -z "$2" ]; then
secretd add-genesis-account $GENACCT $coins
$SECRETD add-genesis-account $GENACCT $coins
fi

secretd gentx validator 5000000000uscrt --keyring-backend="test" --chain-id $CHAINID
secretd collect-gentxs
$SECRETD gentx validator 5000000000uscrt --keyring-backend="test" --chain-id $CHAINID --home $SECRETD_HOME
$SECRETD collect-gentxs --home $SECRETD_HOME

# Set proper defaults and change ports
sed -i 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' ~/.secretd/config/config.toml
sed -i 's/timeout_commit = "5s"/timeout_commit = "1s"/g' ~/.secretd/config/config.toml
sed -i 's/timeout_propose = "3s"/timeout_propose = "1s"/g' ~/.secretd/config/config.toml
sed -i 's/index_all_keys = false/index_all_keys = true/g' ~/.secretd/config/config.toml
perl -i -pe 's/"stake"/ "uscrt"/g' ~/.secretd/config/genesis.json
sed -i 's#"tcp://127.0.0.1:26657"#"tcp://0.0.0.0:26657"#g' $SECRETD_HOME/config/config.toml
sed -i 's/timeout_commit = "5s"/timeout_commit = "1s"/g' $SECRETD_HOME/config/config.toml
sed -i 's/timeout_propose = "3s"/timeout_propose = "1s"/g' $SECRETD_HOME/config/config.toml
sed -i 's/index_all_keys = false/index_all_keys = true/g' $SECRETD_HOME/config/config.toml
perl -i -pe 's/"stake"/ "uscrt"/g' $SECRETD_HOME/config/genesis.json

# Start the secretd
secretd start --pruning=nothing --bootstrap
$SECRETD start --pruning=nothing --bootstrap --home $SECRETD_HOME

0 comments on commit 7b04756

Please sign in to comment.