Skip to main content

Derivation paths & accounts

A derivation path specifies how addresses and keys are generated from a seed or mnemonic phrase. This allows you to manage multiple addresses (or "accounts") under the same wallet, across every supported chain.

For example, Ethereum commonly uses m/44'/60'/0'/0/0 for the first address. If you want the second address, you'd use m/44'/60'/0'/0/1, and so on.

Wallet type required

Multiple address derivation is relevant only for HD wallets (phrase, seed, xpriv, or xpub). If your wallet is from a private key or public key, you cannot derive multiple addresses — only index 0 is valid.

What is a derivation path?​

A derivation path is instructions telling your wallet how to "walk" through a hierarchical key tree. Each segment corresponds to a level of derivation. By changing the final index, you can create new addresses — all from the same root seed.

For example, a Bitcoin wallet using the BIP84 standard (native SegWit) might use:

m/84'/0'/0'/0/0
  • 84' — BIP84 (native SegWit / bech32)
  • 0' — Bitcoin coin type (SLIP-44)
  • 0' — First account
  • 0 — External chain (receiving addresses)
  • 0 — First receiving address

By incrementing the final index (m/84'/0'/0'/0/1, m/84'/0'/0'/0/2, etc.), the wallet deterministically generates new SegWit addresses — all from the same seed.

Using the index option​

In ChainGate v2, you derive different addresses using the index option on the connector:

import { importWallet, ChainGate } from 'chaingate'

const wallet = importWallet({ phrase: 'some bip39 phrase ...' })
const cg = new ChainGate()

const bitcoin = cg.connect(cg.networks.bitcoin, wallet)

// Default address (index 0)
const address0 = await bitcoin.address()
console.log('Address #0:', address0)

// Second address (index 1)
const address1 = await bitcoin.address({ index: 1 })
console.log('Address #1:', address1)

// Third address (index 2)
const address2 = await bitcoin.address({ index: 2 })
console.log('Address #2:', address2)

The index is appended to the network's default derivation path. For Bitcoin segwit, { index: 0 } resolves to m/84'/0'/0'/0/0, { index: 1 } to m/84'/0'/0'/0/1, etc.

UTXO address types​

For UTXO networks, you can also choose the address type, which selects a different derivation path:

// Segwit address (default for Bitcoin)
const segwitAddr = await bitcoin.address({ addressType: 'segwit' })

// Taproot address
const taprootAddr = await bitcoin.address({ addressType: 'taproot' })

// Legacy address
const legacyAddr = await bitcoin.address({ addressType: 'legacy' })

// Combine address type and index
const taproot3 = await bitcoin.address({ addressType: 'taproot', index: 3 })

Available address types per network​

NetworkAvailable typesDefault
Bitcoinsegwit, taproot, legacysegwit
Litecoinsegwit, taproot, legacysegwit
Dogecoinlegacylegacy
Bitcoin Cashcashaddr, legacycashaddr
Bitcoin Testnetsegwit, taproot, legacysegwit
Ethereumeoaeoa

Custom derivation paths​

You can override the derivation path entirely:

const address = await bitcoin.address({
derivationPath: "m/44'/0'/0'/0",
index: 5
})
// Resolves to m/44'/0'/0'/0/5

Operations at a specific index​

All connector methods support the same options, so you can check balances, transfer, and view history at any index:

// Balance at index 2
const { confirmed } = await bitcoin.addressBalance({ index: 2 })

// Transfer from index 1
const amount = cg.networks.bitcoin.amount('0.001')
const tx = await bitcoin.transfer(amount, 'bc1q...', { index: 1 })

// History at index 3
const history = await bitcoin.addressHistory(undefined, { index: 3 })

Why use different paths?​

  • Multiple addresses: Assign different addresses for receiving payments, accounting separation, or organizational purposes.
  • Privacy: Using a fresh address for each transaction improves privacy on UTXO networks.
  • Multi-account support: Some protocols or dApps expect multiple derivation paths for advanced features.

Key points​

  • HD wallets only: Phrase, seed, xpriv, and xpub wallets support multiple derivation indices.
  • Simple API: Use { index } to derive addresses — no manual path construction needed.
  • Address types: UTXO networks support segwit, taproot, legacy (and cashaddr for Bitcoin Cash).
  • Consistent: All connector methods (address(), addressBalance(), transfer(), addressHistory()) accept the same options.
  • Default paths: ChainGate uses each network's standard derivation path (e.g., m/84'/0'/0'/0 for Bitcoin segwit, m/44'/60'/0'/0 for Ethereum).
  • Private/public key wallets: Only index 0 is valid since there's a single key.