View Source Bitcoinex.Segwit (bitcoinex v0.1.8)

SegWit address serialization.

Link to this section Summary

Functions

Decodes an address and returns its network, witness version, and witness program.

Simpler Interface to check if address is valid

Link to this section Types

@type data() :: [integer()]
@type error() :: atom()
@type hrp() :: String.t()
@type network() :: :testnet | :mainnet | :regtest
@type witness_program() :: [integer()]
@type witness_version() :: 0..16

Link to this section Functions

@spec decode_address(String.t()) ::
  {:ok, {network(), witness_version(), witness_program()}} | {:error, error()}

Decodes an address and returns its network, witness version, and witness program.

Link to this function

encode_address(network, witness_version, program)

View Source
@spec encode_address(network(), witness_version(), witness_program()) ::
  {:ok, String.t()} | {:error, error()}

Encodes an address string.

Link to this function

get_segwit_script_pubkey(version, program)

View Source
@spec get_segwit_script_pubkey(witness_version(), witness_program()) :: String.t()
Link to this function

is_valid_segswit_address?(address)

View Source
@spec is_valid_segswit_address?(String.t()) :: boolean()

Simpler Interface to check if address is valid