Skip to content

Commit a26318e

Browse files
committed
add local node script
1 parent 26429ec commit a26318e

3 files changed

Lines changed: 91 additions & 42 deletions

File tree

create_validator.sh

Lines changed: 0 additions & 41 deletions
This file was deleted.

second_node.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then
7575
#sed -i 's/persistent_peers = "$PEERID"/g' "$CONFIG"
7676

7777
sed -i.bak 's/swagger = false/swagger = true/g' $APP_TOML
78-
sed -i.bak 's/localhost:9090/localhost:8090/g' $APP_TOML
78+
sed -i.bak 's/localhost:9090/localhost:7090/g' $APP_TOML
7979

8080
$BINARY keys add secp256k1_key --key-type segwit --home "$HOMEDIR"
8181
$BINARY tx bank send dev1 $($BINARY keys show secp256k1_key -a --home "$HOMEDIR") 2000000000uside --chain-id $CHAINID --fees 200uside --yes

third_node.sh

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
#!/bin/bash
2+
3+
KEYS=("dev0" "dev1")
4+
CHAINID="sidechain-testnet-4"
5+
MONIKER="Side Labs"
6+
BINARY="$HOME/go/bin/sided"
7+
DENOM_STR="uside,uusdt,uusdc"
8+
9+
set -f
10+
IFS=,
11+
DENOMS=($DENOM_STR)
12+
13+
IFS=";"
14+
15+
16+
INITIAL_SUPPLY="500000000000000"
17+
BLOCK_GAS=10000000
18+
MAX_GAS=10000000000
19+
20+
# Remember to change to other types of keyring like 'file' in-case exposing to outside world,
21+
# otherwise your balance will be wiped quickly
22+
# The keyring test does not require private key to steal tokens from you
23+
KEYRING="test"
24+
#KEYALGO="secp256k1"
25+
KEYALGO="segwit"
26+
LOGLEVEL="info"
27+
# Set dedicated home directory for the $BINARY instance
28+
HOMEDIR="$HOME/.side3"
29+
30+
# Path variables
31+
CONFIG=$HOMEDIR/config/config.toml
32+
APP_TOML=$HOMEDIR/config/app.toml
33+
GENESIS=$HOMEDIR/config/genesis.json
34+
TMP_GENESIS=$HOMEDIR/config/tmp_genesis.json
35+
PEER_ID="peer"
36+
37+
# validate dependencies are installed
38+
command -v jq >/dev/null 2>&1 || {
39+
echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"
40+
exit 1
41+
}
42+
43+
# used to exit on first error (any non-zero exit code)
44+
set -e
45+
46+
# Reinstall daemon
47+
# make install
48+
49+
# User prompt if an existing local node configuration is found.
50+
if [ -d "$HOMEDIR" ]; then
51+
printf "\nAn existing folder at '%s' was found. You can choose to delete this folder and start a new local node with new keys from genesis. When declined, the existing local node is started. \n" "$HOMEDIR"
52+
echo "Overwrite the existing configuration and start a new local node? [y/n]"
53+
read -r overwrite
54+
else
55+
overwrite="Y"
56+
fi
57+
58+
59+
# Setup local node if overwrite is set to Yes, otherwise skip setup
60+
if [[ $overwrite == "y" || $overwrite == "Y" ]]; then
61+
# Remove the previous folder
62+
rm -rf "$HOMEDIR"
63+
64+
$BINARY init $MONIKER -o --chain-id $CHAINID --home "$HOMEDIR"
65+
66+
# Set client config
67+
cp -r ~/.side/config/genesis.json $HOMEDIR/config/genesis.json
68+
$BINARY config keyring-backend $KEYRING --home "$HOMEDIR"
69+
$BINARY config chain-id $CHAINID --home "$HOMEDIR"
70+
71+
sed -i.bak 's/127.0.0.1:26657/0.0.0.0:36657/g' "$CONFIG"
72+
sed -i.bak 's/127.0.0.1:26658/0.0.0.0:36658/g' "$CONFIG"
73+
sed -i.bak 's/0.0.0.0:26656/0.0.0.0:36656/g' "$CONFIG"
74+
sed -i.bak 's/persistent_peers = ""/persistent_peers = "dfd3e3c99414aa850f6e269cf4a674a66062cd49@127.0.0.1:26656"/g' "$CONFIG"
75+
#sed -i 's/persistent_peers = "$PEERID"/g' "$CONFIG"
76+
77+
sed -i.bak 's/swagger = false/swagger = true/g' $APP_TOML
78+
sed -i.bak 's/localhost:9090/localhost:8090/g' $APP_TOML
79+
80+
$BINARY keys add secp256k1_key --key-type segwit --home "$HOMEDIR"
81+
$BINARY tx bank send dev1 $($BINARY keys show secp256k1_key -a --home "$HOMEDIR") 2000000000uside --chain-id $CHAINID --fees 200uside --yes
82+
sleep 6
83+
$BINARY keys add segwit_key --key-type segwit --home "$HOMEDIR"
84+
$BINARY tx bank send dev1 $($BINARY keys show segwit_key -a --home "$HOMEDIR") 2000000000uside --chain-id $CHAINID --fees 200uside --yes
85+
86+
87+
fi
88+
89+
# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
90+
$BINARY start --log_level info --minimum-gas-prices=0.0001${DENOMS[0]} --home "$HOMEDIR" --pruning="everything"

0 commit comments

Comments
 (0)