diff --git a/create_validator.sh b/create_validator.sh new file mode 100755 index 00000000..10ac474c --- /dev/null +++ b/create_validator.sh @@ -0,0 +1,42 @@ +#!/bin/bash + +KEYS=("dev0" "dev1") +CHAINID="S2-testnet-1" +MONIKER="Side Labs" +BINARY="$HOME/go/bin/sided" + +# 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="secp256k1" +KEYALGO="segwit" +LOGLEVEL="info" +# Set dedicated home directory for the $BINARY instance +HOMEDIR="$HOME/.side2" + +# 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 +PEER_ID="" + +# 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 +} + +# used to exit on first error (any non-zero exit code) +set -e + +# Set client config +$BINARY config keyring-backend $KEYRING --home "$HOMEDIR" +$BINARY config chain-id $CHAINID --home "$HOMEDIR" + +# Start the node (remove the --pruning=nothing flag if historical queries are not needed) +$BINARY tx staking create-validator -y --moniker segwit --pubkey=$($BINARY tendermint show-validator --home $HOMEDIR) --amount="10000000uside" --commission-rate 0.1 --commission-max-rate 0.1 --commission-max-change-rate 0.1 --min-self-delegation 1 --chain-id $CHAINID --fees 2000uside --home "$HOMEDIR" --from segwit_key +sleep 6 +$BINARY tx staking create-validator -y --moniker secp256 --pubkey=$($BINARY tendermint show-validator --home $HOMEDIR) --amount="15000000uside" --commission-rate 0.1 --commission-max-rate 0.1 --commission-max-change-rate 0.1 --min-self-delegation 1 --chain-id $CHAINID --fees 2000uside --home "$HOMEDIR" --from secp256k1_key + diff --git a/go.mod b/go.mod index 148346de..59e9f3eb 100644 --- a/go.mod +++ b/go.mod @@ -230,8 +230,8 @@ require ( ) replace ( - github.com/cosmos/cosmos-sdk => github.com/sideprotocol/cosmos-sdk v0.47.115 - //github.com/cosmos/cosmos-sdk => ../cosmos-sdk + github.com/cosmos/cosmos-sdk => github.com/sideprotocol/cosmos-sdk v0.47.116 + // github.com/cosmos/cosmos-sdk => ../cosmos-sdk github.com/cosmos/interchain-security/v3 => github.com/Stride-Labs/interchain-security/v3 v3.1.0-remove-validation-bug-7d3d9d github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 diff --git a/go.sum b/go.sum index d924f5c9..f8f4e1b5 100644 --- a/go.sum +++ b/go.sum @@ -973,8 +973,8 @@ github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg github.com/shopspring/decimal v1.3.1 h1:2Usl1nmF/WZucqkFZhnfFYxxxu8LG21F6nPQBE5gKV8= github.com/shopspring/decimal v1.3.1/go.mod h1:DKyhrW/HYNuLGql+MJL6WCR6knT2jwCFRcu2hWCYk4o= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sideprotocol/cosmos-sdk v0.47.115 h1:7249db6t1AKiTlyyg1jjKl6CFiN+4ae2/2Odza//cnk= -github.com/sideprotocol/cosmos-sdk v0.47.115/go.mod h1:Ql8d4j8oRXssuNQfVIaa6LRo7VsFMJgSy2Qckd/dcr0= +github.com/sideprotocol/cosmos-sdk v0.47.116 h1:9qXEko5qj+RVHR5a01dheCjqzw5MlnYqxu36fqJm5MU= +github.com/sideprotocol/cosmos-sdk v0.47.116/go.mod h1:Ql8d4j8oRXssuNQfVIaa6LRo7VsFMJgSy2Qckd/dcr0= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= diff --git a/local_node.sh b/local_node.sh index 85cf89d8..520198e3 100755 --- a/local_node.sh +++ b/local_node.sh @@ -105,7 +105,7 @@ if [[ $overwrite == "y" || $overwrite == "Y" ]]; then # Sign genesis transaction echo $INITIAL_SUPPLY${DENOMS[0]} - $BINARY gentx "${KEYS[0]}" $INITIAL_SUPPLY${DENOMS[0]} --keyring-backend $KEYRING --chain-id $CHAINID --home "$HOMEDIR" + $BINARY gentx "${KEYS[0]}" $INITIAL_SUPPLY${DENOMS[0]} --keyring-backend $KEYRING --chain-id $CHAINID --identity "666AC57CC678BEC4" --website="https://side.one" --home "$HOMEDIR" ## In case you want to create multiple validators at genesis ## 1. Back to `$BINARY keys add` step, init more keys diff --git a/second_node.sh b/second_node.sh new file mode 100755 index 00000000..87ce046d --- /dev/null +++ b/second_node.sh @@ -0,0 +1,90 @@ +#!/bin/bash + +KEYS=("dev0" "dev1") +CHAINID="S2-testnet-1" +MONIKER="Side Labs" +BINARY="$HOME/go/bin/sided" +DENOM_STR="uside,ubtct,uusdc,uusdc.axl,uusdc.noble,uusdt,uusdt.kava,uusdt.axl,uwbtc.axl,uwbtc.osmo,uwbtc" + +set -f +IFS=, +DENOMS=($DENOM_STR) + +IFS=";" + + +INITIAL_SUPPLY="500000000000000" +BLOCK_GAS=10000000 +MAX_GAS=10000000000 + +# 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="secp256k1" +KEYALGO="segwit" +LOGLEVEL="info" +# Set dedicated home directory for the $BINARY instance +HOMEDIR="$HOME/.side2" + +# 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 +PEER_ID="peer" + +# 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 +} + +# used to exit on first error (any non-zero exit code) +set -e + +# Reinstall daemon +# make install + +# User prompt if an existing local node configuration is found. +if [ -d "$HOMEDIR" ]; then + printf "\nAn existing folder at '%s' was found. You can choose to delete this folder and start a new local node with new keys from genesis. When declined, the existing local node is started. \n" "$HOMEDIR" + echo "Overwrite the existing configuration and start a new local node? [y/n]" + read -r overwrite +else + overwrite="Y" +fi + + +# Setup local node if overwrite is set to Yes, otherwise skip setup +if [[ $overwrite == "y" || $overwrite == "Y" ]]; then + # Remove the previous folder + rm -rf "$HOMEDIR" + + $BINARY init $MONIKER -o --chain-id $CHAINID --home "$HOMEDIR" + + # Set client config + cp -r ~/.side/config/genesis.json $HOMEDIR/config/genesis.json + $BINARY config keyring-backend $KEYRING --home "$HOMEDIR" + $BINARY config chain-id $CHAINID --home "$HOMEDIR" + + sed -i.bak 's/127.0.0.1:26657/0.0.0.0:16657/g' "$CONFIG" + sed -i.bak 's/127.0.0.1:26658/0.0.0.0:16658/g' "$CONFIG" + sed -i.bak 's/0.0.0.0:26656/0.0.0.0:16656/g' "$CONFIG" + sed -i.bak 's/persistent_peers = ""/persistent_peers = "dfd3e3c99414aa850f6e269cf4a674a66062cd49@127.0.0.1:26656"/g' "$CONFIG" + #sed -i 's/persistent_peers = "$PEERID"/g' "$CONFIG" + + sed -i.bak 's/swagger = false/swagger = true/g' $APP_TOML + sed -i.bak 's/localhost:9090/localhost:8090/g' $APP_TOML + + $BINARY keys add secp256k1_key --key-type segwit --home "$HOMEDIR" + $BINARY tx bank send dev1 $($BINARY keys show secp256k1_key -a --home "$HOMEDIR") 2000000000uside --chain-id $CHAINID --fees 200uside --yes + sleep 6 + $BINARY keys add segwit_key --key-type segwit --home "$HOMEDIR" + $BINARY tx bank send dev1 $($BINARY keys show segwit_key -a --home "$HOMEDIR") 2000000000uside --chain-id $CHAINID --fees 200uside --yes + + +fi + +# Start the node (remove the --pruning=nothing flag if historical queries are not needed) +$BINARY start --log_level info --minimum-gas-prices=0.0001${DENOMS[0]} --home "$HOMEDIR" --pruning="everything"