Configuring Slot Leader Calculations

🔥 Hot tip: You can calculate your slot leader schedule, which tells you when it's your stake pools turn to mint a block. This can help you know what time is best to schedule maintenance on your stake pool. It can also help verify your pool is minting blocks correctly when it is your pool's turn. This is to be setup and run on the block producer node.

Since version 1.34, it is possible to check the slot leadership schedule for the current and next epoch using cardano-cli.

Next epoch's leadership schedule becomes available 1.5 days (36 hours) before the end of the current epoch.


Next epoch's leadership schedule is obtained with the following:

cardano-cli conway query leadership-schedule \
--mainnet \
--genesis $NODE_HOME/shelley-genesis.json \
--stake-pool-id $(cat $NODE_HOME/stakepoolid.txt) \
--vrf-signing-key-file $NODE_HOME/vrf.skey \
--next

Current epoch's leadership schedule is obtained with the following:

cardano-cli conway query leadership-schedule \
--mainnet \
--genesis $NODE_HOME/shelley-genesis.json \
--stake-pool-id $(cat $NODE_HOME/stakepoolid.txt) \
--vrf-signing-key-file $NODE_HOME/vrf.skey \
--current

Example leadership schedule output:

[
    {
        "slotNumber": 88241103,
        "slotTime": "2025-08-11T07:25:03Z"
    },
    {
        "slotNumber": 88242465,
        "slotTime": "2025-08-11T07:47:45Z"
    },
    {
        "slotNumber": 88254698,
        "slotTime": "2025-08-11T11:11:38Z"
    },
    {
        "slotNumber": 88267859,
        "slotTime": "2025-08-11T14:50:59Z"
    },
    {
        "slotNumber": 88280570,
        "slotTime": "2025-08-11T18:22:50Z"
    },
    {
        "slotNumber": 88281213,
        "slotTime": "2025-08-11T18:33:33Z"
    },
    {
        "slotNumber": 88283929,
        "slotTime": "2025-08-11T19:18:49Z"
    },
    {
        "slotNumber": 88292543,
        "slotTime": "2025-08-11T21:42:23Z"
    }
]

🔁 Automate the process with Cronjob:

The automation of this process will work with the following method, as said, next epoch blocks can be checked 1.5 days before the start of the next epoch or at the 75% of the current epoch's completion. What the script will do, is to calculate the correct day and hour to run the command, then wait until it is possible to do that and once the selected time comes, run the check listed below. Once finished, it will redirect the output into a log file that can be analyzed.

Credits to Techs2help for developing the script.

Create the leaderScheduleCheck.sh script file in the block producer (script can also be run on a relay node but vrf.skey needs to be exported there) and paste the following code inside of it:

Set the following variables with your data:

Add execution permissions and test that the script is running without errors:

If everything is working correctly, an output as the follow will be presented:

Current epoch: 199 Epoch start time: 04/14/22 20:20:16 Epoch end time: 04/19/22 20:10:16 Current cron execution time: 04/18/22 15:37:51 Next check time: 04/18/22 14:12:46 [...] Cutted output cause it can vary based on time when the script is ran

Configure Cronjob to make the script run automatically:

To configure the job at the start of an epoch, keep in mind the following information:

  • Epoch in MAINNET starts at 21:45 UTC

Find the time when the cronjob should start:

Cronjobs run based on local timezone, not on UTC hours. \

Find timezone:

timedatectl | grep "Time zone"

Once you found your timezone, you need to understand when run the job (It isn't mandatory to run it at epoch's starting hour). Here is an example with a UTC+2 timezone for Mainnet:

Epoch starting hour UTC: 21:45 Epoch starting hour for requested timezone: 23:45 Cronjob will be set to run at 23:45

Add cronjob and edit parameters based on your needs, PATH, NODE_HOME, NODE_CONFIG, CARDANO_NODE_SOCKET_PATH, MM, HH, path_to_script and desired_log_folder:

Last updated