bip0173 v0.1.2 SegwitAddr
Encode and decode BIP-0173 compliant SegWit addresses.
Link to this section Summary
Functions
Decode a SegWit address
Encode a SegWit address
Encode a witness program into a hexadecimal ScriptPubKey
Link to this section Functions
Link to this function
decode(addr)
Decode a SegWit address.
Examples
iex> SegwitAddr.decode("bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4")
{:ok, {"bc", 0, [117, 30, 118, 232, 25, 145, 150, 212,
84, 148, 28, 69, 209, 179, 163, 35, 241, 67, 59, 214]}}
Link to this function
encode(hrp, version, program)
Encode a SegWit address.
Examples
iex> SegwitAddr.encode("bc", "0014751e76e8199196d454941c45d1b3a323f1433bd6")
"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"
Link to this function
to_script_pub_key(version, program)
to_script_pub_key(pos_integer, [integer]) :: String.t
Encode a witness program into a hexadecimal ScriptPubKey.
Examples
iex> SegwitAddr.to_script_pub_key(0, [117, 30, 118, 232, 25, 145, 150,
...> 212, 84, 148, 28, 69, 209, 179, 163, 35, 241, 67, 59, 214])
"0014751e76e8199196d454941c45d1b3a323f1433bd6"