BSV-ex v0.2.5 BSV.Script.PublicKeyHash View Source

Module for building P2PKH input and output scripts.

Link to this section Summary

Functions

Build a new P2PKH input script, from the given signature and public key.

Build a new P2PKH output script, from the given address or public key.

Returns the public key hash from the given P2PKH output script.

Link to this section Functions

Link to this function

build_input_script(arg1, arg2)

View Source
build_input_script({binary(), integer()}, binary()) :: BSV.Script.t()

Build a new P2PKH input script, from the given signature and public key.

Link to this function

build_output_script(address)

View Source
build_output_script(BSV.Address.t() | binary()) :: BSV.Script.t()

Build a new P2PKH output script, from the given address or public key.

Examples

iex> BSV.KeyPair.from_ecdsa_key(BSV.Test.bsv_keys)
...> |> BSV.Address.from_public_key
...> |> BSV.Script.PublicKeyHash.build_output_script
%BSV.Script{
  chunks: [
    :OP_DUP,
    :OP_HASH160,
    <<47, 105, 50, 137, 102, 179, 60, 141, 131, 76, 2, 71, 24, 254, 231, 1, 101, 139, 55, 71>>,
    :OP_EQUALVERIFY,
    :OP_CHECKSIG
  ]
}

Returns the public key hash from the given P2PKH output script.