Before delegating to a staking pool, a stake address needs first to be registered, with a deposit, of currently 2 ADA, according to the protocol parameter keyDeposit.
Does a reward account (corresponding to a registered stake key) store the amount originally deposited on chain ?
Can/will the protocol parameter keyDeposit ever be updated ?
Will some decay mechanism for the refund due to a deregistration be implemented ?
If one of 2 or 3 holds, how to compute the amount of such a refund (which information is required for building a well-balanced transaction including a deregistration certificate). Currently, a hardcoded value of 2 ADA seems to work, but this approach may not be sustainable.
I think once the stake certificate registered the stake address is fine even the stake keyDeposit changed. The stake certificate can be de-registered and it will automatically gives back the stake keyDeposit.
this is the command how to de-register: cardano-cli stake-address deregistration-certificate
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!