Importing descriptors for multisig addresses

9 replies 331 views
Posts: 8 · Reputation: 92
#1Mar 7, 2018, 12:00 AM
I've been struggling with this issue since yesterday and I'm not sure how to resolve it. How can I import a multisig address into my bitcoin-cli wallet? What I’m trying to do is this: The issue is that I keep getting the error "Cannot import descriptor without private keys to a wallet with private keys enabled." If I don’t import the address, I can’t access unspent UTXOs, and walletnotify just won’t work. Has anyone figured this out? I'd really appreciate any help.
4 Reply Quote Share
sage777Full Member
Posts: 102 · Reputation: 305
#2Mar 7, 2018, 02:37 AM
In the old version, it was possible to mix watch-only and spendable coins in the same wallet. In the latest version, it is no longer the case. Which means, that: 1. If you want to spend those coins, then you have to import private keys. 2. If you want to only watch those coins, then you have to create watch-only wallet, and then, no private keys can be imported. So, your commands are probably correct, but you simply use the wrong type of wallet. And if you want to have both, then you can create two wallets: one watch-only, and one with private keys. And then, one wallet will allow you to directly manage your funds, and another one will allow watching multisigs. Spending from multisig directly is probably not possible, because you would need to have all keys in one place, which would defeat the point of using multisig in the first place. So, all you can do, is to make a partially signed transaction, and then pass it to the wallet with your private keys enabled, to sign it, and then pass partially signed transactions, until the last recipient will broadcast it.
1 Reply Quote Share
Posts: 8 · Reputation: 92
#3Mar 7, 2018, 05:03 AM
Makes sense, thanks for clarifying this - i found the solution, thanks! Unfortunately i can still not implement an active descriptor for a wsh(multi)) descriptor (so multisig). If i do delcare a range, it shows "Range should not be specified for an un-ranged descriptor" - if i do not declare a range it says "Active descriptors must be ranged". Really struggling with it, ugh.
0 Reply Quote Share
sage777Full Member
Posts: 102 · Reputation: 305
#4Mar 9, 2018, 04:16 AM
Compare those results, if you put your keys there. If you have "isrange" set to "true", then you have a range, and to remove it, you can replace the last number with a star. However, if you want to have a specific key, then instead of a star, you can put the proper index, for a single key you want to import. So, the question is: do you want to import 1000 keys, or just a single key? In one case, you import "*" and give "[0,1000]" as a range, and in another case, you import "123" to get a single key, with index equal to 123.
3 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#5Mar 9, 2018, 05:33 AM
Your MultiSig descriptors may be containing public keys or WIF which isn't going to work with range since it's not a master or extended key. For it to be "Active", the wallet should be able to derive child keys with it thus, should be a master/extended key with derivation path and a range to specify its gap limit. And "Ranged" descriptors must contain an extended public key for watch-only or master private key for the signer. Example of Ranged MultiSig wallet setup: https://bitcointalk.org/index.php?topic=5427745.msg61426872#msg61426872 Make sure to specify your xprv/xpub's correct derivation path because the examples are just using m/0/* derivation paths since it's using extended private key and extended public key pair instead of the usual master private key and extended public key.
1 Reply Quote Share
Posts: 8 · Reputation: 92
#6Mar 9, 2018, 07:43 AM
Thanks for the help, i finally succeeded implementing the descriptor and it also gets listed on listdescriptor properly - though i can still not find any unspent UXTOs on it. What i did exactly was this: When i call bitcoin-cli -rpcwallet=wallet_name listdescriptors, i can also see the descriptor as show here Using a Bitcoin Explorer, i can see the funds arrived on the address "3JhZXXXXXXXXXXXXXXXXXXX", using its transaction id with bitcoin-cli -rpcwallet=wallet_name gettransaction TXID results in "Non-wallet ID" and if i call getbalance, i neither can see the funds nor find any unspent UXTOs, even though there are coins available using the Bitcoin Explorer. Do i have to import the address "3JhZXXXXXXXXXXXXXXXXXXX" itself somehow instead of using wsh(multi()) ? The ordering of keys is the very same on both rpc calls.
0 Reply Quote Share
ryan_nodeSenior Member
Posts: 204 · Reputation: 859
#7Mar 10, 2018, 07:09 PM
You imported with a timestamp of "now" which means that no rescan was performed as it assumes that there is no history to scan for. You can have the wallet rescan the blockchain for any related transactions by using rescanblockchain.
4 Reply Quote Share
gr3g.0rbitHero Member
Posts: 1025 · Reputation: 2646
#8Mar 12, 2018, 07:42 AM
Aside from manual rescan, you can also use  \"timestamp\": 0 to scan the entire blockchain after the import. The recommended work flow is to use timestamp "now" to the first and the second last descriptors to import, then "0" when importing the last descriptor so it will only scan once when all of the descriptors are already imported. Or include multiple descriptors in one importdescriptors command and use timestamp 0, check the examples: https://developer.bitcoin.org/reference/rpc/importdescriptors.html Additional note on the ordering, you can use "sortedmulti" for it to be automatically sorted lexicographically like most wallets do. Use "multi" for cases when the wallet has its own way of sorting keys or it's not documented.
5 Reply Quote Share
Posts: 8 · Reputation: 92
#9Mar 12, 2018, 09:36 AM
But since i import the descriptor right after creation, it should not matter that the timestamp is set to now or ? The deposit on that address happens after the import and thus theres no former transaction history - if i rescan from 681.000 on using bitcoin-cli -rpcwallet=multisig_wallet rescanblockchain 681000, which is about 200 blocks before the transaction happens, i still cannot find any data. My assumption is the multisig address is somehow not getting imported properly or well, it does not get identified as part of the wallet even though the descriptor is there but i cannot import addresses directly since i do not use a legacy wallet - no idea how that could be fixed since well, the descriptor is imported and i can see it.
1 Reply Quote Share
Posts: 8 · Reputation: 92
#10Mar 12, 2018, 01:06 PM
I found the issue, i had to use a derived address and not the address getting output by the "Createmultisig" command - now i can see the transaction, the unspent UXTOs and i can see the address belongs to the wallet - awesome!
3 Reply Quote Share

Related topics