How I solved my zero-balance issue in the Daedalus ITN Wallet

carlos lopez de lara
7 min readJan 14, 2020

--

DISCLAIMER: I DO NOT SUGGEST TO TRY THIS METHOD AND THIS IS NOT AN OFFICIAL SOLUTION TO THE PROBLEM. FOLLOW AT YOUR OWN RISK.

Quick and dirty

My Daedalus Rewards Wallet for the Cardano incentivized testnet suddenly was showing a zero balance. I tried the solutions suggested by the support website for four days (deleting the state directory, restoring the wallet and moving funds back to the rewards wallet). If you have tried this and did not worked for you, you might have been frustrated by the transaction never going through.

So today I tried a different approach and worked nicely:

  1. Restored my wallet using Cardano wallet backend (Cardano BE)
  2. Sent a 2 tAda transaction from Cardano BE to my pledge address. And — Voila !!

Since the rewards wallet was created in Daedalus it uses UTXO adressess. Remember that UTXOs work different than account addresses: The whole balance of the Wallet is used as an input, then sent 2tAda to the reciver address and the “change” is sent to a new UTXO address. This UTXO address (obviously) belongs to the same rewards wallet so it is recognized by Daedalus. And that was it. The balance is now shown in Daedalus.

I don’t know if Daedalus will send the funds back to the Balance wallet or show a zero balance again tomorrow morning. By now it worked.

Detailed description of the problem and solution:

The problem

In recent days I have seen two different (but related) problems with the Cardano Daedalus ITN.

  1. Your funds went back from the rewards wallet to the balance wallet.
  2. Your funds seem to have vanished, your wallets showed a zero balance.

This is not real money, but anyways, the experience causes you a microinfarct.

The suggested solution in the support site tells you to:

1. Delete the contents of the state directory, and

2. Restore your Rewards wallet & Balance wallet from the recovery phrase.

While this solution worked for many people (as I discovered in the telegram channels) it didn’t work for me. After deleting the directory and recovering the wallet Daedalus prompted me to move my testnet ada to a rewards wallet:

But the transaction never makes it to a block, It gets stuck somewhere and after some time (I think it is 10 blocks) Daedalus suggests to cancel the transaction as it has been pending for a long time.

There is a particular transaction that might be preventing the problem to be solved by deleting the state directory. But it is a good thing!

To create a stake pool one needed to use a combination of software pieces:

First, one uses Cardano Backend to restore the Snapshot wallet and to get the secret key out from the mnemonics.

Then one uses JCLI to get the public key and to generate an account- type address (the pledge address) required to create the stake pool.

Let me show the history of transactions of my pledge address as I think there is one particular transaction that is preventing the funds to be restored with the deletion of the state directory method:

Transaction 1. After restoring my Balance wallet in Cardano BE, I sent 2.345678 tAda to the pledge address created in JCLI. Just a test transaction.

Transaction 2. From Cardano BE I sent 500.654321 tAda to the pledge address to have enough funds to pay for the stake pool certificate. (The sequence .654321 just allows to avoid mistakes with too many zeros)

Transaction 3. The fee of the stake pool certificate.

Transaction 4. I moved almost all my funds (86807.684603 tAda) to the pledge address.

Transaction 5. The fee for the delegation certificate.

Everything was fine.

Then, Daedalus ITN went out and after restoring the wallet it prompts you to create a Rewards Wallet. So I created it and transferred the funds from the pledge address to my new Rewards Wallet.

Transactions 6, 7 and 8. A couple of test transactions and the “big” one.

But wait !!! My pledge address was left with almost nothing. I thought the pledge address was important for potential delegators to see that I was delegating to my own stake pool (showing commitment!). So I sent 46,000 tAda back from my rewards wallet to the pledge address. Leaving 40,805.123456 in the rewards wallet.

Transactions 9 and 10. A 1 tAda test transaction and a “big” transaction from rewards to pledge

This last transaction is the transaction I regard as responsible for not being able to restore the wallet in Daedalus. But it is a good thing !!!!

Why?

Well, in my case, remember that I had split my funds between the rewards wallet and the pledge address, succeding in process of deleting, restoring and moving the funds, would have resulted in a terrible problem, a catastrophic double spending problem! Let me elaborate:

After todays wallet restoration, the balance shown in the Balance Wallet was $87,312.884602 tAda and that was the ammount I was trying to move back to the rewards wallet. The exact same balance that I had in Daedalus at the time of the snapshot as you can see in the Transaction 1 above.

But remember that I had sent 46,000 and change to the pledge address which is an account-type address that is NOT recognized by Daedalus. So when Daedalus tells you that it is syncing the transaction history, apparently it just can’t handle the balance of the pledge address and doesn’t know what to do with it. So it just stalls.

In conclusion, had it succeded to restore the funds to the rewards wallet, It would have created tAda out of nothing and created a double spending problem. So it is a good thing it did not!

How-to send a transaction using Cardano BE

  1. Run Cardano-wallet backend connecting it to your already running jormungandr node.
./cardano-wallet serve — node-port 3100 — port 8090 — genesis-block-hash 8e4d2a343f3dcf9330ad9035b3e8d168e6728904262f2c434a4f8f934ec7b676### 
Notes:
1) The serve command allows you to connect to an already running jormungandr node
2) 3100 is my REST listen port
3) 8090 is the default port for Cardano Wallet
4) If you are reading this you already know the genesis block hash of the incentivized testnet

2) In a new terminal

### 
Get the Balance of the pledge address
###
$ ./jcli rest v0 account get addr1s5xgmr3m9yeztf7jvl20ga4kxgm485exs50mnvp8yena5waqk6x75pmvvzv -h http://127.0.0.1:3100/api
---
counter: 5
delegation:
pools:
- - 014bb0d84f40900f6dd85835395bc38da3ab81435d1e6ee27d419d6eeaf7d16a
- 1
last_rewards:
epoch: 31
reward: 65548045
value: 51424302093
###
Restore the wallet in Cardano BE
###
$ ./cardano-wallet wallet create --port 8090 CLRWALLET
Please enter a 15–24 word mnemonic sentence: one two three ...
(Enter a blank line if you do not wish to use a second factor.)Please enter a 9–12 word mnemonic second factor:Please enter a passphrase: *************Enter the passphrase a second time: *************
###
Get the details of the wallet, you are looking for the id
###
$ ./cardano-wallet wallet get
a46*******************
Ok.
{
"passphrase": {
"last_updated_at": "2020-01-14T01:56:03.462858Z"
},
"address_pool_gap": 20,
"state": {
"status": "ready"
},
"balance": {
"reward": {
"quantity": 355235591,
"unit": "lovelace"
},
"total": {
"quantity": 40804323456,
"unit": "lovelace"
},
"available": {
"quantity": 40804323456,
"unit": "lovelace"
}
},
"name": "clrwallet",
"delegation": {
"status": "delegating",
"target": "df2bcbf8d850fee9d82204f4acba2899de2e2870685c41d98e1442c106aa4e54"
},
"id": "a46*****************************", # <------ HERE
"tip": {
"height": {
"quantity": 96622,
"unit": "block"
},
"epoch_number": 31,
"slot_number": 12201
}
}
.
.
.
.
###
Send a 2 tAda transaction to my pledge address
###
./cardano-wallet transaction create a46****************** --payment 2000000@addr1s5xgmr3m9yeztf7jvl20ga4kxgm485exs50mnvp8yena5waqk6x75pmvvzv###
Verify the Status
###
$ ./cardano-wallet transaction list a46*******************
[
{
"status": "pending",
"amount": {
"quantity": 2500000, <------ 2 ada + fee
"unit": "lovelace"
},
"inputs": [
{
"amount": {
"quantity": 40804323456, <---- UTXO input
"unit": "lovelace"
},
"address": "addr1ssw632s4mc2u7594e7c5ctjw94uq5hjh0fxwj7zdud8nxhfgx9rx5gc8ze3mmtupxxt85mx3t6ufvrj8y2qy74dfjedanzj5ys6k3gk847usuh",
"id": "a791cd8386b23e42a792bc840bd49e8912fa0436003d142f29c54527ebf5ef61",
"index": 0
}
],
"direction": "outgoing",
"outputs": [
{
"amount": {
"quantity": 2000000, <---- 2 ada
"unit": "lovelace"
},
"address": "addr1s5xgmr3m9yeztf7jvl20ga4kxgm485exs50mnvp8yena5waqk6x75pmvvzv" <--------The pledge address
.
.
###
Get the Balance of the pledge address again
###
$./jcli rest v0 account get addr1s5xgmr3m9yeztf7jvl20ga4kxgm485exs50mnvp8yena5waqk6x75pmvvzv -h http://127.0.0.1:3100/api
---
counter: 5
delegation:
pools:
- - 014bb0d84f40900f6dd85835395bc38da3ab81435d1e6ee27d419d6eeaf7d16a
- 1
last_rewards:
epoch: 31
reward: 65548045
value: 51426302093 # It was 51424302093

After this transaction, apparently Daedalus recognized the funds from the new UTXO address and the Reward Wallet shows the correct balance and everything is back to normal.

Anyway, I made a second transaction from Cardano BE to put all my funds together in my pledge address, waiting for an update to Daedalus that solves the issue of the funds going back to Balance or going to zero.

And this is how I got my funds back !!!

--

--