Finally had some time to bring myself up to speed on UTXOs. Still quite confused about them actually, so I’m sure my DYOR notes are fallible. Please point out my mistakes and lapses in my thinking:
About UTXO
  1. UTXO refers to Unspent Transaction Outputs. It is an accounting method aimed to calculate the total balance in one’s wallet. In other words, your account balance is the sum of your UTXOs.
  2. It represents the amount of the Bitcoin that is left over after a transaction has been finalised.
  3. Operating on inputs and outputs, UTXO allows transactions to happen trustlessly. For instance, people can exchange non-fungible Ordinals for fungible Cardinals.
  4. Every transaction has a script - which denotes the conditions that must be met in order for a transaction to be validated - attached to it. Three factors are typically considered, namely privacy, computational efficiency and size.
  5. It is important to note that UTXOs are not divisible. This means that you send your entire UTXO to your recipient and receive your change back in the form of a new UTXO.
  6. The more UTXOs you have to send, the larger your transaction becomes and the more costly it consequently becomes to send.
  7. If you wish to carry out a CoinJoin so that your Bitcoin becomes untraceable, you have to move each UTXO you end up with individually - without mixing them - to a new unique address from your cold wallet.
  8. UTXO Dealership is a recent privacy tool that allows Bitcoin buyers who wish to safeguard their privacy an opportunity to buy history-free UTXOs from Bitcoin miners. (supertestnet.github.io/utxo-dealership/ ) Bitcoin miners consequently get higher returns for their newly mined UTXOs. It’s a win-win situation.
Some corrections/commentary:
  1. UTXO refers to Unspent Transaction Outputs. It is an accounting method aimed to calculate the total balance in one’s wallet. In other words, your account balance is the sum of your UTXOs.
UTXO refers to Unspent Transaction Output (plural: UTXOs). Funds in the Bitcoin network are tracked in the form of individual UTXOs. Your wallet’s balance is the sum of the UTXO amounts it can spend, however, the total amount you can send from your wallet is lower, since you will need to pay fees on the transaction.
  1. It represents the amount of the Bitcoin that is left over after a transaction has been finalised.
It is not clear to me what you mean with that. Each output on a transaction creates one UTXO and each input on a transaction consumes a UTXO. If you have funds left over, you have to send them back to yourself in the form of a change output (your wallet does this automatically unless you are fiddling with raw transactions). Funds that are not explicitly assigned to an output can be collected as the transaction fee by miners. I.e. transaction fees = Σ(input amounts) – Σ(output amounts).
  1. Operating on inputs and outputs, UTXO allows transactions to happen trustlessly.
The UTXO-model (as opposed to e.g. the account-based model used by Ethereum) makes the transaction outcome immutable. While in an account-based model, you still need to check whether the account still has sufficient balance, directly declaring which exact UTXOs you are spending make it possible for transactions from the wallet to be processed in any order. The UTXO model further allows you to spend funds encumbered with many different output scripts (i.e. different addresses) and pay many different recipients in a single transaction. This allows Bitcoin users to use a new address on every invoice (and in fact, use the address as an invoice identifier), while in the account-based model, you usually can only spend from one account to one other account, which causes extreme address-reuse and undermines financial privacy.
  1. Every transaction has a script - which denotes the conditions that must be met in order for a transaction to be validated - attached to it. Three factors are typically considered, namely privacy, computational efficiency and size.
Every transaction output consists of two fields: amount and output script. The output script denotes the conditions that must be satisfied by the input spending the transaction output for a transaction to be valid.
  1. It is important to note that UTXOs are not divisible. This means that you send your entire UTXO to your recipient and receive your change back in the form of a new UTXO.
You’re right that UTXOs have to be spent in full, but your UTXO is not sent to your recipient. A transaction consumes all UTXOs spent by inputs and creates a complete new set of UTXOs per its outputs. You are right, though, that you need to create a change output to yourself if you have leftover funds after paying your recipient, otherwise the funds fall to the miners (see 2. above).
  1. The more UTXOs you have to send, the larger your transaction becomes and the more costly it consequently becomes to send.
Correct! You are bidding for blockspace with your transaction fees, so the fees correspond to the weight of a transaction and are independent to the amount it transfers. Inputs generally weigh more than outputs and more inputs make for a heavier transaction.
  1. If you wish to carry out a CoinJoin so that your Bitcoin becomes untraceable, you have to move each UTXO you end up with individually - without mixing them - to a new unique address from your cold wallet.
Do you mean that you need to make sure that you don’t combine UTXOs you receive from mixing as that might undermine your prior mixing effort?
reply
Most of the confusion stems from the fact that people try to fit Bitcoin into the Addresses and Balances mental model, but it doesn't work like that. You must think in terms of Transactions, which are the atomical operation of Bitcoin and the actual pieces of data that are stored in the blockchain.
Transactions have Inputs and Outputs. Each input is a pointer to a single Output from a previous Transaction, and contains the unlocking script for that previous Output.
Each Output has some sat value assigned to it, plus a locking script. Outputs begin their lifecycle as UTXOs. The moment a new Transaction appears that points to and unlocks them successfully it ceases to be an UTXO and cannot be pointed at by any other Transaction (that'd be a double spend).
Finally, the Transaction fee is the difference between the total sat value assigned to the previous Outputs that are being spent minus the total sat value assigned to the Transaction's own Outputs. If that number is less than 0 the Transaction is invalid and rejected.
Tip: mempool.space is great to make sense of it all in a visual way.
reply
Tip: mempool.space is great to make sense of it all in a visual way.
Yep, and they have very good documentation https://mempool.space/docs/faq
reply
In simple terms: Think of UTXO as some coins in your pocket. ikf you have a bigger fiat bill of 10 bucks and you pay me with 1buck, I will give you back 4 coins of 1buck or one of 4bucks and you put it into another pocket.
see in Electrum is displayed as "coins" tab
reply
So you get to choose what kind of UTXOs to return to your recipient? Thanks for the explanation
reply
with specific scripts could be possible but usually wallet apps are doing this process more easily for the user,
reply
  1. You receive a digital note of 0.5 BTC in your wallet. This is a UTXO.
  2. You want to pay a friend 0.3 BTC.
  3. You use your 0.5 BTC note, and you get back a new note of 0.2 BTC as change. This new note is a new UTXO in your wallet.
  4. The old 0.5 BTC note is gone, used up, and your friend now has a new UTXO of 0.3 BTC.
Just like with cash, once you use a note (UTXO), it's gone, but you get change back as a new note (UTXO), ready to be spent in the future.
reply
UTXOs are like physical cash media. If I give you $10 in 2 $5 bills.. you have 2 $5 bills that equal $10. Just like if I have 2 UTXOs equaling a total. Then the change acting the same way as breaking bills getting change back.
reply
There are no bitcoins, just UTXOs😉
With number 6. - this is why we believe it is good to consolidate smaller UTXOs into a larger one.
reply
but not so large... never keep all your bitcoin into a single UTXO. Always size your UTXOs to be ready enough to open a decent LN channel. Onchain UTXOs should be used exclusively for opening/closing LN channels.
You end up with small UTXOs because you are transacting too much onchain instead of LN.
reply
Yep. Couldn't agree more!
reply
What are the risks of having all your on-chain Bitcoin in one UTXO? I just condensed all 50 into only one now. But I DCA. So more will be on the way in larger chunks in the future.
reply
Pay attention to this guide. is all explained there. https://darth-coin.github.io/beginner/be-your-own-bank-en.html
reply
Is there a STXO? Is that the "spent" output that goes to the miner for a fee?
reply