Derivation Paths & My Solflare Wallet
Digital wallets introduce many new concepts, such as public & private keys, Keystore files, mnemonics, and self-custody. It can be intimidating to newcomers who only hear about the risks of losing access to these wallets or sending funds to the wrong address.
While those risks are real, the benefits of non-custodial digital wallets like Solflare greatly outweigh them. For a refresher on how Non-custodial wallets benefit society, check out this article. One of the essential features of the Solflare wallet is its derivation path structure.
Derivation paths enable users to generate and access as many accounts as they wish, all while using a single mnemonic phrase. To explain how this works, let’s review how you can access a non-custodial wallet.
Ways to Access Non-Custodial Wallets
There are three main ways to access your non-custodial wallet:
· Private key
· Keystore file (a password-protected private key)
· Mnemonic phrase (a sequence of words that can access multiple private keys)
Besides having different security features, there is a primary distinction between these ways to access a wallet. A Private key or a Keystore file only generates one account. Creating a mnemonic phrase, however, grants you access to many accounts, all of which may be accessed using the same phrase.
What Is a Mnemonic Phrase?
A Mnemonic Phrase, also known as a seed phrase or personal recovery phrase, is a variation of a private key and works slightly similarly. A seed phrase is composed of words that usually vary from 12 to 24 words, each separated by a space. Mnemonic Phrases more or less look like this:
magician crumble practice give trust close laugher whole path late fire least
These phrases may be used to generate a theoretically limitless number of accounts. Mnemonic Phrases are often used with hardware wallets and should be written down by the user on paper to safely back up their digital assets, as wallets cannot be recovered without them.
How Does a Mnemonic Phrase Create More than One Address?
A mnemonic phrase produces addresses by combining its sequence of words with a piece of information known as a derivation path. Together, they generate an unlimited number of accounts using cryptography. But what is a derivation path anyway?
- A derivation path looks like this: m/44’/501’/0’/0’/0
- This formula equates to the following:
- m’ / purpose’ / coin_type’ / account’ / change / address_index
Each number in the sequence has a role to perform, and each one alters the private key, public key, and address. This means that in this sequence, each section is separated by a / and has a different meaning that changes based on what you’re working with.
This quickly becomes complex, but the key takeaway is that if you want the next address from a phrase, add one to the previous address_index number:
Address #1: m/44’/501’/0’/0’/0
Address #2: m/44’/501’/0’/0’/1
Address #3: m/44’/501’/0’/0’/2
….
Address #99: m/44’/501’/0’/0’/98
In programming, you begin counting at 0…1…2…3… rather than 1…2….3….
This derivation path structure results in one mnemonic phrase giving you access to as many accounts as you wish to have. Using the derivation path, you can obtain all your accounts from a single mnemonic phrase.
The Bottom Line
With Solflare, you don’t necessarily need to understand how the derivation paths work; you need to know how to use the wallet interface. For the user, this will consist of clicking on Add a new account and following a few simple prompts. The numbers and the anatomy of these derivation paths will still be visible if you are interested in looking into them in more detail.
Although you don’t need to know everything that happens on the backend of your Solflare wallet, it is interesting to see the structure to understand how a single mnemonic phrase allows you to have more than one wallet.