View Source BitcoinLib.Key.HD.ExtendedPublic.ChildFromDerivationPath (BitcoinLib v0.1.3)

Computes a public key from a derivation path

Link to this section Summary

Functions

Computes a public key from a derivation path

Link to this section Functions

Link to this function

get(public_key, derivation_path)

View Source
@spec get(
  %BitcoinLib.Key.HD.ExtendedPublic{
    chain_code: term(),
    depth: term(),
    fingerprint: term(),
    index: term(),
    key: term(),
    parent_fingerprint: term()
  },
  %BitcoinLib.Key.HD.DerivationPath{
    account: term(),
    address_index: term(),
    change: term(),
    coin_type: term(),
    purpose: term(),
    type: term()
  }
) ::
  {:ok,
   %BitcoinLib.Key.HD.ExtendedPublic{
     chain_code: term(),
     depth: term(),
     fingerprint: term(),
     index: term(),
     key: term(),
     parent_fingerprint: term()
   }}

Computes a public key from a derivation path

examples

Examples

iex> { :ok, derivation_path } = BitcoinLib.Key.HD.DerivationPath.parse("M/84'/0'/0'/0/0") ...> %BitcoinLib.Key.HD.ExtendedPublic{ ...> key: 0x252C616D91A2488C1FD1F0F172E98F7D1F6E51F8F389B2F8D632A8B490D5F6DA9, ...> chain_code: 0x463223AAC10FB13F291A1BC76BC26003D98DA661CB76DF61E750C139826DEA8B ...> } ...> |> BitcoinLib.Key.HD.ExtendedPublic.ChildFromDerivationPath.get(derivation_path) {

:ok,
%BitcoinLib.Key.HD.ExtendedPublic{
  key: 0x3D8E202D3D91B13E955D79BA88EADD709B98640D9633868C6274B9ACEED0F70EF,
  chain_code: 0x3159D0A560A856F5894C15EB0D657A74218B4979D8C6D76F8E78A42C83D22DA8,
  depth: 5,
  index: 0,
  parent_fingerprint: 0x3E4142F6,
  fingerprint: 0xD0D8EFE4
}

}