Class BSV::Overlay::AdminTokenTemplate::Unlocker ¶
Inherits: Object
Unlocker returned by {#unlock}.
Satisfies the P2PK condition in a PushDrop locking script by signing the BIP-143 sighash of the spending transaction using the wallet's derived key for the appropriate protocol.
Constants¶
ESTIMATED_LENGTH ¶
Estimated length of a P2PK unlocking script: 1 push opcode + up to 72 DER-encoded signature bytes + 1 sighash byte = 73 bytes total.
Public Instance Methods¶
estimated_length(_tx, _input_index) ¶
Estimated byte length of the unlocking script. - @param _tx [BSV::Transaction::Transaction] unused - @param _input_index [Integer] unused - @return [Integer]
initialize(wallet, protocol_id, originator) ¶
- @param
wallet[#create_signature] BRC-100 wallet interface - @param
protocol_id[Array] two-element array [security_level, protocol_name] - @param
originator[String, nil] optional originator domain - @return [Unlocker] a new instance of Unlocker
sign(tx, input_index) ¶
Generate the unlocking script for the given input.
Computes the BIP-143 sighash (SIGHASH_ALL|FORK_ID) and signs it using the wallet's derived key for the protocol. - @param tx [BSV::Transaction::Transaction] the spending transaction - @param input_index [Integer] which input to sign - @return [BSV::Script::Script] the unlocking script