Lesson 0001: Bitcoin Transaction Lifecycle Overview

⏱ ~18 minutes πŸ“… 2026-06-10 🎯 Bottom-Up β€’ Overview
Goal: Walk the full path of a Bitcoin transaction β€” from wallet creation through broadcast, relay, mempool dwell, block template construction, mining, and chain inclusion. By the end, you'll have a mental map of every component and how they connect.

The Big Picture: 8 Stages

Every Bitcoin transaction passes through the same eight stages. Here's the roadmap:

1
Create & Sign
Wallet
2
Broadcast
Wallet β†’ Node
3
Relay
P2P Network
4
Mempool
Every Full Node
5
Block Template
Miner / Pool
6
Mining (PoW)
ASICs
7
Block Propagation
P2P Network
8
Confirmation
All Nodes
πŸ’» Wallet
β†’
πŸ“‘ P2P Network
β†’
πŸ“‹ Mempool
β†’
πŸ— Block Template
β†’
⛏ Mining
β†’
πŸ“¦ New Block
β†’
πŸ”— Chain

Stage 1: Transaction Creation & Signing

Where it happens: The wallet

The wallet selects UTXOs (unspent transaction outputs) that belong to the user, constructs outputs specifying the recipient and amount, computes the fee, and signs each input with the corresponding private key. The result is a serialized transaction β€” a blob of bytes ready for the network.

Key detail: The signature covers nearly the entire transaction (SIGHASH_ALL by default), making it tamper-proof. If anyone changes an output amount or destination, the signature becomes invalid.

Source: Bitcoin Developer Guide β€” Transactions

🧠 Quick Check

What does the wallet sign before broadcasting the transaction?

Stage 2: Broadcast

Where it happens: Wallet β†’ First peer node

The wallet sends the serialized transaction to one or more connected full nodes via a tx message (or, if using the inv/getdata flow, the node first announces it has a new transaction via inv, the peer requests it with getdata, and the wallet responds with tx). In practice, wallets often use the simpler tx push: just send the transaction directly.

Key detail: The wallet doesn't need to be a full node. It only needs a connection to at least one peer that accepts and relays transactions. SPV (simplified payment verification) wallets do exactly this.

Source: Bitcoin Developer Guide β€” Transaction Broadcasting

Stage 3: Relay (Gossip Protocol)

Where it happens: The peer-to-peer network

Once a full node receives a valid transaction, it relays it to its peers. The standard flow: Node A sends an inv (inventory) message to each peer announcing the txid. Peers that don't already have the transaction respond with getdata. Node A then sends the full tx message. This gossip protocol ensures every full node on the network sees every unconfirmed transaction within seconds.

Key detail: Each node independently validates the transaction before relaying it. If a transaction fails validation (e.g., double-spend, invalid signature, non-standard script), the node rejects it and does not relay it. It may also increase the peer's "ban score" for sending invalid data.

Source: Bitcoin Developer Guide β€” Transaction Broadcasting; Bitcoin Wiki β€” inv message

Stage 4: Mempool Entry

Where it happens: Every full node's memory

After validating a transaction, each full node adds it to its mempool (memory pool) β€” an in-memory set of unconfirmed transactions eligible for inclusion in the next block. The mempool is not shared or synchronised globally; every node has its own. Transactions stay in the mempool until they are either mined into a block, evicted (if a higher-fee transaction pushes them out), or expire.

Key details:

Source: Bitcoin Developer Guide β€” Memory Pool; Optech β€” Replace-by-Fee; Optech β€” CPFP
🧩 The mempool is a distributed, unsynchronised mess β€” by design. There is no "the" mempool. Every node has its own, with different transactions at different times. Miners' mempools are the ones that matter, because they decide what goes into blocks. This is why fee estimation is inherently uncertain: you're guessing what thousands of independent miners will do.

Stage 5: Block Template Construction

Where it happens: The miner (or mining pool operator)

A miner builds a block template β€” a candidate block β€” by selecting transactions from their local mempool. This is done via the getblocktemplate RPC (or Stratum protocol in pooled mining). The miner software:

  1. Creates the coinbase transaction β€” the special first transaction that pays the block reward (currently 3.125 BTC) plus accumulated fees to the miner. The coinbase has no inputs; it creates new bitcoin.
  2. Selects transactions from the mempool, typically sorted by feerate (highest first), packing them into the block up to the 4 million weight unit limit (roughly 1 vMB for legacy-style transactions, up to ~4 MB with SegWit).
  3. Computes the Merkle root β€” a single 32-byte hash that cryptographically commits to all transactions in the block.
  4. Assembles the 80-byte block header: version, previous block hash, Merkle root, timestamp, difficulty target (nBits), and an initial nonce.

Who builds the template? In solo mining, the miner's own bitcoind builds it. In pooled mining, the pool operator builds it and distributes the header (or parts of it) to participating miners via Stratum. The pool decides which transactions to include β€” individual pool miners have no say.

Source: Bitcoin Developer Guide β€” Block Prototypes

🧠 Quick Check

What is the coinbase transaction?

Stage 6: Mining (Proof of Work)

Where it happens: ASIC hardware

The 80-byte block header is sent to ASIC (Application-Specific Integrated Circuit) miners. The ASIC iterates the nonce field (a 32-bit counter, ~4 billion values) and computes double-SHA256 on the header. If the resulting hash is numerically below the network difficulty target, a valid block is found.

Key details:

Source: Bitcoin Developer Guide β€” Solo Mining; Bitcoin Wiki β€” Block Hashing Algorithm

Stage 7: Block Propagation

Where it happens: P2P network (in reverse)

When a miner finds a valid block, they broadcast it to their peers. The propagation path mirrors transaction relay: inv β†’ getdata β†’ block (or headers β†’ getdata β†’ block for headers-first nodes, or direct cmpctblock for compact block relay per BIP 152). Every full node that receives the block:

  1. Validates the block header: checks PoW, previous block hash, timestamp, difficulty.
  2. Validates every transaction: signature checks, no double-spends, scripts execute correctly.
  3. Updates its UTXO set: removes spent outputs, adds new unspent outputs.
  4. Removes confirmed transactions from its mempool.
  5. Relays the block to its own peers.

Compact block relay (BIP 152): Since peers likely already have most transactions in their mempool, the block can be sent as a header + short transaction IDs. Missing transactions are requested separately. This dramatically reduces bandwidth β€” from ~1.5 MB to ~15 KB in the common case.

Source: Bitcoin Developer Guide β€” Block Broadcasting; Optech β€” Compact Block Relay

Stage 8: Confirmation & Chain Reorganisation

Where it happens: Every full node's chain state

Once a block is added to the tip of the chain, the transaction has 1 confirmation. Each subsequent block mined on top adds another confirmation. Most wallets and services consider a transaction "final" after 6 confirmations (a heuristic from Satoshi's whitepaper based on the exponentially decreasing probability of a reorg).

Chain reorganisations (reorgs): If two miners find valid blocks at similar times, the network temporarily has two competing chain tips. Each node follows the one it saw first. When the next block is found, it will build on one of the two tips β€” the chain with the most accumulated work wins. The other tip becomes a stale block (also called an orphan). Transactions in stale blocks return to the mempool and can be included in future blocks. One-confirmation reorgs happen regularly; deep reorgs (2+ blocks) are rare.

Source: Bitcoin Developer Guide β€” Orphan Blocks

🧠 Quick Check

What happens to transactions in a stale block after a 1-block reorg?

Putting It All Together: A Concrete Example

Alice sends 0.01 BTC to Bob. Here's the journey, end to end:

πŸ”‘ Alice's wallet selects UTXOs
β†’
✍️ Signs inputs with her private key
β†’
πŸ“€ Broadcasts tx to her node
β†’
🌐 Node validates and relays (invβ†’getdataβ†’tx)
β†’
πŸ“‹ Enters mempools of ~50K nodes
β†’
⛏ A miner includes it in a block template (high fee = picked fast)
β†’
πŸ”¨ ASICs hash ~10 min until valid nonce found
β†’
πŸ“¦ Block broadcast to network
β†’
βœ… All nodes validate, update UTXO set, remove tx from mempool
β†’
πŸ”— Bob sees 1 confirmation; after ~60 min, 6 confirmations

What We Didn't Cover (Yet)

This is a flyover. Future lessons will zoom into each component in depth:

πŸ”— Primary source for deeper reading: Bitcoin Developer Guide β€” Transactions β€” the canonical technical reference covering transaction structure, script validation, and the P2P workflow. Read Chapters 4–7 of Mastering Bitcoin (Antonopoulos) for the authoritative deep-dive.
πŸ’¬ Have a question about any stage? Ask your agent-teacher. The lesson is a map β€” the agent is your guide. Say "tell me more about the mempool" or "how does compact block relay actually work?" and we'll go deeper.

Navigate