You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
doc: Update multisig-tutorial.md to use multipath descriptors
Update doc/multisig-tutorial.md to use a single multipath descriptor
instead of separate external/internal descriptors, per PR #22838.
Extract one xpub per participant, build a multipath descriptor with
<0;1> change index, and use getdescriptorinfo to append the checksum.
Clarify importdescriptors expands multipath descriptors into internal
and external forms. Tested shell snippets to confirm equivalent
listdescriptors output as the two-descriptor method.
Added missing loadwallet command for multisig_wallet_01
test: Use multipath descriptors in the functional wallet test
wallet_multisig_descriptor_psbt as this is intended as documentation
doc: replace `bitcoin-cli` with `bitcoin rpc` in multisig-tutorial.md
removed -named parameter where possible.
fixed a couple bugs where -signet was not passed
the call to getcoins.py requires the bitcoin-cli command still
`bitcoin rpc` can also be substituted for `bitcoin-cli`.
35
-
36
34
Extract the xpub of each wallet. To do this, the `listdescriptors` RPC is used. By default, Bitcoin Core single-sig wallets are created using path `m/44'/1'/0'` for PKH, `m/84'/1'/0'` for WPKH, `m/49'/1'/0'` for P2WPKH-nested-in-P2SH and `m/86'/1'/0'` for P2TR based accounts. Each of them uses the chain 0 for external addresses and chain 1 for internal ones, as shown in the example below.
The suffix (after #) is the checksum. Descriptors can optionally be suffixed with a checksum to protect against typos or copy-paste errors.
45
43
All RPCs in Bitcoin Core will include the checksum in their output.
46
44
45
+
Note that previously at least two descriptors were usually used, one for external derivation paths and one for internal ones. Since https://github.com/bitcoin/bitcoin/pull/22838 this redundancy has been eliminated by a multipath descriptor with <code><0;1></code> at the [BIP-44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki#change) change level expanding to external and internal descriptors when imported.
@@ -65,61 +63,57 @@ for x in "${!xpubs[@]}"; do printf "[%s]=%s\n" "$x" "${xpubs[$x]}" ; done
65
63
66
64
As previously mentioned, this step extracts the `m/84'/1'/0'` account instead of the path defined in [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), since there is no way to extract a specific path in Bitcoin Core at the time of writing.
67
65
68
-
### 1.2 Define the Multisig Descriptors
66
+
### 1.2 Define the Multisig Descriptor
69
67
70
-
Define the external and internal multisig descriptors, add the checksum and then, join both in a JSON array.
68
+
Define the multisig descriptor, add the checksum and then, wrap it in a JSON array.
`external_desc` and `internal_desc` specify the output type (`wsh`, in this case) and the xpubs involved. They also use BIP 67 (`sortedmulti`), so the wallet can be recreated without worrying about the order of xpubs. Conceptually, descriptors describe a list of scriptPubKey (along with information for spending from it) [[source](https://github.com/bitcoin/bitcoin/issues/21199#issuecomment-780772418)].
86
-
87
-
Note that at least two descriptors are usually used, one for internal derivation paths and one for external ones. There are discussions about eliminating this redundancy, as can be seen in the issue [#17190](https://github.com/bitcoin/bitcoin/issues/17190).
78
+
`desc` specifies the output type (`wsh`, in this case) and the xpubs involved. It also uses BIP 67 (`sortedmulti`), so the wallet can be recreated without worrying about the order of xpubs. Conceptually, descriptors describe a list of scriptPubKey (along with information for spending from it) [[source](https://github.com/bitcoin/bitcoin/issues/21199#issuecomment-780772418)].
88
79
89
-
After creating the descriptors, it is necessary to add the checksum, which is required by the `importdescriptors` RPC.
80
+
After creating the descriptor, it is necessary to add the checksum, which is required by the `importdescriptors` RPC.
90
81
91
82
The checksum for a descriptor without one can be computed using the `getdescriptorinfo` RPC. The response has the `descriptor` field, which is the descriptor with the checksum added.
92
83
93
-
There are other fields that can be added to the descriptors:
84
+
There are other fields that can be added to the descriptor:
94
85
95
86
*`active`: Sets the descriptor to be the active one for the corresponding output type (`wsh`, in this case).
96
87
*`internal`: Indicates whether matching outputs should be treated as something other than incoming payments (e.g. change).
97
88
*`timestamp`: Sets the time from which to start rescanning the blockchain for the descriptor, in UNIX epoch time.
98
89
99
-
Documentation for these and other parameters can be found by typing `./build/bin/bitcoin-cli help importdescriptors`.
90
+
Note: when a multipath descriptor is imported, it is expanded into two descriptors which are imported separately, with the second implicitly used for internal (change) addresses.
91
+
92
+
Documentation for these and other parameters can be found by typing `./build/bin/bitcoin rpc -signet help importdescriptors`.
100
93
101
-
`multisig_desc`concatenates external and internal descriptors in a JSON array and then it will be used to create the multisig wallet.
94
+
`multisig_desc`wraps the descriptor in a JSON array and will be used to create the multisig wallet.
102
95
103
96
### 1.3 Create the Multisig Wallet
104
97
105
98
To create the multisig wallet, first create an empty one (no keys, HD seed and private keys disabled).
106
99
107
-
Then import the descriptors created in the previous step using the `importdescriptors` RPC.
100
+
Then import the descriptor created in the previous step using the `importdescriptors` RPC.
108
101
109
102
After that, `getwalletinfo` can be used to check if the wallet was created successfully.
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:
@@ -133,7 +127,7 @@ The url used by the script can also be accessed directly. At time of writing, th
133
127
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.
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.
@@ -183,9 +177,9 @@ Optionally, the PSBT can be decoded to a JSON format using `decodepsbt` RPC.
183
177
The `analyzepsbt` RPC analyzes and provides information about the current status of a PSBT and its inputs, e.g. missing signatures.
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.
@@ -219,9 +213,9 @@ The `finalizepsbt` RPC is used to produce a network serialized transaction which
219
213
It checks that all inputs have complete scriptSigs and scriptWitnesses and, if so, encodes them into network serialized transactions.
"""Extract the wallet's xpubs using `listdescriptors` and pick the one from the `pkh` descriptor since it's least likely to be accidentally reused (legacy addresses)."""
0 commit comments