What are UTXOs?
In Bitcoin, transactions work a bit differently from what you might be used to with account-based models in other blockchains. Bitcoin uses UTXOs (Unspent Transaction Outputs) to represent the amount of Bitcoin available to spend. Each transaction generates outputs, which can later be used as inputs for new transactions.
Think of UTXOs as chunks of Bitcoin with a specific value, kind of like individual cash bills (denominated in satoshis). When you send Bitcoin, the entire UTXO must be spent, even if you only need a fraction of it. Just like when you use a $100 bill to buy something costing $40, you get $60 back in change. In Bitcoin, if you spend part of a UTXO, you get the leftover amount back as a new UTXO.
This process results in multiple UTXOs of varying amounts and their unique identifiers, which your Bitcoin wallet tracks to give you your final balance.
Example of how UTXOs work when transferring between wallets:
- John originally has 2.6 BTC in his wallet, made up of 3 UTXOs. Anny has 1.2 BTC in her wallet, consisting 2 UTXOs.
- John wants to send 2.3 BTC to Anny. To do this, his wallet selects two UTXOs as inputs that total 2.5 BTC.
- The transaction creates two outputs: one UTXO of 2.3 BTC that goes to Anny and another UTXO of 0.2 BTC that returns to John as “change”.
- After the transaction, John’s wallet has 0.3 BTC left, and Anny’s wallet balance increases to 3.5 BTC.
Why Managing UTXOs is Important?
Save on Transaction Fees
Transaction fees in Bitcoin are influenced by the size of the transaction in bytes, which is directly tied to the number of UTXOs being used. More UTXOs mean a larger transaction size, resulting in higher fees and slower confirmations.
For a more detailed breakdown of transaction fees calculation, refer to How are Bitcoin Transaction Fees Estimated?
Ensure Smooth Transactions
Accumulating too many UTXOs in a single Bitcoin address can lead to complications during transactions, particularly if the number of UTXOs exceeds the limits imposed by wallets or APIs. Currently, the Mempool API has a handling limit of 500 UTXOs per address, typical for a standard user’s wallet. Xverse, however, supports up to 5000 UTXOs per address. Exceeding these limits may cause errors when trying initiating transactions.
If your address hits the UTXO limit set by mempool.space, you might encounter an Axios 400 error when sending Bitcoin. To resolve this, try switching your BTC API to Xverse’s API by following our guide here.
Regularly consolidating your UTXOs into larger ones can help prevent these issues, making your future transactions smoother.
What is UTXO Consolidation?
UTXO consolidation is the process of combining multiple small UTXOs into larger, more manageable ones. This can be done manually by selecting UTXOs and sending them to yourself or automatically through your wallet. Consolidation reduces the number of UTXOs, making your wallet easier to manage and potentially lowering future transaction fees.
How to Consolidate UTXOs?
-
Manual Consolidation: This involves manually creating a transaction, selecting specific UTXOs, and sending them to your own address as a new output. While this method gives you more control over your UTXOs, it requires active management.
- Please note that this feature is not currently available in Xverse, but the team is actively working on a dedicated tool for this purpose, which will be released soon.
-
Automatic Consolidation: This process is managed by your Bitcoin wallet, which automatically selects and combines multiple UTXOs into a single output based on predefined settings. Unlike the manual method, this approach is hands-off, allowing the wallet to handle the consolidation without requiring your direct involvement.
To consolidate your entire balance in Xverse, you can simply MAX send your balance to yourself.
In Xverse, you can consolidate UTXOs by sending any amount, or your entire balance, to yourself. Smaller transactions will result in less consolidation.
Notes on UTXO Consolidation
- Consolidation incurs transaction fees but can save on future fees if done strategically.
- To minimize fees, perform UTXO consolidation during periods of low network congestion. You can refer to mempool.space for the real-time update of network condition and fee rate.
- If the size of your UTXOs is too small (considered “dust UTXOs”), they might not be selectable for consolidation by the wallet.