A friend asked me to explain UTXOs yesterday. So I said to him: "That's the same thing you get when someone gives you a million dollars. It's cool, but it's better to have the million in paper money, because if someone gives you a million dollars in change, there'll be enough to fill a truck. You'll spend the bigger bills a lot better and it'll definitely be cheaper than driving around with a truck full of change and shopping with it."
How would you explain UTXOs to someone who doesn't understand bitcoin at all?
I prefer bank check analogy. 1 UTXO of 0.5 BTC = 1 bank check of 0.5 BTC If you have to pay 0.1 BTC, you give your bank check of 0.5 to the merchant and he gives you back a bank check of 0.4 BTC
reply
That's a decent model, except that it implies that the merchant has the entire balance before returning the change
reply
What is 0.5 BTC, in this example? What is it made of, on the blockchain.
reply
It isn't made of anything. It is merely a number that says 50,000,000 sats with a public and private key associated with it. The blockchain is just the record-keeping and security base layer needed to ensure that those little entries that say 0.5 BTC, 2 BTC, etc. all possess the properties necessary for them to function as money.
reply
I use an analogy with USD. UTXOs are like the bills that I carry around in my wallet. If I go to buy a coffee and it costs $3, I can pay with $1, $5, $10, $20, or $100. I could choose any of them to pay for the coffee.
If I choose the $1 UTXO, then I would need 3 of them to pay for the coffee and I'd get no change back.
If I choose the $5 UTXO, then I get $2 change back (now itself a $2 UTXO for me to use in the future).
I could pay with the $100 too and get a $97 UTXO back, but now the vendor would know that I have at least $97 more on me. Similarly if you buy something with bitcoin that is a small amount of sats and use a UTXO worth much more, it works but you are revealing to the vendor that you have more bitcoin.
If they understand this, then I also add in this:
If there is something that you are buying that costs $50, it takes more time and energy to count out 50 $1 bills. It is much easier to just use a combination of larger bills or a single $50. In bitcoin terms, combining multiple smaller UTXOs is similar in that the more UTXOs you use, the larger the transaction becomes and the more expensive it is to send.
reply
Surely anyone who receives a payment from you, of any size, will know your address and hence your balance?
reply
This is why any good wallet software doesn't reuse addresses. The receiver knows the address, the amounts and change.
reply
Yes, thats what you have more bitcoin wallets created :)
reply
They will only know the change from the UTXO that I sent them. So unless you reuse addresses, then your entire balance is still hidden from them.
reply
Thank you for your in-depth explanation. I understand UTXOs a little bit better
reply
Remember in the first episode of the Sopranos when Carmela takes out a wad of cash from a tomato can or something like that ?
Each utxo is a wad of cash.
reply
You need to draw lots of pictures, otherwise it will remain too abstract.
Here's my attempt. You have two UTXOs, worth 0.3 and 0.7 BTC, as notes with a strip of magic bitcoinium or something:
+---+ +-------+ |XXX| |XXXXXXX| +---+ +-------+ | | | | |0.3| | 0.7 | | | | | | | | |
and if you want to pay someone 0.8 BTC, you put them together and prepare the new notes, the outputs:
| | | | | | |Ɛ˙0| ᠘˙0 | | | | +---+-------+ |XXX|XXXXXXX| +---+-------+ +--------+--+ | | | | .8 |.2| <- invalid until the transaction is processed | | | | | |
and as you sign the old notes, the strip of magic bitcoinium attaches to the new notes and redistributes itself into 0.8 and 0.2:
| | | | | | |Ɛ˙0| ᠘˙0 | <- spent | | | +---+-------+ +--------+--+ |XXXXXXXX|XX| +--------+--+ | | | | .8 |.2| | | | | | |
and then you pay with the 0.8 UTXO and pocket the 0.2 one as change.
reply
I'd say this:
Don't compare it with money. Money has bills, which you can give away, and receive.
Bitcoin is ONLY transactions. "I have 1 BTC" is synonymous with "Transactions exist the bitcoin ledger which have me as the recipient, their total is 1 BTC, and I haven't spent any of them.".
They are, in other word, unspent transaction objects. UTXOs.
For a real life example, imagine you, Bobby, want to buy a hat from me. You don't have money, so you say "Steve owes me money, here's the proof of that, he'll give you the money". Then, if I want to spend that "money" buying a prostitute from Alice, I'll say "Here's a proof that makes you the rightful receiver of Bobbys money".
But there is no money carrying Bobby. It's transactions all the way down! The "minting" of new BTC (which miners receive as a reward) is itself an IOU given by the system; i.e. everyone agrees that that miner is owed that much coin.
As a sidenote, this is not how for instance Ethereum works, which is another reason ethereum is basically a prostitute.
reply
It's a lot more like cash than it's like an IOU
reply
I certainly defer to your knowledge. I hope I haven't spread misinformation.
If you have the time, can you help me understand? I'm a novice at bitcoin but experienced with ethereum.
In ethereum, accounts are stored on-chain with some associated data, including "balance". So they are like regular cash, all accounts have a balance.
And I thought that for bitcoin, this is not true, there is no place where the ledger contains: "owner of pubkey A has balance 1 btc", all that is recorded is transactions of the form "Transaction from owner of pubkey P: Whoever is the owner of pubkey Q is now delegated the ability to spend 1 BTC of what pubkey P was allowed". So to check "how many BTC do I have?" you need to find all transactions that delegate spending to you, and sum it up.
I'm really interested and if you want to help me understand I appreciate it, I'll give you 5k sats for any attempt. (i learn by bribing people :))
reply
I’d say that Ethereum’s system behaves more like a bank account: you have a single account, any amount received or sent is added or deducted from that balance. When other network participants learn your address they can track your account balance. Transactions from an account are processed in a fixed order to ensure that an account cannot be overdrawn.
Bitcoin instead uses a UTXO-based model. Every transaction output is individually tracked by every full node. Unspent Transaction Outputs (UTXOs) can only be spent in full for exactly the amount assigned to them. Whoever can fulfill the conditions encoded in the output script can spent the funds. Bitcoin users generally use a new address for every payment they receive, which makes it impossible for other users to remotely assess a wallet balance. When you create a transaction, you specify exactly which UTXOs you are spending. This allows transactions to be processed in any order and makes transaction outcomes immutable. Bitcoin UTXOs are more like cash, you designate specific UTXOs that are used similar to how you may hand over a specific $20-bill and a specific $10-bill at the baker’s to pay $21. Since you have to spend UTXOs completely, in your Bitcoin transaction you’d add a change output to yourself to return the $9 change that you’d get from the baker. That’s where the analogy breaks down, though: in Bitcoin that would be a single UTXO, whereas the baker would probably hand you a $5-bill and four $1-bills.
Either way, when you get paid in Bitcoin, the entire network has a record of the funds that you own in the UTXO set. While the transaction is recorded in the blockchain, once the UTXO exists, it no longer matters how that UTXO came to be (except for how you identify the UTXO). As the holder of the corresponding private key, you are the only one that can fulfill the conditions of the output script encoded in your UTXO. You own that UTXO’s amount, just like you’d own a bill in your wallet. It’s not some sort of IOU. You can spend your coin as evidenced by its existence and the appropriate sign-off of the corresponding private key. And just like with bills in your wallet, nobody else can tell which ones are yours unless they get to see the content of the wallet.
reply
If I were a prostitute, I'd be outraged to be compared with such low standards.
reply
I find Bitcoin Designed explains it visually clear: https://www.bitcoindesigned.com/infographics/privacy-and-utxo-part-1/
reply
This is a good simple explanation with diagram of it!
reply
I just spent 10mins thinking about it...
Its quite a difficult thing!
Interested to see some results here
reply
I agree, I don't understand what this is for at all, why don't I just convert the exact amount to sat
reply
Satoshi is too small a unit when you need to count large transactions :D
reply
What do you mean by that? It is already expressed as sats onchain
reply
Oh my goodness thank you for asking this question. I have been wondering about UTXO for the longest time but didn’t know how to even ask a question about it
reply
It's easiest for me to explain with a drawing. Show a transaction as a set of inputs plus a set of outputs. Then show another transaction that uses the outputs of the last transaction as inputs
reply
Think of each UTXO as a coin. They can come in any denomination. Whenever you make a transaction, all the coins you're spending are melted down and you create (usually) two new coins of the appropriate denominations to pay the recipient and return the remainder to yourself.
For example if you have two coins of two and three bitcoins and want to pay Alice four, you melt your two coins and create a new coin to pay her and a second coin of one bitcoin value to keep.
reply
Imagine a spreadsheet with columns A for sender, B receiver, C amount, and D send_to_next. When Alice sends Bob bitcoin a new row is added with Alice in column A, Bob in column B, the amount in C and D is blank. In an existing row with Alice in column B, Bob is added to D. So if D is blank it is unspent. If you sum up all the amounts where Bob is in column B, and D is blank, you get Bob's bitcoin balance. These rows are the UTXOs.
reply
reply