0

I'm trying to get back my funds from my stake.addr from Cardano but I have this error message:

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraBabbage (ApplyTxError [DelegsFailure (DelplFailure (DelegFailure (StakeKeyNonZeroAccountBalanceDELEG (Just (Coin 500000000)))))])

This error message appears when I run these scripts below:

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

cardano-cli transaction build \
    --tx-in 75e262eb49ba1237b1ee00a4854935d67bd05988baed5472a7ff97b49551d386#0 \
    --tx-out $(cat stake.addr)+500000000 \
    --change-address $(cat stake.addr) \
    --mainnet  \
    --out-file tx.raw \
    --certificate-file stake-deregistration.cert \
    --witness-override 2

cardano-cli transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --signing-key-file stake.skey \
    --mainnet \
    --out-file tx.signed

cardano-cli transaction submit \
    --tx-file tx.signed \
    --mainnet

I can see I have the funds on the explorer here. Thank you if you can help me.

1 Answer 1

2

You have 500 ADA rewards at that stake address. First you need to withdraw the 500 ADA, only after that you should deregister your stake key. You cannot send funds to a stake address, so you cannot use the stake-address in a --tx-out or --change-address line. And if you want to send all the funds to a single address, you just use --change-address, without any --tx-out line. You need to have your payment address in the payment.addr file, but I believe you already have it, since you are signing with payment.skey.

cardano-cli transaction build \
    --tx-in 75e262eb49ba1237b1ee00a4854935d67bd05988baed5472a7ff97b49551d386#0 \
    --withdrawal "$(stake.addr)+500000000" \
    --change-address $(cat payment.addr) \
    --mainnet  \
    --out-file tx.raw \
    --witness-override 2

Then sign it and submit it with the commands you had in your message. After the transactions completes, you can do another transaction to deregister the stake key, just like you did before. You will need to use a different UTxO as input for the new transaction (because the one from the first transaction will be consumed). You will be able to use the output of your previous transaction.

cardano-cli transaction build \
    --tx-in <new UTxO>#0 \
    --change-address $(cat payment.addr) \
    --certificate-file stake-deregistration.cert \
    --mainnet  \
    --out-file tx.raw \
    --witness-override 2

You can sign and submit this transaction with the same commands as before.

It might work to withdraw the 500 ADA and deregister in a single transaction, but I did not test it, so I cannot recommend it. I will test it on testnet when I have the chance to do it (but not very soon). To test it, I will add the --certificate-file stake-deregistration.cert line after the --change-address $(cat payment.addr) line in the first transaction. I am not sure if you are able to deregister the stake address without first withdrawing the rewards. This is probably the reason why you have that error.

1
  • Thank you so much it worked. Really appreciate. I think Cardano should at least create a section for this it's very important. Commented Nov 12, 2022 at 6:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.