mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-29 21:30:58 +02:00
Merge bitcoin/bitcoin#31161: cmake: Set top-level target output locations
568fcdddae
scripted-diff: Adjust documentation per top-level target output location (Hennadii Stepanov)026bb226e9
cmake: Set top-level target output locations (Hennadii Stepanov) Pull request description: This PR sets the target output locations to the `bin` and `lib` subdirectories within the build tree, creating a directory structure that mirrors that of the installed targets. This approach is widely adopted by the large projects, such as [LLVM](e146c1867e/lldb/cmake/modules/LLDBStandalone.cmake (L128-L130)
): ```cmake set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}) set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib${LLVM_LIBDIR_SUFFIX}) ``` The `libsecp256k1` project has also recently [adopted](https://github.com/bitcoin-core/secp256k1/pull/1553) this approach. With this PR, all binaries are conveniently located. For example, run: ``` $ ./build/bin/fuzz ``` instead of: ``` $ ./build/src/test/fuzz/fuzz ``` On Windows, all required DLLs are now located in the same directory as the executables, allowing to run `bitcoin-chainstate.exe` (which loads `bitcoinkernel.dll`) without the need to copy DLLs or modify the `PATH` variable. The idea was briefly discussed among the build team during the recent CoreDev meeting. --- **Warning**: This PR changes build locations of newly built executables like `bitcoind` and `test_bitcoin` from `src/` to `bin/` without deleting previously built executables. A clean build is recommended to avoid accidentally running old binaries. ACKs for top commit: theStack: Light re-ACK568fcdddae
ryanofsky: Code review ACK568fcdddae
. Only change since last review was rebasing. I'm ok with this PR in its current form if other developers are happy with it. I just personally think it is inappropriate to \*silently\* break an everyday developer workflow like `git pull; make bitcoind`. I wouldn't have a problem with this PR if it triggered an explicit error, or if the problem was limited to less common workflows like changing cmake options in an existing build. TheCharlatan: Re-ACK568fcdddae
theuni: ACK568fcdddae
Tree-SHA512: 1aa5ecd3cd49bd82f1dcc96c8e171d2d19c58aec8dade4bc329df89311f9e50cbf6cf021d004c58a0e1016c375b0fa348ccd52761bcdd179c2d1e61c105e3b9f
This commit is contained in:
@@ -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.
|
||||
|
@@ -201,8 +201,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.
|
||||
@@ -232,8 +232,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
|
||||
```
|
||||
|
@@ -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.
|
||||
|
@@ -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
|
||||
```
|
||||
|
||||
|
@@ -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
|
||||
@@ -189,7 +189,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.
|
||||
```
|
||||
@@ -216,7 +216,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.
|
||||
|
@@ -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).
|
||||
|
@@ -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
|
||||
```
|
||||
|
@@ -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
|
||||
|
||||
{
|
||||
...
|
||||
|
@@ -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)
|
||||
|
Reference in New Issue
Block a user