Easily Support Custom Derivation Paths for Ledger and Trezor Wallets
While you can hold every private key in the palm on your hand, there are a staggering number of possible wallet addresses that can be generated from a seed phrase. And advanced users may take advantage of these possibilities by using custom derivation paths on their hardware wallets to select new addresses.
The ability to choose a custom derivation path is popular among developers (who need to access test nets) and whales (who have many accounts that they use to secure funds). And support for hardware wallets and custom derivation paths is a commonly requested feature for leading applications.
Having a native hardware wallet integration was the most requested feature for the
Gnosis Safe multisig. Thanks to Blocknative, we were able to deliver an easy and trusted way to use a Ledger or Trezor device with a multisig using Onboard.js.
— Lukas Schor, Product Manager For Gnosis Safe
The latest release of Onboard.js enhances our hardware support module, adding the ability to choose from common derivation paths or enter a custom derivation path. Read on to learn about what custom derivation paths are and why supporting them matters.
What are Hierarchical Deterministic Wallet?
Hierarchical Deterministic (HD) wallets have the ability to derive many different addresses from a single seed phrase (based on BIP 32). This lets a user generate new key pairs and addresses without having to back up a private key.
A Diagram Of HD Keys From Web Of Trust
With a HD wallet, you only need to back up the seed phrase. And with that phrase, you can generate many different wallet addresses.
What are Derivation Paths?
The derivation path refers to all of the possible key pairs that can be generated from the seed phrase. In the diagram above, you can see that there are many branches in which an address can be generated.
Let's look at a typical derivation path: m/44'/1'/0'/0'/0. Each one of those numbers impacts the public/private key and address. To dig deeper into the technical aspects, read this post.
When connecting to a hardware wallet, users are given the choice of which derivation path to use. Usually, people will connect with the default path, since each branch leads to a different set of addresses. However, advanced users may use a different path. And the latest release of Onboard.js improves upon our hardware wallet support to add a new module that allows users to select a derivation path from a list of common paths or input their own custom path to access accounts on their hardware wallets:
With just a few lines of code, you can easily add support for custom derivation paths for Ledger and Trezor.
Easily Support Hardware Wallets and Custom Derivation Paths
To help developers can quickly support hardware wallets, we've filmed a quick start video for Onboard.js:
Once installed, users will be able to select either Ledger, Trezor, or Lattice as a wallet. When a user selects that, Onboard.js will display a wallet check module that directs users to:
- plug in their hardware wallet
- unlock it via the pin code
- have the Ethereum app open on their device (Ledger)
- select a standard or custom derivation path
- wait while Onboard.js loads their accounts
- select their account