How to query delegator info for stake pool from command line?

I run a stake pool and am trying to figure out how I can query via command line who the current delegators are in the current epoch and how much active stake they each have.

Is this something I can do with cardano-cli? Or is there another commandline tool I can use?

I’m trying to automate a lottery function for the pool.


I’m interested in this one as well

I would advise you to check out They offer a free plan that will help you do what you want, quite easily.

1 Like

Agree on the Blockfrost suggestion. Very easy using curl to automate collection of stats and process using bash, or if you prefer nodejs so you can process the json output and use in your website…

We use them for ADAvault plus some other data from coin gecko, and cncli. Happy to share how.

1 Like

Hey @cyberruss How do you do it ? Thanks

You could also use

$ curl ""

The epoch number is optional:

$ curl ""

@HeptaSean im using code from api blockfrost curl -H “project_id: mainne” --output delegs.json

but only shows the stake address any chance that could show the full address?

You can use{stake_address}~1addresses/get to get all addresses for a stake address.

There is not really the full address except if you are using single address apps like Nami or CNTOOLS.


@HeptaSean from that code i was abble to get the address i need but on at the time , can i use this code for more than one stake adress at the same time?

thanks for your help!

No, unfortunately not. That may cost some requests. Or you switch to identifying wallets/accounts/users by stake address instead of full address.

ok, @HeptaSean so mostly every epoch pool operators that send air drops for the delegators wallets , seek one by one from the stake address?

also quick question , the rewards for the delegators is send out automatically when the block is minted and only the pools owner reward that need to be retrived later for another wallet for exemple?

Ah, if that is the use case, you could just cache the stake address – receive address association in a database.

The rewards for the delegators and the pool are both distributed automatically by the protocol to the corresponding stake addresses.

So, the pool does not have to do anything to distribute them to the delegators.

Ah, if that is the use case, you could just cache the stake address – receive address association in a database.

How can i do that ? :smiley: :smiley:

Oh, I just assumed that you were already doing that in some programming language.

Do you know/like one?

not realy , there is a easy way to do it , maybe i can folow some walkthrough

You could try this script:


# Things we need:
for cmd in curl jq awk
    if ! command -v ${cmd} > /dev/null 2>&1
        echo "Command ${cmd} is required. Please install."
if [ "${all_there}" != true ]
    exit 1
    echo "BLOCKFROST_PROJECT_ID has to be set:"
    echo "     export BLOCKFROST_PROJECT_ID=\"mainnetXXXXX\""
    exit 1
if [ -z "${1}" ]
    echo "First argument has to be the pool ID."
    exit 1

# Get stake addresses and put them in file stake_addresses:
curl -s -H "project_id: ${BLOCKFROST_PROJECT_ID}" \${1}/delegators | \
    jq -r '.[] | .address' > stake_addresses

# Get receive addresses and put them in file stake_receive_addresses:
if [ -f stake_receive_addresses ]
    mv stake_receive_addresses old_stake_receive_addresses
while read stake_address
    if ! grep "^${stake_address}" old_stake_receive_addresses 2> /dev/null
        echo -n "${stake_address} "
        curl -s -H "project_id: ${BLOCKFROST_PROJECT_ID}" \
  ${stake_address}/addresses | \
            jq -r '.[0] | .address'
done < stake_addresses > stake_receive_addresses

# Put just the receive addresses in file recevive_addresses:
awk '{print $2}' stake_receive_addresses > receive_addresses

As usual with scripts, put it in a text file, make it executable with chmod +x (or however you have called it) and then you can execute it by ./ in the same directory, put it somewhere in your $PATH or whatever.

The script wants to have the Blockfrost project ID in an environment variable and the pool ID as first and only argument. It creates a bunch of files in the current directory: stake_addresses with only the stake addresses, stake_receive_addresses with both, stake and receive addresses, and receive_addresses with just the receive addresses.

If stake_receive_addresses is there from a previous run, the stake addresses are searched in that file with grep and curl to Blockfrost is only used if they are not found.

1 Like

Thanks @HeptaSean ,Worked Great .

1 Like

Glad it helped!

I’d normally do something like that in Python, but I hoped that a shell script is closer to what you already know and you can track what’s happening there.

Hey @HeptaSean Thank You. Do you know a way to distribute Native Tokens to Delegators? and there is a way to know from a script if those wallets have a specific NFT and how many of them, similar how hosky do it ?

@HeptaSean Hey , is there a way to modify this code to see in those address if they have a nft in it and how many? maybe using the code{asset}/addresses , and also how much adas each have staked ? Thanks!