Transaction class
Container for storing and working with Bitcoin Cash transaction data
Heavily based on https://github.com/anicdh/bitcoin_flutter/blob/master/lib/src/transaction.dart and updated to work with BCH
Constructors
- Transaction([dynamic version = 2, dynamic locktime = 0, dynamic ins, dynamic outs ])
- If inputs or outputs are not defined, empty lists are created for each
- Transaction.clone(Transaction originalTx)
-
factory
- Transaction.fromBuffer(Uint8List buffer)
-
Creates transaction from its hex representation stored in list of integers
factory
- Transaction.fromHex(String hex)
-
Creates transaction from its hex representation
factory
Properties
Methods
-
addInput(
Uint8List hash, int index, [ int sequence, Uint8List scriptSig ]) → int -
Add input to the transaction. If
sequence
is not provided, defaults to DEFAULT_SEQUENCE -
addOutput(
Uint8List scriptPubKey, int value) → int - Add input to the transaction
-
getHash(
) → Uint8List -
getId(
) → String -
hashForCashSignature(
int inIndex, Uint8List prevOutScript, int amount, int hashType) → dynamic - Create a hash for Bitcoin Cash signature. If this is legacy format transaction however, it will revert to the legacy signature [...]
-
hashForSignature(
int inIndex, Uint8List prevOutScript, int hashType) → dynamic - Create hash for legacy signature
-
isCoinbase(
) → bool -
isCoinbaseHash(
dynamic buffer) → bool -
setInputScript(
int index, Uint8List scriptSig) → dynamic -
toBuffer(
[Uint8List buffer, int initialOffset ]) → Uint8List -
toHex(
) → String -
virtualSize(
) → int -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a non-existent method or property is accessed. [...]
inherited
-
toString(
) → String -
Returns a string representation of this object.
inherited
Operators
-
operator ==(
dynamic other) → bool -
The equality operator. [...]
inherited
Static Properties
- BLANK_OUTPUT → Output
-
final
- EMPTY_SCRIPT → Uint8List
-
final
-
ONE
→ List<
int> -
final
-
VALUE_UINT64_MAX
→ List<
int> -
final
-
ZERO
→ List<
int> -
final
Constants
- ADVANCED_TRANSACTION_FLAG → const int
-
0x01
- ADVANCED_TRANSACTION_MARKER → const int
-
0x00
- DEFAULT_SEQUENCE → const int
-
0xffffffff
- SATOSHI_MAX → const double
-
21 * 1e14
- SIGHASH_ALL → const int
-
0x01
- SIGHASH_ANYONECANPAY → const int
-
0x80
- SIGHASH_BITCOINCASHBIP143 → const int
-
0x40
- SIGHASH_NONE → const int
-
0x02
- SIGHASH_SINGLE → const int
-
0x03