Sig class

Signature

A signature is the thing you make when you want to sign a transaction, or the thing you want to verify if you want to ensure that someone signed a transaction. It has an r and s value, which are the cryptographic big numbers that define a signature. And since this is a bitcoin library, it also has nHashType, which is the way to hash a transaction and is used in the binary format of a signature when it is in a transaction. We also support a public key recover value, recovery, allowing one to compute the public key from a signature. The "compressed" value is also necessary to accurately compute the public key from a signature.

There are a few different formats of a signature in bitcoin. One is DER, the other is the TxFormat which is the same as DER but with the nHashType byte appended, and the final one is Compact, which is used by Bitcoin Signed Message (Bsm).

Constructors

Sig({BigIntX? r, BigIntX? s, int? nHashType, int? recovery, bool? compressed})
Sig.fromCompact(List<int> buf)
factory
Sig.fromDer(List<int> buf, [bool strict = false])
factory
Sig.fromHex(List<int> buf)
factory
Sig.fromRS(List<int> rsbuf)
factory
Sig.fromTxFormat(List<int> buf)
factory

Properties

compressed bool?
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
nHashType int?
getter/setter pair
r BigIntX?
getter/setter pair
recovery int?
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
s BigIntX?
getter/setter pair

Methods

fromBuffer(List<int> buf) Sig
fromCompact(List<int> buf) Sig
fromDer(List<int> buf, [bool? strict]) Sig
fromHex(String str) Sig
fromRS(List<int> rsbuf) → dynamic
fromString(String str) Sig
fromTxFormat(List<int> buf) Sig
hasDefinedHashType() bool
Ensures the nHashType is exactly equal to one of the standard options or combinations thereof. Translated from bitcoind's IsDefinedHashtypeSignature
hasLowS() bool
Compares to bitcoind's IsLowDERSignature See also Ecdsa signature algorithm which enforces this. See also Bip 62, "low S values in signatures"
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toBuffer() List<int>
toCompact({dynamic recovery, dynamic compressed}) List<int>
toDer() List<int>
toHex() String
toRS() List<int>
toString() String
A string representation of this object.
override
toTxFormat() List<int>

Operators

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

Static Methods

IsTxDer(List<int> buf) bool
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.
parseDer(List<int> buf, [bool? strict]) Map<String, dynamic>
In order to mimic the non-strict DER encoding of OpenSSL, set strict = false.

Constants

SIGHASH_ALL → const int
SIGHASH_ANYONECANPAY → const int
SIGHASH_FORKID → const int
SIGHASH_NONE → const int
SIGHASH_SINGLE → const int