BtcTransaction class

Represents a Bitcoin transaction

inputs A list of all the transaction inputs outputs A list of all the transaction outputs locktime The transaction's locktime parameter version The transaction version hasSegwit Specifies a tx that includes segwit inputs witnesses The witness structure that corresponds to the inputs

Constructors

BtcTransaction({required List<TxInput> inputs, required List<TxOutput> outputs, List<TxWitnessInput> w = const [], bool hasSegwit = false, Uint8List? lock, Uint8List? v})

Properties

hashCode int
The hash code for this object.
no setterinherited
hasSegwit bool
final
inputs List<TxInput>
final
locktime Uint8List
final
outputs List<TxOutput>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
version Uint8List
latefinal
witnesses List<TxWitnessInput>
final

Methods

getSize() int
Calculates the tx size
getTransactionDigest({required int txInIndex, required Script script, int sighash = SIGHASH_ALL}) Uint8List
returns the transaction input's digest that is to be signed according.
getTransactionSegwitDigit({required int txInIndex, required Script script, int sighash = SIGHASH_ALL, required BigInt amount}) Uint8List
returns the transaction input's segwit digest that is to be signed according to sighash.
getTransactionTaprootDigset({required int txIndex, required List<Script> scriptPubKeys, required List<BigInt> amounts, int extFlags = 0, Script script = const Script(script: []), int leafVar = LEAF_VERSION_TAPSCRIPT, int sighash = TAPROOT_SIGHASH_ALL}) Uint8List
Returns the segwit v1 (taproot) transaction's digest for signing.
getVSize() int
Calculates the tx segwit size
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
serialize() String
converts result of to_bytes to hexadecimal string
toBytes({bool segwit = false}) Uint8List
Serializes Transaction to bytes
toHex() String
converts result of to_bytes to hexadecimal string
toString() String
A string representation of this object.
inherited
txId() String
Calculates txid and returns it

Operators

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

Static Methods

copy(BtcTransaction tx) BtcTransaction
creates a copy of the object (classmethod)
fromRaw(String raw) BtcTransaction
Instantiates a Transaction from serialized raw hexadacimal data (classmethod)