<p>The key that you have retrieved from Bitcoin Core is not a master private key. It is the master <strong>encryption</strong> key for the wallet. This is local to that wallet file only and does not have any relation to the private keys that are used to spend the Bitcoin. If you have only that, there is nothing that can be recovered as the actual private key material is not present.</p>

CC BY-SA 4.0
2023-02-08T23:00:19.450Z
2023-02-08T23:00:19.450Z
Ava Chow
<p>So far as I can tell, Bitcoin core (as of v23.0) has no obvious facility to import a master private key and use that key as the basis of a hierarchical deterministic (HD) wallet.</p>
<p>It has a facility for importing ordinary private keys of the sort that were generated before implementation of HD key derivation, but I doubt that would do anything useful with a master private key.</p>
<p>As we all know, what Bitcoin Core's developers intended us to do is to use the &quot;Backup Wallet&quot; option in the &quot;File&quot; menu and put copies of that in safe places <em>on other devices</em>. Then restore from one of those backups if the active wallet is damaged or lost.</p>
<p>In the &quot;File&quot; menu under &quot;Create Wallet&quot; there is a checkbox option to &quot;Make Blank Wallet&quot; whose tooltip says</p>
<blockquote>
<p>&quot;Blank wallets do not initially have private keys  or scripts. Private keys and addresses can be imported, or an HD seed can be set, at a later time&quot;.</p>
</blockquote>
<p>However I believe you don't have the HD seed, only a master private key derived from such a seed (as I understand it from <a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" rel="nofollow noreferrer">BIP32</a>).</p>
<p>I suspect that in principle, it is theoretically possible to construct from a master private key, an empty wallet.dat file of the sort that Bitcoin core might create when first run and before it has started an initial blockchain download (IBD) or built any indexes or UTXO sets etc. Then that reconstructed wallet.dat file ought to be usable with Bitcoin core. However I do not know of any tool to do this.</p>
<hr />
<p>Related:</p>
<ul>
<li><p><a href="https://bitcoin.stackexchange.com/q/68039/13866">Importing an arbitrarily created Master Private key to Bitcoin Core</a></p>
</li>
<li><p><a href="https://developer.bitcoin.org/reference/rpc/sethdseed.html" rel="nofollow noreferrer">Developer reference for <code>sethdseed</code></a></p>
<blockquote>
<h2>Argument #2 - seed</h2>
<p><strong>Type</strong>: string, optional, default=random seed</p>
<p><strong>The WIF private key to use as the new HD seed.</strong></p>
<p>The seed value can be retrieved using the dumpwallet command. It is the private key marked hdseed=1</p>
</blockquote>
<p><sup>I find this confusing but I think the HD seed and master private key are different things</sup></p>
</li>
<li><p><a href="https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki" rel="nofollow noreferrer">BIP32</a></p>
<blockquote>
<p><a href="https://i.sstatic.net/OHhq1.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/OHhq1.png" alt="BIP32 key derivation diagram" /></a></p>
</blockquote>
<p><sup>Note: S is not m and HMAC-SHA512 is not reversible</sup></p>
</li>
</ul>
<hr />
<p>Decrypting encrypted keys:</p>
<ul>
<li><a href="https://stackoverflow.com/q/16056135/477035">How to use OpenSSL to encrypt/decrypt files?</a> especially the answers that mention the <code>-iter</code>, <code>-salt</code> and <code>-K</code> (key) options. I have not tried this myself. A careful search may reveal other specialised tools more suited to your purpose.</li>
</ul>

CC BY-SA 4.0
2023-01-08T06:58:09.187Z
Can the primary private key be turned to hdseed? And this primary key hash with the AES256CBC plus SALT and iterations, how to decrypt?
nikon
CC BY-SA 4.0
2023-01-08T10:00:09.810Z
@nikon: The BIP32 diagram shows m is derived from S using HMAC-SHA512 which is not reversible.
RedGrittyBrick
CC BY-SA 4.0
2023-01-08T10:02:55.897Z
@nikon: to decrypt encrypted data you need any tool that supports the encryption algorithm (AES-256CBC), the parameters you have and the encryption key (for the wallet)
RedGrittyBrick
CC BY-SA 4.0
2023-01-07T10:18:26.660Z
2023-01-08T10:15:12.700Z
2023-01-08T10:15:12.700Z
RedGrittyBrick
<p>Yes, it is possible to recover (replicate) the wallet if you have a BIP-32 master private key. There is the command: <code>[importdescriptors][1]</code> to use the master key in a wallet in Bitcoin Core. It's not strightforward, though. The master key must be transformed into so-called <a href="https://github.com/bitcoin/bips/blob/master/bip-0380.mediawiki" rel="nofollow noreferrer">Output Script Descriptor</a> in order to be accepted by the command.</p>
<p>There are other software packages that will make it easier to use a BIP-32 master private key, e.g. Electrum, Sparrow, <a href="https://iancoleman.io/bip39/" rel="nofollow noreferrer">https://iancoleman.io/bip39/</a>.</p>

CC BY-SA 4.0
2023-02-08T13:10:56.220Z
2023-02-08T13:10:56.220Z
Greg Tonoski
<p>The wallet is damaged, I only have the encrypted master private key and password, is it possible to recover the wallet?</p>

CC BY-SA 4.0
2023-01-06T10:53:23.680Z
Which wallet software application (and version) were you using?
RedGrittyBrick
CC BY-SA 4.0
2023-01-06T13:16:32.173Z
Generally a master private key and password sounds good, but it is hard to say more without a bit more background information.
Murch
CC BY-SA 4.0
2023-01-06T14:12:54.397Z
@Murch,I am using bitcoin core
nikon
CC BY-SA 4.0
2023-01-06T14:15:11.730Z
@Murch, I am asking for help because I am a novice.
nikon
CC BY-SA 4.0
2023-01-06T14:16:44.710Z
@RedGrittyBrick ,Using bitcoin core
nikon
CC BY-SA 4.0
2023-01-06T14:17:06.500Z
Uh, in the above comment, was that your private key or just an example? I have deleted so that fewer people can see it, and will look to redact it, but I hope you did not just post your private key.
Murch
CC BY-SA 4.0
2023-01-06T14:24:28.067Z
@Murch , It's just an example key, do you have a way to retrieve the private key?
nikon
CC BY-SA 4.0
2023-01-06T14:37:27.130Z
Ah good. I restored your prior comment. Sorry, I do not know from the top of my head how to restore a wallet just from a single key. I expect that someone will be able to help you out, though
Murch
CC BY-SA 4.0
2023-01-06T14:42:57.460Z
The version is not clear, around 2011 bitcoin core
nikon
CC BY-SA 4.0
2023-01-06T15:00:50.237Z
How to use this way to restore private key?https://bitcointalk.org/index.php?topic=5093956.0
nikon
CC BY-SA 4.0
2023-01-06T15:34:40.110Z
The master private key is extracted from mine wallet.dat, now wallet.dat is damage and lost, who can help restore private key, can be rewarded
nikon
CC BY-SA 4.0
2023-01-06T16:14:00.593Z
@RedGrittyBrick: Only the master private key similar to this example mkey:a978c07e3d05c91a5442ee2f8211e02e011f6abdec8e23032b7eb1298ed661fb9ebcd7388b3963b527a2923cce6800ea  like salt:e4aa72cd2bfa00cd  iterations: 60435
nikon
<wallet><private-key><wallet-recovery>
How to restore a wallet with only the master private key
nikon
# How to restore a wallet with only the master private key

(Asked by: username_0 on 2023-01-06)

The wallet is damaged, I only have the encrypted master private key and password, is it possible to recover the wallet?

**Tags:** wallet, private-key, wallet-recovery

> **Comments:**
> **username_1**: Which wallet software application (and version) were you using?  
> **username_2**: Generally a master private key and password sounds good, but it is hard to say more without a bit more background information.  
> **username_0**: @username_2,I am using bitcoin core  
> **username_0**: @username_2, I am asking for help because I am a novice.  
> **username_0**: @username_1 ,Using bitcoin core  
> **username_2**: Uh, in the above comment, was that your private key or just an example? I have deleted so that fewer people can see it, and will look to redact it, but I hope you did not just post your private key.  
> **username_0**: @username_2 , It's just an example key, do you have a way to retrieve the private key?  
> **username_2**: Ah good. I restored your prior comment. Sorry, I do not know from the top of my head how to restore a wallet just from a single key. I expect that someone will be able to help you out, though  
> **username_0**: The version is not clear, around 2011 bitcoin core  
> **username_0**: How to use this way to restore private key?https://bitcointalk.org/index.php?topic=5093956.0  
> **username_0**: The master private key is extracted from mine wallet.dat, now wallet.dat is damage and lost, who can help restore private key, can be rewarded  
> **username_0**: @username_1: Only the master private key similar to this example mkey:a978c07e3d05c91a5442ee2f8211e02e011f6abdec8e23032b7eb1298ed661fb9ebcd7388b3963b527a2923cce6800ea  like salt:e4aa72cd2bfa00cd  iterations: 60435  

---

## 3 answers

### Answer by username_3 on 2023-02-08. Score: 2

The key that you have retrieved from Bitcoin Core is not a master private key. It is the master **encryption** key for the wallet. This is local to that wallet file only and does not have any relation to the private keys that are used to spend the Bitcoin. If you have only that, there is nothing that can be recovered as the actual private key material is not present.


---

### Answer by username_1 on 2023-01-07. Score: 1

So far as I can tell, Bitcoin core (as of v23.0) has no obvious facility to import a master private key and use that key as the basis of a hierarchical deterministic (HD) wallet.

It has a facility for importing ordinary private keys of the sort that were generated before implementation of HD key derivation, but I doubt that would do anything useful with a master private key.

As we all know, what Bitcoin Core's developers intended us to do is to use the "Backup Wallet" option in the "File" menu and put copies of that in safe places *on other devices*. Then restore from one of those backups if the active wallet is damaged or lost.

In the "File" menu under "Create Wallet" there is a checkbox option to "Make Blank Wallet" whose tooltip says

> "Blank wallets do not initially have private keys or scripts. Private keys and addresses can be imported, or an HD seed can be set, at a later time".

However I believe you don't have the HD seed, only a master private key derived from such a seed (as I understand it from [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)).

I suspect that in principle, it is theoretically possible to construct from a master private key, an empty wallet.dat file of the sort that Bitcoin core might create when first run and before it has started an initial blockchain download (IBD) or built any indexes or UTXO sets etc. Then that reconstructed wallet.dat file ought to be usable with Bitcoin core. However I do not know of any tool to do this.

---

Related:

* [Importing an arbitrarily created Master Private key to Bitcoin Core](https://bitcoin.stackexchange.com/q/68039/13866)
* [Developer reference for `sethdseed`](https://developer.bitcoin.org/reference/rpc/sethdseed.html)

  > ## Argument #2 - seed
  >
  > **Type**: string, optional, default=random seed
  >
  > **The WIF private key to use as the new HD seed.**
  >
  > The seed value can be retrieved using the dumpwallet command. It is the private key marked hdseed=1

  I find this confusing but I think the HD seed and master private key are different things
* [BIP32](https://github.com/bitcoin/bips/blob/master/bip-0032.mediawiki)

  > [![BIP32 key derivation diagram](https://i.sstatic.net/OHhq1.png)](https://i.sstatic.net/OHhq1.png)

  Note: S is not m and HMAC-SHA512 is not reversible

---

Decrypting encrypted keys:

* [How to use OpenSSL to encrypt/decrypt files?](https://stackoverflow.com/q/16056135/477035) especially the answers that mention the `-iter`, `-salt` and `-K` (key) options. I have not tried this myself. A careful search may reveal other specialised tools more suited to your purpose.

> **Comments:**
> **username_0**: Can the primary private key be turned to hdseed? And this primary key hash with the AES256CBC plus SALT and iterations, how to decrypt?  
> **username_1**: @username_0: The BIP32 diagram shows m is derived from S using HMAC-SHA512 which is not reversible.  
> **username_1**: @username_0: to decrypt encrypted data you need any tool that supports the encryption algorithm (AES-256CBC), the parameters you have and the encryption key (for the wallet)  

---

### Answer by username_4 on 2023-02-08. Score: 1

Yes, it is possible to recover (replicate) the wallet if you have a BIP-32 master private key. There is the command: `[importdescriptors][1]` to use the master key in a wallet in Bitcoin Core. It's not strightforward, though. The master key must be transformed into so-called [Output Script Descriptor](https://github.com/bitcoin/bips/blob/master/bip-0380.mediawiki) in order to be accepted by the command.

There are other software packages that will make it easier to use a BIP-32 master private key, e.g. Electrum, Sparrow, <https://iancoleman.io/bip39/>.


---

