# Class BSV::Script::PushDropTemplate::Unlocker <a id="class-BSV-Script-PushDropTemplate-Unlocker"></a>

**Inherits:** `Object`

Unlocking template returned by {#unlock}.

Satisfies the P2PKH condition embedded in a PushDrop locking script by
computing the BIP-143 sighash and signing it with the wallet's derived key.

## Constants
### `ESTIMATED_LENGTH` <a id="constant-ESTIMATED_LENGTH"></a> <a id="ESTIMATED_LENGTH-constant"></a>
Estimated unlocking script length in bytes.

P2PKH unlock is 1 + ~72 (DER sig + hashtype) + 1 + 33 (pubkey) = 107 bytes. In
PushDrop context the unlock wraps P2PKH, so the estimate is the same.

## Public Instance Methods
### `estimated_length(_tx, _input_index)` <a id="method-i-estimated_length"></a> <a id="estimated_length-instance_method"></a>
Estimated byte length of the unlocking script.
- **@param** `_tx` [Transaction::Tx] unused
- **@param** `_input_index` [Integer] unused
- **@return** [Integer]

### `initialize(wallet, protocol_id, key_id, counterparty, originator)` <a id="method-i-initialize"></a> <a id="initialize-instance_method"></a>
- **@param** `wallet` [#create_signature, #get_public_key] BRC-100 wallet interface
- **@param** `protocol_id` [Array] two-element [security_level, protocol_name]
- **@param** `key_id` [String] key identifier
- **@param** `counterparty` [String] 'self', 'anyone', or a hex public key
- **@param** `originator` [String, nil] optional originator domain
- **@return** [Unlocker] a new instance of Unlocker

### `sign(tx, input_index)` <a id="method-i-sign"></a> <a id="sign-instance_method"></a>
Generate the unlocking script for the given input.

Computes the BIP-143 sighash (SIGHASH_ALL|FORK_ID), signs it with the wallet's
derived key, then returns a P2PKH unlock wrapped in a PushDrop unlock (which
is a pass-through).
- **@param** `tx` [Transaction::Tx] the spending transaction
- **@param** `input_index` [Integer] which input to sign
- **@return** [BSV::Script::Script] the unlocking script
