Redelegation
This tutorial will show how to redelegate your stake to another stake pool. There can be multiple reasons to redelegate your stake, but the most common ones are:
- Original stake pool is no longer available
- You've discovered a more convenient option
- You have your own stake pool and you want to delegate your stake to it.
To do that, you need to create a new certificate that you are sending in a transaction, as in the first part of the tutorial:
cardano-cli stake-address delegation-certificate \
--stake-verification-key-file stake.vkey \
--stake-pool-id pool1vzqtn3mtfvvuy8ghksy34gs9g97tszj5f8mr3sn7asy5vk577ec \
--out-file new-delegation.cert
Now the delegation certificate contains the --stake-pool-id
of the new stake pool. It means that you're ready to build your transaction, selecting the UTXO from which you will pay the fee:
$ cardano-cli query utxo --address $(cat payment.addr)
TxHash TxIx Amount
--------------------------------------------------------------------------------------
2b1bfc342c1f5531df4cfa220eac79574142c7263d97885d2ad8588ca1a7e22b 0 10016871698 lovelace + TxOutDatumNone
afb33e353a9880b7cbd9e5eb2cbffa024d1b3b938ee2c739e53dd187094e8f0d 0 10000000 lovelace + TxOutDatumInline ReferenceTxInsScriptsInlineDatumsInBabbageEra (HashableScriptData "\216y\159\CAN*\255" (ScriptDataConstructor 0 [ScriptDataNumber 42]))
Build:
cardano-cli transaction build \
--witness-override 2 \
--tx-in 2b1bfc342c1f5531df4cfa220eac79574142c7263d97885d2ad8588ca1a7e22b#0 \
--change-address $(cat payment.addr) \
--certificate new-delegation.cert \
--out-file new-delegation.tx
Sign:
cardano-cli transaction sign \
--tx-file new-delegation.tx \
--signing-key-file payment.skey \
--signing-key-file stake.skey \
--out-file new-delegation.signed
cardano-cli transaction submit --tx-file new-delegation.signed
If you check your stake address details, you'll see that you have delegated your stake to a new stake pool and you have zero rewards for now:
$ cardano-cli query stake-address-info --address $(cat stake.addr)
[
{
"address": "stake_test1uq954t492tmusk2dy9z505g3cz3sfpnh0swsqjmzk47rasqyn8uqp",
"delegation": "pool1vzqtn3mtfvvuy8ghksy34gs9g97tszj5f8mr3sn7asy5vk577ec",
"rewardAccountBalance": 0
}
]