View Source BitcoinLib.Address.P2WPKH (BitcoinLib v0.4.3)

Implementation of P2WPKH addresses

see https://bitcoincore.org/en/segwit_wallet_dev/#native-pay-to-witness-public-key-hash-p2wpkh

Link to this section Summary

Functions

Creates a P2WPKH address out of a key hash

Creates a P2WPKH address out of a script pub key

Link to this section Functions

Link to this function

from_key_hash(key_hash, network \\ :mainnet)

View Source
@spec from_key_hash(<<_::160>>, :mainnet | :testnet) :: binary()

Creates a P2WPKH address out of a key hash

examples

Examples

iex> <<0x13BFFF2D6DD02B8837F156C6F9FE0EA7363DF795::160>>
...> |> BitcoinLib.Address.P2WPKH.from_key_hash()
"bc1qzwll7ttd6q4csdl32mr0nlsw5umrmau4es49qe"
Link to this function

from_script_pub_key(script_pub_key, network \\ :mainnet)

View Source
@spec from_script_pub_key(<<_::176>>, :mainnet | :testnet) :: binary()

Creates a P2WPKH address out of a script pub key

examples

Examples

iex> <<0x001413BFFF2D6DD02B8837F156C6F9FE0EA7363DF795::176>>
...> |> BitcoinLib.Address.P2WPKH.from_script_pub_key()
"bc1qzwll7ttd6q4csdl32mr0nlsw5umrmau4es49qe"