View Source BitcoinLib.Key.PublicKey.Address.Bech32 (BitcoinLib v0.2.0-pre3)

Implementation of Bech32 addresses

BIP173: https://en.bitcoin.it/wiki/BIP_0173

Sources:

Link to this section Summary

Functions

Creates a Bech32 address, which is starting by bc1, out of an Extended Public Key

Link to this section Functions

Link to this function

from_public_key(public_key, network \\ :mainnet)

View Source
@spec from_public_key(
  %BitcoinLib.Key.PublicKey{
    chain_code: term(),
    depth: term(),
    fingerprint: term(),
    index: term(),
    key: term(),
    parent_fingerprint: term(),
    uncompressed_key: term()
  },
  :mainnet | :testnet
) :: binary()

Creates a Bech32 address, which is starting by bc1, out of an Extended Public Key

examples

Examples

iex> %BitcoinLib.Key.PublicKey{ ...> key: <<0x0279BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798::264>>, ...> chain_code: 0 ...> } |> BitcoinLib.Key.PublicKey.Address.Bech32.from_public_key() "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4"