mirror of
https://github.com/0glabs/0g-chain.git
synced 2024-12-28 17:25:19 +00:00
add deploy scripts
This commit is contained in:
parent
31d565f5a7
commit
e976f28232
@ -6,7 +6,7 @@ function help() {
|
|||||||
echo " -i Identity file"
|
echo " -i Identity file"
|
||||||
echo " -k Keyring password to create key (for Linux only)"
|
echo " -k Keyring password to create key (for Linux only)"
|
||||||
echo " -n Network (default: testnet)"
|
echo " -n Network (default: testnet)"
|
||||||
echo " -c Chain ID (default: \"zgtendermint_9000-1\")"
|
echo " -c Chain ID (default: \"zgtendermint_16600-1\")"
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ NUM_NODES=${#IPS[@]}
|
|||||||
|
|
||||||
# Install dependent libraries and binary
|
# Install dependent libraries and binary
|
||||||
for ((i=0; i<$NUM_NODES; i++)) do
|
for ((i=0; i<$NUM_NODES; i++)) do
|
||||||
ssh $PEM_FLAG ubuntu@${IPS[$i]} "git clone https://github.com/0glabs/0g-chain.git; cd 0g-chain; ./networks/testnet/install.sh"
|
ssh $PEM_FLAG ubuntu@${IPS[$i]} "rm -rf 0g-chain; git clone https://github.com/0glabs/0g-chain.git; cd 0g-chain; git checkout testnet; ./networks/testnet/install.sh"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Create genesis config on node0
|
# Create genesis config on node0
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
ROOT_DIR=${ROOT_DIR:-testnet}
|
ROOT_DIR=${ROOT_DIR:-testnet}
|
||||||
CHAIN_ID=${CHAIN_ID:-zgtendermint_9000-1}
|
CHAIN_ID=${CHAIN_ID:-zgtendermint_16600-1}
|
||||||
|
|
||||||
# Usage: init-genesis.sh IP1,IP2,IP3 KEYRING_PASSWORD
|
# Usage: init-genesis.sh IP1,IP2,IP3 KEYRING_PASSWORD
|
||||||
OS_NAME=`uname -o`
|
OS_NAME=`uname -o`
|
||||||
@ -33,8 +33,9 @@ set -e
|
|||||||
IFS=","; declare -a IPS=($1); unset IFS
|
IFS=","; declare -a IPS=($1); unset IFS
|
||||||
|
|
||||||
NUM_NODES=${#IPS[@]}
|
NUM_NODES=${#IPS[@]}
|
||||||
BALANCE=$((100000000/$NUM_NODES))kava
|
VLIDATOR_BALANCE=20000000000000ukava
|
||||||
STAKING=$((50000000/$NUM_NODES))kava
|
FAUCET_BALANCE=20000000000000ukava
|
||||||
|
STAKING=2000000000000ukava
|
||||||
|
|
||||||
# Init configs
|
# Init configs
|
||||||
for ((i=0; i<$NUM_NODES; i++)) do
|
for ((i=0; i<$NUM_NODES; i++)) do
|
||||||
@ -80,14 +81,17 @@ for ((i=0; i<$NUM_NODES; i++)) do
|
|||||||
strategies: ["STRATEGY_TYPE_SAVINGS"],
|
strategies: ["STRATEGY_TYPE_SAVINGS"],
|
||||||
}]' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
}]' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
||||||
|
|
||||||
cat $GENESIS | jq '.app_state.savings.params.supported_denoms = ["bkava-kavavaloper1ffv7nhd3z6sych2qpqkk03ec6hzkmufyz4scd0"]' >$TMP_GENESIS && mv $TMP_GENESIS $GENESIS
|
|
||||||
|
|
||||||
# cat "$GENESIS" | jq '.app_state["staking"]["params"]["bond_denom"]="ukava"' >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
|
# cat "$GENESIS" | jq '.app_state["staking"]["params"]["bond_denom"]="ukava"' >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
|
||||||
# cat "$GENESIS" | jq '.app_state["gov"]["params"]["min_deposit"][0]["denom"]="neuron"' >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
|
# cat "$GENESIS" | jq '.app_state["gov"]["params"]["min_deposit"][0]["denom"]="ukava"' >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
|
||||||
|
|
||||||
|
cat "$GENESIS" | jq '.app_state["staking"]["params"]["max_validators"]=200' >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
|
||||||
|
cat "$GENESIS" | jq '.app_state["slashing"]["params"]["signed_blocks_window"]="1000"' >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
|
||||||
|
|
||||||
|
cat "$GENESIS" | jq '.app_state["consensus_params"]["block"]["time_iota_ms"]="3000"' >"$TMP_GENESIS" && mv "$TMP_GENESIS" "$GENESIS"
|
||||||
|
|
||||||
# Change app.toml
|
# Change app.toml
|
||||||
APP_TOML="$HOMEDIR"/config/app.toml
|
APP_TOML="$HOMEDIR"/config/app.toml
|
||||||
sed -i 's/minimum-gas-prices = "0akava"/minimum-gas-prices = "1000000000ukava"/' "$APP_TOML"
|
sed -i 's/minimum-gas-prices = "0akava"/minimum-gas-prices = "1000000000akava"/' "$APP_TOML"
|
||||||
sed -i '/\[json-rpc\]/,/^\[/ s/enable = false/enable = true/' "$APP_TOML"
|
sed -i '/\[json-rpc\]/,/^\[/ s/enable = false/enable = true/' "$APP_TOML"
|
||||||
sed -i '/\[json-rpc\]/,/^\[/ s/address = "127.0.0.1:8545"/address = "0.0.0.0:8545"/' "$APP_TOML"
|
sed -i '/\[json-rpc\]/,/^\[/ s/address = "127.0.0.1:8545"/address = "0.0.0.0:8545"/' "$APP_TOML"
|
||||||
|
|
||||||
@ -128,13 +132,13 @@ if [[ "$OS_NAME" = "Msys" ]]; then
|
|||||||
set -e
|
set -e
|
||||||
if [[ "$ret" = "" ]]; then
|
if [[ "$ret" = "" ]]; then
|
||||||
echo "Create validator key: $VALIDATOR"
|
echo "Create validator key: $VALIDATOR"
|
||||||
kava keys add $VALIDATOR --keyring-backend os
|
kava keys add $VALIDATOR --keyring-backend os --eth
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
elif [[ "$OS_NAME" = "GNU/Linux" ]]; then
|
elif [[ "$OS_NAME" = "GNU/Linux" ]]; then
|
||||||
# Create N validators for node0
|
# Create N validators for node0
|
||||||
for ((i=0; i<$NUM_NODES; i++)) do
|
for ((i=0; i<$NUM_NODES; i++)) do
|
||||||
yes $PASSWORD | kava keys add "0gchain_9000_validator_$i" --keyring-backend os --home "$ROOT_DIR"/node0
|
yes $PASSWORD | kava keys add "0gchain_9000_validator_$i" --keyring-backend os --home "$ROOT_DIR"/node0 --eth
|
||||||
done
|
done
|
||||||
|
|
||||||
# Copy validators to other nodes
|
# Copy validators to other nodes
|
||||||
@ -153,11 +157,12 @@ fi
|
|||||||
for ((i=0; i<$NUM_NODES; i++)) do
|
for ((i=0; i<$NUM_NODES; i++)) do
|
||||||
for ((j=0; j<$NUM_NODES; j++)) do
|
for ((j=0; j<$NUM_NODES; j++)) do
|
||||||
if [[ "$OS_NAME" = "GNU/Linux" ]]; then
|
if [[ "$OS_NAME" = "GNU/Linux" ]]; then
|
||||||
yes $PASSWORD | kava add-genesis-account "0gchain_9000_validator_$i" $BALANCE --home "$ROOT_DIR/node$j"
|
yes $PASSWORD | kava add-genesis-account "0gchain_9000_validator_$j" $VLIDATOR_BALANCE --home "$ROOT_DIR/node$i"
|
||||||
else
|
else
|
||||||
kava add-genesis-account "0gchain_9000_validator_$i" $BALANCE --home "$ROOT_DIR/node$j"
|
kava add-genesis-account "0gchain_9000_validator_$j" $VLIDATOR_BALANCE --home "$ROOT_DIR/node$i"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
kava add-genesis-account kava17n8707c20e8gge2tk2gestetjcs4536pdtf8y0 $FAUCET_BALANCE --home "$ROOT_DIR/node$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
# Prepare genesis txs
|
# Prepare genesis txs
|
||||||
|
Loading…
Reference in New Issue
Block a user