mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-05-03 18:29:21 +02:00
build, wallet, doc: Remove BDB
This commit is contained in:
@@ -34,33 +34,6 @@ Skip if you don't intend to use descriptor wallets.
|
||||
pkg install sqlite3
|
||||
```
|
||||
|
||||
###### Legacy Wallet Support
|
||||
BerkeleyDB is only required if legacy wallet support is required.
|
||||
|
||||
It is required to use Berkeley DB 4.8. You **cannot** use the BerkeleyDB library
|
||||
from ports. However, you can build DB 4.8 yourself [using depends](/depends).
|
||||
|
||||
```bash
|
||||
pkg install gmake
|
||||
gmake -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_ZMQ=1 NO_USDT=1
|
||||
```
|
||||
|
||||
When the build is complete, the Berkeley DB installation location will be displayed:
|
||||
|
||||
```
|
||||
to: /path/to/bitcoin/depends/x86_64-unknown-freebsd[release-number]
|
||||
```
|
||||
|
||||
Finally, set `BDB_PREFIX` to this path according to your shell:
|
||||
|
||||
```
|
||||
csh: setenv BDB_PREFIX [path displayed above]
|
||||
```
|
||||
|
||||
```
|
||||
sh/bash: export BDB_PREFIX=[path displayed above]
|
||||
```
|
||||
|
||||
#### GUI Dependencies
|
||||
###### Qt6
|
||||
|
||||
@@ -107,20 +80,13 @@ pkg install python3 databases/py-sqlite3 net/py-pyzmq
|
||||
There are many ways to configure Bitcoin Core, here are a few common examples:
|
||||
|
||||
##### Descriptor Wallet and GUI:
|
||||
This disables legacy wallet support and enables the GUI, assuming `sqlite` and `qt` are installed.
|
||||
This enables the GUI, assuming `sqlite` and `qt` are installed.
|
||||
```bash
|
||||
cmake -B build -DWITH_BDB=OFF -DBUILD_GUI=ON
|
||||
cmake -B build -DBUILD_GUI=ON
|
||||
```
|
||||
|
||||
Run `cmake -B build -LH` to see the full list of available options.
|
||||
|
||||
##### Descriptor & Legacy Wallet. No GUI:
|
||||
This enables support for both wallet types, assuming
|
||||
`sqlite3` and `db4` are both installed.
|
||||
```bash
|
||||
cmake -B build -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include" -DWITH_BDB=ON
|
||||
```
|
||||
|
||||
##### No Wallet or GUI
|
||||
```bash
|
||||
cmake -B build -DENABLE_WALLET=OFF
|
||||
|
||||
@@ -55,14 +55,6 @@ It is not necessary to build wallet functionality to run bitcoind or the GUI.
|
||||
pkgin install sqlite3
|
||||
```
|
||||
|
||||
###### Legacy Wallet Support
|
||||
|
||||
`db4` is required to enable support for legacy wallets.
|
||||
|
||||
```bash
|
||||
pkgin install db4
|
||||
```
|
||||
|
||||
#### GUI Dependencies
|
||||
###### Qt6
|
||||
|
||||
|
||||
@@ -26,35 +26,13 @@ git clone https://github.com/bitcoin/bitcoin.git
|
||||
#### Wallet Dependencies
|
||||
|
||||
It is not necessary to build wallet functionality to run either `bitcoind` or `bitcoin-qt`.
|
||||
SQLite is required to build the wallet.
|
||||
|
||||
###### Descriptor Wallet Support
|
||||
|
||||
SQLite is required to support [descriptor wallets](descriptors.md).
|
||||
|
||||
``` bash
|
||||
pkg_add sqlite3
|
||||
```
|
||||
|
||||
###### Legacy Wallet Support
|
||||
BerkeleyDB is only required to support legacy wallets.
|
||||
|
||||
It is recommended to use Berkeley DB 4.8. You cannot use the BerkeleyDB library
|
||||
from ports. However you can build it yourself, [using depends](/depends).
|
||||
|
||||
Refer to [depends/README.md](/depends/README.md) for detailed instructions.
|
||||
|
||||
```bash
|
||||
gmake -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_ZMQ=1 NO_USDT=1
|
||||
...
|
||||
to: /path/to/bitcoin/depends/*-unknown-openbsd*
|
||||
```
|
||||
|
||||
Then set `BDB_PREFIX`:
|
||||
|
||||
```bash
|
||||
export BDB_PREFIX="[path displayed above]"
|
||||
```
|
||||
|
||||
#### GUI Dependencies
|
||||
###### Qt6
|
||||
|
||||
@@ -108,13 +86,6 @@ cmake -B build -DBUILD_GUI=ON
|
||||
|
||||
Run `cmake -B build -LH` to see the full list of available options.
|
||||
|
||||
##### Descriptor & Legacy Wallet. No GUI:
|
||||
This enables support for both wallet types:
|
||||
|
||||
```bash
|
||||
cmake -B build -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include" -DWITH_BDB=ON
|
||||
```
|
||||
|
||||
### 2. Compile
|
||||
|
||||
```bash
|
||||
|
||||
@@ -74,14 +74,6 @@ It is not necessary to build wallet functionality to run `bitcoind` or `bitcoin
|
||||
macOS ships with a useable `sqlite` package, meaning you don't need to
|
||||
install anything.
|
||||
|
||||
###### Legacy Wallet Support
|
||||
|
||||
`berkeley-db@4` is only required to support for legacy wallets.
|
||||
Skip if you don't intend to use legacy wallets.
|
||||
|
||||
``` bash
|
||||
brew install berkeley-db@4
|
||||
```
|
||||
---
|
||||
|
||||
#### GUI Dependencies
|
||||
@@ -160,14 +152,6 @@ It is required that you have `python` and `zip` installed.
|
||||
|
||||
There are many ways to configure Bitcoin Core, here are a few common examples:
|
||||
|
||||
##### Wallet (BDB + SQlite) Support, No GUI:
|
||||
|
||||
If `berkeley-db@4` or `sqlite` are not installed, this will throw an error.
|
||||
|
||||
``` bash
|
||||
cmake -B build -DWITH_BDB=ON
|
||||
```
|
||||
|
||||
##### Wallet (only SQlite) and GUI Support:
|
||||
|
||||
This enables the GUI.
|
||||
|
||||
@@ -54,10 +54,6 @@ SQLite is required for the descriptor wallet:
|
||||
|
||||
sudo apt install libsqlite3-dev
|
||||
|
||||
Berkeley DB is only required for the legacy wallet. Ubuntu and Debian have their own `libdb-dev` and `libdb++-dev` packages,
|
||||
but these will install Berkeley DB 5.3 or later. This will break binary wallet compatibility with the distributed
|
||||
executables, which are based on BerkeleyDB 4.8. Otherwise, you can build Berkeley DB [yourself](#berkeley-db).
|
||||
|
||||
To build Bitcoin Core without wallet, see [*Disable-wallet mode*](#disable-wallet-mode)
|
||||
|
||||
ZMQ dependencies (provides ZMQ API):
|
||||
@@ -109,10 +105,6 @@ SQLite is required for the descriptor wallet:
|
||||
|
||||
sudo dnf install sqlite-devel
|
||||
|
||||
Berkeley DB is only required for the legacy wallet. Fedora releases have only `libdb-devel` and `libdb-cxx-devel` packages, but these will install
|
||||
Berkeley DB 5.3 or later. This will break binary wallet compatibility with the distributed executables, which
|
||||
are based on Berkeley DB 4.8. Otherwise, you can build Berkeley DB [yourself](#berkeley-db).
|
||||
|
||||
To build Bitcoin Core without wallet, see [*Disable-wallet mode*](#disable-wallet-mode)
|
||||
|
||||
ZMQ dependencies (provides ZMQ API):
|
||||
@@ -153,27 +145,6 @@ See [dependencies.md](dependencies.md) for a complete overview, and
|
||||
[depends](/depends/README.md) on how to compile them yourself, if you wish to
|
||||
not use the packages of your Linux distribution.
|
||||
|
||||
### Berkeley DB
|
||||
|
||||
The legacy wallet uses Berkeley DB. To ensure backwards compatibility it is
|
||||
recommended to use Berkeley DB 4.8. If you have to build it yourself, and don't
|
||||
want to use any other libraries built in depends, you can do:
|
||||
```bash
|
||||
make -C depends NO_BOOST=1 NO_LIBEVENT=1 NO_QT=1 NO_ZMQ=1 NO_USDT=1
|
||||
...
|
||||
to: /path/to/bitcoin/depends/x86_64-pc-linux-gnu
|
||||
```
|
||||
and configure using the following:
|
||||
```bash
|
||||
export BDB_PREFIX="/path/to/bitcoin/depends/x86_64-pc-linux-gnu"
|
||||
|
||||
cmake -B build -DBerkeleyDB_INCLUDE_DIR:PATH="${BDB_PREFIX}/include" -DWITH_BDB=ON
|
||||
```
|
||||
|
||||
**Note**: Make sure that `BDB_PREFIX` is an absolute path.
|
||||
|
||||
**Note**: You only need Berkeley DB if the legacy wallet is enabled (see [*Disable-wallet mode*](#disable-wallet-mode)).
|
||||
|
||||
Disable-wallet mode
|
||||
--------------------
|
||||
When the intention is to only run a P2P node, without a wallet, Bitcoin Core can
|
||||
@@ -181,7 +152,7 @@ be compiled in disable-wallet mode with:
|
||||
|
||||
cmake -B build -DENABLE_WALLET=OFF
|
||||
|
||||
In this case there is no dependency on SQLite or Berkeley DB.
|
||||
In this case there is no dependency on SQLite.
|
||||
|
||||
Mining is also possible in disable-wallet mode using the `getblocktemplate` RPC call.
|
||||
|
||||
@@ -204,4 +175,3 @@ This example lists the steps necessary to setup and build a command line only di
|
||||
ctest --test-dir build
|
||||
./build/bin/bitcoind
|
||||
|
||||
If you intend to work with legacy Berkeley DB wallets, see [Berkeley DB](#berkeley-db) section.
|
||||
|
||||
@@ -32,7 +32,6 @@ Bitcoin Core requires one of the following compilers.
|
||||
| [qrencode](../depends/packages/qrencode.mk) (gui) | [link](https://fukuchi.org/works/qrencode/) | [4.1.1](https://github.com/bitcoin/bitcoin/pull/27312) | N/A | No |
|
||||
| [Qt](../depends/packages/qt.mk) (gui) | [link](https://download.qt.io/archive/qt/) | [6.7.3](https://github.com/bitcoin/bitcoin/pull/30997) | [6.2](https://github.com/bitcoin/bitcoin/pull/30997) | No |
|
||||
| [ZeroMQ](../depends/packages/zeromq.mk) (notifications) | [link](https://github.com/zeromq/libzmq/releases) | [4.3.4](https://github.com/bitcoin/bitcoin/pull/23956) | 4.0.0 | No |
|
||||
| [Berkeley DB](../depends/packages/bdb.mk) (legacy wallet) | [link](https://www.oracle.com/technetwork/database/database-technologies/berkeleydb/downloads/index.html) | 4.8.30 | 4.8.x | No |
|
||||
| [SQLite](../depends/packages/sqlite.mk) (wallet) | [link](https://sqlite.org) | [3.38.5](https://github.com/bitcoin/bitcoin/pull/25378) | [3.7.17](https://github.com/bitcoin/bitcoin/pull/19077) | No |
|
||||
| Python (scripts, tests) | [link](https://www.python.org) | N/A | [3.10](https://github.com/bitcoin/bitcoin/pull/30527) | No |
|
||||
| [systemtap](../depends/packages/systemtap.mk) ([tracing](tracing.md)) | [link](https://sourceware.org/systemtap/) | [4.8](https://github.com/bitcoin/bitcoin/pull/26945)| N/A | No |
|
||||
|
||||
@@ -11,8 +11,6 @@ Supporting RPCs are:
|
||||
addresses.
|
||||
- `listunspent` outputs a specialized descriptor for the reported unspent outputs.
|
||||
- `getaddressinfo` outputs a descriptor for solvable addresses (since v0.18).
|
||||
- `importmulti` takes as input descriptors to import into a legacy wallet
|
||||
(since v0.18).
|
||||
- `generatetodescriptor` takes as input a descriptor and generates coins to it
|
||||
(`regtest` only, since v0.19).
|
||||
- `utxoupdatepsbt` takes as input descriptors to add information to the psbt
|
||||
@@ -319,5 +317,5 @@ roughly 1 in a trillion chance of not detecting the errors.
|
||||
|
||||
All RPCs in Bitcoin Core will include the checksum in their output. Only
|
||||
certain RPCs require checksums on input, including `deriveaddresses` and
|
||||
`importmulti`. The checksum for a descriptor without one can be computed
|
||||
`importdescriptors`. The checksum for a descriptor without one can be computed
|
||||
using the `getdescriptorinfo` RPC.
|
||||
|
||||
24
doc/files.md
24
doc/files.md
@@ -8,14 +8,14 @@
|
||||
|
||||
- [Multi-wallet environment](#multi-wallet-environment)
|
||||
|
||||
- [Berkeley DB database based wallets](#berkeley-db-database-based-wallets)
|
||||
|
||||
- [SQLite database based wallets](#sqlite-database-based-wallets)
|
||||
|
||||
- [GUI settings](#gui-settings)
|
||||
|
||||
- [Legacy subdirectories and files](#legacy-subdirectories-and-files)
|
||||
|
||||
- [Berkeley DB database based wallets](#berkeley-db-database-based-wallets)
|
||||
|
||||
- [Notes](#notes)
|
||||
|
||||
## Data directory location
|
||||
@@ -75,7 +75,7 @@ Subdirectory | File(s) | Description
|
||||
|
||||
## Multi-wallet environment
|
||||
|
||||
Wallets are Berkeley DB (BDB) or SQLite databases.
|
||||
Wallets are SQLite databases.
|
||||
|
||||
1. Each user-defined wallet named "wallet_name" resides in the `wallets/wallet_name/` subdirectory.
|
||||
|
||||
@@ -88,15 +88,6 @@ Wallets are Berkeley DB (BDB) or SQLite databases.
|
||||
5. Any copy or backup of the wallet should be done through a `backupwallet` call in order to update and lock the wallet, preventing any file corruption caused by updates during the copy.
|
||||
|
||||
|
||||
### Berkeley DB database based wallets
|
||||
|
||||
Subdirectory | File(s) | Description
|
||||
-------------|-------------------|-------------
|
||||
`database/` | BDB logging files | Part of BDB environment; created at start and deleted on shutdown; a user *must keep it as safe* as personal wallet `wallet.dat`
|
||||
`./` | `db.log` | BDB error file
|
||||
`./` | `wallet.dat` | Personal wallet (a BDB database) with keys and transactions
|
||||
`./` | `.walletlock` | BDB wallet lock file
|
||||
|
||||
### SQLite database based wallets
|
||||
|
||||
Subdirectory | File | Description
|
||||
@@ -123,6 +114,15 @@ Path | Description | Repository notes
|
||||
`addr.dat` | Peer IP address BDB database; replaced by `peers.dat` in [0.7.0](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.7.0.md) | [PR #1198](https://github.com/bitcoin/bitcoin/pull/1198), [`928d3a01`](https://github.com/bitcoin/bitcoin/commit/928d3a011cc66c7f907c4d053f674ea77dc611cc)
|
||||
`onion_private_key` | Cached Tor onion service private key for `-listenonion` option. Was used for Tor v2 services; replaced by `onion_v3_private_key` in [0.21.0](https://github.com/bitcoin/bitcoin/blob/master/doc/release-notes/release-notes-0.21.0.md) | [PR #19954](https://github.com/bitcoin/bitcoin/pull/19954)
|
||||
|
||||
### Berkeley DB database based wallets
|
||||
|
||||
Subdirectory | File(s) | Description
|
||||
-------------|-------------------|-------------
|
||||
`database/` | BDB logging files | Part of BDB environment; created at start and deleted on shutdown; a user *must keep it as safe* as personal wallet `wallet.dat`
|
||||
`./` | `db.log` | BDB error file
|
||||
`./` | `wallet.dat` | Personal wallet (a BDB database) with keys and transactions
|
||||
`./` | `.walletlock` | BDB wallet lock file
|
||||
|
||||
## Notes
|
||||
|
||||
<a name="note1">1</a>. The `/` (slash, U+002F) is used as the platform-independent path component separator in this document.
|
||||
|
||||
@@ -52,8 +52,6 @@ During the generation of the build system only essential build options are enabl
|
||||
|
||||
Run `cmake -B build -LH` to see the full list of available options. GUI tools, such as `ccmake` and `cmake-gui`, can be also helpful.
|
||||
|
||||
If you do need the wallet enabled (`-DENABLE_WALLET=ON`), it is common for devs to use your system bdb version for the wallet, so you don't have to find a copy of bdb 4.8. Wallets from such a build will be incompatible with any release binary (and vice versa), so use with caution on mainnet.
|
||||
|
||||
### Make use of your threads with `-j`
|
||||
|
||||
If you have multiple threads on your machine, you can utilize all of them with:
|
||||
|
||||
51
doc/psbt.md
51
doc/psbt.md
@@ -97,54 +97,3 @@ hardware implementations will typically implement multiple roles simultaneously.
|
||||
#### Multisig with multiple Bitcoin Core instances
|
||||
|
||||
For a quick start see [Basic M-of-N multisig example using descriptor wallets and PSBTs](./descriptors.md#basic-multisig-example).
|
||||
If you are using legacy wallets feel free to continue with the example provided here.
|
||||
|
||||
Alice, Bob, and Carol want to create a 2-of-3 multisig address. They're all using
|
||||
Bitcoin Core. We assume their wallets only contain the multisig funds. In case
|
||||
they also have a personal wallet, this can be accomplished through the
|
||||
multiwallet feature - possibly resulting in a need to add `-rpcwallet=name` to
|
||||
the command line in case `bitcoin-cli` is used.
|
||||
|
||||
Setup:
|
||||
- All three call `getnewaddress` to create a new address; call these addresses
|
||||
*Aalice*, *Abob*, and *Acarol*.
|
||||
- All three call `getaddressinfo "X"`, with *X* their respective address, and
|
||||
remember the corresponding public keys. Call these public keys *Kalice*,
|
||||
*Kbob*, and *Kcarol*.
|
||||
- All three now run `addmultisigaddress 2 ["Kalice","Kbob","Kcarol"]` to teach
|
||||
their wallet about the multisig script. Call the address produced by this
|
||||
command *Amulti*. They may be required to explicitly specify the same
|
||||
addresstype option each, to avoid constructing different versions due to
|
||||
differences in configuration.
|
||||
- They also run `importaddress "Amulti" "" false` to make their wallets treat
|
||||
payments to *Amulti* as contributing to the watch-only balance.
|
||||
- Others can verify the produced address by running
|
||||
`createmultisig 2 ["Kalice","Kbob","Kcarol"]`, and expecting *Amulti* as
|
||||
output. Again, it may be necessary to explicitly specify the addresstype
|
||||
in order to get a result that matches. This command won't enable them to
|
||||
initiate transactions later, however.
|
||||
- They can now give out *Amulti* as address others can pay to.
|
||||
|
||||
Later, when *V* BTC has been received on *Amulti*, and Bob and Carol want to
|
||||
move the coins in their entirety to address *Asend*, with no change. Alice
|
||||
does not need to be involved.
|
||||
- One of them - let's assume Carol here - initiates the creation. She runs
|
||||
`walletcreatefundedpsbt [] {"Asend":V} 0 {"subtractFeeFromOutputs":[0], "includeWatching":true}`.
|
||||
We call the resulting PSBT *P*. *P* does not contain any signatures.
|
||||
- Carol needs to sign the transaction herself. In order to do so, she runs
|
||||
`walletprocesspsbt "P"`, and gives the resulting PSBT *P2* to Bob.
|
||||
- Bob inspects the PSBT using `decodepsbt "P2"` to determine if the transaction
|
||||
has indeed just the expected input, and an output to *Asend*, and the fee is
|
||||
reasonable. If he agrees, he calls `walletprocesspsbt "P2"` to sign. The
|
||||
resulting PSBT *P3* contains both Carol's and Bob's signature.
|
||||
- Now anyone can call `finalizepsbt "P3"` to extract a fully signed transaction
|
||||
*T*.
|
||||
- Finally anyone can broadcast the transaction using `sendrawtransaction "T"`.
|
||||
|
||||
In case there are more signers, it may be advantageous to let them all sign in
|
||||
parallel, rather than passing the PSBT from one signer to the next one. In the
|
||||
above example this would translate to Carol handing a copy of *P* to each signer
|
||||
separately. They can then all invoke `walletprocesspsbt "P"`, and end up with
|
||||
their individually-signed PSBT structures. They then all send those back to
|
||||
Carol (or anyone) who can combine them using `combinepsbt`. The last two steps
|
||||
(`finalizepsbt` and `sendrawtransaction`) remain unchanged.
|
||||
|
||||
Reference in New Issue
Block a user