1

I've just found an old HD with a multibit wallet with a little bit of content and I want to open it in bitcoin core since multibit is deprecated nowadays. I have the private key for the wallet, how to do this in bitcoin core? being the gui interface or the command line interface? Thanks in advance.

EDIT

I keep getting the error key 'XXXXXXXXXX' is not valid (code -5) when running getdescriptorinfo, I think it is as mentioned in my commets below, maybe the encoding used in multibit legacy is different from bitcoin's... Btw, I'm using the key in multibit.key which contains a string of 237 characters and when outputted to cat multibit.key | base64 has 329 characters. Is it really the private key?

Also, my question is not duplicate as mentioned in the comments below...

Fnr
  • 113
  • 5

1 Answers1

1

You can use the importdescriptors RPC command of Bitcoin Core, given you can find the derivation path(s) used by this wallet.

Start by creating a descriptor-enabled wallet on bitcoind (unfortunately not yet the default, you have to set descriptors to true in the createwallet call).

For example if you were looking for native segwit v0 outputs you would import a wpkh descriptor: wpkh(yourxpriv/deriv/path/*).
Here is a concrete example with xpriv xprv9s21ZrQH143K2CewR4LfKvC1Liw16RxrUMSUAiiHs4eqyMPE6UNxKmtKKTG7jFWSUhzDP2YT45ej8ratyi2TjL9UVKDVSCj5BDZiBiP91ew and derivation path m/0/1/*:

wpkh(xprv9s21ZrQH143K2CewR4LfKvC1Liw16RxrUMSUAiiHs4eqyMPE6UNxKmtKKTG7jFWSUhzDP2YT45ej8ratyi2TjL9UVKDVSCj5BDZiBiP91ew/0/1/*)

Now, bitcoind mandates the use of a checksum for the import. Therefore if you don't already have one, you can request it using the getdescriptorinfo command (keeping the same dummy values as above):

getdescriptorinfo "wpkh(xprv9s21ZrQH143K2CewR4LfKvC1Liw16RxrUMSUAiiHs4eqyMPE6UNxKmtKKTG7jFWSUhzDP2YT45ej8ratyi2TjL9UVKDVSCj5BDZiBiP91ew/0/1/*)"

You will get a desc#checksum out of it.
For this call it was wpkh(xpub661MyMwAqRbcEgjQX5sfh48jtkmVVtghqaN4y77uRQBpr9iNe1hCsaCoAkV14nksbcNSWWXH8tr9eKrPTLBpGifS8TMG8toqgtVRP6NWZpT/0/1/*)#78f39hv7.

Finally, you can import the descriptor to bitcoind and rescan the block chain from the timestamp at which you created your wallet (here again an instance with the above dummy values):

importdescriptors '[{"desc":"wpkh(xprv9s21ZrQH143K2CewR4LfKvC1Liw16RxrUMSUAiiHs4eqyMPE6UNxKmtKKTG7jFWSUhzDP2YT45ej8ratyi2TjL9UVKDVSCj5BDZiBiP91ew/0/1/*)","range":1000,"next_index":0,"timestamp":1630308659}]'

The same goes for other scriptPubKey types, you can find a reference of the syntax to use here.

Antoine Poinsot
  • 8,334
  • 2
  • 17
  • 34
  • I keep getting the error key 'XXXXXXXXXX' is not valid (code -5) when running getdescriptorinfo, I think it is as mentioned in my commets above, maybe the encoding used in multibit legacy is different from bitcoin's.. any idea? – Fnr Aug 30 '21 at 21:20
  • btw, I'm using the key in multibit.key which contains a string of 237 characters and when outputted to base64 has 329 characters... – Fnr Aug 30 '21 at 21:30
  • Is it an xpub/xpriv similar to the one in my answer? – Antoine Poinsot Aug 31 '21 at 06:08
  • no, it doesn't begin with xpub/xpriv and it ends with =, so I guess it's ciphered? – Fnr Aug 31 '21 at 12:48
  • You can't know whether it's ciphered just based on the encoding. You should look into how to get an xpriv from a multibit wallet. – Antoine Poinsot Aug 31 '21 at 15:38