Navigating Derivation Paths in Tangem Wallet

When importing a seed phrase from a third-party wallet that supports multi-accounts, i.e., wallets that create new addresses for a coin after each transaction, you'll see only the balance of the first address — whose balance might be 0.

To fix this issue, you must create a custom token with the same path derivation of the wallet from which the seed phrase is imported.

 

What is a derivation path?

Path derivation refers to generating a specific address or public key from a master seed or root key. This is done by applying a derivation path, a sequence of numbers, and slashes (/) that specify the hierarchy of keys.

The derivation path creates a tree-like structure, each level representing a new key pair. The path defines the specific branch to follow for the desired key pair. 

This allows for generating multiple addresses and keys from a single master seed, making managing and organizing addresses for different purposes or accounts easier.

For example, the derivation path "m/44'/0'/0" would generate a specific address by starting from the master seed (m), then deriving a key pair at level 44' (a hardened key), then at level 0' (another hardened key), and finally at level 0 (a non-hardened key).

The typical structure of a derivation path is as follows:

m/purpose'/coin_type'/account'/change/address_index
  • m: represents the master key (or root key)
     
  • Purpose: This field, added through BIP43, indicates the derivation path's standard. It could include 0 or 44 referring to the default BIP44 P2PKH / ‘1’ legacy addresses, 45 referring to BIP45 P2SH multi-party multi-signature wallets (proposed), 47 referring to BIP47 reusable payment codes (draft), 48 referring to hardware multisig wallets (no BIP or standard proposal), 49 referring to BIP49 P2WPKH-nested-in-P2SH / ‘3’ SegWit addresses, or 84 referring to BIP84 P2WPKH / ‘bc1’ native SegWit addresses. 

Tangem Wallet supports only Legacy BIP44 (P2PKH) and SegWit BIP84, (P2WPKH).

  • Coin type: This field indicates which cryptocurrency is being used in a multi-currency wallet. All coins, including testnet bitcoin, are assigned a constant number. For example, a derivation path for a Hedera (HBAR) account would be m/44'/3030'. BIP45 would designate this level as the ‘Cosigner Index’ instead.
     
  • Account: This field, in a multi-account wallet, indicates the identity or collection of addresses, which allows users to segregate funds for different things (ex., savings, donations). Note that BIP45 would not include this field. BIP47 would designate this level as ‘Identity’, though it is equivalent to ‘Account.’
     
  • Change: This field, if the constant 0 is present, indicates “external chain” (regular) addresses; if the constant 1, indicates “internal chain” or change addresses. Note: BIP47 would designate this level for the notification keys and ephemeral payment codes.
     
  • Address Index: This field indicates the specific address number within an account in a sequence.

 

‘Account’ and ‘Address Index’ start with zero (0). This is because they use zero-based numbering, just as the “ground floor” of European buildings is considered level zero, rather than the first floor/level one in the United States.

For example, if you have a BIP44-compliant Bitcoin wallet and want to find the second change address in your third account. The derivation path for the second change address in the third account would look like this: m/44'/0'/2'/1/1.

 

Here's a formatted table for Bitcoin paths based on the information provided:

Format

Derivation Path

Starts with

Note

Legacy (P2WSH)

m/44'/0'/0'/0/*

"1"

Compatible with all Bitcoin wallets and exchanges.

Nested Segwit (P2SH-P2WSH)

m/49'/0'/0'/0/*

"3"

Improved security and lower transaction fees compared to Legacy addresses.

Native Segwit (P2WSH)

m/84'/0'/0'/0/*

"bc1"

The most efficient and secure Bitcoin address format offers cost savings and improved security.

Taproot (P2TR)m/86'/0'/0'/*"bc1p"Use of Schnorr Signatures, which offers better security, lower fees, and more flexible multi-key transactions

 

Which blockchains require a specified derivation path?

Some blockchains generate a new address for every incoming transaction using the UTXO(Unspent Transaction Output) protocol. A UTXO is the amount of cryptocurrency left over after a cryptocurrency transaction. The UTXO model allows users to track ownership of all portions of cryptocurrency. To discover their derivation path, you will need to find the XPUB key for the blockchain to import all transactions automatically.

Examples of blockchains using the UTXO model:

  • Bitcoin
  • Bitcoin Cash
  • BitcoinGold
  • Dash
  • DigiByte
  • Dogecoin
  • Dash
  • Kaspa
  • Litecoin

Your xpub key varies for each blockchain, so you'll have to export it separately for each asset you want to export
 

How to import a wallet with path derivation

So you've imported your wallet with a seed phrase, but some tokens are missing or have zero balances. The issue might be that these token addresses have a different derivation path, which is not supported in Tangem. Here's what to do using Bitcoin as an example.

 

1. Discover the derivation path from the source wallet
 

Most crypto wallets provide the derivation path of token addresses in their XPUB files. You can find your wallet's XPUB file in the wallet settings or look for documentation or guides provided by the wallet developer or manufacturer. They may have a section on derivation paths or key management.

Here are examples of how to find your xpub key based on your wallet.

Trezor:

Trezor Suite derivation path.webp
  • Connect your Trezor wallet and open the Trezor Suite desktop app or web app.
  • Select the desired account from the sidebar menu.
  • Select the Details tab, and copy the derivation key m/84'/0'/0.

 

Ledger:

xpub ledgeer.png
  • Open the account for which you want to retrieve the xpub.
  • Click on the wrench icon.
  • In the Edit Account window, expand the Advanced Logs section.
  • Find and copy the fresh Address Path, which looks like this: "44'/0'/0'/0'/1.
     

Kaspa

  • KDX/Kaspanet Web Wallet uses the m/44'/972'/0' derivation path with 12-word seed phrases.
  • The Core Golang CLI wallet and Kaspium use the m/44'/111111'/0' derivation path with 24-word seed phrases. 
    Note: 972 and 111111 are different coin types.

KDX wallets are not BIP-32 compatible, so your tokens will not appear automatically in the tangem wallet because the KDX derivation path is considered deprecated. You can make these tokens appear using the steps outlined below.

How to get a derivation path using the xpub

To get a derivation path using your xpub (Extended Public Key), you can use a blockchain explorer

Here's a step-by-step guide:

  1. Go to https://bitcoinexplorer.org/
  2. Enter your xpub in the "search" field.
  3. Copy the BIP32 PATH shown.

2. Create custom tokens in Tangem Wallet

Now, you must create a custom token with the derivation path from the source wallet. Here's how to do that:

  1. Open your Tangem Wallet and tap Manage tokens.
  2. Then press the icon in the upper right corner. 

    photo_2023-12-12_10-49-01.jpg
  3.  A menu for adding a custom token appears.

    How to add tokens to Tangem App_11.jpg
  4. Select the network, e.g., Bitcoin.

    Navigating Derivation Paths in Tangem Wallet

     

  5. Tap BIP44 coin type and select Custom derivation.

    Navigating Derivation Paths in Tangem Wallet_3.jpg
  6. Enter the derivation path from your source wallet, e.g., m/84'/0'/0. When entering the derivation path, it's important to start with m/ or else the Tangem Wallet cannot validate the token.

    Navigating Derivation Paths in Tangem Wallet_1.jpg
  7. Enter your access code or biometric ID and scan your Tangem card to authorize these changes.

The derived token will appear on your tangem app's homepage with its correct balance.

 

Hey there!

We have a vibrant English-speaking community on Telegram and Discord. We think you would fit right in and would love it if you joined us.