Bitcoinex.Segwit (bitcoinex v0.1.6) View Source

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

Specs

data() :: [integer()]

Specs

error() :: atom()

Specs

hrp() :: String.t()

Specs

network() :: :testnet | :mainnet | :regtest

Specs

witness_program() :: [integer()]

Specs

witness_version() :: 0..16

Link to this section Functions

Specs

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

Specs

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

Specs

get_segwit_script_pubkey(witness_version(), witness_program()) :: String.t()
Link to this function

is_valid_segswit_address?(address)

View Source

Specs

is_valid_segswit_address?(String.t()) :: boolean()

Simpler Interface to check if address is valid