Skip to content

How to fix non BIP32 compliant wallet?

Chi Kei Chan edited this page Mar 7, 2021 · 5 revisions

Issue

Some wallets have lookahead value that's non-BIP32 compliant (larger than 20) due this this issue. Wallets with this problem will see incomplete account history and balance after import.

Pre-requisite for the fix

This solution requires:

  • Bob Wallet 0.7.0-rc.2 (unreleased) or above
  • hs-client (can be installed by npm install -g hs-client)
  • hsd (can be installed by npm install -g hsd)
  • Node.js v10 or higher

Steps

  1. Save the file scan-and-fill-gap.js to a new directory.

  2. Enter your API key from Bob Wallet to line 13.

  3. Enter the wallet id you want to fix to line 14.

  4. Execute the script by entering node {NEW_DIRECTORY}/scan-and-fill-gap.js. The script will scan your wallet for account gaps larger than 20, and then generate keys for your account gap in wallet db. It will also trigger a deepclean + rescan to temporarily fix your wallet.

  5. After you wallet is finished rescanning, you will find a file containing empty outputs in {NEW_DIRECTORY}/empty-outputs.json. This file contains outputs to all account addresses that needs to be filled in order to fix your wallet.

  6. Your wallet should now be restored after rescan is done - you will need to perform this after every import.

After the fix

You wallet should be functional again after the steps above. We recommend transferring your balance and names to a new wallet after this fix is applied.

Clone this wiki locally