Delegating to a Stake Pool
Registering a Stake Pool involves submitting a stake delegation certificate to the Cardano blockchain ledger. However, using Cardano CLI you can also delegate a wallet address to an existing stake pool without registering a stake pool.
Delegating a wallet address to a stake pool involves:
- Selecting the wallet that you want to use
- Ensuring that the payment address is funded
- Ensuring that the stake address is registered
- Generating a stake delegation certificate
- Submitting the stake delegation certificate to the Cardano blockchain ledger
Note | Cardano CLI commands throughout the How to Set Up a Cardano Stake Pool guide may use the |
To delegate a wallet address to an existing stake pool:
- If you need to create a new wallet address for delegating to an existing stake pool, then follow the procedures for Creating a Wallet, and then Funding Your Payment Address.
Important

Do NOT overwrite existing key, address or certificate files. Throughout the procedure, ensure that you use the key, address and certificate files associated with the wallet that you want to delegate to a stake pool.
- If you are delegating the wallet address to a stake pool for the first time, then follow the procedure for Registering a Stake Address.
- To generate a stake delegation certificate, using a terminal window on the block-producing node in your stake pool configuration, type the following command where
<StakePoolID>is the unique ID for the stake pool where you want to delegate using hexadecimal or Bech32 format:cardano-cli conway stake-address stake-delegation-certificate \
--stake-verification-key-file $NODE_HOME/stake.vkey \
--stake-pool-id <StakePoolID> \
--out-file $NODE_HOME/deleg.cert - On the computer hosting the block-producing node in your stake pool configuration, when the local copy of the Cardano blockchain ledger is fully synchronized with the network, using a terminal window type the following commands to save protocol parameters in a file using JSON format:
cd $NODE_HOME
cardano-cli conway query protocol-parameters \
--mainnet \
--out-file params.json - To query the slot number of the current tip of the ledger, type:
currentSlot=$(cardano-cli conway query tip --mainnet | jq -r '.slot')
echo "Current Slot: ${currentSlot}" - To retrieve the UTXOs available for your payment address and calculate the balance, type:
# Retrieve the list of UTXOs available for your payment address
utxo_json=$(cardano-cli conway query utxo --output-json \
--address $(cat $NODE_HOME/payment.addr) \
--mainnet)
# Initialize variables
tx_in=""
total_balance=0
# Loop through the list of UTXOs
while read -r utxo; do
# Retrieve the values for the current UTXO
values=$(jq -r --arg k "${utxo}" '.[$k]' <<< "${utxo_json}")
# Retrieve datum associated with the UTXO
datum=$(jq -r '.datum' <<< "${values}")
# Retrieve the reference script associated with the UTXO
script=$(jq -r '.referenceScript' <<< "${values}")
# If limits on spending the UTXO may exist, then skip the UTXO
if [[ ${datum} == 'null' && ${script} == 'null' ]]
then
hash=${utxo%%#*}
idx=${utxo#*#}
utxo_balance=$(jq -r '.value.lovelace' <<< "${values}")
total_balance=$((${total_balance}+${utxo_balance}))
echo "TxHash: ${hash}#${idx}"
echo "UTXO Balance: ${utxo_balance} Lovelace"
tx_in="${tx_in} --tx-in ${hash}#${idx}"
fi
done <<< "$(jq -r 'keys[]' <<< "${utxo_json}")"
echo
echo "Total available balance: ${total_balance} Lovelace"
echo "Final --tx-in string:${tx_in}" - To build a draft transaction for calculating the transaction fee, type:
cardano-cli conway transaction build-raw \
${tx_in} \
--tx-out $(cat $NODE_HOME/payment.addr)+$(( ${total_balance} - 200000 )) \
--invalid-hereafter $(( ${currentSlot} + 10000 )) \
--fee 200000 \
--certificate-file $NODE_HOME/deleg.cert \
--out-file $NODE_HOME/tx.tmp - To calculate the fee for the transaction, type:
fee=$(cardano-cli conway transaction calculate-min-fee --output-json \
--tx-body-file $NODE_HOME/tx.tmp \
--witness-count 2 \
--byron-witness-count 0 \
--protocol-params-file $NODE_HOME/params.json | jq -r '.fee')
echo "Fee: ${fee}" - To calculate change from the transaction, type:
txOut=$(( ${total_balance} - ${fee} ))
echo Change: ${txOut} - To build the transaction, type:
cardano-cli conway transaction build-raw \
${tx_in} \
--tx-out $(cat $NODE_HOME/payment.addr)+${txOut} \
--invalid-hereafter $(( ${currentSlot} + 10000 )) \
--fee ${fee} \
--certificate-file $NODE_HOME/deleg.cert \
--out-file $NODE_HOME/tx.raw - Copy the
tx.rawfile that you created in step 10 to the$NODE_HOMEfolder on your air-gapped, offline computer, and then using a terminal window type the following commands to sign the transaction:cd $NODE_HOME
cardano-cli conway transaction sign \
--tx-body-file tx.raw \
--signing-key-file payment.skey \
--signing-key-file stake.skey \
--mainnet \
--out-file tx.signed - Copy the
tx.signedfile that you created in step 11 to the$NODE_HOMEfolder on the block-producing node, and then using a terminal window type the following command to submit the transaction to the network:cardano-cli conway transaction submit \
--tx-file $NODE_HOME/tx.signed \
--mainnet
To verify that the stake delegation is successful, wait a few moments for the transaction to complete, then using a blockchain explorer find the pool where you delegated, and then find the stake address associated with the delegation in the list of delegators.
