How to configure topologyUpdater.sh + relay-topology_pull.sh for testnet

Hello,

After a couple of days of a running testnet pool today morning I saw no more TX processed in my graphana:

I already tried restarting the nodes and also had a look at journalctl but nothing helpful to see there.

This is my testnet-topology.json:

testnet-relay-2:~/cardano-my-node$ cat testnet-topology.json
{
  "Producers": [
   {
        "addr": "*CENSORED*",
        "port": 6000,
        "valency": 1
    },
   {
      "addr": "relays-new.cardano-testnet.iohkdev.io",
      "port": 3001,
      "valency": 2
    }
  ]
}

I know about the topology updater and pull scripts from coincashew guide but had troubles with it. Can this be the cause for my problem?

I advertised my relay for a 4 hours with the topologyupdater script successfully, pulled new topology but got back mainnet configs. It was stated here that I simply can change to own topology.json: Topology updater on testnet is adding mainnet peers to my relay

You need to pass the magic query parameter to topology updater which corresponds to the main testnet one.

To be on the safe side pass it in both scripts, the one that sends the heartbeat every hour and the one that pulls the topology.

To the topologyUpdater URL in the script add &magic=1097911063 for the testnet.

So I did it again and seems like now I got my mistake when tried first: I used ‘&magic=${NWMAGIC}’ but that variable is not defined in the relay-topology_pull.sh. For every one that will follow to struggle how to do it here are my complete changes:

topologyUpdater.sh :

cat topologyUpdater.sh 
#!/bin/bash
# shellcheck disable=SC2086,SC2034
 
USERNAME=$(whoami)
CNODE_PORT=6000 
CNODE_HOSTNAME=<RELAYIP>
CNODE_BIN="/usr/local/bin"
CNODE_HOME=$NODE_HOME
CNODE_LOG_DIR="${CNODE_HOME}/logs"
GENESIS_JSON="${CNODE_HOME}/testnet-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 .block )
 
# 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

relay-topology_pull.sh

cat relay-topology_pull.sh 
#!/bin/bash
BLOCKPRODUCING_IP=<COREIP>
BLOCKPRODUCING_PORT=6000
curl -s -o /home/*CENSORED*/cardano-my-node/testnet-topology.json "https://api.clio.one/htopology/v1/fetch/?max=20&magic=1097911063&customPeers=${BLOCKPRODUCING_IP}:${BLOCKPRODUCING_PORT}:1|relays-new.cardano-testnet.iohkdev.io:3001:2"

The results in testnet-topology.json after pulling with script:

cat testnet-topology.json 
{ "resultcode": "201", "networkMagic": "1097911063", "ipType":4, "requestedIpVersion":"4", "Producers": [ 
  { "addr": "*CENSORED*", "port": 6000, "valency": 1 } ,
  { "addr": "relays-new.cardano-testnet.iohkdev.io", "port": 3001, "valency": 2 } ,
  { "addr": "95.179.169.157", "port": 7700, "valency": 1, "distance":2,  "continent":"EU",  "country":"DE",  "region":"HE" },
  { "addr": "75.119.159.134", "port": 6000, "valency": 1, "distance":183,  "continent":"EU",  "country":"DE",  "region":"NW" },
  { "addr": "116.203.38.64", "port": 3003, "valency": 1, "distance":185,  "continent":"EU",  "country":"DE",  "region":"BY" },
  { "addr": "173.212.206.178", "port": 3001, "valency": 1, "distance":307,  "continent":"EU",  "country":"DE",  "region":"BY" },
  { "addr": "78.23.133.211", "port": 6000, "valency": 1, "distance":316,  "continent":"EU",  "country":"BE",  "region":"BRU" },
  { "addr": "95.179.143.207", "port": 3001, "valency": 1, "distance":377,  "continent":"EU",  "country":"NL",  "region":"NH" },
  { "addr": "cnode.ch", "port": 3003, "valency": 1, "distance":473,  "continent":"EU",  "country":"CH",  "region":"GE" },
  { "addr": "45.147.54.171", "port": 6000, "valency": 1, "distance":633,  "continent":"EU",  "country":"GB",  "region":"ENG" },
  { "addr": "testnet.ada.vegas", "port": 7004, "valency": 1, "distance":693,  "continent":"EU",  "country":"GB",  "region":"ENG" },
  { "addr": "34.254.146.217", "port": 6000, "valency": 1, "distance":1085,  "continent":"EU",  "country":"IE",  "region":"L" },
  { "addr": "195.191.47.220", "port": 6000, "valency": 1, "distance":1450,  "continent":"EU",  "country":"RO",  "region":"B" },
  { "addr": "relaynode1.rikishi.info", "port": 6001, "valency": 1, "distance":2017,  "continent":"AS",  "country":"RU",  "region":"MOW" },
  { "addr": "73.16.61.164", "port": 3000, "valency": 1, "distance":5999,  "continent":"NA",  "country":"US",  "region":"MA" },
  { "addr": "23.94.134.119", "port": 5001, "valency": 1, "distance":6340,  "continent":"NA",  "country":"NL",  "region":"NY" },
  { "addr": "52.149.218.236", "port": 6000, "valency": 1, "distance":6605,  "continent":"NA",  "country":"US",  "region":"VA" },
  { "addr": "35.237.39.9", "port": 6000, "valency": 1, "distance":7174,  "continent":"NA",  "country":"US",  "region":"SC" },
  { "addr": "12.105.221.218", "port": 6003, "valency": 1, "distance":7745,  "continent":"NA",  "country":"US",  "region":"FL" },
  { "addr": "12.105.221.218", "port": 6005, "valency": 1, "distance":7745,  "continent":"NA",  "country":"US",  "region":"FL" },
  { "addr": "ec2-44-241-94-172.us-west-2.compute.amazonaws.com", "port": 3001, "valency": 1, "distance":8245,  "continent":"NA",  "country":"US",  "region":"OR" },
  { "addr": "us.netspectrum.com", "port": 3001, "valency": 1, "distance":9119,  "continent":"NA",  "country":"US",  "region":"CA" }

it wasnt mentioned anywhere how it has to look so that is probably why some like me are not able to do it properly. I will change the topic accordingly so people can find it

e: works now

1 Like

Hello guys, I came across the same thing and now I “solved” the scripts as @efkay did.
Both topologyUpdater.sh and relay-topology_pull.sh is working properly but in my case I still dont see TX processed increasing.

Do I have to wait 24hs or something like that?
should I wait until I see my relay ip in here? (https://explorer.cardano-testnet.iohkdev.io/relays/topology.json)

I have the script topologyUpdater.sh running hourly with more than 20 results as this →
{ "resultcode": "204", "datetime":"2021-09-28 23:48:59", "clientIp": "<RELAY_EXTERNAL_IP>", "iptype": 4, "msg": "glad you're staying with us" }

Maybe you don’t see the Processed TX in gLiveView increasing because TraceMempool is set to false in your config.json file. Check that first, set it to true and restart the node. And if you then see the TX increasing, you should set TraceMempool back to false on the relay in order to save some CPU. And you should also know that we don’t exactly know for sure what are the consequences of turning off this very parameter : [Documentation] - TraceMempool: practical usage for relays · Issue #2350 · input-output-hk/cardano-node · GitHub

Hi Guys, @TSAR_stakepool
Thanks for posting.
Indeed now worked after over night waiting, TX Processed is increasing. (very happy here)
I have set TraceMempool to true in the BP node (I guess in BP I wouldnt never change to false) in relay node it is false

:sunny:
BP_working|367x528