2024-02-01 04:48:40 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2024-03-07 05:10:41 +00:00
|
|
|
KEY="alice"
|
|
|
|
CHAINID="laconic_9000-1"
|
|
|
|
MONIKER="localtestnet"
|
|
|
|
KEYRING="test"
|
|
|
|
LOGLEVEL="${LOGLEVEL:-info}"
|
|
|
|
|
2024-04-01 09:57:26 +00:00
|
|
|
if [ "$1" == "clean" ] || [ ! -d "$HOME/.laconicd/data/blockstore.db" ]; then
|
2024-03-07 05:10:41 +00:00
|
|
|
# validate dependencies are installed
|
|
|
|
command -v jq > /dev/null 2>&1 || {
|
|
|
|
echo >&2 "jq not installed. More info: https://stedolan.github.io/jq/download/"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
# remove existing daemon and client
|
2024-04-01 09:57:26 +00:00
|
|
|
rm -rf $HOME/.laconicd/*
|
2024-03-07 05:10:41 +00:00
|
|
|
|
|
|
|
if [ -n "`which make`" ]; then
|
|
|
|
make install
|
|
|
|
fi
|
|
|
|
|
2024-04-01 09:57:26 +00:00
|
|
|
laconicd config set client chain-id $CHAINID
|
2024-04-01 12:19:54 +00:00
|
|
|
laconicd config set client keyring-backend $KEYRING
|
2024-03-07 05:10:41 +00:00
|
|
|
|
|
|
|
# if $KEY exists it should be deleted
|
2024-04-01 09:57:26 +00:00
|
|
|
laconicd keys add $KEY --keyring-backend $KEYRING
|
2024-03-07 05:10:41 +00:00
|
|
|
|
|
|
|
# Set moniker and chain-id for Ethermint (Moniker can be anything, chain-id must be an integer)
|
2024-07-29 20:27:20 +00:00
|
|
|
laconicd init $MONIKER --chain-id $CHAINID --default-denom alnt
|
2024-03-07 05:10:41 +00:00
|
|
|
|
|
|
|
update_genesis() {
|
2024-04-01 09:57:26 +00:00
|
|
|
jq "$1" $HOME/.laconicd/config/genesis.json > $HOME/.laconicd/config/tmp_genesis.json &&
|
|
|
|
mv $HOME/.laconicd/config/tmp_genesis.json $HOME/.laconicd/config/genesis.json
|
2024-03-07 05:10:41 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if [[ "$TEST_REGISTRY_EXPIRY" == "true" ]]; then
|
|
|
|
echo "Setting timers for expiry tests."
|
|
|
|
|
|
|
|
update_genesis '.app_state["registry"]["params"]["record_rent_duration"]="60s"'
|
|
|
|
update_genesis '.app_state["registry"]["params"]["authority_grace_period"]="60s"'
|
|
|
|
update_genesis '.app_state["registry"]["params"]["authority_rent_duration"]="60s"'
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ "$TEST_AUCTION_ENABLED" == "true" ]]; then
|
|
|
|
echo "Enabling auction and setting timers."
|
|
|
|
|
|
|
|
update_genesis '.app_state["registry"]["params"]["authority_auction_enabled"]=true'
|
|
|
|
update_genesis '.app_state["registry"]["params"]["authority_rent_duration"]="60s"'
|
|
|
|
update_genesis '.app_state["registry"]["params"]["authority_grace_period"]="300s"'
|
|
|
|
update_genesis '.app_state["registry"]["params"]["authority_auction_commits_duration"]="60s"'
|
|
|
|
update_genesis '.app_state["registry"]["params"]["authority_auction_reveals_duration"]="60s"'
|
|
|
|
fi
|
|
|
|
|
2024-07-04 13:40:10 +00:00
|
|
|
if [[ "$ONBOARDING_ENABLED" == "true" ]]; then
|
|
|
|
echo "Enabling validator onboarding."
|
|
|
|
|
|
|
|
update_genesis '.app_state["onboarding"]["params"]["onboarding_enabled"]=true'
|
|
|
|
fi
|
|
|
|
|
2024-03-07 05:10:41 +00:00
|
|
|
# increase block time (?)
|
|
|
|
update_genesis '.consensus["params"]["block"]["time_iota_ms"]="1000"'
|
|
|
|
|
|
|
|
# Set gas limit in genesis
|
|
|
|
update_genesis '.consensus["params"]["block"]["max_gas"]="10000000"'
|
|
|
|
|
|
|
|
# disable produce empty block
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
2024-04-01 09:57:26 +00:00
|
|
|
sed -i '' 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
|
2024-03-07 05:10:41 +00:00
|
|
|
else
|
2024-04-01 09:57:26 +00:00
|
|
|
sed -i 's/create_empty_blocks = true/create_empty_blocks = false/g' $HOME/.laconicd/config/config.toml
|
2024-03-07 05:10:41 +00:00
|
|
|
fi
|
2024-07-30 05:32:54 +00:00
|
|
|
|
2024-07-17 09:59:59 +00:00
|
|
|
# Run this to allow requests from any origin
|
|
|
|
sed -i 's/cors_allowed_origins.*$/cors_allowed_origins = ["*"]/' $HOME/.laconicd/config/config.toml
|
2024-03-07 05:10:41 +00:00
|
|
|
|
2024-04-11 07:56:50 +00:00
|
|
|
# Enable telemetry (prometheus metrics: http://localhost:1317/metrics?format=prometheus)
|
|
|
|
if [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
sed -i '' 's/enabled = false/enabled = true/g' $HOME/.laconicd/config/app.toml
|
|
|
|
sed -i '' 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $HOME/.laconicd/config/app.toml
|
|
|
|
sed -i '' 's/prometheus = false/prometheus = true/g' $HOME/.laconicd/config/config.toml
|
|
|
|
else
|
|
|
|
sed -i 's/enabled = false/enabled = true/g' $HOME/.laconicd/config/app.toml
|
|
|
|
sed -i 's/prometheus-retention-time = 0/prometheus-retention-time = 60/g' $HOME/.laconicd/config/app.toml
|
|
|
|
sed -i 's/prometheus = false/prometheus = true/g' $HOME/.laconicd/config/config.toml
|
|
|
|
fi
|
|
|
|
|
2024-03-07 05:10:41 +00:00
|
|
|
# Allocate genesis accounts (cosmos formatted addresses)
|
2024-07-30 05:32:54 +00:00
|
|
|
# 10^30 alnt | 10^12 lnt
|
2024-07-29 20:27:20 +00:00
|
|
|
laconicd genesis add-genesis-account $KEY 1000000000000000000000000000000alnt --keyring-backend $KEYRING
|
2024-03-07 05:10:41 +00:00
|
|
|
|
|
|
|
# Sign genesis transaction
|
2024-07-30 05:32:54 +00:00
|
|
|
# 10^24 alnt | 10^6 lnt
|
|
|
|
laconicd genesis gentx $KEY 1000000000000000000000000alnt --keyring-backend $KEYRING --chain-id $CHAINID
|
2024-03-07 05:10:41 +00:00
|
|
|
|
|
|
|
# Collect genesis tx
|
2024-04-01 09:57:26 +00:00
|
|
|
laconicd genesis collect-gentxs
|
2024-03-07 05:10:41 +00:00
|
|
|
|
|
|
|
# Run this to ensure everything worked and that the genesis file is setup correctly
|
2024-04-01 09:57:26 +00:00
|
|
|
laconicd genesis validate
|
2024-03-07 05:10:41 +00:00
|
|
|
else
|
2024-04-01 09:57:26 +00:00
|
|
|
echo "Using existing database at $HOME/.laconicd. To replace, run '`basename $0` clean'"
|
2024-03-07 05:10:41 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
# Start the node (remove the --pruning=nothing flag if historical queries are not needed)
|
2024-04-01 09:57:26 +00:00
|
|
|
laconicd start \
|
2024-03-07 05:10:41 +00:00
|
|
|
--pruning=nothing \
|
|
|
|
--log_level $LOGLEVEL \
|
2024-07-29 20:27:20 +00:00
|
|
|
--minimum-gas-prices=1alnt \
|
2024-03-07 05:10:41 +00:00
|
|
|
--api.enable \
|
2024-03-12 12:06:24 +00:00
|
|
|
--rpc.laddr="tcp://0.0.0.0:26657" \
|
2024-03-07 05:10:41 +00:00
|
|
|
--gql-server --gql-playground
|