La phrase seed or seed phrase, makes mention of a set of between 12 to 24 words, which are intended to offer us an easy and simple way to support our cryptocurrency wallet. In this way, if for any reason we lose control over it, we could recover it just by using these words in the order that we were originally given.
That is, in case of breakdowns, thefts or losses of the smartphone or the computer, we can use the seed phrase and retrieve our wallet from another device. All this while we access the addresses associated with our wallet and with it, the funds available in it. Thus, the phrases seeds are kind of coding of private keys of our wallet, but in a much more friendly and manageable way.
Generally we can see this phrase when we first configure a wallet in which we manage private keys and that follows the standard defined by the Bitcoin Improvement Proposal (BIP) BIP-39. These words are commonly displayed by the wallet in English, although some wallets deliver words in other languages, making the task easier. On the other hand, these words do not seem to have any special relationship to each other or a meaning, but the truth is that, cryptographically, and having a specific order, it does. So let's learn more about this practical property and learn how it works.
How does the seed phrase or seed phrase work?
The seed phrase (seed phrase in English) has a fairly simple operation that we can divide into a series of phases or moment. Thus, the mechanism would function as follows:
First, the wallet developer implements the seed phrase functionality following the BIP-39 standard or some derivative of it. BIP-39, is focused on offering us a method of generating private keys using a series of mnemonic words that help support our wallet and at the same time ensure the construction of secure private and public keys.
The BIP-39 takes words at random (generally from the English language, although they can be from another language) and create a long sentence with them (generally between 12 to 24 words). Here the greater the number of words, the greater the entropy and security attributable to the resulting sentence.
Of course, these words are chosen from long dictionaries, with good entropy (randomness), so that the best possible security is guaranteed.
Once the wallet algorithms have created this series of words according to the user's selection or internal configuration, the user is asked to save them in the same order in which they were given. This point is important, because otherwise, the purse cannot be rebuilt in case we need it. In addition, the purse will then ask us to enter these words in the same order. This in order to verify them.
At this point the generation stage of the private key of our wallet is activated. This process is possible thanks to the use of a cryptographic function named PBKDF2. This function is a cryptographic standard for the derivation of secure keys to brute force attacks. An important point, bearing in mind that being “human” words, it is feasible that an attack of this type can obtain the phrase and with it our private key.
This PBKDF2 function is fed by the entire seed phrase or complete seed phrase of the wallet. That will be our source of entropy or "disorder" in the key derivation process.
Additionally, a number of 2048 iterations is established in the generation process. With each iteration, PBKDF2 generates a different key, and the process ends with performing the 2048 scheduled iterations. Along with this function the function is also used HMAC-SHA512 like the pseudorandom function. All this results in a key with a length of 512 bits or 64 bytes.
This final key is known as a binary phrase or binary seed. And it is the one that will finally be used to generate private keys, or even HD purse (deterministic using BIP-0032). In short, our seed or binary seed is the one that will ultimately allow us to generate our private key, hence the public key and hence the address.
BIP-00032 is a standard. That is, if we use the same words in different wallets that support BIP-0032, and are from the same cryptocurrency, we will always get the same binary seed, and from there we can derive the private key and the rest of the public keys that belong to us.