— —
Follow on X
LESSONS

Transactions and UTXOs

Bitcoin has no account balances. It tracks unspent outputs. A payment unlocks whole outputs and creates new ones, with change back to you.

6 MIN READ
A transaction unlocks inputs, creates outputs including change, and the difference is the fee.
LEVEL · Intermediate
IN THIS LESSON · 2 OF 9
BY THE END YOU WILL BE ABLE TO ANSWER
  • What is a UTXO?
  • Why does a transaction usually have a change output?
  • A transaction spends inputs of 0.5 and 0.3 BTC and creates outputs of 0.6 and 0.1995 BTC. What is the fee, in BTC?

Then prove it: a 2-question quiz · a challenge. The lesson marks itself complete at 100%.

Bitcoin does not keep balances. It keeps a set of unspent transaction outputs, or UTXOs: discrete chunks of bitcoin, each locked to an address. Think of them as notes and coins of arbitrary size rather than a number in an account.

Spending

To pay someone, your wallet selects UTXOs as inputs, unlocks them with signatures, and creates new outputs: one to the recipient and, because you cannot split a note, one change output back to an address you control. The sum of inputs minus the sum of outputs is the fee, claimed by the miner.

Example: you hold a 0.010 BTC output and want to pay 0.004. The transaction consumes the whole 0.010 and creates 0.004 to them and 0.0059 to you, leaving 0.0001 as fee.

Why this design

  • Verification is simple. A node only needs to know the current UTXO set to check any transaction: do these inputs exist, are they unspent, do the signatures match, do outputs not exceed inputs.
  • Parallelism and privacy. Outputs are independent; a wallet can use many addresses.
  • No accounts to freeze. There is nothing to lock; only outputs and the keys that unlock them.

Things that surprise people

  • Your balance is the sum of your UTXOs; a wallet with many small ones pays more in fees to spend them, because the transaction is bigger.
  • A transaction is valid only when every input is unspent. Once mined, those inputs are gone from the set forever.
  • Transactions have no "from address" in the way email does; they have inputs, which reference earlier outputs.
How the Bitcoin network works · RiverWatch on YouTube ↗
MINI CHALLENGEFind the fee

A transaction spends inputs of 0.5 and 0.3 BTC and creates outputs of 0.6 and 0.1995 BTC. What is the fee, in BTC?

BTC
CHECK YOURSELF
1/2 What is a UTXO?
2/2 Why does a transaction usually have a change output?
pick an answer for each question

SOURCES

  1. Bitcoin: A Peer-to-Peer Electronic Cash System (Satoshi Nakamoto, 2008)
  2. Learn Me A Bitcoin: How does Bitcoin work?
Progress is saved in this browser only.