Not your Bitcoin basics← Back to YourBitcoinBasics.com

From Chapter 4: “To go deeper, see NotYourBitcoinBasics.com/utxo.”

Pieces, not balances

The book uses bills in your pocket. This page shows the real structure.

In simple words

Your wallet does not hold a balance. It holds pieces of bitcoin, like bills in a pocket. A payment spends whole pieces and makes new ones, and the change comes back to you.

What a payment really is

A bitcoin payment has two lists.

The rule every node checks: the inputs must add up to at least the outputs. Whatever is left over is the fee. The fee is not written as an output. It is simply the difference, and the miner who includes the payment collects it.

The book’s example, written the way the ledger sees it:

Amount
Input: one piece you own50,000 sats
Output 1: the payment, to the shop’s address12,000 sats
Output 2: your change, to a new address of yours37,800 sats
Fee (inputs minus outputs)200 sats

Once this payment confirms, the 50,000-sat piece is gone for good. Two new pieces exist in its place. Your wallet now counts the 37,800 as yours.

The only pieces that do not come from earlier pieces are the miner’s pay in each block, the coinbase transaction (see /block). Every bitcoin in existence can be traced back, piece by piece, to one of those.

Three things you will notice

  1. Change goes to a new address. Your wallet makes a fresh address for the change, from the same 12 or 24 words. It is still yours. Using a new address makes it harder for an outsider to tell which output was the payment and which was your change.
  2. Many small pieces cost more to spend. The fee depends on how much space your payment takes in a block, not on the amount. Every input adds space, about 68 virtual bytes for a typical modern address. Spending ten small pieces takes roughly ten times the input space of spending one large piece. When fees are low, some people combine small pieces into one (called consolidating). Pieces so small that the fee to spend them is more than they are worth are called dust.
  3. Reusing an address hurts your privacy. Everything on the ledger is public. If you give the same address to everyone, anyone who knows one payment is yours can see them all. And when one payment spends several of your pieces at once, an outsider will assume they all belong to the same person. That assumption is usually right.

Seeing your own pieces

Many wallets hide the pieces. Some show them under a tab called “UTXOs” or “Coins,” and let you choose which pieces to spend (called coin control) and label where each came from. That is useful for privacy and for taxes, because each piece has its own date and cost.

The payment’s ID

Every payment has an ID, a long string of letters and numbers. It is a fingerprint (double SHA-256) of the payment’s data. That is how an input points to the exact earlier piece it spends: payment ID, plus the output’s position in that payment.

Try it

On mempool.space, open any recent payment. Find the inputs on the left and the outputs on the right. Add up both sides and subtract. The difference is the fee shown on the page.

Words on this page

Address
The number on the mailbox, the thing you hand to someone who wants to pay you.
Block
A page of the ledger, a batch of transactions added about every 10 minutes.
Coinbase transaction (generation transaction)
The first entry in every block, where new bitcoin is minted and the miner is paid, and the only door new bitcoin comes through; not the company of the same name.
Fingerprint
The everyday word this book uses for a hash.
Ledger
A list of who owns how much.
Mempool
The queue of checked, unconfirmed transactions, waiting for a miner to put them in a block.
Miner
A computer competing to add the next block, paid in new bitcoin and fees when it wins.
Node
A computer with a full copy of the ledger that checks everything for itself.
Satoshi (sat, sats)
The penny of bitcoin, only smaller.
UTXO
An unspent entry on the ledger, a specific amount of bitcoin, locked to your key, that you have not spent yet.
Wallet
The app or device you use to hold and send bitcoin.

Sources

  1. Satoshi Nakamoto, “Bitcoin: A Peer-to-Peer Electronic Cash System,” 2008, sections 2 (transactions) and 9 (combining and splitting value), bitcoin.org/bitcoin.pdf.
  2. Transaction format, inputs and outputs: Bitcoin Developer Documentation, “Transactions,” developer.bitcoin.org/devguide/transactions.html.
  3. Input and output sizes: Bitcoin Optech, “Transaction size calculator,” bitcoinops.org/en/tools/calc-size/.
  4. Privacy and address reuse: Bitcoin Wiki, “Privacy” and “Address reuse,” en.bitcoin.it.