Bitcoinex.Bech32 (bitcoinex v0.1.2) View Source

Includes Bech32 serialization and validation.

Reference: https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki#bech32

Link to this section Summary

Link to this section Types

Specs

data() :: [integer()]

Specs

error() :: atom()

Specs

hrp() :: String.t()

Specs

max_encoded_length() :: pos_integer() | :infinity

Specs

witness_program() :: [integer()]

Specs

witness_version() :: Range.t(0, 16)

Link to this section Functions

Link to this function

convert_bits(data, from_bits, to_bits, padding \\ true)

View Source

Specs

convert_bits([integer()], integer(), integer(), boolean()) ::
  {:error, :invalid_data} | {:ok, [integer()]}
Link to this function

decode(bech32_str, max_encoded_length \\ 90)

View Source

Specs

decode(String.t(), max_encoded_length()) ::
  {:ok, {hrp(), data()}} | {:error, error()}
Link to this function

encode(hrp, data, max_encoded_length \\ 90)

View Source

Specs

encode(hrp(), data() | String.t(), max_encoded_length()) ::
  {:ok, String.t()} | {:error, error()}