View Source BitcoinLib.Key.HD.DerivationPath (BitcoinLib v0.1.3)

Can parse derivation paths string format into a native format

m / purpose' / coin_type' / account' / change / address_index

Inspired by

https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki https://learnmeabitcoin.com/technical/derivation-paths

Link to this section Summary

Functions

Transforms a derivation path string into an elixir structure

Link to this section Functions

@spec parse(binary()) ::
  {:ok,
   %BitcoinLib.Key.HD.DerivationPath{
     account: term(),
     address_index: term(),
     change: term(),
     coin_type: term(),
     purpose: term(),
     type: term()
   }}

Transforms a derivation path string into an elixir structure

examples

Examples

iex> "m / 44' / 1' / 2' / 1 / 4" ...> |> BitcoinLib.Key.HD.DerivationPath.parse() { :ok,

%BitcoinLib.Key.HD.DerivationPath{
  type: :private,
  purpose: :bip44,
  coin_type: :bitcoin_testnet,
  account: %BitcoinLib.Key.HD.DerivationPath.Level{hardened?: true, value: 2},
  change: :change_chain,
  address_index: %BitcoinLib.Key.HD.DerivationPath.Level{hardened?: false, value: 4}
}

}