Derivation paths
In the crypto ecosystem, a derivation path is a way to generate multiple unique addresses from a single root seed phrase. This is achieved using a standardized mathematical algorithm called Hierarchical Deterministic Wallets (HD Wallets).
The purpose of a derivation path is to create a hierarchical structure of addresses that can be used to receive and send transactions. Each level of the hierarchy is determined by a particular derivation index, which is used to generate a unique private key and public key pair.
The most common derivation path used in Ethereum is known as the BIP32/BIP39 standard. BIP32 describes the hierarchical structure of the wallet, while BIP39 describes the seed phrase generation and recovery process.
To generate a new address, a user starts with a root seed phrase. This seed phrase is typically a list of 12, 18, or 24 words chosen from a predefined list of words. The seed phrase is then converted into a binary sequence, which is used as the initial input for the BIP32 algorithm.
Here is a sample word list, called a mnemonic:
daughter welcome giant suspect curious tomato
meadow suffer correct subject manage smoke
The BIP32 derivation path consists of a series of hardened and non-hardened derivation indexes. A hardened derivation index is used to derive a new private key, while a non-hardened derivation index is used to derive a new public key.
Each level of the hierarchy corresponds to a specific index in the derivation path. For example, the first level of the hierarchy is typically represented by the index “m/0’”, where the apostrophe denotes a hardened derivation. The second level might be represented by the index “m/0’/0”, which is a non-hardened derivation.
Using this method, a user can generate an almost unlimited number of unique addresses from a single root seed phrase. This is useful for maintaining privacy, as well as for managing large numbers of transactions across multiple addresses.
Derivation paths are also used to generate smart contract addresses in Ethereum. In this case, a special derivation path known as the BIP44 path is used. This path is similar to the BIP32 path, but it includes additional indexes for different types of Ethereum accounts, such as regular accounts and smart contract accounts.
Practical Examples
Let’s use the following mnemonic and generate a handful of addresses using different derivation paths. The following uses the menmonic above.
Generating Ethereum Addresses
In Metamask, or in a wallet that will that is on the Ethereum network, it will use the key 60.
Path | Address |
---|---|
m/44’/60’/0’/0/0 | 0x4c08356Fe17fb42B801fC0E405B14dCc9B321288 |
m/44’/60’/0’/0/1 | 0x234EE14A557893A978ED86D22A6a94c95f1f309B |
m/44’/60’/0’/0/2 | 0x3Cde56104802C273119FAE72D50D5C645bDe6638 |
Notice the incrementing number at the end, in your wallet, when you click ‘add wallet’, this increments and you get a new address! One mnemonic can create thousands of addresses!
Generating RSK Addresses
Different networks use a different derivation paths to create different addresses on the same network. This is a privacy feature because if you know my address on Rootstock, you shouldn’t be able to see my assets on Ethereum. Speaking of Rootstock, it uses 131 as its key.
Path | Address |
---|---|
m/44’/137’/0’/0/0 | 0xFFA668274f58841E8bcE83e217bc675cF1457151 |
m/44’/137’/0’/0/1 | 0x88886DFe92Ab448A18d0FfdC83CA0912b5Cc5D78 |
m/44’/137’/0’/0/2 | 0xd68901F11f8bf3346d66f816A879b1eCd651989a |
Generate Bitcoin Addresses
You can even use the same mnemonic on a non-EVM chain to create addresses. Here is Bitcoin, which uses the key of 0:
Path | Address |
---|---|
m/44’/0’/0’/0/0 | 1PHWtCN9dHCDdwB4BCBUb6R2wkHVc3FM8B |
m/44’/0’/0’/0/1 | 15W7E33tzqa5NqZt35DHYqSu7XekHuV9wq |
m/44’/0’/0’/0/2 | 14uRTd6YWdVnmDqSUKR4QRqBnxzmBu5RU3 |
In conclusion, a derivation path is a crucial component of the crypto ecosystem, allowing users to generate multiple unique addresses from a single root seed phrase. This method helps to maintain privacy and security while managing large numbers of transactions across multiple accounts. Understanding how derivation paths work is essential for anyone looking to use Ethereum for transactions or smart contracts.
If you want to learn about the capitalization of addresses, see Checksums are for Humans