Issuing a New Operational Certificate
A stake pool requires a valid operational certificate to verify that the pool has the authority to run.
A current Key-evolving Signature (KES) key pair is required to establish an operational certificate for a stake pool. A KES period indicates the time span when an operational certificate is valid. An operational certificate expires 90 days after the KES period defined in the operational certificate. Therefore, you must generate a new KES key pair and operational certificate every 90 days, or sooner, for the stake pool that you operate to be able to produce blocks.
The private KES key is required to start the block-producing node in your stake pool configuration. The public KES key is not sensitive.
Issuing an operational certificate also uses a counter that increments by exactly one (1) for each unique operational certificate that a stake pool uses to produce blocks. In a valid operational certificate, the counter value that you use to issue the operational certificate must be consistent with the current counter value for the stake pool registered on the Cardano blockchain by the protocol.
Note | Cardano CLI commands throughout the How to Set Up a Cardano Stake Pool guide may use the |
Determining the Counter Value
To retrieve the current counter value registered by the blockchain protocol for the stake pool that you operate:
- Using a terminal window on the block-producing node in your stake pool configuration, type:cd $NODE_HOMEcardano-cli conway query kes-period-info \--mainnet \--op-cert-file node.cert
The query kes-period-info command returns output similar to:
✓ Operational certificate's KES period is within the correct KES period interval
✓ The operational certificate counter agrees with the node protocol state counter
{
"qKesCurrentKesPeriod": 737,
"qKesEndKesInterval": 742,
"qKesKesKeyExpiry": "2025-11-11T00:00:00Z",
"qKesMaxKESEvolutions": 62,
"qKesNodeStateOperationalCertificateNumber": 3,
"qKesOnDiskOperationalCertificateNumber": 3,
"qKesRemainingSlotsInKesPeriod": 640357,
"qKesSlotsPerKesPeriod": 129600,
"qKesStartKesInterval": 680
}
The value of the qKesNodeStateOperationalCertificateNumber key indicates the current counter value registered by the blockchain protocol for the stake pool that you operate. The value of the qKesOnDiskOperationalCertificateNumber key indicates the counter value of the current operational certificate that the stake pool uses.
For a new operational certificate, the counter value must be exactly one (1) greater than the current value of the qKesNodeStateOperationalCertificateNumber key.
If qKesOnDiskOperationalCertificateNumber is more than one (1) greater than the value of qKesNodeStateOperationalCertificateNumber then the operational certificate is invalid. A stake pool cannot produce blocks using an invalid operational certificate.
Challenge | To return results of the |
Producing a Block For the First Time
When the stake pool that you operate has produced zero (0) blocks, then no value for qKesNodeStateOperationalCertificateNumber is registered by the blockchain protocol. Therefore, retrieving the current counter value for your stake pool returns the value null for the qKesNodeStateOperationalCertificateNumber key.
After a stake pool produces a block for the first time, then retrieving the current counter value returns the value zero (0) for the qKesNodeStateOperationalCertificateNumber key.
Therefore, when the stake pool that you operate has produced zero (0) blocks, you MUST set the value zero (0) for the qKesOnDiskOperationalCertificateNumber key so that the stake pool may produce a block successfully when elected to produce a block for the first time.
Setting the Counter Value
When you issue a new operational certificate, a node.counter file sets the counter value for the new certificate.
Note | If you follow the How to Set Up a Cardano Stake Pool guide, then you created a |
When you run the query kes-period-info command, if the value of the qKesOnDiskOperationalCertificateNumber key equals the value of the qKesNodeStateOperationalCertificateNumber key, then the stake pool that you operate produced at least one block using the current operational certificate and you do NOT need to set the counter value manually.
If the value of the qKesOnDiskOperationalCertificateNumber key is greater than the value of the qKesNodeStateOperationalCertificateNumber key, then prior to issuing a new operational certificate you need to set the counter value using the following procedure.
To set the counter value for issuing a new operational certificate:
- To create a new
node.counterfile having the required counter value, if the current value of theqKesNodeStateOperationalCertificateNumberkey isnullthen type the following command using a terminal window on the air-gapped, offline computer:cd $HOME/cold-keyscardano-cli conway node new-counter \--cold-verification-key-file $HOME/cold-keys/node.vkey \--counter-value 0 \--operational-certificate-issue-counter-file node.counterOR If the current value of theqKesNodeStateOperationalCertificateNumberkey is NOTnull, then type the following command using a terminal window on the air-gapped, offline computer where<NodeCertificateNumber>is the current value of theqKesNodeStateOperationalCertificateNumberkey:cd $HOME/cold-keyscardano-cli conway node new-counter \--cold-verification-key-file $HOME/cold-keys/node.vkey \--counter-value $(( <NodeCertificateNumber> + 1 )) \--operational-certificate-issue-counter-file node.counter - To display the contents of the
node.counterfile that you created in step 1, type:cat $HOME/cold-keys/node.counterNote

When you generate a new
node.counterfile, the value of thedescriptionkey is empty until you issue a new operational certificate.
Issuing a New Operational Certificate
To issue a new operational certificate:
- Using a terminal window on the block-producing node in your stake pool configuration, type the following commands to generate a new KES key pair:cd $NODE_HOMEcardano-cli conway node key-gen-KES \--verification-key-file kes.vkey \--signing-key-file kes.skey
- Using removable media, copy the
$NODE_HOME/kes.vkeyfile from the block-producing node to$NODE_HOME/kes.vkeyon the air-gapped, offline computer. - To back up the current operational certificate, type the following command using a terminal window on the block-producing node:mv $NODE_HOME/node.cert $NODE_HOME/node.cert.bak
- To issue a new operational certificate, you must set a starting KES period. Set the current KES period as the starting KES period for the new operational certificate. To calculate the current KES period, type the following commands using a terminal window on the block-producing node in your stake pool configuration when the local copy of the Cardano blockchain ledger is fully synchronized:# Retrieve the number of slots per KES period using the key named slotsPerKESPeriod in the Shelley Genesis JSON configuration file that the stake pool usesslotsPerKESPeriod=$(cat $NODE_HOME/shelley-genesis.json | jq -r '.slotsPerKESPeriod')# Query the current slot height of the blockchain, and then retrieve the value of the slot key in the resultscurrentSlot=$(cardano-cli conway query tip --mainnet | jq -r '.slot')# To calculate the current KES period, divide the current slot height by the number of slots per KES periodcurrentKesPeriod=$(( ${currentSlot} / ${slotsPerKESPeriod} ))StartingKESPeriod=${currentKesPeriod}echo StartingKESPEriod: ${StartingKESPeriod}
Note

Remember that in the Cardano ecosystem, a slot occurs every second. For a more detailed procedure to calculate the current KES period, see the topic Configuring the Block Producer.
- To issue a new operational certificate, type the following command using a terminal window on the air-gapped, offline computer where
<StartingKESPeriod>is the value that you calculated in step 4:cardano-cli conway node issue-op-cert \--kes-verification-key-file $NODE_HOME/kes.vkey \--cold-signing-key-file $HOME/cold-keys/node.skey \--operational-certificate-issue-counter $HOME/cold-keys/node.counter \--kes-period <StartingKESPeriod> \--out-file $NODE_HOME/node.certNote

After issuing a new operational certificate, the value of the
node.counterfile automatically increments by one (1) - Using removable media, copy the
$NODE_HOME/node.certfile that you created in step 5 to$NODE_HOME/node.certon the block-producing node in your stake pool configuration. - To restart the Cardano Node instance running on the block-producing node, type:sudo systemctl restart cardano-node
- To verify the operational certificate that you issued in step 5, wait until the block-producing node starts, and then type the following command using a terminal window:cardano-cli conway query kes-period-info \--mainnet \--op-cert-file $NODE_HOME/node.cert
In the results of the query kes-period-info command, prior to a stake pool producing a block using a new operational certificate, in a valid operational certificate the value of the qKesOnDiskOperationalCertificateNumber key is greater than the value of the qKesNodeStateOperationalCertificateNumber key by exactly one (1) For example:
✓ Operational certificate's KES period is within the correct KES period interval
✓ The operational certificate counter ahead of the node protocol state counter by 1
{
"qKesCurrentKesPeriod": 737,
"qKesEndKesInterval": 799,
"qKesKesKeyExpiry": "2026-02-04T12:00:00Z",
"qKesMaxKESEvolutions": 62,
"qKesNodeStateOperationalCertificateNumber": 3,
"qKesOnDiskOperationalCertificateNumber": 4,
"qKesRemainingSlotsInKesPeriod": 8015644,
"qKesSlotsPerKesPeriod": 129600,
"qKesStartKesInterval": 737
}
The first time that a stake pool produces a block using a new operational certificate, the value of the qKesNodeStateOperationalCertificateNumber increments by one (1) to equal the value of the qKesOnDiskOperationalCertificateNumber key.
Challenge | Write a Bash script to automate tasks related to issuing a new operational certificate on the block-producing node in your stake pool configuration. Write another Bash script to automate related tasks on the air-gapped, offline computer. Alternately, implement third-party scripts available in Appendix D: Community Projects. |
