Many of the slcli
commands use either the OPERATOR_ADDRESS (starts with shareledgervaloper) or the DELEGATOR_ADDRESS (starts with shareledger) as arguments.
For some reason I couldn't find a command to output the DELEGATOR_ADDRESS (Self-Delegate Address) using the slcli
but explorer.shareri.ng shows it

So I discovered that the DELEGATOR_ADDRESS is derived from the OPERATOR_ADDRESS so I needed to convert the ShareRing Validator Operator Address to the Self-Delegate Address
You can use a bech32 convert cli command or node
Option 1 - Use bech32 cli
1 2 3 | ./bech32 shareledger <<< shareledgervaloper16kmusd8fxqkxzhyjsfn4xxxfqlmhf9wfvp85t7 #output shareledger16kmusd8fxqkxzhyjsfn4xxxfqlmhf9wfyuz3r4 |
Download https://github.com/input-output-hk/bech32/releases
Option 2 - The nodejs bech32 module
I found a snippet in the source of the Github project I think ShareRing Explorer was originally forked from
I then copied the function into a node project
1 2 3 4 | mkdir operator-bech32-to-delegator-bech32 cd operator-bech32-to-delegator-bech32 npm init npm i --save bech32 |
Save the following as index.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | const { bech32 } = require( "bech32" ); const operatorAddress = process.argv.slice(2)[0]; const bech32PrefixAccAddr = "shareledger" const getDelegator = (operatorAddr) => { let address = bech32.decode(operatorAddr); // console.log(address); // console.log(address.words.length) return bech32.encode(bech32PrefixAccAddr, address.words); } process.stdout.write(getDelegator(operatorAddress)); // use console.log(getDelegator(operatorAddress)); if you want a \n after the returned delegatorAddress |
Run the above with node and a bash command line argument
1 2 3 | echo $(node index.js shareledgervaloper16kmusd8fxqkxzhyjsfn4xxxfqlmhf9wfvp85t7) #output shareledger16kmusd8fxqkxzhyjsfn4xxxfqlmhf9wfyuz3r4 |
If you have a look on https://explorer.shareri.ng the above shareledgervaloper is from the Curio node which I think might be a node run / owned by ShareRing
So you can wrap the node snippet in a bash script and it will provide the delegator address something I haven't figure out how to get with the slicli as yet...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | #!/bin/bash # getNodeAddress.sh cd "$(dirname " $0 ")" MONIKER=${1:-Curio} OPERATOR_ADDRESS=`slcli -o json query staking validators | jq -r ".[] | select (.description.moniker == \"${MONIKER}\" ) | .operator_address" ` DELEGATOR_ADDRESS=$(node index.js $OPERATOR_ADDRESS) echo "OPERATOR_ADDRESS: $OPERATOR_ADDRESS" echo DELEGATOR_ADDRESS: $DELEGATOR_ADDRESS |
1 2 3 4 5 | Call it with an argument . /getNodeAddress .sh ShareDutch # output OPERATOR_ADDRESS: shareledgervaloper1qc4jkq94gfj643hgf09zyuctxm7xh06zx9e654 DELEGATOR_ADDRESS: shareledger1qc4jkq94gfj643hgf09zyuctxm7xh06zwculu7 |
0 Comments