import multisig wallet into bitcoin core, Vpub keys are not valid. how to? 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 &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

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
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=&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