Add BIP49 support for Liquid wallets (Aqua compatibility)#1381
Add BIP49 support for Liquid wallets (Aqua compatibility)#1381echennells wants to merge 1 commit into
Conversation
Implements automatic BIP49 vs BIP84 detection during wallet recovery for backward compatibility with Aqua wallet. - Create DetectLiquidScriptTypeUsecase to centralize detection logic - Check BIP49 balance during recovery, fall back to BIP84 if empty - Add BIP49 (P2SH-P2WPKH) script variant for Liquid descriptors - Fix import wallet sync bug Detection requires network sync to check on-chain balance.
|
Hey @echennells thanks for the PR. To support import of Aqua wallets what is preferable is detecting the funds in the bip49 path and asking the user if they want to sweep it into the default segwit wallet. |
|
Why not just get Aqua to support Segwit instead? |
|
@i5hi @BullishNode Okay understood I know its a bit wonky especially because the wallet needs to be synced to check for balances. Would you be interested in an import and sweep that isn't part of the main wallet creation workflow? Essentially a migration utility which would help people sweep their funds. Interestingly it seems like aqua wrote sweep code but never enabled it in their app so right now there is no easy workflow for people switching from aqua to bull. |
|
@echennells what we can do is show a popup on the wallet home screen that opens up a modal or screen where they have to confirm the sweep. it can be a popup similar to the one users see when they receive funds to their wallet, but haven't started the backup process yet it'll show something like you have n sats in a unsupported wallet, would you like to swap the balance to your instant payment wallet? |
|
@basantagoswami I just want to confirm what workflow are you suggesting. On import of a wallet there would be detection of a BIP49 (legacy) wallet and have a pop up giving the option to sweep it? Sweep to where? I guess that implies it needs to create a new wallet as part of the sweep flow. I'll give that a shot please give me more feedback if I'm misunderstanding; |
|
The BIP49 seed should only be imported after the wallet is created and swept to the default Liquid wallet IMO (not at app install). |
Summary
Adds BIP49 (nested SegWit) support for Liquid wallets to enable automatic recovery of Aqua wallet funds.
When importing/recovering a wallet, the system now automatically detects whether the user has legacy BIP49 Liquid funds (Aqua compatibility) or should use the newer BIP84 (native SegWit) standard.
Dependencies
Requires lwk-dart PR #66 for BIP49 support: SatoshiPortal/lwk-dart#66
Pubspec files are intentionally excluded from this PR. Reviewers will need to configure local dependencies to point to lwk-dart PR #66 for testing.
Network Requirement:
BIP49 detection requires network connectivity during wallet import to check on-chain balances. This adds latency on slow networks (5-30 seconds tested with Network Link
Conditioner).
Key Changes
DetectLiquidScriptTypeUsecaseto centralize BIP49 detection logicRelated Work
PR #1376 fixed the import wallet flow to properly sync existing Liquid wallets. This PR extends that functionality to also auto-detect and support BIP49 Liquid wallets (Aqua compatibility).