This repository was archived by the owner on Aug 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·76 lines (52 loc) · 2.77 KB
/
setup.sh
File metadata and controls
executable file
·76 lines (52 loc) · 2.77 KB
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
66
67
68
69
70
71
72
73
74
75
76
#!/usr/bin/env bash
APP_LOG_LEVEL=${APP_LOG_LEVEL:-"error"}
#### Cleanup
rm -rf $APP_HOME
#### Prepare genesis
$APP init --chain-id $CHAINID $CHAINID --home $APP_HOME
sed -i 's#tcp://127.0.0.1:26657#tcp://0.0.0.0:26657#g' $APP_HOME/config/config.toml
sed -i '/timeout_commit = "5s"/c\timeout_commit = "1s"' $APP_HOME/config/config.toml
sed -i '/minimum-gas-prices =/c\minimum-gas-prices = "'"0.0025$DENOM"'"' $APP_HOME/config/app.toml
# change evidence.max_age_duration
sed -i "s/172800000000000/60000000000/g" $APP_HOME/config/genesis.json
# change gov.max_deposit_period
sed -i "s/172800s/60s/g" $APP_HOME/config/genesis.json
# change the native coin
sed -i "s/stake/$DENOM/g" $APP_HOME/config/genesis.json
sed -i 's/"voting_period": "60s"/\"voting_period": "20s"/g' $APP_HOME/config/genesis.json
### Prepare genesis accounts and validators
$APP keys add w1 --home $APP_HOME
$APP keys add w2 --home $APP_HOME
$APP keys add w3 --home $APP_HOME
$APP keys add faucet --home $APP_HOME
$APP keys add validator --home $APP_HOME
export wallet1=$($APP keys show -a w1)
export wallet2=$($APP keys show -a w2)
export wallet3=$($APP keys show -a w3)
export validator=$($APP keys show -a validator)
CURRENT_TIME_SECONDS=$( date +%s )
VESTING_STARTTIME=$(( $CURRENT_TIME_SECONDS + 10 ))
VESTING_ENDTIME=$(( $CURRENT_TIME_SECONDS + 10000 ))
$APP add-genesis-account $wallet1 1000000000000$DENOM --home $APP_HOME
$APP add-genesis-account $validator 1000000000000$DENOM --home $APP_HOME
$APP add-genesis-account $($APP keys show -a faucet) 1000000000000$DENOM --home $APP_HOME
$APP add-genesis-account $wallet2 1000000000000$DENOM --vesting-amount 100000000000$DENOM --vesting-start-time $VESTING_STARTTIME --vesting-end-time $VESTING_ENDTIME --home $APP_HOME
$APP add-genesis-account $wallet3 1000000000000$DENOM --vesting-amount 500000000000$DENOM --vesting-start-time $VESTING_STARTTIME --vesting-end-time $VESTING_ENDTIME --home $APP_HOME
$APP gentx validator 90000000000$DENOM --chain-id $CHAINID --home $APP_HOME
# $APP gentx validator 10000000000$DENOM ....
$APP collect-gentxs --home $APP_HOME
##### START
echo "* starting the chain in the background*"
# --api.enable=true ---> enable REST
$APP start --home $APP_HOME --log_level $APP_LOG_LEVEL --api.enable=true &
##### Set delegations
sleep 2
echo "* setting delegation *"
VAL_OPR_ADDRESS=$($APP keys show validator -a --bech val --home $APP_HOME)
$APP tx staking delegate $VAL_OPR_ADDRESS 900000000000$DENOM --from w1 --chain-id $CHAINID -y --home $APP_HOME --fees 5000$DENOM
$APP tx staking delegate $VAL_OPR_ADDRESS 100000000000$DENOM --from w2 --chain-id $CHAINID -y --home $APP_HOME --fees 5000$DENOM
## In each command you can
## * specify node address:
# --node $NODE
## * or they keyring
# --keyring-backend test