Skip to content

Instantly share code, notes, and snippets.

@ahaxu
Created November 17, 2021 05:38
Show Gist options
  • Save ahaxu/13bede862e2fcd306501962f97ef31c1 to your computer and use it in GitHub Desktop.
Save ahaxu/13bede862e2fcd306501962f97ef31c1 to your computer and use it in GitHub Desktop.
Cardano node - rotate KES key
#!/bin/bash
# check zip in xxx
# usage:
# ./rotate-kes.sh \
# /path-to/kes.vkey \
# /path-to/cold.skey \
# /path-to/cold.counter
if [ -z "$1" ]
then
echo "Please provide kes.vkey"
exit 1
fi
if [ -z "$2" ]
then
echo "Please provide cold.skey"
exit 1
fi
if [ -z "$3" ]
then
echo "Please provide cold.counter"
exit 1
fi
KES_VKEY=$1
COLD_SKEY=$2
COLD_COUNTER=$3
SLOT_PER_KES=`cat mainnet-shelley-genesis.json | jq '.slotsPerKESPeriod'`
CURR_SLOT=`cardano-cli query tip --mainnet | jq '.slot'`
KES_PERIOD=$((CURR_SLOT/SLOT_PER_KES))
echo "Current period $KES_PERIOD"
cardano-cli node issue-op-cert \
--kes-verification-key-file $KES_VKEY \
--cold-signing-key-file $COLD_SKEY\
--operational-certificate-issue-counter $COLD_COUNTER \
--kes-period $KES_PERIOD \
--out-file node.cert
echo "Done!! Check your node.cert file"
echo "Remember to delete cold key files"
exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment