forked from lavanet/lava
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_validator.sh
executable file
·65 lines (53 loc) · 2.05 KB
/
add_validator.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# this script is adding another validator to the chain (without a running node) (this validator will be soon jailed due to inactivity)
clear
home=~/.lava2
rm -rf $home
lavad init validator2 --chain-id lava --home $home
lavad config broadcast-mode sync --home $home
lavad config keyring-backend test --home $home
lavad keys add validator2 --home $home
cp ~/.lava/config/addrbook.json $home/config/addrbook.json
cp ~/.lava/config/app.toml $home/config/app.toml
cp ~/.lava/config/client.toml $home/config/client.toml
cp ~/.lava/config/genesis.json $home/config/genesis.json
# Specify the file path, field to edit, and new value
path="$home/config/"
config='config.toml'
app='app.toml'
# Determine OS
os_name=$(uname)
case "$(uname)" in
Darwin)
SED_INLINE="-i ''" ;;
Linux)
SED_INLINE="-i" ;;
*)
echo "unknown system: $(uname)"
exit 1 ;;
esac
sed $SED_INLINE \
-e 's/tcp:\/\/0\.0\.0\.0:26656/tcp:\/\/0.0.0.0:36656/' \
-e 's/tcp:\/\/127\.0\.0\.1:26658/tcp:\/\/127.0.0.1:36658/' \
-e 's/tcp:\/\/127\.0\.0\.1:26657/tcp:\/\/127.0.0.1:36657/' \
-e 's/tcp:\/\/127\.0\.0\.1:26656/tcp:\/\/127.0.0.1:36656/' "$path$config"
# Edit app.toml file
sed $SED_INLINE \
-e 's/tcp:\/\/localhost:1317/tcp:\/\/localhost:2317/' \
-e 's/localhost:9090/localhost:8090/' \
-e 's/":7070"/":7070"/' \
-e 's/localhost:9091/localhost:8091/' "$path$app"
GASPRICE="0.000000001ulava"
lavad tx bank send $(lavad keys show alice -a) $(lavad keys show validator2 -a --home $home) 10000000000001ulava -y --from alice --gas-adjustment "1.5" --gas "auto" --gas-prices $GASPRICE
sleep 3
lavad tx staking create-validator -y --from validator2 --amount="10000000000000ulava" --pubkey=$(lavad tendermint show-validator --home $home) \
--commission-rate="0.10" \
--commission-max-rate="0.20" \
--commission-max-change-rate="0.01" \
--min-self-delegation="1000" \
--gas-adjustment "1.5" \
--gas "auto" \
--gas-prices $GASPRICE \
--home $home
id=$(lavad status | jq .NodeInfo.id -r)
addr=$(lavad status | jq .NodeInfo.listen_addr -r | sed 's/tcp:\/\///')
lavad start --home $home --p2p.seeds $id@$addr