How to un-delegate and get key deposit back?

When we delegate to a pool for the first time, we pay 2 ada to register staking address in the blockchain. Later on we can re-delegate to a different different pools without registering staking address and paying more deposit.

Can we un-delegate and get the 2 ada key deposit back?

I understand the wallet software don’t have this feature (yet). I’m interested in command line options as well (cardano-cli). I think there should be a way to un-delegate and, afterwards, re-generate a new staking key for future staking operations.

1 Like

Hey @Jun_Sun

You simply could restore your wallet in Yoroi and delete the staking key there by going to the dashboard and then click on withdraw the rewards.

This way you would get back your deposit of 2 ada.



Thanks, @Zyroxa

Do you know how to do this from command line with “cardano-cli” client?

I found the answer myself. The key is to call “cardano-cli stake-address deregistration-certificate”. Below is the full commandline.

cardano-cli stake-address deregistration-certificate \
    --stake-verification-key-file stake.vkey \
    --out-file stake.cert

And then build a transaction with this certificate. Specifically you need to increase the change amount by 2 ADA and minus the transaction.

cardano-cli transaction build-raw \
    ${tx_in} \
    --tx-out $(cat payment.addr)+${txOut} \
    --invalid-hereafter $(( ${currentSlot} + 10000)) \
    --fee ${fee} \
    --certificate-file stake.cert \
    --mary-era \
    --out-file /tmp/tx.raw

See more details in this discussion