The UTXO Model
Asha's wallet says she has 8 coins. Yet on Bitcoin there is no line anywhere that reads "Asha: 8". Her 8 is the sum of separate unspent outputs, a bit like carrying one 5-coin note and one 3-coin note. To pay 6, she hands over notes and takes change. This is the UTXO model, short for unspent transaction output.
The rule
Spend whole outputs, send the change back to yourself; the rest is the fee.
- Every transaction has inputs, which point to earlier unspent outputs and unlock each one with a signature, and outputs, which lock new amounts to addresses.
- An output is always spent whole, and only once. After that it leaves the set of unspent outputs for good.
- Your balance is the sum of all the unspent outputs your keys can unlock.
- The fee is not written anywhere as its own field. It is total inputs minus total outputs, and the block producer collects it.
Catching double spends is simple: every node keeps the current UTXO set and rejects any input that points to an output not in it.
Wallets hide most of this. When you press "send", the wallet chooses which of your outputs to spend, adds the change output for you, and shows you a single balance. It usually sends the change to a brand-new address of yours rather than an old one, which makes it a little harder for outsiders to link your payments together.
Bitcoin and Litecoin use this model. Cardano uses an extended version, eUTXO, where outputs can also carry data and be locked by scripts, which lets it run smart contracts while keeping the same "consume old outputs, create new ones" style.
The shortcut
Write every UTXO transaction as a tiny ledger: inputs on the left, outputs on the right, and fee = left minus right.
Pick inputs
Asha's unspent outputs are 5 and 3. Neither covers 6 alone, so her wallet uses both. Inputs total 8.
The classic mistake is forgetting the change output. If Asha's wallet sent 6 to Ravi and created nothing else, the whole leftover 2 would become the fee.
Drills
Answer fast — trust the rule.
Meera owns unspent outputs of 4, 2 and 1. What is her balance?
A transaction spends inputs of 10 and 5 and creates outputs of 12 and 2.8. What is the fee?
Why does a UTXO transaction usually include an output back to the sender?
A node sees an input pointing to an output that was spent in an earlier block. What does it do?
Kabir owns one output of 10. He pays Asha 3 and wants to leave a fee of 0.2. What change output should he create?
Remember
- Spend whole outputs, send the change back to yourself; the rest is the fee.
- Shortcut: inputs on the left, outputs on the right, fee is left minus right. Your balance is the sum of your unspent outputs.
- Trap: forget the change output and the leftover becomes the fee.
