<blockquote>
  <p>How many keys can be generated by a deterministic wallet?</p>
</blockquote>

<p>Effectively infinitely many. The same as a non-deterministic wallet which just keeps generating random private keys. There is a limit, 2^256, but you are never going to reach that. It is effectively infinite.</p>

<blockquote>
  <p>Is it possible to list all keys (public keys, to avoid leaking critical information) in such a wallet?</p>
</blockquote>

<p>It depends. If you are using hardened derivation, then no.</p>

<p>Also, because there are effectively infinitely many addresses, this would be impossible to do. You could reasonably generate enough addresses that you would ever use in your lifetime though.</p>

CC BY-SA 3.0
2017-11-29T07:07:15.253Z
Infinitely many? Surely not, since the whole address space is 2^256. The whole address space? I thought the point of deterministic wallets was that they generate a **subset** of the address space, and that a given deterministic wallet can not collide with another deterministic wallet (they *partition* the address space)
blueFast
CC BY-SA 3.0
2017-11-29T07:11:58.430Z
No, there is no such guarantee that a deterministic wallet will not generate addresses that collide with other deterministic wallets. The collision resistance is the same as with random generation.
Ava Chow
CC BY-SA 3.0
2017-11-29T07:48:11.083Z
Something does not seem right: say I have this shiny deterministic wallet, and I have used a trillion addresses already. Now I lose it but I have properly stored my passphrase, and I am able to regenerate it using another deterministic wallet (say a hardware wallet). How does the new wallet know my balance? Goes through all keys (including the trillion keys I have already used)? If what you say is true ("a deterministic wallet generates the whole address space"), then all deterministic wallets would have the same balance, namely the full bitcoin balance.
blueFast
CC BY-SA 3.0
2017-11-29T08:17:52.683Z
a theoretical approach... infinite in the sense, that you cannot spend enough computing power, to generte the addresses. There is a link where the actual implementation is discussed: https://bitcoin.stackexchange.com/questions/50538/how-does-the-client-know-the-number-of-keys-and-coins-when-recovering-from-a-see, so looks like BIP44 has a 20 address limit. On infinity: another limitation comes from the int64_t specification for the maximum addresses in a wallet - only 2^(64-1)-1 adddresses :-)
pebwindkraft
CC BY-SA 3.0
2017-11-29T15:32:08.197Z
@dangonfast Because there are effectively infinite keys, your wallet cannot generate them all in a reasonable amount of time. The wallet just generates a lot of keys, and those are the keys that you use. When you restore a wallet, it just generates a lot of keys until it sees several that do not have any transactions associated with them. Because of the improbability of collisions, it is safe to assume that the coins it does find belongs to you and it is unlikely to generate private keys that belong to someone else.
Ava Chow
CC BY-SA 3.0
2017-11-29T06:57:26.793Z
2017-11-29T06:57:26.793Z
Ava Chow
<p>Deterministic wallets generate a key space following established standards, using a random passphrase as seed. I have a couple of questions:</p>

<ol>
<li>How many keys can be generated by a deterministic wallet?</li>
<li>Is it possible to list all keys (public keys, to avoid leaking critical information) in such a wallet?</li>
</ol>

<public-key><deterministic-wallets><keypool>
How to list all addresses in a deterministic wallet?
blueFast
# How to list all addresses in a deterministic wallet?

(Asked by: username_0 on 2017-11-29)

Deterministic wallets generate a key space following established standards, using a random passphrase as seed. I have a couple of questions:

1. How many keys can be generated by a deterministic wallet?
2. Is it possible to list all keys (public keys, to avoid leaking critical information) in such a wallet?

**Tags:** public-key, deterministic-wallets, keypool


---

## 1 answers

### Answer by username_1 on 2017-11-29. Score: 2

> How many keys can be generated by a deterministic wallet?

Effectively infinitely many. The same as a non-deterministic wallet which just keeps generating random private keys. There is a limit, 2^256, but you are never going to reach that. It is effectively infinite.

> Is it possible to list all keys (public keys, to avoid leaking critical information) in such a wallet?

It depends. If you are using hardened derivation, then no.

Also, because there are effectively infinitely many addresses, this would be impossible to do. You could reasonably generate enough addresses that you would ever use in your lifetime though.

> **Comments:**
> **username_0**: Infinitely many? Surely not, since the whole address space is 2^256. The whole address space? I thought the point of deterministic wallets was that they generate a **subset** of the address space, and that a given deterministic wallet can not collide with another deterministic wallet (they *partition* the address space)  
> **username_1**: No, there is no such guarantee that a deterministic wallet will not generate addresses that collide with other deterministic wallets. The collision resistance is the same as with random generation.  
> **username_0**: Something does not seem right: say I have this shiny deterministic wallet, and I have used a trillion addresses already. Now I lose it but I have properly stored my passphrase, and I am able to regenerate it using another deterministic wallet (say a hardware wallet). How does the new wallet know my balance? Goes through all keys (including the trillion keys I have already used)? If what you say is true ("a deterministic wallet generates the whole address space"), then all deterministic wallets would have the same balance, namely the full bitcoin balance.  
> **username_2**: a theoretical approach... infinite in the sense, that you cannot spend enough computing power, to generte the addresses. There is a link where the actual implementation is discussed: https://bitcoin.stackexchange.com/questions/50538/how-does-the-client-know-the-number-of-keys-and-coins-when-recovering-from-a-see, so looks like BIP44 has a 20 address limit. On infinity: another limitation comes from the int64_t specification for the maximum addresses in a wallet - only 2^(64-1)-1 adddresses :-)  
> **username_1**: @dangonfast Because there are effectively infinite keys, your wallet cannot generate them all in a reasonable amount of time. The wallet just generates a lot of keys, and those are the keys that you use. When you restore a wallet, it just generates a lot of keys until it sees several that do not have any transactions associated with them. Because of the improbability of collisions, it is safe to assume that the coins it does find belongs to you and it is unlikely to generate private keys that belong to someone else.  

---

