Creating P2SH (Nested Segwit) addresses from an imported BECH32 (Native Segwit) XPUB, when running Bitcoin Core (pre-2020 software) wallet (as watch-only, with private keys disabled) can lead to non-standard derivation paths for P2SH addresses, and this can result in XPRIV HWW signing failures/errors.
The standard derivation path for P2SH addresses is m/ 49’ /0’ /0’. I created my P2SH addresses with the non-standard derivation path of m/ 84’ /0’ /0’ (the standard derivation path for BECH32 (Native Segwit) as I used my BECH32 XPUB to create the wallet on Bitcoin Core (pre-2020 software).
You can check derivation path of addresses by using the ‘listunspent’ command on Bitcoin Core in console mode. In my case I noticed that:
• BECH32 (Native Segwit) addresses starting with 'bc1' have the following information in 'desc' field: (wkph)[xpubfingerprint] / 84' / 0' / 0'; and
• P2SH (Nested Segwit) addresses starting '3' with have the following information in 'desc' field: sh(wkph) [xpubfingerprint] / 84' / 0' / 0'
The derivation paths of the P2SH (Nested Segwit) were the same as for BECH32 (Native Segwit).
I managed to re-create the P2SH UTXOs in Sparrow as follows:
- going into Sparrow settings and turning off ‘validate derivation’;
- creating a P2SH (Nested Segwit) wallet on Sparrow by importing default XPUB for P2SH (Nested Segwit) from HWW;
- manually amending the derivation path section in Sparrow to m/ 84’ / 0' / 0';
- manually pasting the BECH32 (Native Segwit) XPUB (can be found on HWW) into XPUB section of Sparrow (i.e. replacing P2SH XPUB imported from HWW);
- rescanning on Sparrow and seeing all my P2SH UTXOs appear; and
- HWW signing for P2SH UTXOs worked.