Testnet topologyUpdater.sh

Hi guys/gals,

trying to setup my testnet relays using the coincashew guide but I cant seem to get the topologyUpdater.sh. Not sure how to modify it to work on the testnet. Any ideas on how to make this work:

copied from coincashew guide:

On relaynode1

cat > $NODE_HOME/topologyUpdater.sh << EOF
#!/bin/bash

shellcheck disable=SC2086,SC2034

USERNAME=$(whoami)
CNODE_PORT=6000 # 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_BIN=“/usr/local/bin”
CNODE_HOME=$NODE_HOME
CNODE_LOG_DIR=“${CNODE_HOME}/logs”
GENESIS_JSON=“${CNODE_HOME}/${NODE_CONFIG}-shelley-genesis.json”
NETWORKID=$(jq -r .networkId $GENESIS_JSON)
CNODE_VALENCY=1 # optional for multi-IP hostnames
NWMAGIC=$(jq -r .networkMagic < $GENESIS_JSON)
[[ “${NETWORKID}” = “Mainnet” ]] && HASH_IDENTIFIER=“–mainnet” || HASH_IDENTIFIER=“–testnet-magic ${NWMAGIC}”
[[ “${NWMAGIC}” = “764824073” ]] && NETWORK_IDENTIFIER=“–mainnet” || NETWORK_IDENTIFIER=“–testnet-magic ${NWMAGIC}”

export PATH=“${CNODE_BIN}:${PATH}”
export CARDANO_NODE_SOCKET_PATH=“${CNODE_HOME}/db/socket”

blockNo=$(/usr/local/bin/cardano-cli query tip ${NETWORK_IDENTIFIER} | jq -r .blockNo )

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

if [ ! -d ${CNODE_LOG_DIR} ]; then
mkdir -p ${CNODE_LOG_DIR};
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
EOF

Thanks in advance

Hi There!

I am not sure that topologyUpdater.sh supports testnet… and can cause issues if your node tries to connect a remote node which running on mainnet…

Thanks! Do you mind if I ask how the testnet-topology.sh should be setup then if not through something like topology updater. I set mine up to look like this:

{
“Producers”: [
{
“addr”: “”,
“port”: ,
“valency”: 1
},
{
“addr”: “relays-new.cardano-testnet.iohkdev.io”,
“port”: 3001,
“valency”: 2
}
]
}

Thanks in advance!

sorry, the top addr/port/valency has my block producer details

that is good!

1 Like

Hi!

It seems that testnet topology also supported by topologyUpdater - from source code:
url="https://api.clio.one/htopology/v1/fetch/?max=${MAX_PEERS}&magic=${NWMAGIC}"

and the NWMAGIC comes from the genegis json - so give it a second try to use topologyUpdater for testnet

1 Like