Renew KES Keys
Typical procedure for renewing KES keys
Please note: paths in this guide are based on Coincashew guide on how to build a stake pool. Please adjust paths as necessary.
Step 1 - Find the starting KES period
On node run the following commands:
Write down this number you will need it when you run the steps on your Air Gapped Machine.
Step 2 - Look up Operational Certificate Numbers
There are two different methods you can use, please review and select your preferred method.
When it's time to update your KES you can run the following command on your block producer to confirm you have the correct Operational Certificate Numbers
Note path to node.cert and adjust if needed. Path in example is based off Coincashew guide for setting up a stake pool.
Results should look similar to the following:
This line is the Operational Certificate that your pool used to mint its last block "qKesNodeStateOperationalCertificateNumber": 4,
This line is the counter number of your current Operational Certificate: "qKesOnDiskOperationalCertificateNumber": 4,
If these number are NOT the same, as for the example above NodeState=4 and OnDisk=5 then you need to rollback your counter. In this case the node counter would need to be rolled back from 5 to 4
Also If you have never made a block then you will need to rollback your counter to 0
To rollback your counter see our guide here If, for example, NodeState and OnDisk =4, then you are all set and can proceed.
Write down this number you will need it when you run the steps on your Air Gapped Machine.
Step 3 - Make a new KES pair
KES files in this example with be created to our $NODE_HOME directory. Adjust if needed.
In this step we will create a new KES pair (kes.vkey and kes.skey)
Step 4 - Verify the current value of your node.counter is valid.
node.counter MUST be ONE greater than the most recently created block's OpCertC or "qKesNodeStateOperationalCertificateNumber" value. Depending which method you used in Step 2
For example, if your OpCertC value is 4 for your last block, then your node.counter should read "Next certificate issue number: 5" Likewise if you used CLI method if "qKesNodeStateOperationalCertificateNumber": 4, our node.counter should read "Next certificate issue number: 5"
If your "Next certificate issue number" is one higher you are all set and can continue to the Step 5.
Step 5 - Create the new node.cert
Update <startKesPeriod> with the value from above from Step 1
Then run this command by replacing "<startKesPeriod>" with correct number from Step 1 Example: --kes-period 503 \
Step 6 - Copy node.cert and kes.skey back to your block producer node.
Copy your new node.cert and kes.skey file to your block producer node
Step 7 - Restart Node on block producer
Now restart cardano node on your block producer with following command
Step 8 - Check if correct
Once you update your KES you can run the following command on your block producer to confirm you have the correct OpCertC
Note path to node.cert and adjust if needed. Path in example is based off Coincashew guide for setting up a stake pool.
Results should look similar to the following:
The first line after checks should show last node counter. For our example the last OpCertC number for our last block was 4. So it should read: "qKesNodeStateOperationalCertificateNumber": 4,
The third line should match the next certificate issue number that we wanted. So, for our example it needed to be 5, ONE number higher than the OpCertC of 4. So it should look like: "qKesOnDiskOperationalCertificateNumber": 5,
Make note of "qKesKesKeyExpiry": date.
Congratulations you did it!
Step 10 - Back up
If update successful:
Best practice recommendation: It's now a good time to make a new backup of your new node.counter file and cold-keys directory to another USB drive or other offline location.
Contributors
Thanks to the following pools for helping to put together these guides. Please consider delegating to their pools to support them. Are you a pool? Consider buying them a coffee
Last updated