<p><sup>Correction: I had thought that Bitcoin Core implements <a href="https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki" rel="nofollow noreferrer">BIP44</a>, which it does not. Thus, what I previously wrote about the gap-limit was wrong.</sup></p>

<p>To restore your wallet-backup you place the <code>wallet.dat</code> into the Bitcoin Core data directory <a href="https://bitcoin.stackexchange.com/a/48339/5406">as Pieter described</a>.</p>

<p>When Bitcoin Core is started, it will load the <code>wallet.dat</code>. The <code>wallet.dat</code> includes the information up to what blockchain height it was used last. So, Bitcoin Core will now from what blockchain height to search for additional transactions. </p>

<p>Hereby, Bitcoin Core will generate a key pool of, by default 100, unused addresses that it also checks for. Whenever it discovers a transaction corresponding to any of its addresses, it will generate more addresses from the deterministic chain to fill the key pool back up.</p>

<p>To recover addresses beyond the key pool, you can just request new addresses in Bitcoin Core until you have found all your funds. This type of initial backup doesn't allow you to recover meta-data such as notes about the transactions' origins or recipients as they are only stored in the <code>wallet.dat</code> and cannot be recovered from the preceding backup.</p>

CC BY-SA 3.0
2016-08-31T12:02:57.933Z
What's the structure of this deterministic chain (is a tree, or a single chain?)?
Yevhen
CC BY-SA 3.0
2016-08-31T12:13:29.367Z
I suppose that this chain is infinite, right?
Yevhen
CC BY-SA 3.0
2016-08-31T12:21:00.680Z
@Yevhen: No, there are only 2^256 possible private keys. ;) Seriously, for practical purposes it's [sufficiently indistinguishable from infinite](http://bitcoin.stackexchange.com/q/8804/5406) though.
Murch
CC BY-SA 3.0
2016-08-31T12:21:52.663Z
And one more thing, can you please tell me, what are the paths of the chain keys (according to BIP32)? bc this formula confuses me a bit )).
Yevhen
CC BY-SA 3.0
2016-08-31T12:27:12.263Z
@Yevhen: What "paths" are you talking about? Text search doesn't find that either here or in the BIP32 text.
Murch
CC BY-SA 3.0
2016-08-31T12:33:56.183Z
Sorry, 'paths' was the wrong word. I meant paths as `m/44'/0'/0'/0...` (m for master node, nodes with quote -- for hardened, each number is the child's index), so I can regenerate my chain in case it has larger gaps with some python bitcoin library for example.
Yevhen
CC BY-SA 3.0
2016-08-31T13:11:10.830Z
I don't know, you should probably ask a new question about that.
Murch
CC BY-SA 3.0
2016-08-31T11:33:25.670Z
2016-08-31T15:33:25.103Z
2017-04-13T12:47:33.610Z
Murch
<p>You don't make a backup of the secret key. You make a backup of the <code>wallet.dat</code> file, once.</p>

<p>If you need to restore the wallet, you restore the <code>wallet.dat</code> file into Bitcoin Core's <a href="https://en.bitcoin.it/wiki/Data_directory" rel="nofollow">data directory</a> while Bitcoin Core is not running.</p>

CC BY-SA 3.0
2016-08-31T10:34:49.163Z
Ok, so you've made a backup wallet.dat file. And now you start receiving bitcoins to your new addresses.
How can you restore all these new addresses later? Your backup is stale, but BIP32 enables you to restore all your addresses from a single root node. How can I do that in BitcoinCore 0.13?
Yevhen
CC BY-SA 3.0
2016-08-31T10:26:54.147Z
2016-08-31T10:26:54.147Z
Pieter Wuille
<p>BitcoinCore 0.13 now supports BIP32 wallets. Documentation states, that if I create a new wallet and encrypt it, it will be an hd wallet. Then I can make a one-time backup of the master secret key.</p>

<p>Imagine that I do all the steps listed above. I start generating addresses and accepting payments. I <strong>do not</strong> make any backups. </p>

<p>How can I restore my wallet at any time in future (with all keys generated <strong>after</strong> the initial backup?)?</p>

<bitcoind><bitcoin-core><backup><bip32-hd-wallets><wallet-import>
Bitcoin Core 0.13 BIP32 support
Yevhen
# Bitcoin Core 0.13 BIP32 support

(Asked by: username_0 on 2016-08-31)

BitcoinCore 0.13 now supports BIP32 wallets. Documentation states, that if I create a new wallet and encrypt it, it will be an hd wallet. Then I can make a one-time backup of the master secret key.

Imagine that I do all the steps listed above. I start generating addresses and accepting payments. I **do not** make any backups.

How can I restore my wallet at any time in future (with all keys generated **after** the initial backup?)?

**Tags:** bitcoind, bitcoin-core, backup, bip32-hd-wallets, wallet-import


---

## 2 answers

### Answer by username_1 on 2016-08-31. Score: 2 | Accepted answer

Correction: I had thought that Bitcoin Core implements [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki), which it does not. Thus, what I previously wrote about the gap-limit was wrong.

To restore your wallet-backup you place the `wallet.dat` into the Bitcoin Core data directory [as username_2 described](https://bitcoin.stackexchange.com/a/48339/5406).

When Bitcoin Core is started, it will load the `wallet.dat`. The `wallet.dat` includes the information up to what blockchain height it was used last. So, Bitcoin Core will now from what blockchain height to search for additional transactions.

Hereby, Bitcoin Core will generate a key pool of, by default 100, unused addresses that it also checks for. Whenever it discovers a transaction corresponding to any of its addresses, it will generate more addresses from the deterministic chain to fill the key pool back up.

To recover addresses beyond the key pool, you can just request new addresses in Bitcoin Core until you have found all your funds. This type of initial backup doesn't allow you to recover meta-data such as notes about the transactions' origins or recipients as they are only stored in the `wallet.dat` and cannot be recovered from the preceding backup.

> **Comments:**
> **username_0**: What's the structure of this deterministic chain (is a tree, or a single chain?)?  
> **username_0**: I suppose that this chain is infinite, right?  
> **username_1**: @username_0: No, there are only 2^256 possible private keys. ;) Seriously, for practical purposes it's [sufficiently indistinguishable from infinite](http://bitcoin.stackexchange.com/q/8804/5406) though.  
> **username_0**: And one more thing, can you please tell me, what are the paths of the chain keys (according to BIP32)? bc this formula confuses me a bit )).  
> **username_1**: @username_0: What "paths" are you talking about? Text search doesn't find that either here or in the BIP32 text.  
> **username_0**: Sorry, 'paths' was the wrong word. I meant paths as `m/44'/0'/0'/0...` (m for master node, nodes with quote -- for hardened, each number is the child's index), so I can regenerate my chain in case it has larger gaps with some python bitcoin library for example.  
> **username_1**: I don't know, you should probably ask a new question about that.  

---

### Answer by username_2 on 2016-08-31. Score: 1

You don't make a backup of the secret key. You make a backup of the `wallet.dat` file, once.

If you need to restore the wallet, you restore the `wallet.dat` file into Bitcoin Core's [data directory](https://en.bitcoin.it/wiki/Data_directory) while Bitcoin Core is not running.

> **Comments:**
> **username_0**: Ok, so you've made a backup wallet.dat file. And now you start receiving bitcoins to your new addresses. How can you restore all these new addresses later? Your backup is stale, but BIP32 enables you to restore all your addresses from a single root node. How can I do that in BitcoinCore 0.13?  

---

