In the Cardano ecosystem, Delegated Representatives (DReps) work to coordinate resources on behalf of ADA holders who delegate power to vote on governance actions.
For more information on Cardano governance, visit 1694.IO or GOV TOOL
Delegating to a representative involves generating a vote delegation certificate reflecting your delegation, and then submitting the certificate to the blockchain.
You can delegate your 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 on every proposal.
You need to find the tip of the blockchain to set the invalid-hereafter parameter properly.
Retrieve the UTXOs available for your payment address and calculate the balance.
Run the build-raw transaction command:
The invalid-hereafter value must be greater than the current tip. In this example, we use current slot + 10000.
Calculate the current minimum fee:
When calculating the fee for a transaction, the --witness-count option indicates the number of keys signing the transaction. You must sign a transaction submitting a vote delegation certificate to the blockchain 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.
Calculate your change output:
Build your transaction to delegate voting power:
Copy tx.raw to your cold environment.
Sign the transaction with both the payment and stake secret keys:
currentSlot=$(cardano-cli conway query tip --mainnet | jq -r '.slot')
echo Current Slot: $currentSlot
# Retrieve the list of UTXOs available for your payment address
utxo_json=$(cardano-cli conway query utxo --address $(cat payment.addr) --mainnet)
# Initialize variables
tx_in=""
total_balance=0
txcnt=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 "ADA: ${utxo_balance}"
tx_in="${tx_in} --tx-in ${hash}#${idx}"
txcnt=$((txcnt + 1))
fi
done <<< "$(jq -r 'keys[]' <<< "${utxo_json}")"
echo
echo "Total available ADA balance: ${total_balance}"
echo "Number of UTXOs: ${txcnt}"
echo "Final --tx-in string:${tx_in}"