This next section of Satoshi’s whitepaper explains how individual transactions are structured.
Rather than having a transaction for every cent transferred, Bitcoin structures each transaction to contain one or more different inputs and at most two outputs.
“To allow value to be split and combined, transactions contain multiple inputs and outputs.”
Each transaction spends outputs from prior transactions and generates new outputs that can be spent by transactions in the future.
At any point in time, we have a full record of all “unspent” transactions (i.e., the outputs). This model of storing and keeping track of unspent transactions is called the UTXO (Unspent Transaction Output) model.
A user’s wallet keeps track of a list of unspent transactions associated with all addresses owned by the user. Logically, the balance of the wallet is the sum of those unspent transactions.
Let’s look at an example.
- Let’s assume that Bob’s wallet has 5 unspent bitcoins.
- Alice, another user in the network, owns 1 unspent bitcoin.
- Bob wants to give Alice 2 bitcoins. In order to send 2 bitcoins, he has to send the unspent 5 bitcoins to Alice as the input to the transaction. This transaction then returns 3 bitcoins to Bob as output in the form of a new UTXO (often known as “change”). This UTXO is signed back to a newly created address that is owned by Bob.
- Alice’s wallet now has a balance of 3 bitcoins. She has two UTXOs: one from before and another from the bitcoin she just received from Bob. If she wants to send these bitcoins to others, she can use the UTXOs as inputs.
Therefore, the state of the Bitcoin network is essentially defined by the set of all transaction outputs that are not yet spent, the UTXO Set.
To make sure you really understand this, I recommend you spend a few minutes going to a Bitcoin block explorer and looking at the transaction data.
Here is an example:
The only exception to this output and input model is the coinbase, which, you’ll recall from a previous lesson, is the first transaction in every block. The coinbase transaction creates brand-new bitcoin (i.e., the “block reward”) for the miner that mined that block. The input of this transaction is not a UTXO from a previous transaction, but rather a special type of input. Every block creates new bitcoin that gets assigned to the miner through this coinbase transaction. This is how the money supply of Bitcoin increases.
Satoshi concludes by saying that the problem of a “fan-out,” where a transaction depends on many other transactions, is not a problem.
“It should be noted that fan-out, where a transaction depends on several transactions, and those transactions depend on many more, is not a problem here.”
As soon as an UTXO serves as input to a new transaction, that input is destroyed. At any point in time, we have access to the full UTXO set, and that is all that is needed in order to know who owns which bitcoins.
Phew! We’re getting to the end. Next up, we’ll look at the crucial issue of Bitcoin privacy.