View Source BitcoinLib.Key.PublicKey.ChildFromIndex (BitcoinLib v0.4.2)

Calculates direct childs from a public key based on a given index

Link to this section Summary

Functions

Calculates a direct child from a public key based on a given index

Link to this section Functions

Link to this function

get(parent_public_key, index)

View Source
@spec get(
  %BitcoinLib.Key.PublicKey{
    chain_code: term(),
    depth: term(),
    fingerprint: term(),
    index: term(),
    key: term(),
    parent_fingerprint: term(),
    uncompressed_key: term()
  },
  integer()
) ::
  {:ok,
   %BitcoinLib.Key.PublicKey{
     chain_code: term(),
     depth: term(),
     fingerprint: term(),
     index: term(),
     key: term(),
     parent_fingerprint: term(),
     uncompressed_key: term()
   }}
  | {:error, binary()}

Calculates a direct child from a public key based on a given index

examples

Examples

iex> %BitcoinLib.Key.PublicKey{
...>   key: <<0x252C616D91A2488C1FD1F0F172E98F7D1F6E51F8F389B2F8D632A8B490D5F6DA9::264>>,
...>   chain_code: <<0x463223AAC10FB13F291A1BC76BC26003D98DA661CB76DF61E750C139826DEA8B::256>>
...> }
...> |> BitcoinLib.Key.PublicKey.ChildFromIndex.get(0)
{
  :ok,
  %BitcoinLib.Key.PublicKey{
    fingerprint: <<0x9680603F::32>>,
    key: <<0x30204D3503024160E8303C0042930EA92A9D671DE9AA139C1867353F6B6664E59::264>>,
    chain_code: <<0x05AAE71D7C080474EFAAB01FA79E96F4C6CFE243237780B0DF4BC36106228E31::256>>,
    depth: 1,
    index: 0,
    parent_fingerprint: <<0x18C1259::32>>
  }
}