
Rename WITH_MULTIPROCESS to ENABLE_IPC, because ENABLE_IPC is a more accurate name for the feature. It controls whether the src/ipc/ directory is built and whether IPC features like -ipcbind, -ipcconnect, and -ipcfd are available. It does NOT currently enable multiprocess features which are implemented in #10102 building on top of the IPC features. It will also no longer (as of the next commit), control whether a find_package call is made so the "WITH_" prefix is also inappropriate. -BEGIN VERIFY SCRIPT- git grep -l WITH_MULTIPROCESS | xargs sed -i s/WITH_MULTIPROCESS/ENABLE_IPC/g -END VERIFY SCRIPT-
3.3 KiB
Multiprocess Bitcoin
This document describes usage of the multiprocess feature. For design information, see the design/multiprocess.md file.
Build Option
On Unix systems, the -DENABLE_IPC=ON
build option can be passed to build the supplemental bitcoin-node
and bitcoin-gui
multiprocess executables.
Debugging
The -debug=ipc
command line option can be used to see requests and responses between processes.
Installation
The multiprocess feature requires Cap'n Proto and libmultiprocess as dependencies. A simple way to get started using it without installing these dependencies manually is to use the depends system with the MULTIPROCESS=1
dependency option passed to make:
cd <BITCOIN_SOURCE_DIRECTORY>
make -C depends NO_QT=1 MULTIPROCESS=1
# Set host platform to output of gcc -dumpmachine or clang -dumpmachine or check the depends/ directory for the generated subdirectory name
HOST_PLATFORM="x86_64-pc-linux-gnu"
cmake -B build --toolchain=depends/$HOST_PLATFORM/toolchain.cmake
cmake --build build
build/bin/bitcoin-node -regtest -printtoconsole -debug=ipc
BITCOIND=$(pwd)/build/bin/bitcoin-node build/test/functional/test_runner.py
The cmake
build will pick up settings and library locations from the depends directory, so there is no need to pass -DENABLE_IPC=ON
as a separate flag when using the depends system (it's controlled by the MULTIPROCESS=1
option).
Alternately, you can install Cap'n Proto and libmultiprocess packages on your system, and just run cmake -B build -DENABLE_IPC=ON
without using the depends system. The cmake
build will be able to locate the installed packages via pkg-config. See Installation section of the libmultiprocess readme for install steps. See build-unix.md and build-osx.md for information about installing dependencies in general.
Usage
bitcoin-node
is a drop-in replacement for bitcoind
, and bitcoin-gui
is a drop-in replacement for bitcoin-qt
, and there are no differences in use or external behavior between the new and old executables. But internally after #10102, bitcoin-gui
will spawn a bitcoin-node
process to run P2P and RPC code, communicating with it across a socket pair, and bitcoin-node
will spawn bitcoin-wallet
to run wallet code, also communicating over a socket pair. This will let node, wallet, and GUI code run in separate address spaces for better isolation, and allow future improvements like being able to start and stop components independently on different machines and environments.
#19460 also adds a new bitcoin-node
-ipcbind
option and a bitcoind-wallet
-ipcconnect
option to allow new wallet processes to connect to an existing node process.
And #19461 adds a new bitcoin-gui
-ipcconnect
option to allow new GUI processes to connect to an existing node process.