View Source BitcoinLib.Key.Private (BitcoinLib v0.1.3)

Bitcoin private key management module

Link to this section Summary

Functions

Creates a Bitcoin private key using efficient randomness

Converts a binary primary key to the WIF format

Link to this section Functions

@spec generate() :: %{raw: integer(), wif: String.t()}

Creates a Bitcoin private key using efficient randomness

Inspired by https://learnmeabitcoin.com/technical/private-key

examples

Examples

iex> %{raw: raw1} = BitcoinLib.Key.Private.generate ...> %{raw: raw2} = BitcoinLib.Key.Private.generate ...> raw1 == raw2 false

Converts a binary primary key to the WIF format

Based on https://learnmeabitcoin.com/technical/wif

examples

Examples

iex> 0x6C7AB2F961A1BC3F13CDC08DC41C3F439ADEBD549A8EF1C089E81A5907376107 ...> |> BitcoinLib.Key.Private.to_wif() "KzractrYn5gnDNVwBDy7sYhAkyMvX4WeYQpwyhCAUKDogJTzYsUc"