-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: add build setup for validator script
- Loading branch information
1 parent
3ad4c05
commit 520a447
Showing
6 changed files
with
221 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
FROM scratch | ||
ENTRYPOINT ["/sedad"] | ||
COPY sedad / | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# Basic Setup Configurations | ||
BIN=$(git rev-parse --show-toplevel)/build/seda-chaind # chain binary executable on your machine | ||
KEYRING="${KEYRING:-file}" | ||
KEYPASSWD="${KEYPASSWD:-somepassword}" | ||
|
||
$BIN config keyring-backend file # use file backend | ||
|
||
KeyName="${KEY_NAME:-default_key}" | ||
|
||
# Adds a key to the keyring with the given MNEMONIC and KEYPASSWD (if provided) and KeyName | ||
# or generates a new key if MNEMONIC is not provided. | ||
if [[ -z "${MNEMONIC}" ]]; then | ||
# $BIN | ||
echo $KeyName | ||
(echo $KEYPASSWD; echo $KEYPASSWD) | $BIN keys add $KeyName | ||
else | ||
(echo $KEYPASSWD; echo $KEYPASSWD; echo $MNEMONIC) | $BIN keys add $KeyName | ||
fi | ||
|
||
|
||
$BIN init new $MONIKER | ||
|
||
cp /Users/jc/Downloads/genesis.json /Users/jc/.seda-chain/config/genesis.json | ||
|
||
# VALIDATOR ENVS | ||
STAKE_AMOUNT="${STAKE_AMOUNT:-100000000000000000seda}" | ||
MONIKER="${MONIKER:-node0}" | ||
COMMISSION_RATE="${COMMISSION_RATE:-0.10}" | ||
COMMISSION_MAX_RATE="${COMMISSION_MAX_RATE:-0.20}" | ||
COMMISSION_MAX_CHANGE_RATE="${COMMISSION_MAX_CHANGE_RATE:-0.01}" | ||
MINIMAL_SELF_DELETAGION="${MINIMAL_SELF_DELETAGION:-10000000000000000seda}" | ||
|
||
|
||
# Query for a validator if it does not exist exist create it | ||
VALIDATOR=$($BIN query staking validators --output json | jq -r '.validators[] | select(.description.moniker=="'"${MONIKER}"'")') | ||
|
||
if [[ -z "${VALIDATOR}" ]]; then | ||
$BIN tx staking create-validator \ | ||
--amount "${STAKE_AMOUNT}seda" \ | ||
--moniker "${MONIKER}" \ | ||
--pubkey $($BIN tendermint show-validator) \ | ||
--commission-rate "${COMMISSION_RATE}" \ | ||
--commission-max-rate "$COMMISSION_MAX_RATE" \ | ||
--commission-max-change-rate "${COMMISSION_MAX_CHANGE_RATE}" \ | ||
--min-self-delegation "${MINIMAL_SELF_DELETAGION}"\ | ||
--from "${KEY_NAME}" \ | ||
--keyring-backend "${KEYRING}" | ||
else | ||
echo "Validator already exists" | ||
exit 1 | ||
fi | ||
|
||
|
||
|
||
#$BIN start |