How can a single little "seed phrase" can restore for example all my 15,845 addresses? ?
Wow
A private key is nothing more than a very big number. It can be represented in various formats, but by the time the wallet is using it, it is nothing more than a very big number.
That being said, the "Seed phrase" is nothing more than a way to encode a number (a very big number) using words instead of digits.
The actual HD processes is a bit (but not much) more complicated than this, but here's an example of how a seed phrase can restore 15,845 private keys.
Imagine that you pick a very big number and convert it to a seed phrase.
- Now imagine that you add 1 to that very big number and use the result as a private key (you calculate the public key from it, and then the address from that).
- Now imagine that you add 2 to that very big number and use the result as a private key (you calculate the public key from it, and then the address from that).
- Now imagine that you add 3 to that very big number and use the result as a private key (you calculate the public key from it, and then the address from that).
- Now imagine that you add 4 to that very big number and use the result as a private key (you calculate the public key from it, and then the address from that).
- Now imagine that you add 5 to that very big number and use the result as a private key (you calculate the public key from it, and then the address from that).
- ...
- Now imagine that you keep doing this 15,845 times (each time you calculate the public key, and then the address from the resulting private key).
When you are done, you have 15,845 different private keys that each have their own public key and address.
As long as nobody knows your seed phrase, they are not able to find your starting point, and are therefore NOT able to generate your sequence of 15,845 private keys.
As long as you DO know your seed phrase, you can figure out your starting point, and therefore ARE able to generate your sequence of 15,845 private keys.
Please note, this is NOT exactly how HD wallets work. It is just a simplified example of how a single seed phrase could "restore for example all your 15,845 addresses".
If I'm not mistaken, the seed is used to produce a master private key (from this, a master public key can also be generated).
This master private key is then able to produce your addresses (however, in a HD wallet such as Bitcoin Core it may take different disguises and may not be something easily traceable) .
So it what you said, but these are deterministic so you reproduce the private keys in the same order as they were originally produced in.