<p>I finally got this. Here is a brief summary for the future searcher:</p>
<ol>
<li>use the old software to launch the node with the old wallet.db file</li>
<li>run the dump wallet command. This creates a file that is in a text format that is more portable than bdb.</li>
<li>run load wallet command on the new node.</li>
<li>rescan the new node (the default scan does not look very far back)</li>
</ol>
<p>Note that the file created in step 2 is unencrypted and contains your private keys, so handle with care. Though I did wait for the new node to finish syncing, I doubt that is actually a requirement. I did <em>not</em> allow the old node to sync more than a few blocks.</p>

CC BY-SA 4.0
2021-03-28T03:24:44.260Z
2021-03-28T03:24:44.260Z
memtha
<p>After 2 years of being shut down, I am trying to revive my bitcoin full node, while both switching platforms and upgrading to the current version in the process. Everything works but the wallet. The presence of the wallet causes the new node to crash (segfault). The node works when either wallet.dat is missing or when -disablewallet is provided. I do not really need that wallet to be fully imported, just to get the bitcoin associated with it into the an address controlled by the new node.</p>
<p>I read <a href="https://github.com/bitcoin/bitcoin/issues/12047" rel="nofollow noreferrer">this issue report</a> that blames the version of the berkley db lib files. I compiled bitcoin core locally with the older BDB libs provided via <code>bitcoin/contrib/install_db4.sh</code> per that issue report, and got the same result. The thing is, since (afaik) the windows platform does not provide an implementation of BDB, I have no idea what headers are correct for the wallet file generated by windows bitcoin core.</p>
<p>I want to avoid deleting and re-downloading the entire blockchain. I did run once with <code>-disablewallet -assumevalid=0</code> to verify the entire blockchain. I retain backups of all pre-upgrade files, if it helps.</p>
<p><a href="https://pastebin.com/BXNYnvxs" rel="nofollow noreferrer">gdb backtrace pastebin</a>. Note that this run was only a subset of the cli options I normally run with, specifically missing rpc info.</p>
<p>Old setup:</p>
<ul>
<li>Windows 7 pro x64 sp1</li>
<li>bitcoin core gui (qt) 0.16.0</li>
<li>last synced early December 2018</li>
<li>BDB version unknown</li>
<li>datadir sat on slow external hdd (ntfs)</li>
</ul>
<p>New node:</p>
<ul>
<li>Debian Buster stable</li>
<li>bitcoin core daemon 0.21, compiled locally</li>
<li>syncing now, currently late March 2019</li>
<li>BDB 4.8.30.NC compiled via included script and detected by configure</li>
<li>datadir on slow internal sata hdd (ext4)</li>
</ul>
<p>Is there any way to import an old/differently formatted wallet.dat file into a newer node? Is there perhaps a way to extract the private key info from said old file, so it can be manually imported? Could the old node software possibly create and send a transaction with the entire contents of the old wallet to a new address <em>without fully syncing first</em>? Is it possible the old version of bitcoinn core could fully sync with the modern blockchain?</p>
<p>e: forgot to mention: the db err logfile <code>/mnt/data/blockchains/btc/blockchain/db.log</code> is empty and retains the last modified date from the first startup of the original node in mid 2017.</p>
<p>e2: after translating the wallet to db version 4.8 as @PieterWuille suggested, the node reindexed and printed a number of lines like</p>
<pre><code>2021-02-18T23:58:08Z [default wallet] Submitting wtx f7b5 to mempool for relay
</code></pre>
<p>but after running for a few days, it indexed up to block height just under 500000 and then segfaulted again.</p>

CC BY-SA 4.0
2021-02-15T21:10:13.597Z
What often works (but make sure you have a wallet.dat backup) in these cases is running "db<ver>_dump old_wallet.dat | db<ver>_load new_wallet.dat", where you replace the <ver> with the respective version number (e.g. db5.3_dump, db4.8_load). This'll create a new_wallet.dat file that's compatible with whatever version you select.
Pieter Wuille
CC BY-SA 4.0
2021-02-15T21:10:35.000Z
Was the old Bitcoin-Qt binary self compiled or a release binary? Release binaries always use BDB 4.8.
Pieter Wuille
CC BY-SA 4.0
2021-02-15T21:21:50.283Z
It doesn't look like this is related to BDB at all, actually, looking at the stacktrace. Can you try starting with -upgradewallet cmdline argument? (make a backup of wallet.dat first, of course).
Pieter Wuille
CC BY-SA 4.0
2021-02-15T22:01:25.683Z
@PieterWuille the old setup was the release build (80% sure). I will try upgradewallet next once my current attempt to importwallet via bitcoin-cli finishes, if it does not work. Does it matter that the old wallet.dat file is passphrase protected? At what point should I enter the passphrase (and how)?
memtha
CC BY-SA 4.0
2021-02-15T22:07:38.977Z
You only need the passphrase to sign transactions (i.e, sending coins). You'll have to provide it using the `walletpassphrase` RPC (or if you use the GUI, it'll just ask you when needed).
Pieter Wuille
CC BY-SA 4.0
2021-02-15T23:34:09.533Z
@PieterWuille that's is what I thought, though I was hoping that that was what was going wrong with my import attempt. bitcoind says the -upgradewallet option is not valid and I see nothing similar in the man file that shipped with the source. I am having a heck of a time finding binaries of db4.8-utils for debian. Though I'm not quite sure if the wallet version is the problem, since the old and new are theoretically both 4.8.
memtha
CC BY-SA 4.0
2021-02-15T23:46:54.470Z
Supplemental: I just did the dump | load thing and restarted the node. Looks like the node is reindexing starting from block 1. So that might be a good sign.
memtha
<bitcoin-core><bitcoind><wallet.dat>
Upgrading/converting bitcoin core wallet between platforms
memtha
# Upgrading/converting bitcoin core wallet between platforms

(Asked by: username_0 on 2021-02-15)

After 2 years of being shut down, I am trying to revive my bitcoin full node, while both switching platforms and upgrading to the current version in the process. Everything works but the wallet. The presence of the wallet causes the new node to crash (segfault). The node works when either wallet.dat is missing or when -disablewallet is provided. I do not really need that wallet to be fully imported, just to get the bitcoin associated with it into the an address controlled by the new node.

I read [this issue report](https://github.com/bitcoin/bitcoin/issues/12047) that blames the version of the berkley db lib files. I compiled bitcoin core locally with the older BDB libs provided via `bitcoin/contrib/install_db4.sh` per that issue report, and got the same result. The thing is, since (afaik) the windows platform does not provide an implementation of BDB, I have no idea what headers are correct for the wallet file generated by windows bitcoin core.

I want to avoid deleting and re-downloading the entire blockchain. I did run once with `-disablewallet -assumevalid=0` to verify the entire blockchain. I retain backups of all pre-upgrade files, if it helps.

[gdb backtrace pastebin](https://pastebin.com/BXNYnvxs). Note that this run was only a subset of the cli options I normally run with, specifically missing rpc info.

Old setup:

* Windows 7 pro x64 sp1
* bitcoin core gui (qt) 0.16.0
* last synced early December 2018
* BDB version unknown
* datadir sat on slow external hdd (ntfs)

New node:

* Debian Buster stable
* bitcoin core daemon 0.21, compiled locally
* syncing now, currently late March 2019
* BDB 4.8.30.NC compiled via included script and detected by configure
* datadir on slow internal sata hdd (ext4)

Is there any way to import an old/differently formatted wallet.dat file into a newer node? Is there perhaps a way to extract the private key info from said old file, so it can be manually imported? Could the old node software possibly create and send a transaction with the entire contents of the old wallet to a new address *without fully syncing first*? Is it possible the old version of bitcoinn core could fully sync with the modern blockchain?

e: forgot to mention: the db err logfile `/mnt/data/blockchains/btc/blockchain/db.log` is empty and retains the last modified date from the first startup of the original node in mid 2017.

e2: after translating the wallet to db version 4.8 as @username_1 suggested, the node reindexed and printed a number of lines like

```
2021-02-18T23:58:08Z [default wallet] Submitting wtx f7b5 to mempool for relay

```

but after running for a few days, it indexed up to block height just under 500000 and then segfaulted again.

**Tags:** bitcoin-core, bitcoind, wallet.dat

> **Comments:**
> **username_1**: What often works (but make sure you have a wallet.dat backup) in these cases is running "db<ver>_dump old_wallet.dat | db<ver>_load new_wallet.dat", where you replace the <ver> with the respective version number (e.g. db5.3_dump, db4.8_load). This'll create a new_wallet.dat file that's compatible with whatever version you select.  
> **username_1**: Was the old Bitcoin-Qt binary self compiled or a release binary? Release binaries always use BDB 4.8.  
> **username_1**: It doesn't look like this is related to BDB at all, actually, looking at the stacktrace. Can you try starting with -upgradewallet cmdline argument? (make a backup of wallet.dat first, of course).  
> **username_0**: @username_1 the old setup was the release build (80% sure). I will try upgradewallet next once my current attempt to importwallet via bitcoin-cli finishes, if it does not work. Does it matter that the old wallet.dat file is passphrase protected? At what point should I enter the passphrase (and how)?  
> **username_1**: You only need the passphrase to sign transactions (i.e, sending coins). You'll have to provide it using the `walletpassphrase` RPC (or if you use the GUI, it'll just ask you when needed).  
> **username_0**: @username_1 that's is what I thought, though I was hoping that that was what was going wrong with my import attempt. bitcoind says the -upgradewallet option is not valid and I see nothing similar in the man file that shipped with the source. I am having a heck of a time finding binaries of db4.8-utils for debian. Though I'm not quite sure if the wallet version is the problem, since the old and new are theoretically both 4.8.  
> **username_0**: Supplemental: I just did the dump | load thing and restarted the node. Looks like the node is reindexing starting from block 1. So that might be a good sign.  

---

## 1 answers

### Answer by username_0 on 2021-03-28. Score: 1

I finally got this. Here is a brief summary for the future searcher:

1. use the old software to launch the node with the old wallet.db file
2. run the dump wallet command. This creates a file that is in a text format that is more portable than bdb.
3. run load wallet command on the new node.
4. rescan the new node (the default scan does not look very far back)

Note that the file created in step 2 is unencrypted and contains your private keys, so handle with care. Though I did wait for the new node to finish syncing, I doubt that is actually a requirement. I did *not* allow the old node to sync more than a few blocks.


---

