View Source BitcoinLib (BitcoinLib v0.1.3)

High level bitcoin operations

Link to this section Summary

Functions

Derives a public key from a raw private key

Creates a P2PKH address from a public key

Creates a bitcoin private key both in raw and WIF format

Link to this section Functions

Link to this function

derive_public_key(private_key)

View Source
@spec derive_public_key(integer()) :: {integer(), integer()}

Derives a public key from a raw private key

examples

Examples

iex> 0x0a8d286b11b98f6cb2585b627ff44d12059560acd430dcfa1260ef2bd9569373 ...> |> BitcoinLib.derive_public_key() {

0x040f69ef8f2feb09b29393eef514761f22636b90d8e4d3f2138b2373bd37523053002119e16b613619691f760eadd486315fc9e36491c7adb76998d1b903b3dd12,
0x020f69ef8f2feb09b29393eef514761f22636b90d8e4d3f2138b2373bd37523053

}

Link to this function

generate_p2pkh_address(public_key)

View Source
@spec generate_p2pkh_address(integer()) :: binary()

Creates a P2PKH address from a public key

examples

Examples

iex> 0x020f69ef8f2feb09b29393eef514761f22636b90d8e4d3f2138b2373bd37523053 ...> |> BitcoinLib.generate_p2pkh_address() "1Ak9NVPmwCHEpsSWvM6cNRC7dsYniRmwMG"

@spec generate_private_key() :: %{raw: integer(), wif: binary()}

Creates a bitcoin private key both in raw and WIF format

examples

Examples

iex> %{raw: , wif: } = BitcoinLib.generate_private_key()