Refund of deposits on deregistration (depending on protocol parameters and decay)

I just tried it and it turned out we do have to include 2 ADA to the TX output amount. See logs below. First execution did not include 2 ADA and caused an error. The second one did and went through successfully.

jsun@ubuntu:~/hobby/cardano/temp$ ../account-mng/deregister-stake.sh
For which network - mainnet or testnet? (default : testnet)
===> running deregister_stake ...
keyDeposit: 2000000
utxo (balance) for the account is :
TxHash: 36cb41d6164e0d11785910f5704994a89be4cc0f3c58ab8c3df5fc12269d1377#0
ADA: 7820683
Total ADA balance: 7820683
Number of UTXOs: 1
Current Slot: 25802049
fee: 179317
Change Output: 7641366
Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError ShelleyBasedEraMary (ApplyTxError [LedgerFailure (UtxowFailure (UtxoFailure (ValueNotConservedUTxO (Value 9820683 (fromList [])) (Value 7820683 (fromList [])))))])
jsun@ubuntu:~/hobby/cardano/temp$ ../account-mng/deregister-stake.sh
For which network - mainnet or testnet? (default : testnet)
===> running deregister_stake ...
keyDeposit: 2000000
utxo (balance) for the account is :
TxHash: 36cb41d6164e0d11785910f5704994a89be4cc0f3c58ab8c3df5fc12269d1377#0
ADA: 7820683
Total ADA balance: 7820683
Number of UTXOs: 1
Current Slot: 25802075
fee: 179317
Change Output: 9641366
Transaction successfully submitted.
Initial build is done!
2 Likes