-
-
Save gufmar/7e1bc16f8df62af953567a373d6a8f72 to your computer and use it in GitHub Desktop.
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
#!/bin/bash | |
# shellcheck disable=SC2086,SC2034 | |
CNODE_PORT=3010 # must match your relay node port as set in the startup command | |
CNODE_HOSTNAME="CHANGE ME" # optional. must resolve to the IP you are requesting from | |
CNODE_VALENCY=1 # optional for multi-IP hostnames | |
CNODE_HOME="/opt/cardano/testnet" | |
CNODE_LOG_DIR="${CNODE_HOME}/logs/" | |
CONFIG="$CNODE_HOME/files/config.json" | |
GENESIS_JSON="${CNODE_HOME}/files/testnet-shelley-genesis.json" | |
########################################### | |
EKGPORT=$(jq -r .hasEKG $CONFIG) | |
NWMAGIC=$(jq -r .networkMagic < $GENESIS_JSON) | |
metrics=$(curl -s -H 'Accept: application/json' http://127.0.0.1:${EKGPORT}/ ) | |
blockNo=$(echo "${metrics}" | jq -r .cardano.node.ChainDB.metrics.blockNum.int.val) | |
# Note: | |
# if you run your node in IPv4/IPv6 dual stack network configuration and want announced the | |
# IPv4 address only please add the -4 parameter to the curl command below (curl -4 -s ...) | |
if [ "${CNODE_HOSTNAME}" != "CHANGE ME" ]; then | |
T_HOSTNAME="&hostname=${CNODE_HOSTNAME}" | |
else | |
T_HOSTNAME='' | |
fi | |
curl -s "https://api.clio.one/htopology/v1/?port=${CNODE_PORT}&blockNo=${blockNo}&valency=${CNODE_VALENCY}&magic=${NWMAGIC}${T_HOSTNAME}" | tee -a $CNODE_LOG_DIR/topologyUpdater_lastresult.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment