I have this old wallet.dat file, originally created in Bitcoin Core around 2015-2016. Now, I’m trying to move all my Bitcoins from this wallet into an Electrum wallet because I simply cannot get Bitcoin Core to sync and load my wallet without problems (I’ve tried on several different platforms with different errors and I’ve given up on this route for the time being).
Anyhow, my mission is to export all private keys containing unspent transactions so that I can sweep them into Electrum. The first thing I did was to make a wallet dump using [jackjack-jj/pywallet](https://github.com/jackjack-jj/pywallet). This gave me all the addresses starting with “1”, some of them contained in the list of receive addresses in Bitcoin Core and some of them being change addresses. However, some receive addresses, starting with “3” were obviously missing from this dump.
So, I fired up a fresh install of Bitcoin Core and used the dumpwallet command to export all my keys. This gave me a lot of addresses beginning with “3”, including the missing receive addresses from the pywallet dump. However, not all addresses beginning with “1” that I found using the pywallet dump showed up for this Bitcoin Core dump.
So, what I’m left with are two non-identical subsets of keys, and I don’t know if there are more that I haven’t been able to retrieve. However, if I were to understand why the two programs gives me different outputs, maybe I would be more confident that I’ve located them all.
First of all, I don’t know why I have a mix of addresses starting with “1” and addresses starting with “3”. Without really knowing, it seems like my wallet is some kind of mix between a HD wallet (generating addresses starting with “1”?) and an old wallet where each address is generated individually (addresses starting with “1”?). Since my wallet is filled with keywords suggesting a HD wallet (for example derivation paths and master private keys), I guess this is the case. If so, I still don’t understand why Bitcoin Core won’t dump all of the keys that pywallet can find. At least pywallet feels more consistent, since I only get addresses starting with “1” (I guess support for addresses starting with “3” are lacking).
Further, there are two things I really don’t understand. If I have a HD wallet, shouldn’t I be able to generate an infinite addresses? I realize that Bitcoin Core can’t print all of them since I don’t have an infinite hard drive, but how is it decided which one will be shown? Some kind of internal track record of all my transactions? Also, when reading [the wiki page about addresses starting with “3”](https://en.bitcoin.it/wiki/Pay_to_script_hash), it says “To spend bitcoins sent via P2SH, the recipient must provide a script matching the script hash and data which makes the script evaluate to true.” Does this mean that the private key contained in my dump from Bitcoin Core won’t be enough?
Sorry for this brain dump about my wallet dump, but I’ve been looking into this for months now. I would really appreciate any help.