BSV.Transaction.P2PKH (bsv_sdk v1.1.0)

Copy Markdown View Source

P2PKH signing template.

Summary

Functions

Estimated unlocking script length in bytes (sig + pubkey ≈ 106).

Create a P2PKH locking script from an address string.

Sign a transaction input, producing a P2PKH unlocking script.

Create an unlocker struct.

Types

t()

@type t() :: %BSV.Transaction.P2PKH{
  private_key: BSV.PrivateKey.t(),
  sighash_flag: non_neg_integer()
}

Functions

estimate_length(_, _, _)

Estimated unlocking script length in bytes (sig + pubkey ≈ 106).

lock(address_string)

@spec lock(String.t()) :: {:ok, BSV.Script.t()} | {:error, term()}

Create a P2PKH locking script from an address string.

sign(p2_pkh, tx, input_index)

Sign a transaction input, producing a P2PKH unlocking script.

unlock(key, opts \\ [])

@spec unlock(
  BSV.PrivateKey.t(),
  keyword()
) :: t()

Create an unlocker struct.