Save on Bitcoin transaction fees with UTXO management
In this post, I'll explain the basics of Bitcoin UTXO consolidation and how, if done correctly, it can help you save on future transaction fees. Don't worry if you don't know what a "UTXO" is; I'll cover all the essential information you need to understand and perform consolidation on your own.
Understanding the UTXO and Transactions
"UTXO" stands for "Unspent Transaction Output," and is essentially how your Bitcoin is stored. Each UTXO is like a bill in your wallet, representing a specific amount of Bitcoin. Just as you might have various denominations of cash, like $1, $5, or $10 bills, each UTXO can hold a different amount, such as 0.021541 BTC, 1.21 BTC, or even a tiny 0.00000215 BTC. Your wallet manages these UTXOs, and each one remains untouched until you decide to spend it in a transaction.
In the bitcoin network, a transaction consumes UTXOs as input, and creates new UTXOs at the output.
Cash Example: Paying a Friend
Check out the diagram below too see what a regular cash transaction with your friend might look like as a bitcoin transaction. Note how the change is sent back to you as an output of the transaction.
Your $20 UTXO is consumed in the transaction, and 2 new UTXOs are created. One worth $15 and going to your friend, and one worth $5 sent back to you because it's your "change".
Let's now look at a simple bitcoin example.
Simple Example: Paying a friend
In the example above, not much has changed from the Cash example presented earlier. The difference is we added another output where we pay a miner. Since there is no middle man in bitcoin, you have to pay a fee with your transaction to incentivize a miner to include your transaction in their next bitcoin block, basically ensuring your transaction makes it into the blockchain.
The fee you pay to the miner is based directly on the number of "virtual bytes" your transaction is made of. Simply put, the bigger the transaction, or the more inputs and outputs, the more virtual bytes it takes to retain the information of the transaction. The final fee paid to the miner is equal to the product of your transactions' virtual bytes (vB) and the market fee rate. You can see the current market fee rate at mempool.space. Notice the units of the fee rate; they are in sats/vB, meaning when you multiply the total vB with the fee rate you're left with an amount of sats.
What is UTXO consolidation
UTXO consolidation is the process of combining your many UTXOs in your wallet to a single UTXO. Generally, people do this to save on fees. In the last section, we mentioned that the fee due to the miner is dependent on the size of the transaction in "virtual bytes." Most bitcoin transactions look something like this:
Notice how we don't have a single UTXO big enough to cover the cost of the desired transaction, so we must supply 2 UTXOs, increasing the size of the transaction, and the fee the miner will require.
Normally, when the transaction fee rate is low, this isn't a really big deal. However, the bitcoin fees can become quite high, and the addition of each new input to the transaction can end up costing a substantial amount.
To counteract this, when the fee market is cool and fee rates are low, its a good time to combine your UTXOs by sending them to yourself so that when you need to use them in the future, you can save money by not having to supply a bunch of inputs. Below is an image of what a consolidation transaction might look like:
Remember, the idea is to combine your UTXOs when the transaction fee rate is low. You can see the rate for blockspace at mempool.space
Dust UTXOs
If you spent some time thinking about how transaction fees are calculated , you may have come to realization that it's possible you can have UTXOs worth so little that it doesn't cover the fee that it will cost to spend it. This is known as a "dust UTXO," and if you frequently receive small UTXOs, you should find a way to make them bigger or be on top of your UTXO management and consolidation so that you don't risk your UTXOs turning to dust.
In the long-run, I believe this is a non-issue, as bitcoin is finite, and blockspace, if given enough time, is infinite. Everything goes to zero against bitcoin, including the price for blockspace.
Wrapping Up
So there you have it, everything you need to know about saving fees with bitcoin UTXO consolidation. If you want to see a live demo of me performing a bitcoin consolidation with Sparrow Wallet, check out the youtube video at the top of this post. The Sparrow demo starts at 4:39.
If you found value in this content, please share it with your friends or someone who is going down the bitcoin rabbit-hole. Additionally, feel free to let me know topics you would like to see covered.
Thanks for reading!