MASTERING-BITCOIN Β· Unit 2 Β· Video 2 Β· Interactive Practice
| Formula | Name | Description |
|---|---|---|
| Transaction Fee | Implicit miner fee β the gap between inputs and outputs | |
| Change Output | Unspent value returned to the sender via a new output | |
| Unit Conversion | A satoshi (sat) is the smallest Bitcoin unit | |
| Wallet Balance | Sum of all unspent transaction outputs your keys can unlock |
In Bitcoin, the fee is never written explicitly into a transaction. It is simply the gap between total input value and total output value. The miner who includes your transaction in a block claims this gap as payment.
Explore: What happens when you turn OFF the change output? Watch the fee bar carefully.
β interactive visualization β coming to this page format soon
π‘ Key insight: Toggle the change output OFF and watch the fee explode! Without a change output, the entire remainder goes to the miner. It's like handing the cashier a $20 bill for a $5 coffee and walking away without waiting for change β the cashier keeps it all.
Your wallet holds multiple unspent transaction outputs (UTXOs) of different sizes. When making a payment, the wallet must choose which UTXOs to combine as inputs. Each additional input makes the transaction larger in bytes, which increases the fee.
Explore: Try different UTXO combinations to pay the target. Which selection gives the lowest fee?
β interactive visualization β coming to this page format soon
π‘ Try this: Compare using just the 80k UTXO (1 input, fee = 5,000) vs. combining 10k + 25k + 50k (3 inputs, fee = 15,000) to pay 60,000. Fewer inputs = smaller transaction = lower fee, even though it creates more change. This is why wallets consolidate small UTXOs when network fees are low.
Bitcoin transactions come in recognizable shapes depending on how many inputs and outputs they have. The same rules always apply (inputs fully consumed, outputs explicitly created, gap = fee), but the shape reveals the intent.
Explore: Select each transaction type and compare the structures. How would you identify each pattern on a block explorer?
β interactive visualization β coming to this page format soon
π‘ Key pattern: All three shapes obey the same rule β inputs fully consumed, outputs explicitly created, gap = fee. On a block explorer, you identify the type by counting: 1 in β 2 out is a payment, many in β 1 out is consolidation, and 1 in β many out is batching. The blockchain itself never labels the purpose.
Question 1
Alice creates a transaction with one input of 200,000 sats and two outputs: 150,000 sats to Bob and 40,000 sats back to herself as change. How much does the miner collect as a fee?
β Correct! Fee = 200,000 β 150,000 β 40,000 = 10,000 sats. The implicit gap goes to the miner.
β Not quite. Remember: Fee = Total Inputs β Total Outputs. Sum all outputs and subtract from the input.
Solution:
The fee equals total inputs minus total outputs:
The fee is never written as a field in the transaction β it is simply whatever input value is not claimed by any output. The miner who includes this transaction in a block collects the 10,000 sat difference.
Question 2
Bob has a UTXO worth 80,000 sats and wants to pay Carol 30,000 sats. He creates a transaction with one input (80,000 sats) and only one output (30,000 sats to Carol). He does NOT create a change output. What happens to the remaining 50,000 sats?
β Correct! Bitcoin has no refund mechanism. The entire 50,000 sat remainder becomes the miner's fee. Ouch!
β Not quite. There is no mechanism in Bitcoin to automatically return unspent value. What happens to the gap between inputs and outputs?
Solution:
The miner collects all 50,000 sats as the fee!
In Bitcoin, there are no automatic refunds. Inputs must be fully consumed, and any value not explicitly assigned to an output goes directly to the miner. This is why wallets always create change outputs automatically β forgetting one is an extremely expensive mistake.
Question 3 Β· True or False
Statement: On the Bitcoin blockchain, the payment output and the change output in a transaction are structurally different β the network labels which output is the payment and which is the change.
β Correct! Payment and change outputs are structurally identical. The network has no concept of which is which β they're both just an amount plus a locking script.
β Not quite. Think about what data each output actually contains. Is there any field that says 'this is change'?
Solution: False
At the protocol level, all transaction outputs are structurally identical. Each output contains only:
There is no field that marks an output as "payment" or "change." Both look exactly the same to the network. This is why privacy-conscious wallets generate a fresh, never-before-used address for every change output β if change went back to a reused address, a blockchain observer could identify which output is change (the reused one) and deduce the payment amount.
Question 4
Your wallet holds UTXOs of 10,000, 25,000, 50,000, and 80,000 sats. You need to pay 60,000 sats. If the fee is 5,000 sats per input used, which coin selection strategy results in the lowest total fee?
β Correct! Fewer inputs = smaller transaction = lower fee. The 80k UTXO alone needs only 1 input, giving the minimum fee of 5,000 sats.
β Not quite. Each additional input increases the transaction size and fee. Which option uses the fewest inputs while still covering the payment?
Solution:
Using the 80,000 sat UTXO alone gives the lowest fee at 5,000 sats.
| Strategy | Inputs | Total In | Fee | Change | Valid? |
|---|---|---|---|---|---|
| 80k alone | 1 | 80,000 | 5,000 | 15,000 | β |
| 25k + 50k | 2 | 75,000 | 10,000 | 5,000 | β |
| 10k + 25k + 50k | 3 | 85,000 | 15,000 | 10,000 | β |
| All four | 4 | 165,000 | 20,000 | 85,000 | β |
Each additional input adds bytes to the transaction, increasing the fee. Using one large UTXO minimizes transaction size and therefore the fee β even though it creates more change.
This is why consolidating small UTXOs during low-fee periods is a smart wallet strategy: it reduces the cost of future spending.
Solved: 0 / 4