Bitcoin Forum
June 25, 2024, 06:06:27 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
  Home Help Search Login Register More  
  Show Posts
Pages: [1]
1  Bitcoin / Development & Technical Discussion / import multisig wallet into bitcoin core, but Vpub keys are not valid. how to? on: February 12, 2021, 08:32:01 AM
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:

Code:
Vpub5fRxfoprsHS9Vnhq1grZcJrWSRmSeBZbLCbnTJcvSDXr3xoBurx8MUt8UmHCsTVPXqk1rNpgt3X3KAvcJzCZvwn9yQymrWhwMJpEYysLqQV
becomes

Code:
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)

Code:
#!/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:

Code:
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
Pages: [1]
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!