Highlander •
Understanding UXTO Fees

Understanding UXTO Fees
The complicated world of how your wallet calculates transaction fees
Understanding UXTO Fees
The complicated world of how your wallet calculates transaction fees
Contents:
- UXTO selection and transaction size
- Dust and unspendable UTXO’s
- UXTO Selection Algorithms
- Understanding Miners Transaction Selections
- What to do with stuck transactions
- RBF and other measures to handle fee replacement
Glossary
- Bitcoin: A decentralized digital currency created and held electronically.
- UTXO: Unspent Transaction Output — an output of a transaction that has not been used as an input in a new transaction.
- Altcoins: Any cryptocurrency other than Bitcoin.
- Dust: A tiny transaction amount, usually too small to be sent on its own.
- Miner: A computer that creates new blocks on the blockchain.
- Transaction: A record of a cryptocurrency exchange between two parties.
- Blockchain: A digital ledger that records and verifies transactions on a distributed network.
UXTO selection and transaction size
UXTO selection and transaction size refer to the process of choosing which Unspent Transaction Outputs (UXTOs) should be included in a given transaction, and the size of the resulting transaction. UXTOs are outputs from previous transactions which have not yet been spent. When creating a new transaction, the wallet software must select which UXTOs to include in order to meet the desired transaction size.
For example, if the user wants to send 0.01 BTC, the wallet software must select one or more UXTOs to add up to at least 0.01 BTC. The inputs and outputs of the transaction, as well as its size in bytes and vbytes, will depend on the UXTOs selected. In this transaction, the user has selected three UXTOs (txids: 8793a, 8b7c8, and 8cc0c) with a total value of 0.03 BTC. The inputs of the transaction are therefore the three UXTOs selected and the outputs are the recipient’s address and the change address. The size of the transaction in bytes is 568, and in vbytes it is 144. The script type used for this transaction is the Pay-to-Public-Key-Hash (P2PKH).
The cost of this transaction is 0.0005 BTC, which is roughly $4.50. This fee is the sum of the inputs minus the size of the outputs. In this case, the inputs are 0.03 BTC and the outputs are 0.029 BTC, resulting in a 0.0005 BTC fee.
UXTO selection algorithms
UXTO selection and transaction size refer to the process of choosing which Unspent Transaction Outputs (UXTOs) should be included in a given transaction, and the size of the resulting transaction. UXTOs are outputs from previous transactions which have not yet been spent. When creating a new transaction, the wallet software must select which UXTOs to include in order to meet the desired transaction size.
Coin selection algorithms are used to select Unspent Transaction Outputs (UXTOs) from a wallet with the goal of creating a valid transaction. The algorithm works by selecting the smallest number of UXTOs necessary to match the amount of the transaction.
These algorithms are used by wallets to select the UXTOs that result in the lowest fee when sending transactions.
Other common selection algorithms include:
- Random selection
- Greedy selection
- Round-robin selection
Random selection algorithms allow users to randomly select UXTOs from a wallet. Greedy selection algorithms select the largest UXTOs available in a wallet until the desired amount is reached. And round-robin selection algorithms select UXTOs in a sequential order from the wallet. As the size of a wallet increases, selecting UXTOs becomes more and more complex computationally. This is due to the fact that the algorithm must search through an increasing number of UXTOs to find the ones necessary to create a valid transaction. To overcome this complexity, blackjack selection algorithms can be used to reduce the number of UXTOs needed for a valid transaction.
The smaller the transaction, the less you pay in fees. The better a wallet is at selecting inputs, the more it saves you money!
Understanding Miners Transaction Selections
Miners select transactions to include in a block based on a variety of factors, including UXTO selection and transaction size. Miners typically choose transactions with the highest fees, which provide the highest reward for their work.
The fee level of the network is a Monte Carlo calculation of the fees in the previous blocks. There are many services that use other algorithms for this, and its selection is kind of arbitrary because they are all algorithms trying to predict the future. How many transactions are going to join the mempool before your transaction gets confirmed.
They also consider the UXTO selection algorithm used and the size of the transaction, since larger transactions take up more space in the block.
Segwit is a protocol-level fee discount that reduces the fee paid by users. By moving how information in the transaction is stored on-chain, Segwit enables wallets to get a discount on its selected UXTOs and reduces the fee associated with the transaction.
At the end of the day, you must have fees on your transaction that are larger than the next 1MB of transactions in the mempool. As well as just be lucky that the miner chose your transaction and not someone else’s. No amount of math can predict what users after you will submit into the mempool.
The best bet is simply to select a “high” fee level and hope for the best.