Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odin/validatorsh2 #254

Merged
merged 2 commits into from
Nov 3, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 7 additions & 10 deletions scripts/validator.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@

#!/bin/bash

set -o pipefail
set -ex

CHAIN_ID="arkeo"
PORT_RPC=${PORT_RPC:=26657}
PORT_P2P=${PORT_P2P:=26656}
RPC="${RPC:=seed.arkeo.network:26657}"
SEED="${SEED:=seed.arkeo.network:26656}"
PEER="${PEER:=none}" # the hostname of a seed node set as tendermint persistent peer
PEER_ID=$(curl -s http://$RPC/status | jq -r '.result.node_info.id')
PEER_ID=$(curl -sL http://$RPC/status | jq -r '.result.node_info.id')

# delete empty file (ie an empty genesis.json file if exists)
find ~/.arkeo/config -size 0 -print -delete

if [ ! -f ~/.arkeo/config/genesis.json ]; then
Expand All @@ -21,22 +18,22 @@ if [ ! -f ~/.arkeo/config/genesis.json ]; then

rm -rf ~/.arkeo/config/genesis.json

if [ "$PEER" = "none" ]; then
if [ "$RPC" = "none" ]; then
echo "Missing PEER"
exit 1
fi

# wait for peer
until curl -s "$PEER" 1>/dev/null 2>&1; do
echo "Waiting for peer: $PEER"
until curl -s "$RPC" 1>/dev/null 2>&1; do
echo "Waiting for peer: $RPC"
sleep 3
done

# fetch genesis file from seed node
curl -sL "$PEER/genesis" | jq '.result.genesis' > ~/.arkeo/config/genesis.json
curl -sL "$RPC/genesis" | jq '.result.genesis' > ~/.arkeo/config/genesis.json

# fetch node id
SEED_ID=$(curl -s "$PEER/status" | jq -r .result.node_info.id)
SEED_ID=$(curl -sL "$RPC/status" | jq -r .result.node_info.id)
SEEDS="$SEED_ID@$SEED"

sed -i 's/enable = false/enable = true/g' ~/.arkeo/config/app.toml
Expand Down
Loading