Skip to content

Class BSV::Transaction::UnlockingScriptTemplate

Inherits: Object

Abstract base class for unlocking script templates.

Templates provide deferred signing — an input can hold a template that generates the unlocking script at sign time, when the full transaction is available for sighash computation. Subclass and implement {#sign} and {#estimated_length}.

  • @abstract Subclass and override {#sign} and {#estimated_length}.
  • @see P2PKH

Public Instance Methods

estimated_length(_tx, _input_index)

Estimate the unlocking script length in bytes (for fee estimation). - @param _tx [Transaction] the transaction - @param _input_index [Integer] the input index - @raise [NotImplementedError] if not overridden by a subclass - @return [Integer] estimated script length in bytes

sign(_tx, _input_index)

Generate the unlocking script for a transaction input. - @param _tx [Transaction] the transaction being signed - @param _input_index [Integer] the input index to sign - @raise [NotImplementedError] if not overridden by a subclass - @return [Script::Script] the generated unlocking script