STAS unlocking script templates (P2PKH and P2MPKH).
Supports both legacy (P2PKH-only, no spend type) and v3 (with spend type) signing modes.
For P2PKH: produces <sig> <pubkey>.
For P2MPKH: produces <sig1> … <sigM> <serialized_multisig_script>.
The on-chain STAS script auto-detects the format based on the size of the public key data: 33 bytes → P2PKH; otherwise → P2MPKH.
Summary
Functions
Estimated unlocking script length in bytes.
Sign a STAS input, producing a P2PKH or P2MPKH unlocking script.
Create a STAS unlocker struct from a PrivateKey (P2PKH, backward compatible).
Create a STAS unlocker from a SigningKey (dispatches P2PKH vs P2MPKH).
Create a STAS P2MPKH unlocker struct from threshold keys and a multisig script.
Types
@type t() :: %BSV.Tokens.Template.Stas{ sighash_flag: non_neg_integer(), signing_key: BSV.Tokens.SigningKey.t(), spend_type: BSV.Tokens.SpendType.t() | nil }
Functions
Estimated unlocking script length in bytes.
Sign a STAS input, producing a P2PKH or P2MPKH unlocking script.
@spec unlock( BSV.PrivateKey.t(), keyword() ) :: t()
Create a STAS unlocker struct from a PrivateKey (P2PKH, backward compatible).
Options
:spend_type—SpendType.t()for v3 scripts (default:nilfor legacy):sighash_flag— sighash flag byte (default:0x41)
@spec unlock_from_signing_key( BSV.Tokens.SigningKey.t(), keyword() ) :: t()
Create a STAS unlocker from a SigningKey (dispatches P2PKH vs P2MPKH).
@spec unlock_mpkh( [BSV.PrivateKey.t()], BSV.Transaction.P2MPKH.multisig_script(), keyword() ) :: t()
Create a STAS P2MPKH unlocker struct from threshold keys and a multisig script.
Options
:spend_type—SpendType.t()for v3 scripts (default:nil):sighash_flag— sighash flag byte (default:0x41)