Blockchain Foundations Part 8: Seed (Random Seed) and HD Wallet
This article is about seeds. A seed can help you organizing the great number of public/privat key pairs you may need.
The article is part of a series starting with this article: Blockchain Foundations Part 1: Distributed, Decentralized and Centralized Computer Architecture
The articles are drawn from my book "Blockchain and Crypto Currencies Easy to Understand for Everyone, Thomas Bauer". Please refer to the part 1 article for a introduction to the blockchain foundations series.
Seed
When using crypto currencies, then we quickly need to deal with a growing number of public/private key pairs. With a seed (random seed) we can avoid remembering all the used key pairs.
A seed is a character string, for example:
"a90dcxvuw34df74cxl246o345qweratwemzesdfseszdfw332843sfmsacx"
Nobody can keep in mind such a character string. Hence we use a mnemonic like:
"dog cat elephant first ape third Jim horse salamander ninth mouse rat"
From such a mnemonic we derive a seed. For example, by calculating a hash value from this character string.
Now we have a seed. We use this seed and an additional number, let's take "1", as base number when creating a key pair. Another key pair we create bases on the seed and the number "2". And so on. This way we could, for example, create 100 key pairs. We do not need to remember the created key pairs. Neither the public nor the private keys. Both we can recreate from the seed and the numbers 1 to 100. And the seed we can derive from the mnemonic. We only need to remember the mnemonic.
Instead of simply incrementing a number in practice some more complicate algorithm are used. For example, we could derive some number or string from the aimed intended use of the key pair. This result and the seed and maybe again incrementing numbers lead to our key pairs. Sometime this procedure is called a derivation path.
The application of a seed is described in the next chapter.
HD Wallet
A HD wallet (hierarchical deterministic wallet) is not really a wallet but a technique to be used together with one of the different forms of wallets. With a HD wallet we can create key pairs based on a seed phrase. These key pairs we then use to receive cryptocurrency.
Example: If we want to receive Bitcoins using the Bitcoin Core wallet we must create a new pair of public address and private key each time. The public address we tell the sender of the Bitcoins. We should make a backup of the private key instantly. We also could generate 100 pairs of public addresses and private keys at once. These we could use sequentially. Then we only need to make a backup of the keys after generating the 100 keys. But we still have to backup every used key.
With a HD wallet this is easier. A HD wallet generates the keys for us. And we do not need to memorize or note all private keys. We only need to memorize a seed phrase. From this seed phrase the HD wallet generates the private keys. The needed private keys we can import in our wallet.
A HD wallet usually is a hardware wallet.