block-core / blockcore

Open source .NET Core Bitcoin based blockchain node in C#
https://www.blockcore.net
224 stars 91 forks source link

Wallet Guide - How to recover the legacy segwit BIP44 coins in old wallets #416

Closed dangershony closed 2 years ago

dangershony commented 2 years ago

When the nodes wallet was refactored to use a sqlite db segwit was also introduced However the segwit derivation path where introduced under the BIP44 derivation path instead of the BIP84 path dedicated for segwit addresses

On startup

The node will look at the wallet version, if its a legacy V1 wallet (or no version because old wallets did not have versioning) the wallet will try to detect if there are any segwit UTXOs, if such are found the node will print a warning and shut down.

How to recover

TBD

Relevant BIPs https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki

dangershony commented 2 years ago

This is actually solved in code, no need to do anything for old wallets, the solution is to add also the segwit scripts for wallets version smaller then 2, this will discover the segwit scripts for old wallets and allow to spend them However wallet from now on can only support new segwit addresses when creating a dedicated segwit account type