P2PKHInput class

An input for a Pay-to-Public-Key-Hash output (P2PKH). This contains the public key that should match the hash in the associated output. It is either signed or unsigned. The sign method can be used to sign the input with the corresponding ECPrivateKey or a signature can be added without checks using addSignature.

Inheritance
Mixed in types

Constructors

P2PKHInput({required OutPoint prevOut, required ECPublicKey publicKey, ECDSAInputSignature? insig, int sequence = Input.sequenceFinal})

Properties

complete bool
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
insig ECDSAInputSignature?
final
prevOut OutPoint
finalinherited
publicKey ECPublicKey
final
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 setteroverride
scriptCode 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.
final
size int
Obtains the cached size of the object
no setterinherited

Methods

addSignature(ECDSAInputSignature insig) P2PKHInput
Returns a new P2PKHInput with the ECDSAInputSignature added. Any existing signature is replaced.
override
checkKey(ECPrivateKey key) ECPrivateKey
inherited
createInputSignature({required Transaction tx, required int inputN, required ECPrivateKey key, required Script scriptCode, SigHashType hashType = const SigHashType.all()}) ECDSAInputSignature
Creates a signature for the input. Used by subclasses to implement signing.
inherited
filterSignatures(bool predicate(InputSignature insig)) P2PKHInput
Removes signatures that the predicate returns false for. This is used to remove invalidated signatures.
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sign({required Transaction tx, required int inputN, required ECPrivateKey key, SigHashType hashType = const SigHashType.all()}) P2PKHInput
Signs the input given the tx, input number (inputN) and a private key using the specifified hashType. Implemented by specific subclasses.
override
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
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) P2PKHInput?
Checks if the RawInput matches the expected format for a P2PKHInput, with or without a signature. If it does it returns a P2PKHInput for the input or else it returns null.