# Are keys generated deterministically?

**URL:** <https://forum.zcashcommunity.com/t/are-keys-generated-deterministically/645>\
**Category:** General\
**Created:** [May 24, 2016, 8:05am UTC](https://forum.zcashcommunity.com/t/are-keys-generated-deterministically/645 "2016-05-24T08:05:48Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Austin-Williams](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Austin-Williams](https://forum.zcashcommunity.com/u/Austin-Williams)\
**Post date:** [May 24, 2016, 8:05am UTC](https://forum.zcashcommunity.com/t/are-keys-generated-deterministically/645/1 "2016-05-24T08:05:48Z")

</div>

…or does the wallet “roll dice” each time to create a new address?

In other words, does the current client implement HD wallets?

Thank you.

---

<div class="post-metadata">

**Author:** ![hud](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@hud](https://forum.zcashcommunity.com/u/hud)\
**Post date:** [May 24, 2016, 1:16pm UTC](https://forum.zcashcommunity.com/t/are-keys-generated-deterministically/645/2 "2016-05-24T13:16:56Z")

</div>

Current Zcash implementation is based on Bitcoin Core 0.11.2 which means no HD wallet.

---

<div class="post-metadata">

**Author:** ![Austin-Williams](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Austin-Williams](https://forum.zcashcommunity.com/u/Austin-Williams)\
**Post date:** [May 24, 2016, 11:06pm UTC](https://forum.zcashcommunity.com/t/are-keys-generated-deterministically/645/3 "2016-05-24T23:06:12Z")

</div>

That is _really_ weird then.

I installed zcash on a server. Took an image of the server. Then copied that image over to three other servers.

Then I told each of the three new servers (along with the original one) to generate 5 new addresses each. Each machine generated exactly the same 5 new addresses in exactly the same order.

---

<div class="post-metadata">

**Author:** ![bitcartel](https://sea2.discourse-cdn.com/zcash/user_avatar/forum.zcashcommunity.com/bitcartel/32/8558_2.png) [@bitcartel](https://forum.zcashcommunity.com/u/bitcartel)\
**Post date:** [May 25, 2016, 6:53am UTC](https://forum.zcashcommunity.com/t/are-keys-generated-deterministically/645/4 "2016-05-25T06:53:42Z")

</div>

This behaviour is inherited from Bitcoin. On the first launch of bitcoind/zcashd, a keypool is filled with keys. If you took an image of the main server after you had launched zcashd, this would explain why the other three servers are retrieving the same addresses from the keypool.

---

<div class="post-metadata">

**Author:** ![Austin-Williams](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Austin-Williams](https://forum.zcashcommunity.com/u/Austin-Williams)\
**Post date:** [May 25, 2016, 9:07pm UTC](https://forum.zcashcommunity.com/t/are-keys-generated-deterministically/645/5 "2016-05-25T21:07:19Z")

</div>

Okay, that makes sense. So then if I kept creating new addresses on each of the servers, I would expect to see each server generating different addresses _after_ the initial keypool were exhausted.

---

<div class="post-metadata">

**Author:** ![hud](https://avatars.discourse-cdn.com/v4/letter/h/ce73a5/32.png) [@hud](https://forum.zcashcommunity.com/u/hud)\
**Post date:** [May 26, 2016, 3:55pm UTC](https://forum.zcashcommunity.com/t/are-keys-generated-deterministically/645/6 "2016-05-26T15:55:45Z")

</div>

You shouldn’t run same wallet.dat in multiple computers, especially for incoming transactions. Gavin suggested that it might lead to problems:

> **[Multiple instance of bitcoin with the same wallet](https://bitcointalk.org/index.php?topic=5324.0)**
>
> Multiple instance of bitcoin with the same wallet

Bitcoin Core is bad wallet, because it is actually a node software.

---

<div class="post-metadata">

**Author:** ![Austin-Williams](https://avatars.discourse-cdn.com/v4/letter/a/ecd19e/32.png) [@Austin-Williams](https://forum.zcashcommunity.com/u/Austin-Williams)\
**Post date:** [June 15, 2016, 4:16pm UTC](https://forum.zcashcommunity.com/t/are-keys-generated-deterministically/645/7 "2016-06-15T16:16:13Z")

</div>

Yeah, that’s the “divergin keypool” issue.  
However, I think a recent merge solves these problems. It seems core has finally implemented HD wallets 🙂

[[Wallet] Add simplest BIP32/deterministic key generation implementation by jonasschnelli · Pull Request #8035 · bitcoin/bitcoin · GitHub](https://github.com/bitcoin/bitcoin/pull/8035)
