forked from xrplevm/node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
local-node.sh
executable file
·103 lines (87 loc) · 5.3 KB
/
local-node.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
CHAINID="exrp_1440002-1"
MONIKER="localnet"
# Remember to change to other types of keyring like 'file' in-case exposing to outside world,
# otherwise your balance will be wiped quickly
# The keyring test does not require private key to steal tokens from you
KEYRING="test"
KEYALGO="eth_secp256k1"
LOGLEVEL="debug"
# Set dedicated home directory for the evmosd instance
HOMEDIR="$PWD/.exrpd"
# to trace evm
#TRACE="--trace"
TRACE=""
# feemarket params basefee
BASEFEE=0
# Path variables
CONFIG=$HOMEDIR/config/config.toml
APP_TOML=$HOMEDIR/config/app.toml
GENESIS=$HOMEDIR/config/genesis.json
TMP_GENESIS=$HOMEDIR/config/tmp_genesis.json
#Account variables
KEY_NAME="alice"
MNEMONIC="birth rebuild refuse area aisle language bullet pride place clutch paddle drama"
rm -rf $HOMEDIR
make build
bin/exrpd --home "$HOMEDIR" config keyring-backend "$KEYRING"
bin/exrpd --home "$HOMEDIR" config chain-id "$CHAINID"
echo "$MNEMONIC" | bin/exrpd --home "$HOMEDIR" keys add "$KEY_NAME" --recover --keyring-backend "$KEYRING" --algo "$KEYALGO"
bin/exrpd --home "$HOMEDIR" init "$MONIKER" -o --chain-id "$CHAINID"
jq '.consensus_params["block"]["max_gas"]="10500000"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["crisis"]["constant_fee"]["denom"]="token"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["evm"]["params"]["evm_denom"]="token"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["evm"]["params"]["allow_unprotected_txs"]=true' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["gov"]["params"]["min_deposit"][0]["denom"]="token"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["gov"]["params"]["min_deposit"][0]["amount"]="1"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["gov"]["params"]["voting_period"]="10s"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["staking"]["params"]["bond_denom"]="apoa"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["staking"]["params"]["unbonding_time"]="60s"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["feemarket"]["params"]["base_fee"]="'${BASEFEE}'"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
jq '.app_state["erc20"]["token_pairs"][0]["denom"]="token"' "$GENESIS" >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
bin/exrpd --home "$HOMEDIR" add-genesis-account "$(bin/exrpd --home "$HOMEDIR" keys show "$KEY_NAME" -a --keyring-backend "$KEYRING")" 1000000apoa,1000000000000000000000000000token --keyring-backend "$KEYRING"
bin/exrpd --home "$HOMEDIR" gentx alice 1000000apoa --gas-prices ${BASEFEE}token --keyring-backend "$KEYRING" --chain-id "$CHAINID"
bin/exrpd --home "$HOMEDIR" collect-gentxs
bin/exrpd --home "$HOMEDIR" validate-genesis
if [[ $1 == "pending" ]]; then
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/timeout_propose = "3s"/timeout_propose = "30s"/g' "$CONFIG"
sed -i '' 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' "$CONFIG"
sed -i '' 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' "$CONFIG"
sed -i '' 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' "$CONFIG"
sed -i '' 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' "$CONFIG"
sed -i '' 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' "$CONFIG"
sed -i '' 's/timeout_commit = "5s"/timeout_commit = "150s"/g' "$CONFIG"
sed -i '' 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' "$CONFIG"
else
sed -i 's/timeout_propose = "3s"/timeout_propose = "30s"/g' "$CONFIG"
sed -i 's/timeout_propose_delta = "500ms"/timeout_propose_delta = "5s"/g' "$CONFIG"
sed -i 's/timeout_prevote = "1s"/timeout_prevote = "10s"/g' "$CONFIG"
sed -i 's/timeout_prevote_delta = "500ms"/timeout_prevote_delta = "5s"/g' "$CONFIG"
sed -i 's/timeout_precommit = "1s"/timeout_precommit = "10s"/g' "$CONFIG"
sed -i 's/timeout_precommit_delta = "500ms"/timeout_precommit_delta = "5s"/g' "$CONFIG"
sed -i 's/timeout_commit = "5s"/timeout_commit = "150s"/g' "$CONFIG"
sed -i 's/timeout_broadcast_tx_commit = "10s"/timeout_broadcast_tx_commit = "150s"/g' "$CONFIG"
fi
fi
# enable prometheus metrics and all APIs for dev node
if [[ "$OSTYPE" == "darwin"* ]]; then
sed -i '' 's/prometheus = false/prometheus = true/' "$CONFIG"
sed -i '' 's/prometheus-retention-time = 0/prometheus-retention-time = 1000000000000/g' "$APP_TOML"
sed -i '' 's/enabled = false/enabled = true/g' "$APP_TOML"
sed -i '' 's/enable = false/enable = true/g' "$APP_TOML"
# Don't enable memiavl by default
grep -q -F '[memiavl]' "$APP_TOML" && sed -i '' '/\[memiavl\]/,/^\[/ s/enable = true/enable = false/' "$APP_TOML"
else
sed -i 's/prometheus = false/prometheus = true/' "$CONFIG"
sed -i 's/prometheus-retention-time = "0"/prometheus-retention-time = "1000000000000"/g' "$APP_TOML"
sed -i 's/enabled = false/enabled = true/g' "$APP_TOML"
sed -i 's/enable = false/enable = true/g' "$APP_TOML"
# Don't enable memiavl by default
grep -q -F '[memiavl]' "$APP_TOML" && sed -i '/\[memiavl\]/,/^\[/ s/enable = true/enable = false/' "$APP_TOML"
fi
bin/exrpd start \
--metrics "$TRACE" \
--log_level $LOGLEVEL \
--json-rpc.api eth,txpool,personal,net,debug,web3 \
--home "$HOMEDIR" \
--chain-id "$CHAINID"