Configuring the Block Producer
To operate a stake pool, in addition to a wallet you need to generate the following key pairs and related files:
- Key-evolving Signature (KES) Hot Keys—Used to validate the operational certificate for a stake pool, verifying that the pool has the authority to run. You must generate a new KES key pair and operational certificate every 90 days. Generating an operational certificate uses an incrementing counter file to count how many operational certificates your stake pool uses.
- Cold Keys—Used to register a stake pool; update registration certificate parameters; rotate KES keys and operational certificates; and, retire a stake pool.
- Verifiable Random Function (VRF) Hot Keys—Used to determine when a block-producing node is elected to prepare a block
For more details, see Cardano Key Pairs.
The How to Set Up a Cardano Stake Pool guide uses the following file names throughout for the stake pool key pairs and related files:
- KES Keys—
kes.vkeyandkes.skey - Operational Certificate—
node.cert - Incrementing Counter File—
node.counter - Cold Keys—
node.vkeyandnode.skey - Stake Pool Registration Certificate—
pool.cert - VRF Keys—
vrf.vkeyandvrf.skey
Note | Cardano CLI commands throughout the How to Set Up a Cardano Stake Pool guide may use the |
To generate a KES key pair:
- On the computer designated as the block-producing node in your stake pool configuration, type the following commands using a terminal window:
cd $NODE_HOME
cardano-cli conway node key-gen-KES \
--verification-key-file kes.vkey \
--signing-key-file kes.skey
To generate a cold key pair and incrementing counter file:
- On your air-gapped, offline computer type the following commands using a terminal window:
mkdir $HOME/cold-keys
cd $HOME/cold-keys
cardano-cli conway node key-gen \
--cold-verification-key-file $HOME/cold-keys/node.vkey \
--cold-signing-key-file $HOME/cold-keys/node.skey \
--operational-certificate-issue-counter $HOME/cold-keys/node.counterImportant

To ensure that your Cardano stake pool operating on Mainnet remains secure, do NOT use or store the
node.skeysecret signing key file for your stake pool on a computer that connects to a network or the Internet. - Carefully back up the cold keys that you generated in step 1 using a secure and comprehensive backup strategy.
Important

If you lose the cold keys, then you permanently lose access to your stake pool.
- Using removable media, copy the
$HOME/cold-keys/node.vkeypublic verification key file to the$NODE_HOMEfolder on the computer designated as the block-producing node in your stake pool configuration.
To generate an operational certificate:
- To verify that the Cardano Node instance designated as the block producer in your stake pool configuration is fully synchronized with the network, confirm that the values of the
cardano.node.metrics.epoch.intandcardano.node.metrics.slotInEpoch.intEKG metrics are equal to the current network epoch and slot values available using a Cardano blockchain explorer. - To calculate the current KES period:
- On the computer designated as the block-producing node in your stake pool configuration, type the following commands using a terminal window to retrieve the number of slots per KES period for your environment using the Shelley Genesis file:
slotsPerKESPeriod=$(cat $NODE_HOME/shelley-genesis.json | jq -r '.slotsPerKESPeriod')
echo slotsPerKESPeriod: ${slotsPerKESPeriod} - To query the slot number of the tip of the local copy of the Cardano blockchain since the beginning of the ledger, type:
currentSlot=$(cardano-cli conway query tip --mainnet | jq -r '.slot')
echo "Current Slot: ${currentSlot}" - To divide the current slot tip by the number of slots per KES period, type:
currentKesPeriod=$(( ${currentSlot} / ${slotsPerKESPeriod} ))
echo currentKesPeriod: ${currentKesPeriod}
- On the computer designated as the block-producing node in your stake pool configuration, type the following commands using a terminal window to retrieve the number of slots per KES period for your environment using the Shelley Genesis file:
- Using removable media, copy the
$NODE_HOME/kes.vkeyfile from the computer designated as the block-producing node in your stake pool configuration to$NODE_HOME/kes.vkeyon the air-gapped, offline computer. - On the air-gapped, offline computer, using a terminal window type the following command where
<currentKesPeriod>is the value that you calculated in step 2: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 <currentKesPeriod> \
--out-file $NODE_HOME/node.cert - Using removable media, copy the
$NODE_HOME/node.certfile to$NODE_HOME/node.certon the computer designated as the block-producing node in your stake pool configuration.
For more details, see the topic Issuing a New Operational Certificate.
To generate a VRF key pair:
- On the computer designated as the block-producing node in your stake pool configuration, using a terminal window type:
cd $NODE_HOME
cardano-cli conway node key-gen-VRF \
--verification-key-file vrf.vkey \
--signing-key-file vrf.skey - To secure the secret key file, type:
chmod 400 vrf.skey - Using removable media, copy the
$NODE_HOME/vrf.vkeyfile to$NODE_HOME/vrf.vkeyon the air-gapped, offline computer.
To configure a Cardano Node instance to operate as a block producer:
- On the computer designated as the block-producing node in your stake pool configuration, type the following command to stop the Cardano Node instance:
sudo systemctl stop cardano-node - To retrieve the value of the
$NODE_HOMEenvironment variable, type:echo $NODE_HOME - Using a text editor, open the
$NODE_HOME/startCardanoNode.shfile. - In the
startCardanoNode.shfile, add or edit the following lines as needed, where<NodeHomeValue>is the value of your$NODE_HOMEenvironment variable that you retrieved in step 2:# Set a variable to indicate the file path to the KES secret key file
KES=<NodeHomeValue>/kes.skey
# Set a variable to indicate the file path to the VRF secret key file
VRF=<NodeHomeValue>/vrf.skey
# Set a variable to indicate the file path to the operational certificate file
CERT=<NodeHomeValue>/node.cert
#
# Run Cardano Node using the options that you set using variables
#
/usr/local/bin/cardano-node run \
--topology ${TOPOLOGY} \
--database-path ${DB_PATH} \
--socket-path ${SOCKET_PATH} \
--host-addr ${HOSTADDR} \
--port ${PORT} \
--config ${CONFIG} \
--shelley-kes-key ${KES} \
--shelley-vrf-key ${VRF} \
--shelley-operational-certificate ${CERT} - Save and close the
startCardanoNode.shfile. - To start the block-producing node in your stake pool configuration, type:
sudo systemctl start cardano-node - To confirm that the Cardano Node instance is operating as a block producer, verify that the
cardano.node.metrics.forging_enabledEKG metric displays the value1
Summarizing Security Considerations
As explained in the procedures above, on the block-producing node in your stake pool configuration store ONLY the following stake pool key and operational certificate files:
kes.vkeykes.skeyvrf.vkeyvrf.skeynode.vkeynode.cert
Copy NO stake pool key or operational certificate files from the air-gapped, offline computer or block-producing node to computers designated as relay nodes in your stake pool configuration.
