src/crypto/utxo/utxo library

Classes

BTCRawTransaction
Raw Transaction Implementation for Bitcoin
EC8RawTransaction
Raw Transaction Implementation for EC8
POPResult
RawTransaction

Constants

kAddressesUpperLimit → const int
kEmptyLimit → const int
max_cheap_tx_weight → const int
SEGWIT_FLAG → const int
SEGWIT_MARKER → const int

Functions

broadcastTransaction({required String rawTxHex, required dynamic type}) Future<String>
buildDummyTx({required dynamic networkType, required dynamic walletPath, required Map inputMap, required List dummyOutputs}) → dynamic
buildDummyTxFromScratch({required dynamic intent, required dynamic networkType, required dynamic walletPath, required Iterable txList, required List<String> changeAddresses}) DummyTxInfo
Creates a dummy transaction to estimate the size of the transaction and hence the fee Also returns the chosen UTXOs so that they can be used to create the real transaction with the same UTXOs Includes a safety margin so that changes in the Amount dont lead to a different fee
buildInput({required String txidHex, required Set<String> usedUTXO, required dynamic utxo, required dynamic networkType}) → dynamic
buildInputs(Map utxos, dynamic networkType) → (BigInt, Map)
buildOutput(String address, BigInt value, dynamic networkType) → dynamic
buildOutputs({required String recipient, required BigInt value, required String? changeAddress, required BigInt changeValue, required dynamic networkType}) List
buildUnsignedTransaction({required dynamic intent, required dynamic networkType, required dynamic walletPath, required Iterable txList, required dynamic feePerByte, required Iterable<String> changeAddresses, List? preChosenUTXOs}) → dynamic
Useful: https://btcinformation.org/en/developer-reference#raw-transaction-format https://github.com/bitcoin/bips/blob/master/bip-0144.mediawiki
calculateFee({required dynamic tx, required dynamic feePerByte}) BigInt
calculateFeeEC8({required dynamic tx}) BigInt
computeBalanceFromUTXOs({required Iterable txList}) BigInt
computeBalanceFromVisualList({required Iterable txList}) BigInt
computeMissingUTXODetails({required Iterable txList, required Iterable nodes, required Iterable addressTypes, required dynamic type, required List<(String, int)> endpoints}) Future<Iterable>
constructScriptSig({required dynamic walletPurpose, required Uint8List signature, required Uint8List publicKey, Uint8List? redeemScript}) Uint8List
createEurocoinMessageHash(String message) Uint8List
createScriptSignature({required dynamic tx, required int i, required dynamic output, required dynamic walletPurpose, required dynamic networkType, required dynamic node}) Uint8List
createScriptWitness({required dynamic tx, required int i, required dynamic output, required dynamic networkType, required dynamic node}) Uint8List
deriveBIP32Ec8({required List<int> derivationPath, required Uint8List seed}) Future
determineSendDirection({required List inputs, required List outputs, required Iterable nodes, required dynamic type, required Iterable addressTypes}) → dynamic
determineTransactionTarget(List outputs, dynamic transferMethod, dynamic type, dynamic addressType) String?
determineTransactionValue(List outputs, dynamic transferMethod, Iterable nodes, dynamic type) → (BigInt, BigInt)
ec8Recover({required String message, required String sig}) String
ec8SignMessage(String message, dynamic node) Uint8List
encodeVarint(int value) Uint8List
estimateFeeForPriority({required int blocks, required dynamic network, required dynamic initalClient}) Future
extractAllUTXOs({required Iterable txList, bool own = true}) Map
Returns a map of UTXOs which belong to us and are unspent and their corresponding transactions
extractUTXOs({required Iterable txList}) Map
Returns a map of UTXOs which belong to us and are unspent and their corresponding transactions
fetchMissingUTXOTransactions({required Set cachedTransactions, required List cachedNodes, required Set allTxs, required Iterable nodes, required dynamic coin, required dynamic networkType, required Iterable addressTypes, required List<(String, int)> endpoints, required Stopwatch watch}) Future<UTXOTxInfo>
fetchUTXOTransactions({required Iterable walletTypes, required Iterable addressTypes, required dynamic networkType, required Uint8List seed, Set cachedTransactions = const {}, List cachedNodes = const [], int minEndpoints = 2, Duration maxLatency = const Duration(milliseconds: 800)}) Future<UTXOTxInfo>
fetchUTXOTransactionsFromEpubKey({required Iterable addressTypes, required dynamic networkType, required String ePubKey, dynamic purpose, Set cachedTransactions = const {}, List cachedNodes = const [], int minEndpoints = 2, Duration maxLatency = const Duration(milliseconds: 800)}) Future<UTXOTxInfo>
Fetches UTXO Transactions for a given ePubKey if purpose is not provied the returned nodes cant be used to derive the master node (used in Proof of Payment)
findOurOwnCoins(List outputs, Iterable nodes, Iterable addressTypes, dynamic type) List
findUnusedAddress({required Iterable<String> addresses, required Iterable txs}) String
getNetworkFees({required dynamic network, double multiplier = 1.0}) Future
getSpendableOutputs({required List txList}) List
Returns a map of UTXOs which belong to us and are unspent and their corresponding transactions
nomoIdDerivationPath(int hostId) List<int>
padUint8ListTo32(Uint8List data) Uint8List
proofOfPayment({required String txid, required String nonce, required List nodes, required Uint8List seed, required dynamic networkType}) Future<POPResult>
Proof of Payment using BIP120: https://bips.xyz/120
rebroadcastTransaction({required String hash, required String serializedTx, required dynamic type, Duration delay = const Duration(seconds: 5)}) Future<bool>
For a given hash and serializedTx we check if the transaction is already in the mempool If not we rebroadcast the transaction until at least half of the nodes have the transaction
searchForTransactions({required dynamic masterNode, required int chainIndex, required Iterable addressTypes, required dynamic walletPurpose, required dynamic networkType, required List<(String, int)> endpoints, required List cachedNodes, required dynamic isolateManager, int emptyLimit = kEmptyLimit}) Future<(Set, List)>
searchTransactionsForWalletType({required dynamic masterNode, required dynamic purpose, required Iterable addressTypes, required dynamic networkType, required List<(String, int)> endpoints, required List cachedNodes, required dynamic isolateManager}) Future<(Set, Set)>
signInput({required dynamic bip32, required Uint8List sigHash}) Uint8List
signInputs({required Map inputs, required dynamic walletPath, required dynamic networkType, required dynamic tx, required Uint8List seed}) List
uint8ListFromList(List<int> data) Uint8List
unsignedIntToBytes(BigInt number) Uint8List

Typedefs

DummyTxInfo = ({List chosenUTXOs, dynamic dummyRawTx})
ElectrumXResult = (Set?, dynamic)
SearchTransactionResult = (Set, Set)
UTXOTxInfo = (Set, Iterable)
Txs; Receive Addresses; Change Addresses