<p>To be safe, you should use BDB 4.8 as that is the version that is used in releases. However using <code>--with-incompatible-bdb</code> should still produce wallet.dat files that can be used with the officially built clients.</p>

<p>You may find that people say that the BDB database files are incompatible from version to version. Furthermore Oracle, in their own documentation, say that there are no guarantees that database or environment files are compatible from version to version, even from minor version to minor version. But from researching and testing this out myself, this is not true in practice.</p>

<p>BDB rarely changes the database file format. Rather what does tend to change are the <a href="https://en.wikipedia.org/wiki/Transaction_log" rel="nofollow noreferrer">database transaction logs</a>. These log files are used to ensure Durability (the D in <a href="https://en.wikipedia.org/wiki/ACID" rel="nofollow noreferrer">ACID</a>). Oracle has changed the log file format in minor versions so they are not backwards compatible (they are forwards compatible, so you can always move to a newer version of BDB). When you use <code>--with-incompatible-bdb</code>, you will probably be using a newer version of BDB that has incompatible transaction logs. So this would be a problem.</p>

<p>But Bitcoin Core actually mostly takes care of that problem for you. The transaction logs are removed if the wallet is able to be closed cleanly. So if nothing crashes and the wallet file is closed normally, you will be able to use a version of Bitcoin Core compiled with a different BDB, and then have the official release be able to use the same datadir and open the same wallet files.</p>

<p>In the event that Core crashes or the wallet files are otherwise uncleanly closed (e.g. power loss), then you should use a build of Bitcoin Core using the same BDB version that you had been using prior to the unclean shutdown. This will ensure that the transaction log can be read correctly and any information replayed and written to the wallet.dat file.</p>

<p>So what versions are compatible? From <a href="https://github.com/bitcoin/bitcoin/pull/18844#issuecomment-623004113" rel="nofollow noreferrer">my own testing</a>, I have found the following versions to work with no modification to Core necessary (Note these versions are what Oracle has available for download, versions with the same major and minor number of different patch number should still work):</p>

<ul>
<li>4.8.30 (Note this is the version that Core ships with)</li>
<li>5.0.32</li>
<li>5.1.29</li>
<li>5.2.42</li>
<li>5.3.29</li>
</ul>

<p>6.0 and above are not backwards compatible as they database file format has changed for these versions. You would be able to use 6.0+ but any wallet.dat files created by them cannot be used in the official binaries. However existing wallets created with the official binaries or one of the above versions of BDB could be used with a build that uses 6.0+ and be subsequently used again in the builds with older BDB versions. I.e. you could go from 4.8 to 6.0 and back to 4.8 with the same wallet.dat file.</p>

<p>4.7.25 also works but requires you to modify <code>configure.ac</code> to be able to build with a version less than 4.8.</p>

<p>4.6.21 requires modifying some code as API calls changed, but the database format still works. 4.5.x and below have significantly more API differences so I wasn't able to test them.</p>

CC BY-SA 4.0
2020-05-03T03:22:01.097Z
2020-05-03T03:27:27.677Z
2020-05-03T03:27:27.677Z
Ava Chow
<p>If I build using --with-incompatible-bdb, will the resulting wallet be incompatible with the bitcoin core client from bitcoin.org? What if I'm using a <em>newer</em> version?</p>

<wallet.dat>
Do Berkley DB versions need to be the same?
Nick ODell
# Do Berkley DB versions need to be the same?

(Asked by: username_0 on 2016-02-18)

If I build using --with-incompatible-bdb, will the resulting wallet be incompatible with the bitcoin core client from bitcoin.org? What if I'm using a *newer* version?

**Tags:** wallet.dat


---

## 1 answers

### Answer by username_1 on 2020-05-03. Score: 2

To be safe, you should use BDB 4.8 as that is the version that is used in releases. However using `--with-incompatible-bdb` should still produce wallet.dat files that can be used with the officially built clients.

You may find that people say that the BDB database files are incompatible from version to version. Furthermore Oracle, in their own documentation, say that there are no guarantees that database or environment files are compatible from version to version, even from minor version to minor version. But from researching and testing this out myself, this is not true in practice.

BDB rarely changes the database file format. Rather what does tend to change are the [database transaction logs](https://en.wikipedia.org/wiki/Transaction_log). These log files are used to ensure Durability (the D in [ACID](https://en.wikipedia.org/wiki/ACID)). Oracle has changed the log file format in minor versions so they are not backwards compatible (they are forwards compatible, so you can always move to a newer version of BDB). When you use `--with-incompatible-bdb`, you will probably be using a newer version of BDB that has incompatible transaction logs. So this would be a problem.

But Bitcoin Core actually mostly takes care of that problem for you. The transaction logs are removed if the wallet is able to be closed cleanly. So if nothing crashes and the wallet file is closed normally, you will be able to use a version of Bitcoin Core compiled with a different BDB, and then have the official release be able to use the same datadir and open the same wallet files.

In the event that Core crashes or the wallet files are otherwise uncleanly closed (e.g. power loss), then you should use a build of Bitcoin Core using the same BDB version that you had been using prior to the unclean shutdown. This will ensure that the transaction log can be read correctly and any information replayed and written to the wallet.dat file.

So what versions are compatible? From [my own testing](https://github.com/bitcoin/bitcoin/pull/18844#issuecomment-623004113), I have found the following versions to work with no modification to Core necessary (Note these versions are what Oracle has available for download, versions with the same major and minor number of different patch number should still work):

* 4.8.30 (Note this is the version that Core ships with)
* 5.0.32
* 5.1.29
* 5.2.42
* 5.3.29

6.0 and above are not backwards compatible as they database file format has changed for these versions. You would be able to use 6.0+ but any wallet.dat files created by them cannot be used in the official binaries. However existing wallets created with the official binaries or one of the above versions of BDB could be used with a build that uses 6.0+ and be subsequently used again in the builds with older BDB versions. I.e. you could go from 4.8 to 6.0 and back to 4.8 with the same wallet.dat file.

4.7.25 also works but requires you to modify `configure.ac` to be able to build with a version less than 4.8.

4.6.21 requires modifying some code as API calls changed, but the database format still works. 4.5.x and below have significantly more API differences so I wasn't able to test them.


---

