<p>You can use the <code>importdescriptors</code> RPC command of Bitcoin Core, given you can find the derivation path(s) used by this wallet.</p>
<p>Start by creating a descriptor-enabled wallet on <code>bitcoind</code> (unfortunately not yet the default, you have to set <code>descriptors</code> to <code>true</code> in the <code>createwallet</code> call).</p>
<p>For example if you were looking for native segwit v0 outputs you would import a <code>wpkh</code> descriptor: <code>wpkh(yourxpriv/deriv/path/*)</code>.<br />
Here is a concrete example with xpriv <code>xprv9s21ZrQH143K2CewR4LfKvC1Liw16RxrUMSUAiiHs4eqyMPE6UNxKmtKKTG7jFWSUhzDP2YT45ej8ratyi2TjL9UVKDVSCj5BDZiBiP91ew</code> and derivation path <code>m/0/1/*</code>:</p>
<pre><code>wpkh(xprv9s21ZrQH143K2CewR4LfKvC1Liw16RxrUMSUAiiHs4eqyMPE6UNxKmtKKTG7jFWSUhzDP2YT45ej8ratyi2TjL9UVKDVSCj5BDZiBiP91ew/0/1/*)
</code></pre>
<p>Now, <code>bitcoind</code> mandates the use of a checksum for the import. Therefore if you don't already have one, you can request it using the <code>getdescriptorinfo</code> command (keeping the same dummy values as above):</p>
<pre><code>getdescriptorinfo &quot;wpkh(xprv9s21ZrQH143K2CewR4LfKvC1Liw16RxrUMSUAiiHs4eqyMPE6UNxKmtKKTG7jFWSUhzDP2YT45ej8ratyi2TjL9UVKDVSCj5BDZiBiP91ew/0/1/*)&quot;
</code></pre>
<p>You will get a <code>desc#checksum</code> out of it.<br />
For this call it was <code>wpkh(xpub661MyMwAqRbcEgjQX5sfh48jtkmVVtghqaN4y77uRQBpr9iNe1hCsaCoAkV14nksbcNSWWXH8tr9eKrPTLBpGifS8TMG8toqgtVRP6NWZpT/0/1/*)#78f39hv7</code>.</p>
<p>Finally, you can import the descriptor to <code>bitcoind</code> and rescan the block chain from the timestamp at which you created your wallet (here again an instance with the above dummy values):</p>
<pre><code>importdescriptors '[{&quot;desc&quot;:&quot;wpkh(xprv9s21ZrQH143K2CewR4LfKvC1Liw16RxrUMSUAiiHs4eqyMPE6UNxKmtKKTG7jFWSUhzDP2YT45ej8ratyi2TjL9UVKDVSCj5BDZiBiP91ew/0/1/*)&quot;,&quot;range&quot;:1000,&quot;next_index&quot;:0,&quot;timestamp&quot;:1630308659}]'
</code></pre>
<p>The same goes for other scriptPubKey types, you can find a reference of the syntax to use <a href="https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md" rel="nofollow noreferrer">here</a>.</p>

CC BY-SA 4.0
2021-08-30T21:20:00.170Z
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
CC BY-SA 4.0
2021-08-30T21:30:39.640Z
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
CC BY-SA 4.0
2021-08-31T06:08:43.913Z
Is it an xpub/xpriv similar to the one in my answer?
Antoine Poinsot
CC BY-SA 4.0
2021-08-31T12:48:20.310Z
no, it doesn't begin with xpub/xpriv and it ends with `=`, so I guess it's ciphered?
Fnr
CC BY-SA 4.0
2021-08-31T15:38:07.397Z
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
CC BY-SA 4.0
2021-08-30T07:35:24.853Z
2021-08-30T07:35:24.853Z
Antoine Poinsot
<p>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.</p>
<p><strong>EDIT</strong></p>
<p>I keep getting the error <code>key 'XXXXXXXXXX' is not valid (code -5)</code> when running <code>getdescriptorinfo</code>, 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 <code>multibit.key</code> which contains a string of 237 characters and when outputted to <code>cat multibit.key | base64</code> has 329 characters. Is it really the private key?</p>
<p>Also, my question is not duplicate as mentioned in the comments below...</p>

CC BY-SA 4.0
2021-08-29T18:18:25.273Z
Does this answer your question? [How do I import a private key into Bitcoin-Core?](https://bitcoin.stackexchange.com/questions/5941/how-do-i-import-a-private-key-into-bitcoin-core)
RedGrittyBrick
CC BY-SA 4.0
2021-08-29T22:48:16.830Z
no because the encoding used to store the multibit key seems to be different, I've tried simply outputting it to base64 too to import to core but didnt worked also... any idea?
Fnr
CC BY-SA 4.0
2021-08-30T07:37:25.693Z
I vote to leave this question open as importing a private key is a legacy and footguny way of recovering a wallet on Bitcoin Core.
Antoine Poinsot
<bitcoin-core><multibit>
How to import multibit private key to bitcoin core?
Fnr
# How to import multibit private key to bitcoin core?

(Asked by: username_0 on 2021-08-29)

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...

**Tags:** bitcoin-core, multibit

> **Comments:**
> **username_1**: Does this answer your question? [How do I import a private key into Bitcoin-Core?](https://bitcoin.stackexchange.com/questions/5941/how-do-i-import-a-private-key-into-bitcoin-core)  
> **username_0**: no because the encoding used to store the multibit key seems to be different, I've tried simply outputting it to base64 too to import to core but didnt worked also... any idea?  
> **username_2**: I vote to leave this question open as importing a private key is a legacy and footguny way of recovering a wallet on Bitcoin Core.  

---

## 1 answers

### Answer by username_2 on 2021-08-30. Score: 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](https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md).

> **Comments:**
> **username_0**: 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?  
> **username_0**: btw, I'm using the key in `multibit.key` which contains a string of 237 characters and when outputted to base64 has 329 characters...  
> **username_2**: Is it an xpub/xpriv similar to the one in my answer?  
> **username_0**: no, it doesn't begin with xpub/xpriv and it ends with `=`, so I guess it's ciphered?  
> **username_2**: 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.  

---

