SVSignature class

Sign bitcoin transactions and verify signatures.

Constructors

SVSignature.fromCompact(List<int> buffer, List<int> signedMessage)
Construct the Signature and recover the public key. With the public key recovered we can use this signature for verification only
SVSignature.fromDER(String derBuffer, {SVPublicKey? publicKey = null})
Constructs a signature from it's DER-encoded form
SVSignature.fromECParams(BigInt? _r, BigInt? _s)
Construct a instance from the R and S components of an ECDSA signature.
SVSignature.fromPrivateKey(SVPrivateKey privateKey)
Construct a signature instance from a PrivateKey for signing purposes.
SVSignature.fromPublicKey(SVPublicKey publicKey)
Constructs a signature instance from PublicKey for verification ONLY.
SVSignature.fromTxFormat(String buffer)
Constructs a signature for it's bitcoin-transaction-encoded form.

Properties

hashCode int
The hash code for this object.
no setterinherited
nhashtype int
Returns the SighashType value that was detected with fromTxFormat() constructor
getter/setter pair
publicKey SVPublicKey
Returns the public key that will be used to verify signatures
no setter
r BigInt
Returns the signature's R value
no setter
rHex String
Returns the signature's R value as a hexadecimal string
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
s BigInt
Returns the signature's S value
no setter
sHex String
Returns the signature's S value as a hexadecimal string
no setter

Methods

hasDefinedHashtype() bool
Returns true if the hashType is exactly equal to one of the standard options or combinations thereof. Translated from bitcoind's IsDefinedHashtypeSignature
hasLowS() bool
Comparable to bitcoind's IsLowDERSignature. Returns true if the signature has a 'low' S-value.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
sign(String message, {bool forCompact = false}) String
Signs a message and optionally also calculates the first byte needed for compact format rendering.
toCompact() List<int>
Renders the signature in compact form.
toDER() List<int>
Renders the signature as a DER-encoded byte buffer
toString() String
A string representation of this object.
override
toTxFormat() String
Returns the signature in standard DER format, with the SighashType value appended
verify(String message) bool
Verify that the provided message was signed using this signature

Operators

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

Static Methods

hasForkId(List<int> sigBytes) bool
isTxDER(String buffer) bool
ported from moneybutton/bsv This function is translated from bitcoind's IsDERSignature and is used in the script interpreter. This 'DER' format actually includes an extra byte, the nhashtype, at the end. It is really the tx format, not DER format.