Skip to main content

Delegating to a Representative

In the Cardano ecosystem, Delegated Representatives (DReps) work to coordinate resources on behalf of ADA holders who delegate power to vote on governance actions.

Note
Note

For more information on Cardano governance, visit 1694.IO or GOV TOOL

Prior to Claiming Stake Pool Rewards for a wallet account, you must complete a vote delegation for the account.

You can delegate voting power to:

  • Registered DReps—Members of the Cardano community, who receive the delegation of voting power for voting on governance actions.
  • Always Abstain—Opt out of the governance process.
  • Always Vote No Confidence—Vote No Confidence in the current Constitutional Committee on every proposal.

Delegating voting power involves generating a vote delegation certificate reflecting your delegation, and then submitting the certificate to the blockchain.

To delegate voting power:

  1. Using a terminal window on the block-producing node in your stake pool configuration, type the following command where <DRepID> is the unique ID of the representative receiving your delegation:
    cardano-cli conway stake-address vote-delegation-certificate \
    --stake-verification-key-file $NODE_HOME/stake.vkey \
    --drep-key-hash <DRepID> \
    --out-file $NODE_HOME/vote-deleg.cert
    OR
    To opt out of the governance process, type:
    cardano-cli conway stake-address vote-delegation-certificate \
    --stake-verification-key-file $NODE_HOME/stake.vkey \
    --always-abstain \
    --out-file $NODE_HOME/vote-deleg.cert
    OR
    To vote No Confidence on every proposal, type:
    cardano-cli conway stake-address vote-delegation-certificate \
    --stake-verification-key-file $NODE_HOME/stake.vkey \
    --always-no-confidence \
    --out-file $NODE_HOME/vote-deleg.cert
  2. To save protocol parameters, type:
    cd $NODE_HOME
    cardano-cli conway query protocol-parameters \
    --mainnet \
    --out-file params.json
  3. When the local copy of the Cardano blockchain ledger is fully synchronized, type the following command to query the slot number of the current tip of the ledger:
    currentSlot=$(cardano-cli conway query tip --mainnet | jq -r '.slot')
    echo "Current Slot: ${currentSlot}"
  4. 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 \
    --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}"
  5. 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 $NODE_HOME/vote-deleg.cert \
    --out-file $NODE_HOME/tx.tmp
  6. To calculate the fee for the transaction, type:
    fee=$(cardano-cli conway transaction calculate-min-fee \
    --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}"

    Note
    Note

    Regarding the value of the --witness-count option in the transaction, when submitting a vote delegation certificate to the blockchain you must sign the transaction using the secret—private—key for the payment address spending the input, as well as the secret key for the stake address delegating voting power.

  7. To calculate change from the transaction, type:
    txOut=$(( ${total_balance} - ${fee} ))
    echo Change: ${txOut}
  8. To build the transaction delegating voting power, 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/vote-deleg.cert \
    --out-file $NODE_HOME/tx.raw
  9. Copy the tx.raw file that you created in step 8 to the $NODE_HOME folder 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
  10. Copy the tx.signed file that you created in step 9 to the $NODE_HOME folder 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