Understanding the Protocol Design
Under development...
UTXO-Based
Bitcoin operates on a UTXO (Unspent Transaction Output) model rather than an account-based balance system. Every transaction consumes one or more existing UTXOs as inputs and produces new UTXOs as outputs. The library handles UTXO selection, change calculation, and fee estimation internally. Each method on TransactionFactory returns the resulting UTXOs (nextUTXOs) that your application must track and pass as inputs to subsequent transactions. Failure to do so will result in double-spend rejections.
Two-Transaction Model
OP_NET smart contract operations, both deployments and interactions, require a pair of Bitcoin transactions that are broadcast together as a unit. The interaction transaction embeds the contract calldata within a Taproot script path, while the funding transaction creates a UTXO with the exact amount needed (covering fees, priority fee, and gas) locked to the interaction's script address. The TransactionFactory handles this two-transaction construction automatically: you provide the parameters, and it returns both signed transactions ready to broadcast.
Simple Bitcoin transfers that do not involve smart contract logic use a single transaction and do not require this pairing.