View Source BitcoinLib.Key.PrivateKey.ChildFromIndex (BitcoinLib v0.4.7)

Calculates direct childs from a private key based on a given index, and maybe a hardened flag

Link to this section Summary

Functions

Calculates a direct child from a private key based on a given index, and maybe a hardened flag

Link to this section Functions

Link to this function

get(private_key, index, hardened? \\ false)

View Source
@spec get(BitcoinLib.Key.PrivateKey.t(), integer(), boolean()) ::
  {:ok, BitcoinLib.Key.PrivateKey.t()} | {:error, binary()}

Calculates a direct child from a private key based on a given index, and maybe a hardened flag

examples

Examples

iex> %BitcoinLib.Key.PrivateKey{
...>  key: <<0xF79BB0D317B310B261A55A8AB393B4C8A1ABA6FA4D08AEF379CABA502D5D67F9::256>>,
...>  chain_code: <<0x463223AAC10FB13F291A1BC76BC26003D98DA661CB76DF61E750C139826DEA8B::256>>
...> }
...> |> BitcoinLib.Key.PrivateKey.ChildFromIndex.get(0)
{
  :ok,
  %BitcoinLib.Key.PrivateKey{
    key: <<0x39F329FEDBA2A68E2A804FCD9AEEA4104ACE9080212A52CE8B52C1FB89850C72::256>>,
    chain_code: <<0x05AAE71D7C080474EFAAB01FA79E96F4C6CFE243237780B0DF4BC36106228E31::256>>,
    depth: 1,
    index: 0,
    parent_fingerprint: <<0x18C1259::32>>
  }
}