Table of contents
Wallets
We use wallets to keep our money, well, in this case not really. In Web3, wallets help us store and manage the keys that give us access to our assets for example cryptocurrency and NFTs. Wallets are the interface that allows us to perform transactions. An example of a wallet that you might have interacted with is Metamask.
In this article, you will learn about how multiple accounts are generated in a single wallet.
Types of wallet
Wallets are mainly divided into three types, based on their private key generation mechanism. They are Non-deterministic, deterministic and hierarchical deterministic wallets.
Non-deterministic: these are wallets that allow us to have just one private key, hence one account, so basically for every non-deterministic wallet that there is, only one account can be linked to it. The keys in this type of wallet are often referred to as “Just a Bunch of Keys” (JBOK) because the keys from different wallets are not related to each other. An example of a non-deterministic wallet is Monero wallet.
Deterministic wallet: these are wallets that can generate as many private keys as we want. Meaning you can create as many accounts that are linked to one wallet. All the private keys generated are from a single master key (mnemonic or seed).
Hierarchical deterministic wallets: HD wallets are also deterministic wallets but their keys are generated in a more structured way, in a tree-like manner, the generated keys are related in the form of a family where there are parents, children, grandchildren, and great-grandchildren and it goes on. Which is useful in cases where you want to group your accounts accordingly. Examples of these are Metamask and Coinbase.
HOW ARE WALLETS CREATED FROM SEEDS
Random sequence numbers (Entropy) are generated cryptographically usually within the range of 128 bits to 256 bits, a checksum is created by dividing the entropy by 32 bits. Let's say we have a 128-bit sequence generated, we divide it by 32 bits to give us our checksum, our checksum is then added to the original sequence.
i.e. (Entropy / 32 bits) + Entropy
(128 bits/ 32bits) + 128 bits = 4 + 128 = 132
The result gotten is divided into 12 parts of 11 bits each. Each of the values generated is mapped to a word from a dictionary of 2048 words to get the mnemonic seed phrase, an example is shown below.
“Free woman tull were charger cry bet example dry set butter bat“
This mnemonic seed phrase, with another parameter (salt - “mnemonic” + an optional passphrase) undergoes 2048 rounds of key stretching function to generate a 512-bit HD wallet seed. An HD wallet is generated from this mnemonic seed, which enables us to generate an unlimited amount of private keys, hence unlimited accounts with their respective public keys that are linked to one wallet.
Conclusion
Wallets are interfaces that help us manage the keys that give us access to our assets that are usually stored on the blockchain. Mnemonics are the source of our account and are very crucial in the process of wallet generation. Wallets are of different types such as non-deterministic, deterministic and hierarchical deterministic wallets.