Converting a Validator Operator Address to a Delegator Address

Written by James McDonald

February 5, 2022

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 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

./bech32 shareledger <<< shareledgervaloper16kmusd8fxqkxzhyjsfn4xxxfqlmhf9wfvp85t7


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

mkdir operator-bech32-to-delegator-bech32
cd operator-bech32-to-delegator-bech32
npm init
npm i --save bech32

Save the following as index.js

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);

// 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

echo $(node index.js shareledgervaloper16kmusd8fxqkxzhyjsfn4xxxfqlmhf9wfvp85t7)

If you have a look on 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…



cd "$(dirname "$0")"


OPERATOR_ADDRESS=`slcli -o json query staking validators | jq -r ".[] | select (.description.moniker == \"${MONIKER}\" ) | .operator_address"`



Call it with an argument
./ ShareDutch
# output
OPERATOR_ADDRESS: shareledgervaloper1qc4jkq94gfj643hgf09zyuctxm7xh06zx9e654
DELEGATOR_ADDRESS: shareledger1qc4jkq94gfj643hgf09zyuctxm7xh06zwculu7


Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…