This adds 7 commits on top of #16546 (External signer support) to enable multisig functionality.
It introduces a new createmultisigwallet
RPC which can also be used without external signer support (although it’s only marginally easier than importing descriptors).
It automatically fetches xpubs from connected hardware devices (using HWI), constructs BIP67 multisig descriptors (native and wrapped SegWit) and imports them into a new wallet. For not connected external signers it’s also possible to manually provide an xpub.
Use enumeratesigners
to get a list of device fingerprints, and then call the new createmultisigwallet
:
0createmultisigwallet "wallet_name" threshold ["fingerprint","xpub1","xpub2",...] ( avoid_reuse )
1
2Creates and loads a new multisig wallet.
3Only native segwit bech32 addresses are supported.
4Arguments:
51. wallet_name (string, required) The name for the new wallet. If this is a path, the wallet will be created at the path location.
62. threshold (numeric, required) Number of required signatures
73. signers (json array, required) A json array of signers identified by their BIP32 fingerprint
8 [
9 "fingerprint", (string, required) master key fingerprint. Can be obtained using emumeratesigners.
10 "xpub1", (string) the xpub at deriviation path m/48h/0h/0h/1h used for P2SH_SEGWIT, obtained automatically if -signer if configured
11 "xpub2", (string) the xpub at deriviation path m/48h/0h/0h/2h used for native SegWit, obtained automatically if -signer if configured
12 ...
13 ]
144. avoid_reuse (boolean, optional, default=false) Keep track of coin reuse, and treat dirty and clean coins differently with privacy considerations in mind.
15
16Result:
17{
18 "name" : <wallet_name>, (string) The wallet name if created successfully. If the wallet was created using a full path, the wallet_name will be the full path.
19 "warning" : <warning>, (string) Warning message if wallet was not loaded cleanly.
20}
21
22Examples:
23> bitcoin-cli createmultisigwallet "ManualMultisigWallet" 2 '[{"fingerprint": "d34db33f", "xpub2": "xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY"}, {"fingerprint": "3442193e", "xpub1": "xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8"}]'
24> bitcoin-cli createmultisigwallet "AutomaticMultisigWallet" 2 '[{"fingerprint": "d34db33f"}, {"fingerprint": "3442193e"}]'
25> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createmultisigwallet", "params": ["ManualMultisigWallet", 2, '[{"fingerprint": "d34db33f", "xpub2": "xpub6DJ2dNUysrn5Vt36jH2KLBT2i1auw1tTSSomg8PhqNiUtx8QX2SvC9nrHu81fT41fvDUnhMjEzQgXnQjKEu3oaqMSzhSrHMxyyoEAmUHQbY"}, {"fingerprint": "3442193e", "xpub1": "xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8"}]'] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
26> curl --user myusername --data-binary '{"jsonrpc": "1.0", "id":"curltest", "method": "createmultisigwallet", "params": ["AutomaticMultisigWallet", 2, '[{"fingerprint": "d34db33f"}, {"fingerprint": "3442193e"}]'] }' -H 'content-type: text/plain;' http://127.0.0.1:8332/
It uses the getxpub
HWI method instead of getdescriptors
, and constructs the descriptor locally.
TODO:
- displayaddress support for all connected devices (only ColdCard can handle this afaik, but requires producing a Multisig.txt file)
- wait for improved change address detection support, or add strong warning
See also: Junction or Specter Desktop for similar workflows.
Change detection
Note that due to limitations in HWI, hardware wallet firmware and the PSBT format, the current multisig flow is pretty unsafe. This is because change detection generally doesn’t work.
On ColdCard you can put a multisig.txt
file to enable change detection:
0Name: My-2-of-2
1Policy: 2 of 2
2Derivation: m/48h/0h/0h/2h
3
4A1A1A1A1: xpub...
5B1B1B1B1: xpub...