MASTERING-BITCOIN Β· Unit 2 Β· Video 3 Β· Interactive Practice

From Wallet to World: How Your Bitcoin Transaction Reaches the Network

IKey Formulas

Formula Name Description
Balance=βˆ‘UTXOs\text{Balance} = \sum \text{UTXOs} Wallet Balance Sum of all unspent transaction outputs
Fee=βˆ‘Inputsβˆ’βˆ‘Outputs\text{Fee} = \sum \text{Inputs} - \sum \text{Outputs} Implied Fee No explicit fee field; miners collect the gap
Change=InputΒ Totalβˆ’Paymentβˆ’Fee\text{Change} = \text{Input Total} - \text{Payment} - \text{Fee} Change Output Remainder returned to the sender

IIVisualization 1: UTXO Selection

Your Bitcoin wallet doesn't store a single "balance" number β€” it holds a collection of UTXOs (Unspent Transaction Outputs), like discrete coins in a digital purse. When you make a payment, the wallet selects enough UTXOs to cover the amount.

Explore: Adjust the payment amount and watch which UTXOs the wallet selects. How does the selection strategy change as the payment grows?

βš™ interactive visualization β€” coming to this page format soon

πŸ’‘ Notice: When the payment is small (e.g., 0.015), the wallet uses a single large UTXO. But when no single UTXO is big enough, multiple smaller ones must be combined β€” just like paying with several coins from your pocket. Try setting the payment above 0.100 to see what happens when there aren't enough coins.

IIIVisualization 2: Transaction Anatomy β€” Inputs, Outputs, and the Implied Fee

A Bitcoin transaction has no explicit fee field. The fee is simply the gap between total inputs and total outputs:

Fee=βˆ‘Inputsβˆ’βˆ‘Outputs\text{Fee} = \sum\text{Inputs} - \sum\text{Outputs}

Miners collect whatever is left over.

Explore: Adjust the payment and fee amounts. Watch how the change output shrinks as the fee grows β€” and what happens when the total exceeds the input.

βš™ interactive visualization β€” coming to this page format soon

πŸ’‘ Notice: As you increase the fee, the change output shrinks β€” because the fee eats into Alice's remainder. There is no "fee field" in the transaction data; miners simply collect the mathematical difference between inputs and outputs.

IVVisualization 3: Gossip Protocol β€” Network Propagation

Once a transaction reaches any single node, the gossip protocol kicks in. Each node forwards valid transactions to all its peers, creating an exponential cascade that saturates the network in 2–4 seconds.

Explore: Step through time and watch the transaction ripple outward from Alice's entry node. How many hops does it take to reach Bob?

βš™ interactive visualization β€” coming to this page format soon

πŸ’‘ Reflection: Notice how the number of newly reached nodes grows with each hop β€” this is exponential spread in action. No central relay coordinates the propagation. Every node that receives a valid transaction forwards it to all its peers, saturating thousands of nodes worldwide in just 2–4 seconds.

VQuiz Questions

Question 1 Β· Calculate the Implied Fee

Alice creates a transaction with:

  • Input: One UTXO worth 0.1 BTC
  • Output 1: 0.015 BTC to Bob
  • Output 2: 0.0845 BTC change back to Alice

What is the implied transaction fee?

βœ… Correct! Fee = 0.1 βˆ’ (0.015 + 0.0845) = 0.0005 BTC. The fee is always implied, never explicitly stated.

❌ Not quite. Remember: Fee = Total Inputs βˆ’ Total Outputs. Add both outputs and subtract from the input.

Show solution

Solution:

The fee is the gap between total inputs and total outputs:

Fee=Inputβˆ’Output1βˆ’Output2=0.1βˆ’0.015βˆ’0.0845=0.0005Β BTC\text{Fee} = \text{Input} - \text{Output}_1 - \text{Output}_2 = 0.1 - 0.015 - 0.0845 = 0.0005 \text{ BTC}

There is no explicit fee field in a Bitcoin transaction. Miners simply collect the remainder after all outputs are subtracted from all inputs.

Question 2 Β· Understanding UTXOs

True or False: A Bitcoin wallet stores your balance as a single number, similar to a bank account.

βœ… Correct! A wallet holds a list of individual UTXOs, not a single number. The displayed balance is derived by summing them.

❌ Not quite. Think about UTXOs β€” they are discrete coins in a digital purse, not a running total like a bank account.

Show solution

Answer: False

A Bitcoin wallet does not store a single balance number. Instead, it maintains a list of UTXOs (Unspent Transaction Outputs) β€” discrete chunks of Bitcoin that haven't been spent yet.

UTXO Amount
UTXO 1 0.005 BTC
UTXO 2 0.008 BTC
UTXO 3 0.1 BTC

The displayed "balance" (0.113 BTC) is just the wallet summing these up for convenience. When making a payment, the wallet must select specific UTXOs as transaction inputs.

Question 3 Β· Transaction Broadcasting

Which statement about broadcasting a Bitcoin transaction is correct?

βœ… Correct! Bitcoin is transport-agnostic. The self-contained transaction is valid regardless of how it reaches the network.

❌ Not quite. Remember: Bitcoin is transport-agnostic. Alice doesn't connect to Bob, and Bob doesn't need to be online.

Show solution

Answer: The transaction can be transmitted through any communication channel

Bitcoin is transport-agnostic. A signed transaction is self-contained β€” it carries everything any node needs to verify it. Alice can broadcast via:

  • WiFi, mobile data, or wired Ethernet
  • Pasting raw transaction hex into a block explorer website
  • Even non-internet channels (satellite, radio, etc.)

Alice does not connect to Bob directly. Bob does not need to be online. The transaction just needs to reach any single node on the Bitcoin network, and the gossip protocol delivers it to everyone else.

Question 4 Β· Division of Labor

The video describes three roles in Bitcoin transaction processing: the wallet, the network, and every node. Which role is responsible for selecting UTXOs, writing output scripts, and calculating change?

βœ… Correct! The wallet is the accountant β€” it builds the entire transaction locally by selecting UTXOs, defining outputs, and calculating change.

❌ Not quite. Think about where the transaction is constructed β€” it happens on your device, before it ever touches the network.

Show solution

Answer: The wallet (the accountant)

The three roles in Bitcoin transaction processing are:

Role Responsibility
Wallet β€” The Accountant Selects UTXOs, creates outputs, calculates change
Network β€” The Postal Service Carries transactions to every node; transport-agnostic
Every Node β€” The Auditor Validates independently, checks math, forwards if valid

No central authority constructs, routes, or validates the transaction. The wallet builds it locally on Alice's device before any network communication occurs. Construction, transmission, and verification are each fully decentralized.

Solved: 0 / 4