Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data Backup does not restore Bitcoin Core hot wallet. #948

Closed
ghost opened this issue Feb 14, 2021 · 9 comments · Fixed by #1495
Closed

Data Backup does not restore Bitcoin Core hot wallet. #948

ghost opened this issue Feb 14, 2021 · 9 comments · Fixed by #1495
Assignees
Labels
bug Something isn't working enhancement New feature or request

Comments

@ghost
Copy link

ghost commented Feb 14, 2021

Using a brand new Specter 1.0.0 (via getumbrel.com), I loaded the data backup files from my other node and it appeared to successfully restore all devices and wallet onto the node.

When attempting a simple roundtrip transaction using a 2-of-3, I discovered the following issue.

When signing with the newly restored hot wallet, the following error was surfaced:

Failed to sign PSBT: Request error: Requested wallet does not exist or is not loaded.

My best guess is that Specter restores the metadata, but does not check for hot wallets within, and therefor does not reinitialize those wallets inside Bitcoin Core. This causes the wallet to feel restored, but otherwords be orphaned.

@ghost
Copy link
Author

ghost commented Feb 15, 2021

I was able to verify that on the new node that no hot wallet has been initiated in Bitcoin Core.

The original node has a specter..._hotstorage folder in the Bitcoin Core data dir containing the initialized hot wallet, including the wallet.dat binary file. The new node does not have this folder at all.

This makes me think that my guess above was correct:

Specter restores the metadata, but does not check for hot wallets within, and therefor does not reinitialize those wallets inside Bitcoin Core. This causes the wallet to feel restored, but otherwords be orphaned.

@ben-kaufman
Copy link
Contributor

Hi, yeah that's a good point. We should definitely add better support for backup of the hot wallet. We don't save the mnemonic itself, so you might need to go to the wallet screen, click add more keys, and re-add the keys with the mnemonic, but we should at least create a new wallet on the bitcoin core when you restore a hot wallet type.

@ben-kaufman ben-kaufman added bug Something isn't working enhancement New feature or request labels Feb 16, 2021
@kdmukai
Copy link
Collaborator

kdmukai commented Mar 5, 2021

@ben-kaufman would it make sense to make the mnemonic entry screen part of the import flow if there's a hot wallet involved? Maybe also revisit whatever language is around the wallet backups to make it clear that if you don't have your mnemonic phrase, this "backup" you're about to download ain't doing sh*t.

If this all makes sense, assign this one to me.

@ben-kaufman
Copy link
Contributor

Thanks, yes that'd definitely make sense. The whole backup and flow of the hot wallet functionality could be improved quite a bit, so would be great if you could do that.

@kdmukai
Copy link
Collaborator

kdmukai commented Mar 7, 2021

Initial progress. @ben-kaufman @k9ert any concerns with updating the wallet backup account_map format to include device type and label?

https://github.com/kdmukai/specter-desktop/blob/2417839b824c41434bf5b53eb26f897ca71e421c/src/cryptoadvance/specter/wallet.py#L926

{
  "label": "Keith_s test _Hot_!",
  "blockheight": 0,
  "descriptor": "...",
  "devices": [
    {
      "type": "bitcoincore",
      "label": "My Core Hot Wallet"
    },
    {
      "type": "keepkey",
      "label": "Muh KeepKey"
    }
  ]
}

There's a note in helpers.py that Account Map is used by "Fully Noded, Gordian, Sparrow etc." My changes are adding to the json but not changing any of the existing fields. Hopefully that doesn't impact their portability to those projects. If we don't want to mess with account_map, then I'll have to create a third backup option: Account Map, Electrum, and Specter-Desktop native.

With that in place I'm able to identify and label unknown devices to a new Specter instance. The next step will be to require/encourage(?) mnemonic entry if you're importing a hot wallet.

Screen Shot 2021-03-07 at 9 26 08 AM

@ben-kaufman
Copy link
Contributor

As long as the extra fields to the format are optional I don't see any issues adding them. Not sure if you should require adding the mnemonic for the hot wallet import, I think just warning that otherwise it'll be watch only is fine.

@ghost
Copy link
Author

ghost commented Mar 10, 2021

@ben-kaufman you suggesting they import, and then, seeing the warning, go into settings and add the 24 word mnemonic, 25th word, and encryption password by hand? That flow could work.

@ghost
Copy link
Author

ghost commented Mar 12, 2021

Ok - I figured out a reasonable workaround for folks who are stuck waiting for this issue to be resolved.

Recovering a Hot Wallet in Specter, by hand

After SSHing into the machine, grab the Specter session ID and create a new hot wallet at the correct path, entering the encryption password (for the wallet.dat that will be created) when prompted:

$ ssh umbrel@<NODEIP>

$ SPECTERUID="$(cat /home/umbrel/umbrel/app-data/specter-desktop/data/config.json | jq .uid -r)"

$ /home/umbrel/umbrel/bin/bitcoin-cli createwallet "specter`echo $SPECTERUID`_hotstorage/umbrel_hot_wallet" false false "`read -p 'Enter encryption password: ' pw; echo $pw`" false false true

Now that the hot wallet has been initiated in Bitcoin Core, select it in the Specter UI and:

  1. Hit the gear (configure) in the top right.
  2. Select "Add more keys."
  3. Input the 24 word mnemonic.
  4. Select "Advanced" and input the 25th word and encryption password.

I have tested that this works end-to-end on a multisig vault.

Cheers.

@ben-kaufman
Copy link
Contributor

Thanks for posting @LaserHodl! Anyway, I believe now @kdmukai is working on it, and so hopefully it'll be resolvd with the next version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment