zcash icon indicating copy to clipboard operation
zcash copied to clipboard

Add ability to restore the zcashd wallet from the emergency recovery phrase (mnemonic seed).

Open nuttycom opened this issue 2 years ago • 4 comments

We need to be able to recover:

  • keys derived from the legacy Sapling HD seed;
  • keys derived from the mnemonic seed under the legacy account ID:
    • keys produced by z_getnewaddress post-zcashd v4.7.0;
    • transparent keys produced by getnewaddress post-zcashd v4.7.0;
  • keys derived from the mnemonic seed according to ZIP 316.

For recovery of transparent and legacy-Sapling keys, we need to implement the gap limit logic from BIP 44. Once we have fully recovered the wallet from Sapling activation to the tip, we will only continue to scan with keys at indices for which funds were found, plus indices some small constant beyond the last index for which funds were found.

For keys derived according to ZIP 316, the user should explicitly specify the account ids they want to recover keys for. Alternatively, we could increment the index by one whenever we find funds, essentially using a gap limit of 1.

nuttycom avatar Apr 01 '22 15:04 nuttycom

I think this should definitely be a priority. I've read other posts here about adding orchard key import/export abilities which also sounds like a great idea assuming it's practical and the new mnemonic seed and account (of a height) recovery method is the designed implementation but there should be at least one.

autotunafish avatar Oct 18 '22 14:10 autotunafish

We have a draft PR for this (https://github.com/zcash/zcash/pull/6102); I think I can finish it and get it into 5.6.0.

daira avatar Apr 27 '23 16:04 daira

Hi I don't quite understand. If z_getnewaddress is deprecated, and there is no way to restore/recover a unified address, and zcash-cli says that we must use unified addresses, how does this make sense as a safe policy? Maybe I'm misunderstanding?

zine999 avatar Feb 13 '24 20:02 zine999

It's not a safe policy. We're aware that this is missing functionality that could lead to loss or inaccessibility of funds. I apologize for the delay in implementing it.

daira avatar Feb 14 '24 01:02 daira