Can you post the exact script you are using, and tell me exactly when you executed it and for each epoch?
You wrote:
I ran the
cardano-cli query ledger-stateand dumped
ledger-state.json to
but the usage does not need it.
You need to query stake snapshot and extract POOL_STAKE and ACTIVE_STAKE, then calculate the leaderlog.
SNAPSHOT=$(/usr/local/bin/cardano-cli query stake-snapshot --mainnet --stake-pool-id ${POOL_ID})
POOL_STAKE=$(jq .poolStakeMark <<< ${SNAPSHOT})
ACTIVE_STAKE=$(jq .activeStakeMark <<< ${SNAPSHOT})
If you use poolStakeMark and activeStakeMark, you can calculate for the next epoch, when there are less than 36 hours before the epoch ends:
cncli leaderlog --ledger-set next ....
and if you want for the current epoch, then you have to use poolStakeSet and activeStakeSet
POOL_STAKE=$(jq .poolStakeSet <<< ${SNAPSHOT})
ACTIVE_STAKE=$(jq .activeStakeSet <<< ${SNAPSHOT})
and run
cncli leaderlog --ledger-set current ....
Did you do this?
Sure, here is my script that runs the leaderlog for the current epoch. Itâs based on the coincashew guide, but itâs the same as the Andrew Westberg script.
#!/usr/bin/env bash
/usr/local/bin/cncli sync --host 127.0.0.1 --port 6000 --no-service
MYPOOLID=$(cat $NODE_HOME/stakepoolid.txt)
echo "LeaderLog - POOLID $MYPOOLID"
SNAPSHOT=$(/usr/local/bin/cardano-cli query stake-snapshot --stake-pool-id $MYPOOLID --mainnet)
POOL_STAKE=$(echo "$SNAPSHOT" | grep -oP '(?<= "poolStakeMark": )\d+(?=,?)')
ACTIVE_STAKE=$(echo "$SNAPSHOT" | grep -oP '(?<= "activeStakeMark": )\d+(?=,?)')
MYPOOL=`/usr/local/bin/cncli leaderlog --pool-id $MYPOOLID --pool-vrf-skey ${NODE_HOME}/vrf.skey --byron-genesis ${NODE_HOME}/mainnet-byron-genesis.json --shelley-genesis ${NODE_HOME}/mainnet-shelley-genesis.json --pool-stake $POOL_STAKE --active-stake $ACTIVE_STAKE --ledger-set current`
echo $MYPOOL | jq .
EPOCH=`echo $MYPOOL | jq .epoch`
echo "\`Epoch $EPOCH\` đ§đź:"
SLOTS=`echo $MYPOOL | jq .epochSlots`
IDEAL=`echo $MYPOOL | jq .epochSlotsIdeal`
PERFORMANCE=`echo $MYPOOL | jq .maxPerformance`
echo "\`MYPOOL - $SLOTS \`đ°\`, $PERFORMANCE% \`đmax, \`$IDEAL\` đ§±ideal"
The, if you read your script and my previous message, it is clear why it is wrong.
You are using the stake values for next epoch to calculate the leaderlog for the current epoch.
You should update it to use:
POOL_STAKE=$(jq .poolStakeSet <<< ${SNAPSHOT})
ACTIVE_STAKE=$(jq .activeStakeSet <<< ${SNAPSHOT})
or
POOL_STAKE=$(echo "$SNAPSHOT" | grep -oP '(?<= "poolStakeSet": )\d+(?=,?)') ACTIVE_STAKE=$(echo "$SNAPSHOT" | grep -oP '(?<= "activeStakeSet": )\d+(?=,?)')
(if you prefer to use grep
instead of jq
) for the current epoch.
1 Like
Great catch George! I simply copied one of the scripts and changed out the ledger-set values (prev
,current
,next
). I didnât notice the stake property name differences. Thanks to you, I have fixed them.
As long as weâre on this subject. Maybe you know the answer to these questions:
-
Where can one see the nonce value of each epoch, so that we can compare to the script output? I could not find it on cardanoscan.io.
-
Last epoch, I ran the ReLeaderLogs
script, which queries Blockfrost API using python (github repo). This script gave me back 2 assigned slots. However, I only minted one block last epoch, so I assumed I missed the 2nd block. Just now, I ran the cncli-leaderlogs-prev.sh
script, and it only shows one assigned slot, which matches the one I minted. Is the cncli-leaderlogs-prev.sh
script only showing the assigned slots that produced blocks? Iâm guessing that it doesnât cull out the missed slots, so maybe I was only meant to get one assigned block after all. But, thatâs just a guess.
Thanks
Iâm glad itâs working now!
-
the nonce must be calculated, I did not see it on any cardano explorer.
You can calculate it for the next epoch (when there are less than 36 hours until the current epoch ends) like this:
/usr/local/bin/cncli nonce
âledger-set next
âbyron-genesis ~/cardano-node/config/mainnet-byron-genesis.json
âshelley-genesis ~/cardano-node/config/mainnet-shelley-genesis.json
âdb ~/cardano-node/cncli-db/cncli.db
(of course with you correct paths to the files)
-
I donât think the leaderlog for the previous epoch is checking the minted blocks. Iâm sure it is calculating the slots just as for the current epoch and next epoch.
1 Like