Bitcoin Core 0.13 BIP32 support

1

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?)?

Yevhen

Posted 2016-08-31T10:07:36.803

Reputation: 153

Answers

1

Correction: I had thought that Bitcoin Core implements BIP44, 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 Pieter described.

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.

Murch

Posted 2016-08-31T10:07:36.803

Reputation: 41 609

What's the structure of this deterministic chain (is a tree, or a single chain?)?Yevhen 2016-08-31T12:02:57.933

I suppose that this chain is infinite, right?Yevhen 2016-08-31T12:13:29.367

@Yevhen: No, there are only 2^256 possible private keys. ;) Seriously, for practical purposes it's sufficiently indistinguishable from infinite though.

Murch 2016-08-31T12:21:00.680

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 2016-08-31T12:21:52.663

@Yevhen: What "paths" are you talking about? Text search doesn't find that either here or in the BIP32 text.Murch 2016-08-31T12:27:12.263

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 2016-08-31T12:33:56.183

I don't know, you should probably ask a new question about that.Murch 2016-08-31T13:11:10.830

Ok. You've helped a lot, thanks very much.Yevhen 2016-08-31T13:13:25.653

@Murch Where do you read about that gap limit? As far as I know, Bitcoin Core has nothing like that. It's just using BIP32 to create keys deterministically from a seed. It won't reconstruct addresses when restoring a backup - only as much as the keypool will let you. But it won't skip ahead or so (which is also why there is no import support).Pieter Wuille 2016-08-31T13:32:36.113

@PieterWuille: There was a conversation on the Bitcoin-Dev-List about BIP44 which made me curios. BIP44which says the gap limit for BIP32 is currently set to 20. Does Bitcoin Core not implement BIP44?Murch 2016-08-31T15:22:16.817

I've corrected my answer. I hope it's now accurate.Murch 2016-08-31T15:38:42.840

0

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 while Bitcoin Core is not running.

Pieter Wuille

Posted 2016-08-31T10:07:36.803

Reputation: 54 032

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 2016-08-31T10:34:49.163