iron-fish / ironfish

A novel cryptocurrency focused on privacy and accessibility.
https://ironfish.network
Mozilla Public License 2.0
964 stars 579 forks source link

FIP: Update wallet key derivation from BIP39 to BIP44 #1780

Open wd021 opened 1 year ago

wd021 commented 1 year ago

Description

Propose to upgrade our implementation of wallet key generation to use the BIP44 standard. BIP44 uses a hardened derivation path that is industry standard with HD wallets. This ultimately leads to a far better user experience.

BIP 44 Derivation path m / purpose' / coin_type' / account' / change / address_index

What needs updating

1 - Add ironfish coin to SLIP-0044 2 - update ironfish-rust to implement key generation with set derivation path using tiny-hderive

Thoughts

I was researching zcash’s wallet implementation and came across changes they’re making in Orchard. Sapling uses a non-hardened derivation mode and in Orchard, they're updating to use a hardened derivation mode. From ZIP32 (Shielded Hierarchical Deterministic Wallets) 👇

Orchard keys may be derived in a hierarchical deterministic (HD) manner. We do not adapt the Sapling HD mechanism from ZIP 32 to Orchard; instead, we define a hardened-only derivation mechanism (similar to Sprout).

Some more interesting notes on Orchard key/address design

Here's the code using bip44 derivation in Orchard's key generation. And here's their code for supporting legacy Sapling wallets and creating a unified address for Orchard/Sapling.

All of that is to say, hoping we can get ahead of this and use bip44 from the get-go to avoid potential future technical debt.

NullSoldier commented 1 year ago

Thanks for doing this research! Just for the uninformed, this is talking about switching to HD wallets, which eventually we do want to do. https://www.investopedia.com/terms/h/hd-wallet-hierarchical-deterministic-wallet.asp

We'll have to do the research on how to do that with sapling, or switch to orchard. I'm not sure if we'll do this for launch because it's a fairly large task, when we haven't gotten our basic wallet working yet. Once wallet 2.0 is complete, I think we should look into HD wallets.