bitcoin-elixir v0.0.2 Bitcoin.Base58Check

Base58Check encoding.

Base58Check is used in Bitcoin addresses and WIF. It’s a Base58 where additional 4 checksum bytes are appended to the payload before encoding (and stripped and checked when decoding).

Checksum is first 4 bytes from the double sha256 of the payload.

Summary

Functions

Decode Base58 encoded string into binary

Same as base_decode/1 but returns binary without the tuple and raisse exception in case of an error

Encode binary payload in Base58

Check if the string is a valid Base58 encoding

Decode Base58Check string into binary

Just like decode/1 but raises exception in case of an error

Encode binary into Base58Check

Returns true if the string is a valid Base58Check encoding

Functions

base_decode(string)
base_decode(String.t) :: {:ok, binary} | {:error, term}

Decode Base58 encoded string into binary.

Returns {:ok, binary} if decoding was successful or {:error, :invalid_character} if some character outside the alphabet was found.

base_decode!(string)
base_decode!(String.t) :: binary

Same as base_decode/1 but returns binary without the tuple and raisse exception in case of an error.

base_encode(payload)
base_encode(binary) :: String.t

Encode binary payload in Base58.

base_valid?(string)
base_valid?(String.t) :: boolean

Check if the string is a valid Base58 encoding.

decode(string)
decode(String.t) :: {:ok, binary} | {:error, term}

Decode Base58Check string into binary.

Returns {:ok, binary} tuple in case of success, otherwise an {:error, err} tuple.

decode!(string)
decode!(String.t) :: binary

Just like decode/1 but raises exception in case of an error.

encode(payload)
encode(binary) :: String.t

Encode binary into Base58Check.

valid?(string)
valid?(String.t) :: boolean

Returns true if the string is a valid Base58Check encoding.