View Source BitcoinLib.Key.PublicKeyHash (BitcoinLib v0.2.0-pre1)

Bitcoin Public Key Hash module

Link to this section Summary

Functions

Extracts the public key hash from an address, and make sure the checkum is ok

Extract a public key hash from a bitcoin public key

Link to this section Functions

@spec from_address(binary()) :: {:ok, bitstring(), atom()} | {:error, binary()}

Extracts the public key hash from an address, and make sure the checkum is ok

examples

Examples

iex> address = "mwYKDe7uJcgqyVHJAPURddeZvM5zBVQj5L" ...> BitcoinLib.Key.PublicKeyHash.from_address(address)

Link to this function

from_public_key(public_key)

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()
}) :: bitstring()

Extract a public key hash from a bitcoin public key

Inspired by https://learnmeabitcoin.com/technical/public-key-hash

examples

Examples

iex> %BitcoinLib.Key.PublicKey{ ...> key: <<0x02b4632d08485ff1df2db55b9dafd23347d1c47a457072a1e87be26896549a8737::264>> ...> } ...> |> BitcoinLib.Key.PublicKeyHash.from_public_key() <<0x93ce48570b55c42c2af816aeaba06cfee1224fae::160>>