MASTERING-BITCOIN · Interactive Practice | Unit 10 · Video 1

The Hidden Auction: How Bitcoin Transaction Fees Actually Work

IKey Formulas

Formula Name Description
Fee=inputsoutputs\text{Fee} = \sum \text{inputs} - \sum \text{outputs} Implicit fee No fee field exists; the leftover is the fee
Fee rate=Fee (sats)Size (vB)\text{Fee rate} = \dfrac{\text{Fee (sats)}}{\text{Size (vB)}} Fee rate The bid that miners actually compare
1 sat/vB0.25 sat/WU1 \text{ sat/vB} \approx 0.25 \text{ sat/WU} Unit conversion sat/vB to sat/WU
1 sat/vB=108 BTC/kB10001 \text{ sat/vB} = 10^{-8} \text{ BTC/kB} \cdot 1000 Unit conversion 2525 sat/vB =0.00025= 0.00025 BTC/kB

IIVisualization 1: The Mempool Auction

Miners pull transactions from the mempool that maximize their revenue per virtual byte. Block space is limited (~1,000,000 vB), so not every transaction fits. Adjust the minimum fee rate miners are willing to include and the block capacity to see who makes it into the next block.

Conceptual question: Why does a transaction paying a higher total fee sometimes lose to one paying a lower total fee?

⚙ interactive visualization — coming to this page format soon

Notice: Transactions are picked by fee rate, not total fee. Try lowering the miner threshold — low-fee-rate transactions only get in when the block has spare capacity. Raise the threshold and even fat transactions paying large totals get rejected if their rate is too low.

IIIVisualization 2: Fee Rate vs Total Fee

Two transactions can pay very different totals but compete on the same metric: sat/vB. Use the sliders to construct two transactions and see which one a miner would prefer.

Conceptual question: Which transaction wins — the one with the larger total fee, or the one with the higher fee per virtual byte?

⚙ interactive visualization — coming to this page format soon

Reflect: Try making Tx B pay 10,000 sats with size 1000 vB, and Tx A pay 2,000 sats with size 100 vB. Tx B pays five times more in total — but Tx A wins, because miners care about revenue per byte of scarce block space.

IVVisualization 3: The Change Output Disaster

A Bitcoin transaction has no "fee" field. The fee is whatever you fail to assign to an output. Adjust the inputs and outputs below to see what happens — including what occurs if you forget the change output entirely.

Conceptual question: What protects you from accidentally sending 19 BTC to a miner as a fee?

⚙ interactive visualization — coming to this page format soon

Notice: When you uncheck "Include change output," the entire leftover input becomes the fee. The protocol does not check whether your fee looks sane — it just enforces Fee=inputsoutputs\text{Fee} = \sum \text{inputs} - \sum \text{outputs}. The only protection is well-written wallet software constructing the change output for you, every single time.

VPractice Problems

Question 1 · Computing the Fee Rate

A Bitcoin transaction pays a total fee of 4,5004{,}500 sats and occupies 300300 virtual bytes.

What is its fee rate in sat/vB?

Correct! Fee rate = total fee ÷ size = 4,500 ÷ 300 = 15 sat/vB.

Not quite. Fee rate is fee divided by size, measured in sat/vB.

Show solution

Solution:

Fee rate is total fee divided by transaction size:

Fee rate=Fee (sats)Size (vB)=4,500 sats300 vB=15 sat/vB\text{Fee rate} = \frac{\text{Fee (sats)}}{\text{Size (vB)}} = \frac{4{,}500 \text{ sats}}{300 \text{ vB}} = 15 \text{ sat/vB}

The answer is 15 sat/vB.

Note: 4,2004{,}200 would be the result of subtracting size from fee — a meaningless operation. 1.51.5 would come from dividing the wrong way (size/fee).

Question 2 · Which Transaction Wins?

A miner is choosing between two pending transactions:

  • Transaction X: pays 8,0008{,}000 sats, size 400400 vB
  • Transaction Y: pays 3,0003{,}000 sats, size 100100 vB

Assuming both fit in the block, which transaction will a profit-maximizing miner prefer to include first?

Correct! Tx X = 20 sat/vB, Tx Y = 30 sat/vB. Higher rate wins.

Not quite. Miners maximize revenue per virtual byte, since block space is the scarce resource. Compute the fee rates first.

Show solution

Solution:

Compare fee rates, not total fees:

  • Tx X: 8,000/400=208{,}000 / 400 = 20 sat/vB
  • Tx Y: 3,000/100=303{,}000 / 100 = 30 sat/vB

Even though Tx X pays nearly three times more in absolute sats, Tx Y pays a higher rate per virtual byte. Block space is the scarce resource — miners optimize revenue per byte, so Tx Y wins.

This is the rice-bag analogy: Bag B might cost more total, but Bag A costs less per pound. The "per unit" price is what matters.

Question 3 · The Forgotten Change Output

A user constructs a transaction with:

  • One input: a UTXO worth 55 BTC
  • One output: 0.20.2 BTC sent to a recipient
  • No change output

How much will the miner receive as a fee?

Correct! Fee = 5 − 0.2 = 4.8 BTC, handed to the miner.

Not quite. Remember: there is no fee field, and no auto-refund. Fee = inputs − outputs, no matter how absurd that value looks.

Show solution

Solution:

The fee is implicit — it equals whatever you fail to assign to an output:

Fee=inputsoutputs=50.2=4.8 BTC\text{Fee} = \sum \text{inputs} - \sum \text{outputs} = 5 - 0.2 = 4.8 \text{ BTC}

The protocol does not auto-refund or sanity-check fees. There is no fee field. Whatever you leave unassigned goes to the miner. This is exactly the kind of disaster from the opening of the video — and the only protection is correct wallet software that constructs the change output for you.

Question 4 · True or False — The Coinbase Transaction

Statement: "The coinbase transaction in each block is a fee paid by users to the miner."

Is this statement true or false?

Correct! The coinbase mints new bitcoin as the block reward — it is not a fee from any user.

Not quite. The coinbase is the protocol's block reward (newly minted BTC), not a user-paid fee. Fees and the coinbase are separate components of miner revenue.

Show solution

Solution:

False.

The coinbase transaction is a special transaction at the start of every block that mints new bitcoin as the block reward — it is the miner's "salary" from the protocol itself, not a fee paid by any user. It has no real inputs; it creates bitcoin out of thin air according to the issuance schedule.

User-paid fees are entirely separate: they come from the implicit difference between inputs and outputs of ordinary transactions in the block. A miner's total revenue per block is therefore:

Miner revenue=Block subsidy (coinbase)+transaction fees\text{Miner revenue} = \text{Block subsidy (coinbase)} + \sum \text{transaction fees}

Solved: 0 / 4