<p>this is a script that works for me, it imports a 2of3 HD multisig wallet.</p>
<p>I have very basic knowledge of bash so you may want to double check it before running it, anyway, what finally worked for me was to understand that I had to <code>wsh(sortedmulti(2,${pub1}/0/*,${pub2}/0/*,${pub3}/0/*))</code>to derive the receive descriptor and <code>wsh(sortedmulti(2,${pub1}/1/*,${pub2}/0/*,${pub3}/0/*))</code>for receiver.</p>
<p>I also found this good converter here:
<a href="https://jlopp.github.io/xpub-converter/" rel="nofollow noreferrer">https://jlopp.github.io/xpub-converter/</a></p>
<pre><code>#!/bin/sh

wallet=$1
pub1=$2
pub2=$3
pub3=$4
startfrom=$5
range=$6

wallet=&quot;${wallet:=test}&quot;
pub1=&quot;${pub1:=Vpub1...}&quot;
pub2=&quot;${pub2:=Vpub2...}&quot;
pub3=&quot;${pub3:=Vpub3...}&quot;
rescanblockchain=&quot;${startfrom:=1934907}&quot;
range=&quot;${range:=[0,100]}&quot;

p1=$(echo $pub1 | cut -c1-10)
p2=$(echo $pub2 | cut -c1-10)
p3=$(echo $pub3 | cut -c1-10)

printf &quot;\n\nWorking on '${wallet}' from ${p1}... ${p2}... ${p3} starting from ${rescanblockchain}\n\n&quot;

# create wallet if needed
if [[ $(bitcoin-cli listwallets | jq '. | index(&quot;'$wallet'&quot;)' ) == &quot;null&quot; ]]; then
    echo &quot;Making wallet '${wallet}' from ${pub1} ${pub2} ${pub3}&quot;
    bitcoin-cli createwallet $wallet  true
fi

# convert keys format from vpub to tpub https://jlopp.github.io/xpub-converter/
pub1=$(node converter.js ${pub1})
pub2=$(node converter.js ${pub2})
pub3=$(node converter.js ${pub3})

# get descriptor for receive addresses
raw_receive_descriptor=&quot;wsh(sortedmulti(2,${pub1}/0/*,${pub2}/0/*,${pub3}/0/*))&quot;
receive_descriptor=$(bitcoin-cli getdescriptorinfo $raw_receive_descriptor | jq -r '.descriptor')

# get descriptor for change addresses
raw_change_descriptor=&quot;wsh(sortedmulti(2,${pub1}/1/*,${pub2}/0/*,${pub3}/0/*))&quot;
change_descriptor=$(bitcoin-cli getdescriptorinfo $raw_change_descriptor | jq -r '.descriptor')

# import receive addresses
bitcoin-cli -rpcwallet=$wallet importmulti  '[{&quot;desc&quot;: &quot;'$receive_descriptor'&quot;, &quot;internal&quot;: false, &quot;range&quot;: '${range}', &quot;timestamp&quot;: &quot;now&quot;, &quot;keypool&quot;: true, &quot;watchonly&quot;: true}]'  '{&quot;rescan&quot;: false}' | jq .

# import change addresses
bitcoin-cli -rpcwallet=$wallet importmulti  '[{&quot;desc&quot;: &quot;'$change_descriptor'&quot;, &quot;internal&quot;: true, &quot;range&quot;: '${range}', &quot;timestamp&quot;: &quot;now&quot;, &quot;keypool&quot;: true, &quot;watchonly&quot;: true}]'  '{&quot;rescan&quot;: false}' | jq .

# rescan blockchain
bitcoin-cli -rpcwallet=$wallet rescanblockchain &quot;${rescanblockchain}&quot; | jq .

# just print out few receive addresses
bitcoin-cli deriveaddresses  ${receive_descriptor} &quot;${range}&quot; | jq .

# print out balance
bitcoin-cli -rpcwallet=$wallet getbalance
</code></pre>

CC BY-SA 4.0
2021-03-03T21:25:04.973Z
2021-03-03T21:25:04.973Z
prcvcc
<p>So just to make this post more clear, this can be run directly on bitcoin-cli or in the bitcoin-qt console. Mostly I followed <a href="https://www.reddit.com/r/Bitcoin/comments/gvwk4p/howto_setup_your_multisignature_cold_wallet_in/" rel="nofollow noreferrer">this guide</a>.
instead of Vpubs, I used Jameson Lopp's <a href="https://jlopp.github.io/xpub-converter/" rel="nofollow noreferrer">converter</a> to convert the Vpubs into tpubs, and while there I get the matching fingerprints, so I have everything I need.
Mind you, this is just to verify receive addresses independently from any other wallet (Electrum, Specter).</p>
<p>Sorry I can't upvote or do anything else, I am a first time user with 0 reputation :(</p>

CC BY-SA 4.0
2021-03-04T16:17:26.570Z
2021-03-12T08:33:51.557Z
2021-03-12T08:33:51.557Z
user116697
<p>I'm trying to import an HD multisig wallet created with Electrum into Bitcoin core v0.21.0.0.</p>
<p>I managed to do so with the fantastic <a href="https://specter.solutions/" rel="nofollow noreferrer">cryptoadvance.specter</a> server, but I also would like to import it using the standard bitcoin-cli commands.</p>
<p>This is what I managed to do so far, and it only works if I <a href="https://jlopp.github.io/xpub-converter/" rel="nofollow noreferrer">convert</a> the pub keys Vpub <code>Multi-signature P2WSH</code> to tpub <code>P2PKH</code>, so for example:</p>
<p><code>Vpub5fRxfoprsHS9Vnhq1grZcJrWSRmSeBZbLCbnTJcvSDXr3xoBurx8MUt8UmHCsTVPXqk1rNpgt3X3KAvcJzCZvwn9yQymrWhwMJpEYysLqQV</code></p>
<p>becomes</p>
<p><code>tpubD8a2g9FwJxvC3c7YBvwvQL35Ph7jJTN4PnarTPCJAND6HGXSizk4ew1JxWKgqLXZuZSZ6KXZTFfgem2ar1itGNUywE1XJTY9azG4WBr25hn</code></p>
<p>then I can run this program and it seems to be working fine, unless it's not because the resulting addresses are very different. (the wallet created with Specter matches perfectly the one in Electrum, it finds the correct transactions as well)</p>
<pre><code>#!/bin/sh

wallet=$1
pub1=$2
pub2=$3

echo &quot;Making wallet '${wallet}' from ${pub1} ${pub2}&quot;

rawdescriptor=&quot;wsh(sortedmulti(2,${pub1}/*,${pub2}/*))&quot;
descriptor=$(bitcoin-cli getdescriptorinfo $rawdescriptor | jq -r '.descriptor')
bitcoin-cli deriveaddresses  ${descriptor} &quot;[0,0]&quot;

bitcoin-cli createwallet $wallet true
bitcoin-cli -rpcwallet=$1  importmulti '[{&quot;desc&quot;: &quot;'$descriptor'&quot;, &quot;internal&quot;: false, &quot;range&quot;: [0, 1000], &quot;timestamp&quot;: 1609459200, &quot;keypool&quot;: true, &quot;watchonly&quot;: true, &quot;label&quot;: &quot;lol&quot;}]' '{ &quot;rescan&quot;: true}'
# bitcoin-cli -rpcwallet=$1 rescanblockchain
</code></pre>
<p>I can't use the Vpub keys because bitcoin-cli (v0.21.0.0) throws this message:</p>
<pre><code>key 'vpub5UXsYa6RJKsn5DYT52PanEWhidjBRpt11vx7Y3MP4ShSRnEH9TZrGN2Cg4KjK2GVJNg2ynpZzq8YC1Jr1m3cnTfV8wsNT7EwTaYMy4PCDAg' is not valid.
</code></pre>
<p>At this stage i’m only interested into a watch only wallet, so i don’t need to use private keys.</p>
<p>Also, I'm in testnet and I have <code>testnet=1</code> on my bitcoin.conf</p>
<p>I've tried reading as much as I could but I think i hit a wall now and I don't know how to continue.
Any help would be greatly appreciated</p>

CC BY-SA 4.0
2021-02-11T18:45:22.653Z
You're trying this with testnet funds, right?
Murch
CC BY-SA 4.0
2021-02-11T18:45:57.527Z
yes, i’ll edit my question
prcvcc
CC BY-SA 4.0
2021-03-03T21:14:23.763Z
Did you ever get this to work? I'm having the exact same issue on 0.21. barely any docs on the matter.
user116697
CC BY-SA 4.0
2021-03-03T21:15:43.137Z
In fact I did! i'll answer my question, hold on
prcvcc
CC BY-SA 4.0
2021-03-03T21:26:41.723Z
Actually I just kind of succeeded too. I wonder if we have the same solution :)
So I was using the root key signatures from seedpicker, where I got the Vpubs, but now I tried the master fingerprints from Specter PDF with SLIP132 and got the same addresses. What I still don't know is
a. where I can independently get the correct signature without relying on Specter and 
b. why the addresses imported are completely out of order and 
c. why bitcoin-qt does not show past transactions (I'm on a pruned node, so that could be the reason...)
user116697
CC BY-SA 4.0
2021-03-03T21:29:31.167Z
see my answer for that, it should give you enough info
prcvcc
CC BY-SA 4.0
2021-03-03T21:32:36.930Z
I used this guide. I understand you completely ignored the fingerprint and derivation path?
user116697
CC BY-SA 4.0
2021-03-03T21:35:23.863Z
/0/* is the derivation path for receive addresses where /1/* is for change addresses, you use the script i pasted like this script.sh wallet_name vpub1... vpub2... vpub3... 0 "0,100"
prcvcc
CC BY-SA 4.0
2021-03-03T21:38:49.087Z
I didn't mean the receive and change derivation paths. I means the key derivation path. When I created the descriptor I used the following format:
wsh(sortedmulti(2,[XXXXXXXX/48h/1h/0h/2h]tpubDFfbToY......e8dAX/0/*, ...
user116697
CC BY-SA 4.0
2021-03-03T21:39:38.777Z
right, I ignored that. turned out it worked fine
prcvcc
CC BY-SA 4.0
2021-03-03T21:41:58.327Z
Interesting. I also have a question for 'a' above. When converting the Vpub to tpub lopp's tool also gave me a new fingerprint, which I promptly (at least at first) ignored. Still wondering about the order of the addresses. Thanks for the info!
user116697
CC BY-SA 4.0
2021-03-04T09:41:37.350Z
if it worked for you accept the answer!
prcvcc
<bitcoin-core><multi-signature><public-key><xpub>
import multisig wallet into bitcoin core, Vpub keys are not valid. how to?
prcvcc
# import multisig wallet into bitcoin core, Vpub keys are not valid. how to?

(Asked by: username_0 on 2021-02-11)

I'm trying to import an HD multisig wallet created with Electrum into Bitcoin core v0.21.0.0.
I managed to do so with the fantastic cryptoadvance.specter server, but I also would like to import it using the standard bitcoin-cli commands.
This is what I managed to do so far, and it only works if I convert the pub keys Vpub Multi-signature P2WSH to tpub P2PKH, so for example:
Vpub5fRxfoprsHS9Vnhq1grZcJrWSRmSeBZbLCbnTJcvSDXr3xoBurx8MUt8UmHCsTVPXqk1rNpgt3X3KAvcJzCZvwn9yQymrWhwMJpEYysLqQV
becomes
tpubD8a2g9FwJxvC3c7YBvwvQL35Ph7jJTN4PnarTPCJAND6HGXSizk4ew1JxWKgqLXZuZSZ6KXZTFfgem2ar1itGNUywE1XJTY9azG4WBr25hn
then I can run this program and it seems to be working fine, unless it's not because the resulting addresses are very different. (the wallet created with Specter matches perfectly the one in Electrum, it finds the correct transactions as well)
#!/bin/sh

wallet=$1
pub1=$2
pub2=$3

echo "Making wallet '${wallet}' from ${pub1} ${pub2}"

rawdescriptor="wsh(sortedmulti(2,${pub1}/*,${pub2}/*))"
descriptor=$(bitcoin-cli getdescriptorinfo $rawdescriptor | jq -r '.descriptor')
bitcoin-cli deriveaddresses  ${descriptor} "[0,0]"

bitcoin-cli createwallet $wallet true
bitcoin-cli -rpcwallet=$1  importmulti '[{"desc": "'$descriptor'", "internal": false, "range": [0, 1000], "timestamp": 1609459200, "keypool": true, "watchonly": true, "label": "lol"}]' '{ "rescan": true}'
# bitcoin-cli -rpcwallet=$1 rescanblockchain

I can't use the Vpub keys because bitcoin-cli (v0.21.0.0) throws this message:
key 'vpub5UXsYa6RJKsn5DYT52PanEWhidjBRpt11vx7Y3MP4ShSRnEH9TZrGN2Cg4KjK2GVJNg2ynpZzq8YC1Jr1m3cnTfV8wsNT7EwTaYMy4PCDAg' is not valid.

At this stage i’m only interested into a watch only wallet, so i don’t need to use private keys.
Also, I'm in testnet and I have testnet=1 on my bitcoin.conf
I've tried reading as much as I could but I think i hit a wall now and I don't know how to continue.
Any help would be greatly appreciated

**Tags:** bitcoin-core, multi-signature, public-key, xpub

> **Comments:**
> **username_1**: You're trying this with testnet funds, right?  
> **username_0**: yes, i’ll edit my question  
> **username_2**: Did you ever get this to work? I'm having the exact same issue on 0.21. barely any docs on the matter.  
> **username_0**: In fact I did! i'll answer my question, hold on  
> **username_2**: Actually I just kind of succeeded too. I wonder if we have the same solution :) So I was using the root key signatures from seedpicker, where I got the Vpubs, but now I tried the master fingerprints from Specter PDF with SLIP132 and got the same addresses. What I still don't know is a. where I can independently get the correct signature without relying on Specter and  b. why the addresses imported are completely out of order and  c. why bitcoin-qt does not show past transactions (I'm on a pruned node, so that could be the reason...)  
> **username_0**: see my answer for that, it should give you enough info  
> **username_2**: I used this guide. I understand you completely ignored the fingerprint and derivation path?  
> **username_0**: /0/* is the derivation path for receive addresses where /1/* is for change addresses, you use the script i pasted like this script.sh wallet_name vpub1... vpub2... vpub3... 0 "0,100"  
> **username_2**: I didn't mean the receive and change derivation paths. I means the key derivation path. When I created the descriptor I used the following format: wsh(sortedmulti(2,[XXXXXXXX/48h/1h/0h/2h]tpubDFfbToY......e8dAX/0/*, ...  
> **username_0**: right, I ignored that. turned out it worked fine  
> **username_2**: Interesting. I also have a question for 'a' above. When converting the Vpub to tpub lopp's tool also gave me a new fingerprint, which I promptly (at least at first) ignored. Still wondering about the order of the addresses. Thanks for the info!  
> **username_0**: if it worked for you accept the answer!  

---

## 2 answers

### Answer by username_0 on 2021-03-03. Score: 1 | Accepted answer

this is a script that works for me, it imports a 2of3 HD multisig wallet.
I have very basic knowledge of bash so you may want to double check it before running it, anyway, what finally worked for me was to understand that I had to wsh(sortedmulti(2,${pub1}/0/*,${pub2}/0/*,${pub3}/0/*))to derive the receive descriptor and wsh(sortedmulti(2,${pub1}/1/*,${pub2}/0/*,${pub3}/0/*))for receiver.
I also found this good converter here:
https://jlopp.github.io/xpub-converter/
#!/bin/sh

wallet=$1
pub1=$2
pub2=$3
pub3=$4
startfrom=$5
range=$6

wallet="${wallet:=test}"
pub1="${pub1:=Vpub1...}"
pub2="${pub2:=Vpub2...}"
pub3="${pub3:=Vpub3...}"
rescanblockchain="${startfrom:=1934907}"
range="${range:=[0,100]}"

p1=$(echo $pub1 | cut -c1-10)
p2=$(echo $pub2 | cut -c1-10)
p3=$(echo $pub3 | cut -c1-10)

printf "\n\nWorking on '${wallet}' from ${p1}... ${p2}... ${p3} starting from ${rescanblockchain}\n\n"

# create wallet if needed
if [[ $(bitcoin-cli listwallets | jq '. | index("'$wallet'")' ) == "null" ]]; then
    echo "Making wallet '${wallet}' from ${pub1} ${pub2} ${pub3}"
    bitcoin-cli createwallet $wallet  true
fi

# convert keys format from vpub to tpub https://jlopp.github.io/xpub-converter/
pub1=$(node converter.js ${pub1})
pub2=$(node converter.js ${pub2})
pub3=$(node converter.js ${pub3})

# get descriptor for receive addresses
raw_receive_descriptor="wsh(sortedmulti(2,${pub1}/0/*,${pub2}/0/*,${pub3}/0/*))"
receive_descriptor=$(bitcoin-cli getdescriptorinfo $raw_receive_descriptor | jq -r '.descriptor')

# get descriptor for change addresses
raw_change_descriptor="wsh(sortedmulti(2,${pub1}/1/*,${pub2}/0/*,${pub3}/0/*))"
change_descriptor=$(bitcoin-cli getdescriptorinfo $raw_change_descriptor | jq -r '.descriptor')

# import receive addresses
bitcoin-cli -rpcwallet=$wallet importmulti  '[{"desc": "'$receive_descriptor'", "internal": false, "range": '${range}', "timestamp": "now", "keypool": true, "watchonly": true}]'  '{"rescan": false}' | jq .

# import change addresses
bitcoin-cli -rpcwallet=$wallet importmulti  '[{"desc": "'$change_descriptor'", "internal": true, "range": '${range}', "timestamp": "now", "keypool": true, "watchonly": true}]'  '{"rescan": false}' | jq .

# rescan blockchain
bitcoin-cli -rpcwallet=$wallet rescanblockchain "${rescanblockchain}" | jq .

# just print out few receive addresses
bitcoin-cli deriveaddresses  ${receive_descriptor} "${range}" | jq .

# print out balance
bitcoin-cli -rpcwallet=$wallet getbalance


---

### Answer by username_2 on 2021-03-04. Score: 0

So just to make this post more clear, this can be run directly on bitcoin-cli or in the bitcoin-qt console. Mostly I followed [this guide](https://www.reddit.com/r/Bitcoin/comments/gvwk4p/howto_setup_your_multisignature_cold_wallet_in/).
instead of Vpubs, I used Jameson Lopp's [converter](https://jlopp.github.io/xpub-converter/) to convert the Vpubs into tpubs, and while there I get the matching fingerprints, so I have everything I need.
Mind you, this is just to verify receive addresses independently from any other wallet (Electrum, Specter).

Sorry I can't upvote or do anything else, I am a first time user with 0 reputation :(


---

