<p>The problem is based on the generating method I used from the the Bitwasp library.</p>

<pre><code>$key = PrivateKeyFactory::fromHex($hex, true);
$wif = $key-&gt;toWif();
</code></pre>

<p>Will return a WIF assuming the hex key was compressed. Restoring the history while importin in electrum failed.</p>

<pre><code>$key = PrivateKeyFactory::fromHex($hex, false);
$wif = $key-&gt;toWif();
</code></pre>

<p>Will return a WIF from an uncompressed hex key an electrum was able to restore the history of the address.</p>

CC BY-SA 4.0
2018-05-29T11:57:02.340Z
master private key doesn't lead to an address in the wallet on its own. you have to run it through hash functions and do ec math to generate child keys at various indices. that's what the type2 deterministic thing is all about. so it seems like you have a regular private key and not a master private key.
Abdussamad
CC BY-SA 4.0
2018-05-29T07:53:23.467Z
2018-05-29T07:53:23.467Z
Michael
<p>I´m trying to recover a wallet from which the Master Private Key (mpk) in hex format and the number of used addresses is known.</p>

<p>Till now I could manage to convert the hex mpk to the wif format and import this to electrum. But here to history seems to be totally lost. </p>

<p>Is there any way to recover the full wallet and history (not neccessary with electrum)?</p>

CC BY-SA 4.0
2018-05-25T10:53:58.960Z
are you sure it's the master private key and not the seed? the seed in hex is 32 characters. if it's the seed do a restore from seed and paste in the hex instead of the words.
Abdussamad
CC BY-SA 4.0
2018-05-29T07:48:10.667Z
sorry for the late respnse. yes, I`m sure that the key is a mpk and not a seed in hex. It seems that the problem is based on compressed vs. uncompressed keys.
Michael
<electrum><private-key-import><wallet-import-format>
recover wallet in electrum from hex mpk
Michael
# recover wallet in electrum from hex mpk

(Asked by: username_0 on 2018-05-24)

I´m trying to recover a wallet from which the Master Private Key (mpk) in hex format and the number of used addresses is known.

Till now I could manage to convert the hex mpk to the wif format and import this to electrum. But here to history seems to be totally lost.

Is there any way to recover the full wallet and history (not neccessary with electrum)?

**Tags:** electrum, private-key-import, wallet-import-format

> **Comments:**
> **username_1**: are you sure it's the master private key and not the seed? the seed in hex is 32 characters. if it's the seed do a restore from seed and paste in the hex instead of the words.  
> **username_0**: sorry for the late respnse. yes, I`m sure that the key is a mpk and not a seed in hex. It seems that the problem is based on compressed vs. uncompressed keys.  

---

## 1 answers

### Answer by username_0 on 2018-05-29. Score: 0

The problem is based on the generating method I used from the the Bitwasp library.
$key = PrivateKeyFactory::fromHex($hex, true);
$wif = $key->toWif();

Will return a WIF assuming the hex key was compressed. Restoring the history while importin in electrum failed.
$key = PrivateKeyFactory::fromHex($hex, false);
$wif = $key->toWif();

Will return a WIF from an uncompressed hex key an electrum was able to restore the history of the address.

> **Comments:**
> **username_1**: master private key doesn't lead to an address in the wallet on its own. you have to run it through hash functions and do ec math to generate child keys at various indices. that's what the type2 deterministic thing is all about. so it seems like you have a regular private key and not a master private key.  

---

