TaprootScriptInput class

A TaprootInput which spends using the script-path for 0xc0 version Tapscripts. There is no signing logic and sign() is not implemented. Subclasses should handle signing. createScriptSignature can be used to create signatures as necessary. Insertion of signatures and other data can be done manually via updateStack. These signatures must be handled by the consumer and will not be filtered upon a transaction update.

Inheritance

Constructors

TaprootScriptInput.new({required OutPoint prevOut, required Uint8List controlBlock, required Script tapscript, List<Uint8List>? stack, int sequence = Input.sequenceFinal})
TaprootScriptInput.fromTaprootLeaf({required OutPoint prevOut, required Taproot taproot, required TapLeaf leaf, List<Uint8List>? stack, int sequence = Input.sequenceFinal})

Properties

complete bool
Always true as a simple RawInput is assumed to be fully signed as there is no way to determine if it is or not.
no setterinherited
controlBlock Uint8List
no setter
hashCode int
The hash code for this object.
no setterinherited
prevOut OutPoint
finalinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
script Script?
The script from the scriptSig bytes or null if the bytes do not represent a valid script.
no setterinherited
scriptSig Uint8List
finalinherited
sequence int
finalinherited
signedSize int?
The maximum total size when fully signed via the default hash type including any witness data of the input. If this is unknown, this is null. The actual signed size may be lower according to the data being encoded.
no setterinherited
size int
Obtains the cached size of the object
no setterinherited
tapscript Script
The tapscript embedded in the witness data, not to be confused with the empty script.
final
witness List<Uint8List>
finalinherited

Methods

createInputSignature({required Transaction tx, required int inputN, required ECPrivateKey key, required List<Output> prevOuts, SigHashType hashType = const SigHashType.all(), Uint8List? leafHash, int codeSeperatorPos = 0xFFFFFFFF}) SchnorrInputSignature
Creates a signature for the input. Used by subclasses to implement signing.
inherited
createScriptSignature({required Transaction tx, required int inputN, required ECPrivateKey key, required List<Output> prevOuts, SigHashType hashType = const SigHashType.all(), int codeSeperatorPos = 0xFFFFFFFF}) SchnorrInputSignature
Creates a SchnorrInputSignature to be used for the input's script data. Provides the leaf hash to an underlying call to createInputSignature.
filterSignatures(bool predicate(InputSignature insig)) Input
Removes signatures that the predicate returns false for. This is used to remove invalidated signatures.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sign({required Transaction tx, required int inputN, required ECPrivateKey key, required List<Output> prevOuts, SigHashType hashType = const SigHashType.all()}) TaprootInput
Signs the input given the tx, input number (inputN), private key and prevOuts using the specifified hashType. Should throw CannotSignInput if the key cannot sign the input. Implemented by specific subclasses.
inherited
toBytes() Uint8List
Obtains a cached Uint8List with data serialized for this object
inherited
toHex() String
inherited
toString() String
A string representation of this object.
inherited
updateStack(List<Uint8List> newStack) TaprootScriptInput
Replaces the stack to update the data required to spend the input
write(Writer writer) → void
Override to write data into writer
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

match(RawInput raw, List<Uint8List> witness) TaprootScriptInput?
Checks if the raw input and witness data match the expected format for a TaprootScriptInput with the control block and script. If it matches this returns a TaprootScriptInput for the input or else it returns null. The script must be valid with minimal push data. The control block must be the correct size and contain the correct 0xc0 tapscript version but the internal key and parity bit is not validated.
override