1 // Package wtxmgr provides an implementation of a transaction database handling spend tracking for a bitcoin wallet. Its
2 // primary purpose is to save transactions with outputs spendable with wallet keys and transactions that are signed by
3 // wallet keys in memory, handle spend tracking for unspent outputs and newly-inserted transactions, and report the
4 // spendable balance from each unspent transaction output. It uses walletdb as the backend for storing the serialized
5 // transaction objects in buckets.
6 //
7 // Transaction outputs which are spendable by wallet keys are called credits (because they credit to a wallet's total
8 // spendable balance). Transaction inputs which spend previously-inserted credits are called debits (because they debit
9 // from the wallet's spendable balance).
10 //
11 // Spend tracking is mostly automatic. When a new transaction is inserted, if it spends from any unspent credits, they
12 // are automatically marked spent by the new transaction, and each input which spent a credit is marked as a debit.
13 // However, transaction outputs of inserted transactions must manually marked as credits, as this package has no
14 // knowledge of wallet keys or addresses, and therefore cannot determine which outputs may be spent.
15 //
16 // Details regarding individual transactions and their credits and debits may be queried either by just a transaction
17 // hash, or by hash and block. When querying for just a transaction hash, the most recent transaction with a matching
18 // hash will be queried. However, because transaction hashes may collide with other transaction hashes, methods to query
19 // for specific transactions in the chain (or unmined) are provided as well.
20 package wtxmgr
21