From 026bb226e96919603af829d0b677779a234a0f6e Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:04:31 +0000 Subject: [PATCH 1/2] cmake: Set top-level target output locations This change: 1. Collects build artifacts in dedicated locations. 2. Allows running bitcoin-chainstate.exe with bitcoinkernel.dll directly from the build tree on Windows. --- .github/workflows/ci.yml | 10 +-- CMakeLists.txt | 3 - contrib/devtools/check-deps.sh | 8 +-- contrib/devtools/gen-bitcoin-conf.sh | 2 +- contrib/devtools/gen-manpages.py | 12 ++-- src/CMakeLists.txt | 64 +++++++++++++------ .../test_framework/test_framework.py | 6 +- test/fuzz/test_runner.py | 2 +- test/util/test_runner.py | 2 +- 9 files changed, 64 insertions(+), 45 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1da02a86b07..e3b55c400f2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -238,10 +238,10 @@ jobs: if: matrix.job-type == 'standard' working-directory: build env: - BITCOIND: '${{ github.workspace }}\build\src\Release\bitcoind.exe' - BITCOINCLI: '${{ github.workspace }}\build\src\Release\bitcoin-cli.exe' - BITCOINUTIL: '${{ github.workspace }}\build\src\Release\bitcoin-util.exe' - BITCOINWALLET: '${{ github.workspace }}\build\src\Release\bitcoin-wallet.exe' + BITCOIND: '${{ github.workspace }}\build\bin\Release\bitcoind.exe' + BITCOINCLI: '${{ github.workspace }}\build\bin\Release\bitcoin-cli.exe' + BITCOINUTIL: '${{ github.workspace }}\build\bin\Release\bitcoin-util.exe' + BITCOINWALLET: '${{ github.workspace }}\build\bin\Release\bitcoin-wallet.exe' TEST_RUNNER_EXTRA: ${{ github.event_name != 'pull_request' && '--extended' || '' }} shell: cmd run: py -3 test\functional\test_runner.py --jobs %NUMBER_OF_PROCESSORS% --ci --quiet --tmpdirprefix=%RUNNER_TEMP% --combinedlogslen=99999999 --timeout-factor=%TEST_RUNNER_TIMEOUT_FACTOR% %TEST_RUNNER_EXTRA% @@ -258,7 +258,7 @@ jobs: if: matrix.job-type == 'fuzz' working-directory: build env: - BITCOINFUZZ: '${{ github.workspace }}\build\src\test\fuzz\Release\fuzz.exe' + BITCOINFUZZ: '${{ github.workspace }}\build\bin\Release\fuzz.exe' shell: cmd run: | py -3 test\fuzz\test_runner.py --par %NUMBER_OF_PROCESSORS% --loglevel DEBUG %RUNNER_TEMP%\qa-assets\fuzz_corpora diff --git a/CMakeLists.txt b/CMakeLists.txt index 94464907de1..88d6b950b6c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -609,9 +609,6 @@ endif() add_subdirectory(test) add_subdirectory(doc) -include(cmake/crc32c.cmake) -include(cmake/leveldb.cmake) -include(cmake/minisketch.cmake) add_subdirectory(src) include(cmake/tests.cmake) diff --git a/contrib/devtools/check-deps.sh b/contrib/devtools/check-deps.sh index 54cca3846b4..25e948647c0 100755 --- a/contrib/devtools/check-deps.sh +++ b/contrib/devtools/check-deps.sh @@ -8,10 +8,10 @@ declare -A LIBS LIBS[cli]="libbitcoin_cli.a" LIBS[common]="libbitcoin_common.a" LIBS[consensus]="libbitcoin_consensus.a" -LIBS[crypto]="crypto/libbitcoin_crypto.a" +LIBS[crypto]="libbitcoin_crypto.a" LIBS[node]="libbitcoin_node.a" -LIBS[util]="util/libbitcoin_util.a" -LIBS[wallet]="wallet/libbitcoin_wallet.a" +LIBS[util]="libbitcoin_util.a" +LIBS[wallet]="libbitcoin_wallet.a" # Declare allowed dependencies "X Y" where X is allowed to depend on Y. This # list is taken from doc/design/libraries.md. @@ -187,7 +187,7 @@ fi # shellcheck disable=SC2046 cmake --build "$BUILD_DIR" -j"$(nproc)" -t $(lib_targets) TEMP_DIR="$(mktemp -d)" -cd "$BUILD_DIR/src" +cd "$BUILD_DIR/lib" extract_symbols "$TEMP_DIR" if check_libraries "$TEMP_DIR"; then echo "Success! No unexpected dependencies were detected." diff --git a/contrib/devtools/gen-bitcoin-conf.sh b/contrib/devtools/gen-bitcoin-conf.sh index 5905cc7d65a..234318e1a14 100755 --- a/contrib/devtools/gen-bitcoin-conf.sh +++ b/contrib/devtools/gen-bitcoin-conf.sh @@ -6,7 +6,7 @@ export LC_ALL=C TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)} BUILDDIR=${BUILDDIR:-$TOPDIR/build} -BINDIR=${BINDIR:-$BUILDDIR/src} +BINDIR=${BINDIR:-$BUILDDIR/bin} BITCOIND=${BITCOIND:-$BINDIR/bitcoind} SHARE_EXAMPLES_DIR=${SHARE_EXAMPLES_DIR:-$TOPDIR/share/examples} EXAMPLE_CONF_FILE=${EXAMPLE_CONF_FILE:-$SHARE_EXAMPLES_DIR/bitcoin.conf} diff --git a/contrib/devtools/gen-manpages.py b/contrib/devtools/gen-manpages.py index cbb0abd3373..c7678817a99 100755 --- a/contrib/devtools/gen-manpages.py +++ b/contrib/devtools/gen-manpages.py @@ -9,12 +9,12 @@ import tempfile import argparse BINARIES = [ -'src/bitcoind', -'src/bitcoin-cli', -'src/bitcoin-tx', -'src/bitcoin-wallet', -'src/bitcoin-util', -'src/qt/bitcoin-qt', +'bin/bitcoind', +'bin/bitcoin-cli', +'bin/bitcoin-tx', +'bin/bitcoin-wallet', +'bin/bitcoin-util', +'bin/bitcoin-qt', ] parser = argparse.ArgumentParser( diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8862196dcf3..41577b2ad6d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,28 +7,18 @@ include(AddWindowsResources) configure_file(${PROJECT_SOURCE_DIR}/cmake/bitcoin-build-config.h.in bitcoin-build-config.h USE_SOURCE_PERMISSIONS @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -add_custom_target(generate_build_info - BYPRODUCTS ${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h - COMMAND ${CMAKE_COMMAND} -DBUILD_INFO_HEADER_PATH=${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h -DSOURCE_DIR=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateBuildInfo.cmake - COMMENT "Generating bitcoin-build-info.h" - VERBATIM -) -add_library(bitcoin_clientversion STATIC EXCLUDE_FROM_ALL - clientversion.cpp -) -target_link_libraries(bitcoin_clientversion - PRIVATE - core_interface -) -add_dependencies(bitcoin_clientversion generate_build_info) - -add_subdirectory(crypto) +#============================= +# Subprojects +#============================= +# Subprojects include subdirectories that do or could have tests +# and/or benchmark binaries, such as all subtrees and univalue. +# These need to be included before CMAKE_*_OUTPUT_DIRECTORY variables +# are set, so output locations of subproject tests and libraries are +# not overridden. +include(../cmake/crc32c.cmake) +include(../cmake/leveldb.cmake) +include(../cmake/minisketch.cmake) add_subdirectory(univalue) -add_subdirectory(util) -if(WITH_MULTIPROCESS) - add_subdirectory(ipc) -endif() - #============================= # secp256k1 subtree #============================= @@ -78,6 +68,38 @@ set_target_properties(secp256k1 PROPERTIES ) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +# Set top-level target output locations. +if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) +endif() +if(NOT CMAKE_LIBRARY_OUTPUT_DIRECTORY) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +endif() +if(NOT CMAKE_ARCHIVE_OUTPUT_DIRECTORY) + set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib) +endif() + +add_custom_target(generate_build_info + BYPRODUCTS ${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h + COMMAND ${CMAKE_COMMAND} -DBUILD_INFO_HEADER_PATH=${PROJECT_BINARY_DIR}/src/bitcoin-build-info.h -DSOURCE_DIR=${PROJECT_SOURCE_DIR} -P ${PROJECT_SOURCE_DIR}/cmake/script/GenerateBuildInfo.cmake + COMMENT "Generating bitcoin-build-info.h" + VERBATIM +) +add_library(bitcoin_clientversion STATIC EXCLUDE_FROM_ALL + clientversion.cpp +) +target_link_libraries(bitcoin_clientversion + PRIVATE + core_interface +) +add_dependencies(bitcoin_clientversion generate_build_info) + +add_subdirectory(crypto) +add_subdirectory(util) +if(WITH_MULTIPROCESS) + add_subdirectory(ipc) +endif() + add_library(bitcoin_consensus STATIC EXCLUDE_FROM_ALL arith_uint256.cpp consensus/merkle.cpp diff --git a/test/functional/test_framework/test_framework.py b/test/functional/test_framework/test_framework.py index 921f12d9fb4..d5b338f2ba2 100755 --- a/test/functional/test_framework/test_framework.py +++ b/test/functional/test_framework/test_framework.py @@ -255,7 +255,7 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): for binary, [attribute_name, env_variable_name] in binaries.items(): default_filename = os.path.join( self.config["environment"]["BUILDDIR"], - "src", + "bin", binary + self.config["environment"]["EXEEXT"], ) setattr(self.options, attribute_name, os.getenv(env_variable_name, default=default_filename)) @@ -272,8 +272,8 @@ class BitcoinTestFramework(metaclass=BitcoinTestMetaClass): self.set_binary_paths() os.environ['PATH'] = os.pathsep.join([ - os.path.join(config['environment']['BUILDDIR'], 'src'), - os.path.join(config['environment']['BUILDDIR'], 'src', 'qt'), os.environ['PATH'] + os.path.join(config['environment']['BUILDDIR'], 'bin'), + os.environ['PATH'] ]) # Set up temp directory and start logging diff --git a/test/fuzz/test_runner.py b/test/fuzz/test_runner.py index e87977edfc2..12661b4da59 100755 --- a/test/fuzz/test_runner.py +++ b/test/fuzz/test_runner.py @@ -109,7 +109,7 @@ def main(): logging.error("Must have fuzz executable built") sys.exit(1) - fuzz_bin=os.getenv("BITCOINFUZZ", default=os.path.join(config["environment"]["BUILDDIR"], 'src', 'test', 'fuzz', 'fuzz')) + fuzz_bin=os.getenv("BITCOINFUZZ", default=os.path.join(config["environment"]["BUILDDIR"], 'bin', 'fuzz')) # Build list of tests test_list_all = parse_test_list( diff --git a/test/util/test_runner.py b/test/util/test_runner.py index cac184ca302..d6faf18c5c6 100755 --- a/test/util/test_runner.py +++ b/test/util/test_runner.py @@ -73,7 +73,7 @@ def bctest(testDir, testObj, buildenv): are not as expected. Error is caught by bctester() and reported. """ # Get the exec names and arguments - execprog = os.path.join(buildenv["BUILDDIR"], "src", testObj["exec"] + buildenv["EXEEXT"]) + execprog = os.path.join(buildenv["BUILDDIR"], "bin", testObj["exec"] + buildenv["EXEEXT"]) if testObj["exec"] == "./bitcoin-util": execprog = os.getenv("BITCOINUTIL", default=execprog) elif testObj["exec"] == "./bitcoin-tx": From 568fcdddaec2cc8decba5a098257f31729cc1caa Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:04:44 +0000 Subject: [PATCH 2/2] scripted-diff: Adjust documentation per top-level target output location -BEGIN VERIFY SCRIPT- ren() { sed -i "s|\<$1\>|$2|g" $( git grep -l "$1" :\(exclude\)./src/secp256k1 ) ; } ren build/src/bench build/bin ren build/src/test build/bin ren build/src/qt/test build/bin ren build/src/qt build/bin ren build/src build/bin ren build_fuzz/src/test/fuzz build_fuzz/bin -END VERIFY SCRIPT- --- contrib/signet/README.md | 4 +- contrib/tracing/README.md | 2 +- contrib/tracing/connectblock_benchmark.bt | 6 +-- contrib/tracing/log_p2p_connections.bt | 10 ++-- contrib/tracing/log_p2p_traffic.bt | 4 +- contrib/tracing/log_utxos.bt | 8 ++-- contrib/valgrind.supp | 6 +-- doc/benchmarking.md | 4 +- doc/build-osx.md | 12 ++--- doc/build-unix.md | 2 +- doc/developer-notes.md | 6 +-- doc/fuzzing.md | 14 +++--- doc/multiprocess.md | 4 +- doc/multisig-tutorial.md | 56 +++++++++++------------ doc/offline-signing-tutorial.md | 28 ++++++------ doc/tracing.md | 12 ++--- src/qt/README.md | 2 +- src/test/README.md | 20 ++++---- 18 files changed, 100 insertions(+), 100 deletions(-) diff --git a/contrib/signet/README.md b/contrib/signet/README.md index 5fcd8944e64..cd0cae6d509 100644 --- a/contrib/signet/README.md +++ b/contrib/signet/README.md @@ -24,7 +24,7 @@ miner You will first need to pick a difficulty target. Since signet chains are primarily protected by a signature rather than proof of work, there is no need to spend as much energy as possible mining, however you may wish to choose to spend more time than the absolute minimum. The calibrate subcommand can be used to pick a target appropriate for your hardware, eg: MINER="./contrib/signet/miner" - GRIND="./build/src/bitcoin-util grind" + GRIND="./build/bin/bitcoin-util grind" $MINER calibrate --grind-cmd="$GRIND" nbits=1e00f403 for 25s average mining time @@ -32,7 +32,7 @@ It defaults to estimating an nbits value resulting in 25s average time to find a To mine the first block in your custom chain, you can run: - CLI="./build/src/bitcoin-cli -conf=mysignet.conf" + CLI="./build/bin/bitcoin-cli -conf=mysignet.conf" ADDR=$($CLI -signet getnewaddress) NBITS=1e00f403 $MINER --cli="$CLI" generate --grind-cmd="$GRIND" --address="$ADDR" --nbits=$NBITS diff --git a/contrib/tracing/README.md b/contrib/tracing/README.md index 0757ab9c76d..252053e7b87 100644 --- a/contrib/tracing/README.md +++ b/contrib/tracing/README.md @@ -188,7 +188,7 @@ In a different terminal, starting Bitcoin Core in SigNet mode and with re-indexing enabled. ``` -$ ./build/src/bitcoind -signet -reindex +$ ./build/bin/bitcoind -signet -reindex ``` This produces the following output. diff --git a/contrib/tracing/connectblock_benchmark.bt b/contrib/tracing/connectblock_benchmark.bt index de112af639c..c5d74309c45 100755 --- a/contrib/tracing/connectblock_benchmark.bt +++ b/contrib/tracing/connectblock_benchmark.bt @@ -16,7 +16,7 @@ This script requires a 'bitcoind' binary compiled with eBPF support and the 'validation:block_connected' USDT. By default, it's assumed that 'bitcoind' is - located in './build/src/bitcoind'. This can be modified in the script below. + located in './build/bin/bitcoind'. This can be modified in the script below. EXAMPLES: @@ -67,7 +67,7 @@ BEGIN connected block is between the start and end height (or the end height is unset). */ -usdt:./build/src/bitcoind:validation:block_connected /arg1 >= $1 && (arg1 <= $2 || $2 == 0 )/ +usdt:./build/bin/bitcoind:validation:block_connected /arg1 >= $1 && (arg1 <= $2 || $2 == 0 )/ { $height = arg1; $transactions = arg2; @@ -102,7 +102,7 @@ usdt:./build/src/bitcoind:validation:block_connected /arg1 >= $1 && (arg1 <= $2 blocks where the time it took to connect the block is above the . */ -usdt:./build/src/bitcoind:validation:block_connected / (uint64) arg5 / 1e6 > $3 / +usdt:./build/bin/bitcoind:validation:block_connected / (uint64) arg5 / 1e6 > $3 / { $hash = arg0; $height = (int32) arg1; diff --git a/contrib/tracing/log_p2p_connections.bt b/contrib/tracing/log_p2p_connections.bt index fd2cc934d73..e04441e7c5e 100755 --- a/contrib/tracing/log_p2p_connections.bt +++ b/contrib/tracing/log_p2p_connections.bt @@ -5,7 +5,7 @@ BEGIN printf("Logging opened, closed, misbehaving, and evicted P2P connections\n") } -usdt:./build/src/bitcoind:net:inbound_connection +usdt:./build/bin/bitcoind:net:inbound_connection { $id = (int64) arg0; $addr = str(arg1); @@ -15,7 +15,7 @@ usdt:./build/src/bitcoind:net:inbound_connection printf("INBOUND conn from %s: id=%ld, type=%s, network=%d, total=%d\n", $addr, $id, $conn_type, $network, $existing); } -usdt:./build/src/bitcoind:net:outbound_connection +usdt:./build/bin/bitcoind:net:outbound_connection { $id = (int64) arg0; $addr = str(arg1); @@ -25,7 +25,7 @@ usdt:./build/src/bitcoind:net:outbound_connection printf("OUTBOUND conn to %s: id=%ld, type=%s, network=%d, total=%d\n", $addr, $id, $conn_type, $network, $existing); } -usdt:./build/src/bitcoind:net:closed_connection +usdt:./build/bin/bitcoind:net:closed_connection { $id = (int64) arg0; $addr = str(arg1); @@ -34,7 +34,7 @@ usdt:./build/src/bitcoind:net:closed_connection printf("CLOSED conn to %s: id=%ld, type=%s, network=%d, established=%ld\n", $addr, $id, $conn_type, $network, arg4); } -usdt:./build/src/bitcoind:net:evicted_inbound_connection +usdt:./build/bin/bitcoind:net:evicted_inbound_connection { $id = (int64) arg0; $addr = str(arg1); @@ -43,7 +43,7 @@ usdt:./build/src/bitcoind:net:evicted_inbound_connection printf("EVICTED conn to %s: id=%ld, type=%s, network=%d, established=%ld\n", $addr, $id, $conn_type, $network, arg4); } -usdt:./build/src/bitcoind:net:misbehaving_connection +usdt:./build/bin/bitcoind:net:misbehaving_connection { $id = (int64) arg0; $message = str(arg1); diff --git a/contrib/tracing/log_p2p_traffic.bt b/contrib/tracing/log_p2p_traffic.bt index 89e5b777be9..7b07dd5e1ce 100755 --- a/contrib/tracing/log_p2p_traffic.bt +++ b/contrib/tracing/log_p2p_traffic.bt @@ -5,7 +5,7 @@ BEGIN printf("Logging P2P traffic\n") } -usdt:./build/src/bitcoind:net:inbound_message +usdt:./build/bin/bitcoind:net:inbound_message { $peer_id = (int64) arg0; $peer_addr = str(arg1); @@ -15,7 +15,7 @@ usdt:./build/src/bitcoind:net:inbound_message printf("inbound '%s' msg from peer %d (%s, %s) with %d bytes\n", $msg_type, $peer_id, $peer_type, $peer_addr, $msg_len); } -usdt:./build/src/bitcoind:net:outbound_message +usdt:./build/bin/bitcoind:net:outbound_message { $peer_id = (int64) arg0; $peer_addr = str(arg1); diff --git a/contrib/tracing/log_utxos.bt b/contrib/tracing/log_utxos.bt index a04f2211579..d309c029151 100755 --- a/contrib/tracing/log_utxos.bt +++ b/contrib/tracing/log_utxos.bt @@ -8,7 +8,7 @@ This script requires a 'bitcoind' binary compiled with eBPF support and the 'utxocache' tracepoints. By default, it's assumed that 'bitcoind' is - located in './build/src/bitcoind'. This can be modified in the script below. + located in './build/bin/bitcoind'. This can be modified in the script below. NOTE: requires bpftrace v0.12.0 or above. */ @@ -22,7 +22,7 @@ BEGIN /* Attaches to the 'utxocache:add' tracepoint and prints additions to the UTXO set cache. */ -usdt:./build/src/bitcoind:utxocache:add +usdt:./build/bin/bitcoind:utxocache:add { $txid = arg0; $index = (uint32)arg1; @@ -44,7 +44,7 @@ usdt:./build/src/bitcoind:utxocache:add /* Attaches to the 'utxocache:spent' tracepoint and prints spents from the UTXO set cache. */ -usdt:./build/src/bitcoind:utxocache:spent +usdt:./build/bin/bitcoind:utxocache:spent { $txid = arg0; $index = (uint32)arg1; @@ -66,7 +66,7 @@ usdt:./build/src/bitcoind:utxocache:spent /* Attaches to the 'utxocache:uncache' tracepoint and uncache UTXOs from the UTXO set cache. */ -usdt:./build/src/bitcoind:utxocache:uncache +usdt:./build/bin/bitcoind:utxocache:uncache { $txid = arg0; $index = (uint32)arg1; diff --git a/contrib/valgrind.supp b/contrib/valgrind.supp index 1ec5b8d20d4..9a9e640c615 100644 --- a/contrib/valgrind.supp +++ b/contrib/valgrind.supp @@ -2,14 +2,14 @@ # dependencies that cannot be fixed in-tree. # # Example use: -# $ valgrind --suppressions=contrib/valgrind.supp build/src/test/test_bitcoin +# $ valgrind --suppressions=contrib/valgrind.supp build/bin/test_bitcoin # $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ -# --show-leak-kinds=all build/src/test/test_bitcoin +# --show-leak-kinds=all build/bin/test_bitcoin # # To create suppressions for found issues, use the --gen-suppressions=all option: # $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ # --show-leak-kinds=all --gen-suppressions=all --show-reachable=yes \ -# --error-limit=no build/src/test/test_bitcoin +# --error-limit=no build/bin/test_bitcoin # # Note that suppressions may depend on OS and/or library versions. # Tested on: diff --git a/doc/benchmarking.md b/doc/benchmarking.md index 5e3b6ddadf8..4d95ff933e0 100644 --- a/doc/benchmarking.md +++ b/doc/benchmarking.md @@ -18,7 +18,7 @@ and lock analysis. After compiling bitcoin-core, the benchmarks can be run with: - build/src/bench/bench_bitcoin + build/bin/bench_bitcoin The output will look similar to: ``` @@ -40,7 +40,7 @@ The output will look similar to: Help --------------------- - build/src/bench/bench_bitcoin -h + build/bin/bench_bitcoin -h To print the various options, like listing the benchmarks without running them or using a regex filter to only run certain benchmarks. diff --git a/doc/build-osx.md b/doc/build-osx.md index 80039d9e6ab..e739dc83982 100644 --- a/doc/build-osx.md +++ b/doc/build-osx.md @@ -199,8 +199,8 @@ cmake --build build --target deploy ## Running Bitcoin Core -Bitcoin Core should now be available at `./build/src/bitcoind`. -If you compiled support for the GUI, it should be available at `./build/src/qt/bitcoin-qt`. +Bitcoin Core should now be available at `./build/bin/bitcoind`. +If you compiled support for the GUI, it should be available at `./build/bin/bitcoin-qt`. The first time you run `bitcoind` or `bitcoin-qt`, it will start downloading the blockchain. This process could take many hours, or even days on slower than average systems. @@ -230,8 +230,8 @@ tail -f $HOME/Library/Application\ Support/Bitcoin/debug.log ## Other commands: ```shell -./build/src/bitcoind -daemon # Starts the bitcoin daemon. -./build/src/bitcoin-cli --help # Outputs a list of command-line options. -./build/src/bitcoin-cli help # Outputs a list of RPC commands when the daemon is running. -./build/src/qt/bitcoin-qt -server # Starts the bitcoin-qt server mode, allows bitcoin-cli control +./build/bin/bitcoind -daemon # Starts the bitcoin daemon. +./build/bin/bitcoin-cli --help # Outputs a list of command-line options. +./build/bin/bitcoin-cli help # Outputs a list of RPC commands when the daemon is running. +./build/bin/bitcoin-qt -server # Starts the bitcoin-qt server mode, allows bitcoin-cli control ``` diff --git a/doc/build-unix.md b/doc/build-unix.md index 1e88c725505..d891aabc89f 100644 --- a/doc/build-unix.md +++ b/doc/build-unix.md @@ -188,6 +188,6 @@ This example lists the steps necessary to setup and build a command line only di cmake -B build cmake --build build ctest --test-dir build - ./build/src/bitcoind + ./build/bin/bitcoind If you intend to work with legacy Berkeley DB wallets, see [Berkeley DB](#berkeley-db) section. diff --git a/doc/developer-notes.md b/doc/developer-notes.md index eb5c1917900..30a4699ab1c 100644 --- a/doc/developer-notes.md +++ b/doc/developer-notes.md @@ -475,10 +475,10 @@ which includes known Valgrind warnings in our dependencies that cannot be fixed in-tree. Example use: ```shell -$ valgrind --suppressions=contrib/valgrind.supp build/src/test/test_bitcoin +$ valgrind --suppressions=contrib/valgrind.supp build/bin/test_bitcoin $ valgrind --suppressions=contrib/valgrind.supp --leak-check=full \ - --show-leak-kinds=all build/src/test/test_bitcoin --log_level=test_suite -$ valgrind -v --leak-check=full build/src/bitcoind -printtoconsole + --show-leak-kinds=all build/bin/test_bitcoin --log_level=test_suite +$ valgrind -v --leak-check=full build/bin/bitcoind -printtoconsole $ ./build/test/functional/test_runner.py --valgrind ``` diff --git a/doc/fuzzing.md b/doc/fuzzing.md index 3b3c2c4c0e1..94ef20c8803 100644 --- a/doc/fuzzing.md +++ b/doc/fuzzing.md @@ -11,7 +11,7 @@ $ cmake --preset=libfuzzer # macOS users: If you have problem with this step then make sure to read "macOS hints for # libFuzzer" on https://github.com/bitcoin/bitcoin/blob/master/doc/fuzzing.md#macos-hints-for-libfuzzer $ cmake --build build_fuzz -$ FUZZ=process_message build_fuzz/src/test/fuzz/fuzz +$ FUZZ=process_message build_fuzz/bin/fuzz # abort fuzzing using ctrl-c ``` @@ -35,7 +35,7 @@ If you specify a corpus directory then any new coverage increasing inputs will b ```sh $ mkdir -p process_message-seeded-from-thin-air/ -$ FUZZ=process_message build_fuzz/src/test/fuzz/fuzz process_message-seeded-from-thin-air/ +$ FUZZ=process_message build_fuzz/bin/fuzz process_message-seeded-from-thin-air/ INFO: Seed: 840522292 INFO: Loaded 1 modules (424174 inline 8-bit counters): 424174 [0x55e121ef9ab8, 0x55e121f613a6), INFO: Loaded 1 PC tables (424174 PCs): 424174 [0x55e121f613a8,0x55e1225da288), @@ -79,7 +79,7 @@ of the test. Just make sure to use double-dash to distinguish them from the fuzzer's own arguments: ```sh -$ FUZZ=address_deserialize_v2 build_fuzz/src/test/fuzz/fuzz -runs=1 fuzz_corpora/address_deserialize_v2 --checkaddrman=5 --printtoconsole=1 +$ FUZZ=address_deserialize_v2 build_fuzz/bin/fuzz -runs=1 fuzz_corpora/address_deserialize_v2 --checkaddrman=5 --printtoconsole=1 ``` ## Fuzzing corpora @@ -90,7 +90,7 @@ To fuzz `process_message` using the [`bitcoin-core/qa-assets`](https://github.co ```sh $ git clone https://github.com/bitcoin-core/qa-assets -$ FUZZ=process_message build_fuzz/src/test/fuzz/fuzz qa-assets/fuzz_corpora/process_message/ +$ FUZZ=process_message build_fuzz/bin/fuzz qa-assets/fuzz_corpora/process_message/ INFO: Seed: 1346407872 INFO: Loaded 1 modules (424174 inline 8-bit counters): 424174 [0x55d8a9004ab8, 0x55d8a906c3a6), INFO: Loaded 1 PC tables (424174 PCs): 424174 [0x55d8a906c3a8,0x55d8a96e5288), @@ -134,7 +134,7 @@ Patience is useful; even with improved throughput, libFuzzer may need days and more slowly with sanitizers enabled, but a crash should be reproducible very quickly from a crash case) - run the fuzzer with the case number appended to the seed corpus path: - `FUZZ=process_message build_fuzz/src/test/fuzz/fuzz + `FUZZ=process_message build_fuzz/bin/fuzz qa-assets/fuzz_corpora/process_message/1bc91feec9fc00b107d97dc225a9f2cdaa078eb6` ## Submit improved coverage @@ -186,7 +186,7 @@ $ cmake --build build_fuzz # try compiling using: AFL_NO_X86=1 cmake --build build_fuzz $ mkdir -p inputs/ outputs/ $ echo A > inputs/thin-air-input -$ FUZZ=bech32 ./AFLplusplus/afl-fuzz -i inputs/ -o outputs/ -- build_fuzz/src/test/fuzz/fuzz +$ FUZZ=bech32 ./AFLplusplus/afl-fuzz -i inputs/ -o outputs/ -- build_fuzz/bin/fuzz # You may have to change a few kernel parameters to test optimally - afl-fuzz # will print an error and suggestion if so. ``` @@ -213,7 +213,7 @@ $ cmake -B build_fuzz \ -DSANITIZERS=address,undefined $ cmake --build build_fuzz $ mkdir -p inputs/ -$ FUZZ=process_message ./honggfuzz/honggfuzz -i inputs/ -- build_fuzz/src/test/fuzz/fuzz +$ FUZZ=process_message ./honggfuzz/honggfuzz -i inputs/ -- build_fuzz/bin/fuzz ``` Read the [Honggfuzz documentation](https://github.com/google/honggfuzz/blob/master/docs/USAGE.md) for more information. diff --git a/doc/multiprocess.md b/doc/multiprocess.md index 1757296eed6..a0c754ea21a 100644 --- a/doc/multiprocess.md +++ b/doc/multiprocess.md @@ -21,8 +21,8 @@ make -C depends NO_QT=1 MULTIPROCESS=1 HOST_PLATFORM="x86_64-pc-linux-gnu" cmake -B build --toolchain=depends/$HOST_PLATFORM/toolchain.cmake cmake --build build -build/src/bitcoin-node -regtest -printtoconsole -debug=ipc -BITCOIND=$(pwd)/build/src/bitcoin-node build/test/functional/test_runner.py +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 `-DWITH_MULTIPROCESS=ON` as a separate flag when using the depends system (it's controlled by the `MULTIPROCESS=1` option). diff --git a/doc/multisig-tutorial.md b/doc/multisig-tutorial.md index 28b5a70b2c1..57d3d8d6722 100644 --- a/doc/multisig-tutorial.md +++ b/doc/multisig-tutorial.md @@ -9,7 +9,7 @@ This tutorial uses [jq](https://github.com/stedolan/jq) JSON processor to proces Before starting this tutorial, start the bitcoin node on the signet network. ```bash -./build/src/bitcoind -signet -daemon +./build/bin/bitcoind -signet -daemon ``` This tutorial also uses the default WPKH derivation path to get the xpubs and does not conform to [BIP 45](https://github.com/bitcoin/bips/blob/master/bip-0045.mediawiki) or [BIP 87](https://github.com/bitcoin/bips/blob/master/bip-0087.mediawiki). @@ -27,7 +27,7 @@ These three wallets should not be used directly for privacy reasons (public key ```bash for ((n=1;n<=3;n++)) do - ./build/src/bitcoin-cli -signet createwallet "participant_${n}" + ./build/bin/bitcoin-cli -signet createwallet "participant_${n}" done ``` @@ -47,9 +47,9 @@ declare -A xpubs for ((n=1;n<=3;n++)) do - xpubs["internal_xpub_${n}"]=$(./build/src/bitcoin-cli -signet -rpcwallet="participant_${n}" listdescriptors | jq '.descriptors | [.[] | select(.desc | startswith("wpkh") and contains("/1/*"))][0] | .desc' | grep -Po '(?<=\().*(?=\))') + xpubs["internal_xpub_${n}"]=$(./build/bin/bitcoin-cli -signet -rpcwallet="participant_${n}" listdescriptors | jq '.descriptors | [.[] | select(.desc | startswith("wpkh") and contains("/1/*"))][0] | .desc' | grep -Po '(?<=\().*(?=\))') - xpubs["external_xpub_${n}"]=$(./build/src/bitcoin-cli -signet -rpcwallet="participant_${n}" listdescriptors | jq '.descriptors | [.[] | select(.desc | startswith("wpkh") and contains("/0/*") )][0] | .desc' | grep -Po '(?<=\().*(?=\))') + xpubs["external_xpub_${n}"]=$(./build/bin/bitcoin-cli -signet -rpcwallet="participant_${n}" listdescriptors | jq '.descriptors | [.[] | select(.desc | startswith("wpkh") and contains("/0/*") )][0] | .desc' | grep -Po '(?<=\().*(?=\))') done ``` @@ -71,8 +71,8 @@ Define the external and internal multisig descriptors, add the checksum and then external_desc="wsh(sortedmulti(2,${xpubs["external_xpub_1"]},${xpubs["external_xpub_2"]},${xpubs["external_xpub_3"]}))" internal_desc="wsh(sortedmulti(2,${xpubs["internal_xpub_1"]},${xpubs["internal_xpub_2"]},${xpubs["internal_xpub_3"]}))" -external_desc_sum=$(./build/src/bitcoin-cli -signet getdescriptorinfo $external_desc | jq '.descriptor') -internal_desc_sum=$(./build/src/bitcoin-cli -signet getdescriptorinfo $internal_desc | jq '.descriptor') +external_desc_sum=$(./build/bin/bitcoin-cli -signet getdescriptorinfo $external_desc | jq '.descriptor') +internal_desc_sum=$(./build/bin/bitcoin-cli -signet getdescriptorinfo $internal_desc | jq '.descriptor') multisig_ext_desc="{\"desc\": $external_desc_sum, \"active\": true, \"internal\": false, \"timestamp\": \"now\"}" multisig_int_desc="{\"desc\": $internal_desc_sum, \"active\": true, \"internal\": true, \"timestamp\": \"now\"}" @@ -94,7 +94,7 @@ There are other fields that can be added to the descriptors: * `internal`: Indicates whether matching outputs should be treated as something other than incoming payments (e.g. change). * `timestamp`: Sets the time from which to start rescanning the blockchain for the descriptor, in UNIX epoch time. -Documentation for these and other parameters can be found by typing `./build/src/bitcoin-cli help importdescriptors`. +Documentation for these and other parameters can be found by typing `./build/bin/bitcoin-cli help importdescriptors`. `multisig_desc` concatenates external and internal descriptors in a JSON array and then it will be used to create the multisig wallet. @@ -107,17 +107,17 @@ Then import the descriptors created in the previous step using the `importdescri After that, `getwalletinfo` can be used to check if the wallet was created successfully. ```bash -./build/src/bitcoin-cli -signet -named createwallet wallet_name="multisig_wallet_01" disable_private_keys=true blank=true +./build/bin/bitcoin-cli -signet -named createwallet wallet_name="multisig_wallet_01" disable_private_keys=true blank=true -./build/src/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" importdescriptors "$multisig_desc" +./build/bin/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" importdescriptors "$multisig_desc" -./build/src/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" getwalletinfo +./build/bin/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" getwalletinfo ``` Once the wallets have already been created and this tutorial needs to be repeated or resumed, it is not necessary to recreate them, just load them with the command below: ```bash -for ((n=1;n<=3;n++)); do ./build/src/bitcoin-cli -signet loadwallet "participant_${n}"; done +for ((n=1;n<=3;n++)); do ./build/bin/bitcoin-cli -signet loadwallet "participant_${n}"; done ``` ### 1.4 Fund the wallet @@ -131,9 +131,9 @@ The url used by the script can also be accessed directly. At time of writing, th Coins received by the wallet must have at least 1 confirmation before they can be spent. It is necessary to wait for a new block to be mined before continuing. ```bash -receiving_address=$(./build/src/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" getnewaddress) +receiving_address=$(./build/bin/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" getnewaddress) -./contrib/signet/getcoins.py -c ./build/src/bitcoin-cli -a $receiving_address +./contrib/signet/getcoins.py -c ./build/bin/bitcoin-cli -a $receiving_address ``` To copy the receiving address onto the clipboard, use the following command. This can be useful when getting coins via the signet faucet mentioned above. @@ -145,7 +145,7 @@ echo -n "$receiving_address" | xclip -sel clip The `getbalances` RPC may be used to check the balance. Coins with `trusted` status can be spent. ```bash -./build/src/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" getbalances +./build/bin/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" getbalances ``` ### 1.5 Create a PSBT @@ -161,13 +161,13 @@ For simplicity, the destination address is taken from the `participant_1` wallet The `walletcreatefundedpsbt` RPC is used to create and fund a transaction in the PSBT format. It is the first step in creating the PSBT. ```bash -balance=$(./build/src/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" getbalance) +balance=$(./build/bin/bitcoin-cli -signet -rpcwallet="multisig_wallet_01" getbalance) amount=$(echo "$balance * 0.8" | bc -l | sed -e 's/^\./0./' -e 's/^-\./-0./') -destination_addr=$(./build/src/bitcoin-cli -signet -rpcwallet="participant_1" getnewaddress) +destination_addr=$(./build/bin/bitcoin-cli -signet -rpcwallet="participant_1" getnewaddress) -funded_psbt=$(./build/src/bitcoin-cli -signet -named -rpcwallet="multisig_wallet_01" walletcreatefundedpsbt outputs="{\"$destination_addr\": $amount}" | jq -r '.psbt') +funded_psbt=$(./build/bin/bitcoin-cli -signet -named -rpcwallet="multisig_wallet_01" walletcreatefundedpsbt outputs="{\"$destination_addr\": $amount}" | jq -r '.psbt') ``` There is also the `createpsbt` RPC, which serves the same purpose, but it has no access to the wallet or to the UTXO set. It is functionally the same as `createrawtransaction` and just drops the raw transaction into an otherwise blank PSBT. [[source](https://bitcointalk.org/index.php?topic=5131043.msg50573609#msg50573609)] In most cases, `walletcreatefundedpsbt` solves the problem. @@ -181,9 +181,9 @@ Optionally, the PSBT can be decoded to a JSON format using `decodepsbt` RPC. The `analyzepsbt` RPC analyzes and provides information about the current status of a PSBT and its inputs, e.g. missing signatures. ```bash -./build/src/bitcoin-cli -signet decodepsbt $funded_psbt +./build/bin/bitcoin-cli -signet decodepsbt $funded_psbt -./build/src/bitcoin-cli -signet analyzepsbt $funded_psbt +./build/bin/bitcoin-cli -signet analyzepsbt $funded_psbt ``` ### 1.7 Update the PSBT @@ -193,9 +193,9 @@ In the code above, two PSBTs are created. One signed by `participant_1` wallet a The `walletprocesspsbt` is used by the wallet to sign a PSBT. ```bash -psbt_1=$(./build/src/bitcoin-cli -signet -rpcwallet="participant_1" walletprocesspsbt $funded_psbt | jq '.psbt') +psbt_1=$(./build/bin/bitcoin-cli -signet -rpcwallet="participant_1" walletprocesspsbt $funded_psbt | jq '.psbt') -psbt_2=$(./build/src/bitcoin-cli -signet -rpcwallet="participant_2" walletprocesspsbt $funded_psbt | jq '.psbt') +psbt_2=$(./build/bin/bitcoin-cli -signet -rpcwallet="participant_2" walletprocesspsbt $funded_psbt | jq '.psbt') ``` ### 1.8 Combine the PSBT @@ -203,7 +203,7 @@ psbt_2=$(./build/src/bitcoin-cli -signet -rpcwallet="participant_2" walletproces The PSBT, if signed separately by the co-signers, must be combined into one transaction before being finalized. This is done by `combinepsbt` RPC. ```bash -combined_psbt=$(./build/src/bitcoin-cli -signet combinepsbt "[$psbt_1, $psbt_2]") +combined_psbt=$(./build/bin/bitcoin-cli -signet combinepsbt "[$psbt_1, $psbt_2]") ``` There is an RPC called `joinpsbts`, but it has a different purpose than `combinepsbt`. `joinpsbts` joins the inputs from multiple distinct PSBTs into one PSBT. @@ -217,9 +217,9 @@ The `finalizepsbt` RPC is used to produce a network serialized transaction which It checks that all inputs have complete scriptSigs and scriptWitnesses and, if so, encodes them into network serialized transactions. ```bash -finalized_psbt_hex=$(./build/src/bitcoin-cli -signet finalizepsbt $combined_psbt | jq -r '.hex') +finalized_psbt_hex=$(./build/bin/bitcoin-cli -signet finalizepsbt $combined_psbt | jq -r '.hex') -./build/src/bitcoin-cli -signet sendrawtransaction $finalized_psbt_hex +./build/bin/bitcoin-cli -signet sendrawtransaction $finalized_psbt_hex ``` ### 1.10 Alternative Workflow (PSBT sequential signatures) @@ -229,11 +229,11 @@ Instead of each wallet signing the original PSBT and combining them later, the w After that, the rest of the process is the same: the PSBT is finalized and transmitted to the network. ```bash -psbt_1=$(./build/src/bitcoin-cli -signet -rpcwallet="participant_1" walletprocesspsbt $funded_psbt | jq -r '.psbt') +psbt_1=$(./build/bin/bitcoin-cli -signet -rpcwallet="participant_1" walletprocesspsbt $funded_psbt | jq -r '.psbt') -psbt_2=$(./build/src/bitcoin-cli -signet -rpcwallet="participant_2" walletprocesspsbt $psbt_1 | jq -r '.psbt') +psbt_2=$(./build/bin/bitcoin-cli -signet -rpcwallet="participant_2" walletprocesspsbt $psbt_1 | jq -r '.psbt') -finalized_psbt_hex=$(./build/src/bitcoin-cli -signet finalizepsbt $psbt_2 | jq -r '.hex') +finalized_psbt_hex=$(./build/bin/bitcoin-cli -signet finalizepsbt $psbt_2 | jq -r '.hex') -./build/src/bitcoin-cli -signet sendrawtransaction $finalized_psbt_hex +./build/bin/bitcoin-cli -signet sendrawtransaction $finalized_psbt_hex ``` diff --git a/doc/offline-signing-tutorial.md b/doc/offline-signing-tutorial.md index 8ec4355bc78..522303b032e 100644 --- a/doc/offline-signing-tutorial.md +++ b/doc/offline-signing-tutorial.md @@ -25,7 +25,7 @@ We are going to first create an `offline_wallet` on the offline host. We will th 1. On the offline machine create a wallet named `offline_wallet` secured by a wallet `passphrase`. This wallet will contain private keys and must remain unconnected to any networks at all times. ```sh -[offline]$ ./build/src/bitcoin-cli -signet -named createwallet \ +[offline]$ ./build/bin/bitcoin-cli -signet -named createwallet \ wallet_name="offline_wallet" \ passphrase="** enter passphrase **" @@ -40,7 +40,7 @@ We are going to first create an `offline_wallet` on the offline host. We will th 2. Export the public key-only descriptors from the offline host to a JSON file named `descriptors.json`. We use `jq` here to extract the `.descriptors` field from the full RPC response. ```sh -[offline]$ ./build/src/bitcoin-cli -signet -rpcwallet="offline_wallet" listdescriptors \ +[offline]$ ./build/bin/bitcoin-cli -signet -rpcwallet="offline_wallet" listdescriptors \ | jq -r '.descriptors' \ >> /path/to/descriptors.json ``` @@ -58,7 +58,7 @@ The `watch_only_wallet` wallet will be used to track and validate incoming trans > `disable_private_keys` indicates that the wallet should refuse to import private keys, i.e. will be a dedicated watch-only wallet. ```sh -[online]$ ./build/src/bitcoin-cli -signet -named createwallet \ +[online]$ ./build/bin/bitcoin-cli -signet -named createwallet \ wallet_name="watch_only_wallet" \ disable_private_keys=true \ blank=true @@ -71,7 +71,7 @@ The `watch_only_wallet` wallet will be used to track and validate incoming trans 2. Import the `offline_wallet`s public key descriptors to the online `watch_only_wallet` using the `descriptors.json` file created on the offline wallet. ```sh -[online]$ ./build/src/bitcoin-cli -signet -rpcwallet="watch_only_wallet" importdescriptors "$(cat /path/to/descriptors.json)" +[online]$ ./build/bin/bitcoin-cli -signet -rpcwallet="watch_only_wallet" importdescriptors "$(cat /path/to/descriptors.json)" [ { @@ -110,7 +110,7 @@ At this point, it's important to understand that both the `offline_wallet` and o 1. Generate an address to receive coins. You can use _either_ the `offline_wallet` or the online `watch_only_wallet` to generate this address, as they will produce the same addresses. For the sake of this guide, we'll use the online `watch_only_wallet` to generate the address. ```sh -[online]$ ./build/src/bitcoin-cli -signet -rpcwallet="watch_only_wallet" getnewaddress +[online]$ ./build/bin/bitcoin-cli -signet -rpcwallet="watch_only_wallet" getnewaddress tb1qtu5qgc6ddhmqm5yqjvhg83qgk2t4ewajg0h6yh ``` @@ -120,7 +120,7 @@ tb1qtu5qgc6ddhmqm5yqjvhg83qgk2t4ewajg0h6yh 3. Confirm that coins were received using the online `watch_only_wallet`. Note that the transaction may take a few moments before being received on your local node, depending on its connectivity. Just re-run the command periodically until the transaction is received. ```sh -[online]$ ./build/src/bitcoin-cli -signet -rpcwallet="watch_only_wallet" listunspent +[online]$ ./build/bin/bitcoin-cli -signet -rpcwallet="watch_only_wallet" listunspent [ { @@ -149,7 +149,7 @@ tb1qtu5qgc6ddhmqm5yqjvhg83qgk2t4ewajg0h6yh 2. Create a funded but unsigned PSBT to the destination address with the online `watch_only_wallet` by using `send [{"address":amount},...]` and export the unsigned PSBT to a file `funded_psbt.txt` for easy portability to the `offline_wallet` for signing: ```sh -[online]$ ./build/src/bitcoin-cli -signet -rpcwallet="watch_only_wallet" send \ +[online]$ ./build/bin/bitcoin-cli -signet -rpcwallet="watch_only_wallet" send \ '{"tb1q9k5w0nhnhyeh78snpxh0t5t7c3lxdeg3erez32": 0.009}' \ | jq -r '.psbt' \ >> /path/to/funded_psbt.txt @@ -166,13 +166,13 @@ cHNidP8BAHECAAAAAWLHKR9/xAjetzL/FCmZU5lbfINRMWPRPHWO68PfUzkPAQAAAAD9////AoA4AQAA Decode and analyze the unsigned PSBT on the `offline_wallet` using the `funded_psbt.txt` file: ```sh -[offline]$ ./build/src/bitcoin-cli -signet decodepsbt $(cat /path/to/funded_psbt.txt) +[offline]$ ./build/bin/bitcoin-cli -signet decodepsbt $(cat /path/to/funded_psbt.txt) { ... } -[offline]$ ./build/src/bitcoin-cli -signet analyzepsbt $(cat /path/to/funded_psbt.txt) +[offline]$ ./build/bin/bitcoin-cli -signet analyzepsbt $(cat /path/to/funded_psbt.txt) { "inputs": [ @@ -203,13 +203,13 @@ Notice that the analysis of the PSBT shows that "signatures" are missing and sho Use the walletpassphrase command to unlock the `offline_wallet` with the passphrase. You should specify the passphrase and a timeout (in seconds) for how long you want the wallet to remain unlocked. ```sh -[offline]$ ./build/src/bitcoin-cli -signet -rpcwallet="offline_wallet" walletpassphrase "** enter passphrase **" 60 +[offline]$ ./build/bin/bitcoin-cli -signet -rpcwallet="offline_wallet" walletpassphrase "** enter passphrase **" 60 ``` 2. Process, sign and finalize the PSBT on the `offline_wallet` using the `walletprocesspsbt` command, saving the output to a file `final_psbt.txt`. ```sh -[offline]$ ./build/src/bitcoin-cli -signet -rpcwallet="offline_wallet" walletprocesspsbt \ +[offline]$ ./build/bin/bitcoin-cli -signet -rpcwallet="offline_wallet" walletprocesspsbt \ $(cat /path/to/funded_psbt.txt) \ | jq -r .hex \ >> /path/to/final_psbt.txt @@ -219,7 +219,7 @@ Use the walletpassphrase command to unlock the `offline_wallet` with the passphr Broadcast the funded, signed and finalized PSBT `final_psbt.txt` using `sendrawtransaction` with an online node: ```sh -[online]$ ./build/src/bitcoin-cli -signet sendrawtransaction $(cat /path/to/final_psbt.txt) +[online]$ ./build/bin/bitcoin-cli -signet sendrawtransaction $(cat /path/to/final_psbt.txt) c2430a0e46df472b04b0ca887bbcd5c4abf7b2ce2eb71de981444a80e2b96d52 ``` @@ -229,7 +229,7 @@ c2430a0e46df472b04b0ca887bbcd5c4abf7b2ce2eb71de981444a80e2b96d52 Confirm the updated balance of the offline wallet using the `watch_only_wallet`. ```sh -[online]$ ./build/src/bitcoin-cli -signet -rpcwallet="watch_only_wallet" getbalances +[online]$ ./build/bin/bitcoin-cli -signet -rpcwallet="watch_only_wallet" getbalances { "mine": { @@ -248,7 +248,7 @@ Confirm the updated balance of the offline wallet using the `watch_only_wallet`. You can also show transactions related to the wallet using `listtransactions` ```sh -[online]$ ./build/src/bitcoin-cli -signet -rpcwallet="watch_only_wallet" listtransactions +[online]$ ./build/bin/bitcoin-cli -signet -rpcwallet="watch_only_wallet" listtransactions { ... diff --git a/doc/tracing.md b/doc/tracing.md index 53577438fa7..d4fcee095e0 100644 --- a/doc/tracing.md +++ b/doc/tracing.md @@ -430,13 +430,13 @@ USDT support. To list probes in Bitcoin Core, use `info probes` in `gdb`: ``` -$ gdb ./build/src/bitcoind +$ gdb ./build/bin/bitcoind … (gdb) info probes Type Provider Name Where Semaphore Object -stap net inbound_message 0x000000000014419e 0x0000000000d29bd2 /build/src/bitcoind -stap net outbound_message 0x0000000000107c05 0x0000000000d29bd0 /build/src/bitcoind -stap validation block_connected 0x00000000002fb10c 0x0000000000d29bd8 /build/src/bitcoind +stap net inbound_message 0x000000000014419e 0x0000000000d29bd2 /build/bin/bitcoind +stap net outbound_message 0x0000000000107c05 0x0000000000d29bd0 /build/bin/bitcoind +stap validation block_connected 0x00000000002fb10c 0x0000000000d29bd8 /build/bin/bitcoind … ``` @@ -446,7 +446,7 @@ The `readelf` tool can be used to display the USDT tracepoints in Bitcoin Core. Look for the notes with the description `NT_STAPSDT`. ``` -$ readelf -n ./build/src/bitcoind | grep NT_STAPSDT -A 4 -B 2 +$ readelf -n ./build/bin/bitcoind | grep NT_STAPSDT -A 4 -B 2 Displaying notes found in: .note.stapsdt Owner Data size Description stapsdt 0x0000005d NT_STAPSDT (SystemTap probe descriptors) @@ -470,7 +470,7 @@ between distributions. For example, on [ubuntu binary]: https://github.com/iovisor/bcc/blob/master/INSTALL.md#ubuntu---binary ``` -$ tplist -l ./build/src/bitcoind -v +$ tplist -l ./build/bin/bitcoind -v b'net':b'outbound_message' [sema 0xd29bd0] 1 location(s) 6 argument(s) diff --git a/src/qt/README.md b/src/qt/README.md index 3ecdd0888e7..1fcac5414f5 100644 --- a/src/qt/README.md +++ b/src/qt/README.md @@ -11,7 +11,7 @@ When following your systems build instructions, make sure to install the `Qt` de To run: ```sh -./build/src/qt/bitcoin-qt +./build/bin/bitcoin-qt ``` ## Files and Directories diff --git a/src/test/README.md b/src/test/README.md index 7e0f245ee8e..c7e7ab911dc 100644 --- a/src/test/README.md +++ b/src/test/README.md @@ -24,7 +24,7 @@ tests from subtrees. Run `test_bitcoin --list_content` for the full list of tests. -To run the unit tests manually, launch `build/src/test/test_bitcoin`. To recompile +To run the unit tests manually, launch `build/bin/test_bitcoin`. To recompile after a test file was modified, run `cmake --build build` and then run the test again. If you modify a non-test file, use `cmake --build build --target test_bitcoin` to recompile only what's needed to run the unit tests. @@ -33,7 +33,7 @@ To add more unit tests, add `BOOST_AUTO_TEST_CASE` functions to the existing .cpp files in the `test/` directory or add new .cpp files that implement new `BOOST_AUTO_TEST_SUITE` sections. -To run the GUI unit tests manually, launch `build/src/qt/test/test_bitcoin-qt` +To run the GUI unit tests manually, launch `build/bin/test_bitcoin-qt` To add more GUI unit tests, add them to the `src/qt/test/` directory and the `src/qt/test/test_main.cpp` file. @@ -50,19 +50,19 @@ test_bitcoin --help For example, to run only the tests in the `getarg_tests` file, with full logging: ```bash -build/src/test/test_bitcoin --log_level=all --run_test=getarg_tests +build/bin/test_bitcoin --log_level=all --run_test=getarg_tests ``` or ```bash -build/src/test/test_bitcoin -l all -t getarg_tests +build/bin/test_bitcoin -l all -t getarg_tests ``` or to run only the doubledash test in `getarg_tests` ```bash -build/src/test/test_bitcoin --run_test=getarg_tests/doubledash +build/bin/test_bitcoin --run_test=getarg_tests/doubledash ``` The `--log_level=` (or `-l`) argument controls the verbosity of the test output. @@ -71,7 +71,7 @@ The `test_bitcoin` runner also accepts some of the command line arguments accept `bitcoind`. Use `--` to separate these sets of arguments: ```bash -build/src/test/test_bitcoin --log_level=all --run_test=getarg_tests -- -printtoconsole=1 +build/bin/test_bitcoin --log_level=all --run_test=getarg_tests -- -printtoconsole=1 ``` The `-printtoconsole=1` after the two dashes sends debug logging, which @@ -98,7 +98,7 @@ what the test wrote to `debug.log` after it completes, for example. so no leftover state is used.) ```bash -$ build/src/test/test_bitcoin --run_test=getarg_tests/doubledash -- -testdatadir=/somewhere/mydatadir +$ build/bin/test_bitcoin --run_test=getarg_tests/doubledash -- -testdatadir=/somewhere/mydatadir Test directory (will not be deleted): "/somewhere/mydatadir/test_common bitcoin/getarg_tests/doubledash/datadir" Running 1 test case... @@ -138,13 +138,13 @@ For debugging you can launch the `test_bitcoin` executable with `gdb` or `lldb` start debugging, just like you would with any other program: ```bash -gdb build/src/test/test_bitcoin +gdb build/bin/test_bitcoin ``` #### Segmentation faults If you hit a segmentation fault during a test run, you can diagnose where the fault -is happening by running `gdb ./build/src/test/test_bitcoin` and then using the `bt` command +is happening by running `gdb ./build/bin/test_bitcoin` and then using the `bt` command within gdb. Another tool that can be used to resolve segmentation faults is @@ -162,7 +162,7 @@ Running the tests and hitting a segmentation fault should now produce a file cal You can then explore the core dump using ```bash -gdb build/src/test/test_bitcoin core +gdb build/bin/test_bitcoin core (gdb) bt # produce a backtrace for where a segfault occurred ```