Can not withdraw ADA to my Binance account after retiring a pool (ValueNotConservedUTxO)

My binance address is DdzFFzCqrhsq3cqj7d9rs6f1GECZR3oUeNwvnSigeKMS81Ec4pcRxihWwVCco9CWvFrw4pMB8yvRKRzfoJsXcqofzz3L6wNK9FQAQpii
(a small question why it does not have the prefix addr like any Yoroi wallet?)
Steps:

1- Get the slot and account balance

# my producer node
currentSlot=$(cardano-cli query tip --mainnet | jq -r '.slot')
echo Current Slot: $currentSlot
cardano-cli query utxo \
    --address $(cat payment.addr) \
    --mainnet > fullUtxo.out

tail -n +3 fullUtxo.out | sort -k3 -nr > balance.out

The ouput is

# my producer node
cat balance.out
9f904d7a128bdfc1057b74a92918c410952ea301fcc89c3b5412b26c609193e5     0        695847765 lovelace

2- Then get the transaction hash, transaction index, …:

# my producer node
tx_in=""
total_balance=0
while read -r utxo; do
    in_addr=$(awk '{ print $1 }' <<< "${utxo}")
    idx=$(awk '{ print $2 }' <<< "${utxo}")
    utxo_balance=$(awk '{ print $3 }' <<< "${utxo}")
    total_balance=$((${total_balance}+${utxo_balance}))
    echo TxHash: ${in_addr}#${idx}
    echo ADA: ${utxo_balance}
    tx_in="${tx_in} --tx-in ${in_addr}#${idx}"
done < balance.out
txcnt=$(cat balance.out | wc -l)
echo Total ADA balance: ${total_balance}
echo Number of UTXOs: ${txcnt}

The output is:

# my producer node
Total ADA balance: 695847765
Number of UTXOs: 1

3- Calculate the fee

# my producer node
cardano-cli transaction build-raw \
    ${tx_in} \
    --tx-out $my_binance_addr+695847765 \
    --invalid-hereafter $(( ${currentSlot} + 10000)) \
    --fee 0 \
    --out-file tx.tmp

fee=$(cardano-cli transaction calculate-min-fee \
    --tx-body-file tx.tmp \
    --tx-in-count ${txcnt} \
    --tx-out-count 1 \
    --mainnet \
    --witness-count 2 \
    --byron-witness-count 0 \
    --protocol-params-file params.json | awk '{ print $1 }')
echo fee: $fee

Output:

# my producer node
fee: 178129

4- Check the transaction output

# my producer node
txOut=$((${total_balance}-${stakeAddressDeposit}-${fee}))
echo Change Output: ${txOut}

Output:

Change Output: 696025894

5- Build the transaction

# my producer node
cardano-cli transaction build-raw \
    ${tx_in} \
    --tx-out $my_binance_addr+${txOut} \
    --invalid-hereafter $(( ${currentSlot} + 10000)) \
    --fee ${fee} \
    --out-file tx.raw

6- And then I copy tx.raw to my cold machine to sign it:

# my cold machine
cardano-cli transaction sign \
    --tx-body-file tx.raw \
    --signing-key-file payment.skey \
    --mainnet \
    --out-file tx.signed

7- Submit transaction
And then I copy tx.signed to my producer node and submit the transaction

# my producer node
cardano-cli transaction submit \
    --tx-file tx.signed \
    --mainnet

Output:

Command failed: transaction submit  Error: Error while submitting tx: ShelleyTxValidationError
ShelleyBasedEraMary (ApplyTxError [UtxowFailure
(UtxoFailure (ValueNotConservedUTxO
(Value 695847765 (fromList [])) (Value 696204023 (fromList []))))])

Please help!

Check the balance of the CLI wallet (use cardanoscan.io), I know after retiring the pool you will receive back the 500 ADA as a rewards… so you will need to withdraw the rewards first

DdzFFzCqrhsq3cqj7d9rs6f1GECZR3oUeNwvnSigeKMS81Ec4pcRxihWwVCco9CWvFrw4pMB8yvRKRzfoJsXcqofzz3L6wNK9FQAQpii
(a small question why it does not have the prefix addr like any Yoroi wallet?)

all exchanges wallet are starting with DdzFF… (at least this is what I observed for 4 Exchanges)

1 Like

@Alexd1985, thank you for your comment, I already got the reward before creating the question

cardano-my-node$ cardano-cli query stake-address-info  --address $(cat stake.addr)  --mainnet

output:

[
    {
        "address": "stake1u8yncg4y9fzyr5vckqwgqh7vs5q2d7y8sf3fwmwa6synmpqpruaap",
        "rewardAccountBalance": 0,
        "delegation": null
    }
]

Output from cardanoscan:

Do you have any hint for me?

It’s not clear for me why this output

Change Output: 696025894

1 Like

try 18.9 Send a simple transaction example from this guide

@Alexd1985 good catch, I just try to change stakeAddressDeposit to my_binance_addr, it seems work

1 Like

It works, thank you a lot

great, you are welcome