Feedback
Sign in./start

Site navigation

Theme

Learn

  • Roadmaps

Build

  • Projects
  • Developer Tools

Contribute

  • Open Source Projects
  • Issues
  • Reviews
  • First Contribution
  • BountiesSoon
  • Feedback

Prove

  • Builders

Ecosystem

  • Partners
  • Get Funded↗
  • HackathonsSoon
Sign in./start-building

Become an Open Source Builder. Learn. Build. Contribute. Prove.

Feedback welcome — open a GitHub issue.

Learn

RoadmapsStart Building

Build

ProjectsDeveloper Tools

Contribute

Open Source ProjectsIssuesReviewsFirst ContributionSupportFeedback

Prove

Builders Directory

Account

Sign in

Legal

PrivacyTermsCredits

© 2026 Pull // code MIT · curriculum CC BY-SA 4.0

PrivacyTermsCredits

lesson // bitcoin

Blocks & Chain

Headers, merkle trees, proof-of-work, and chain validation rules.

beginner5 days

Public lesson — sign in to track progress on this roadmap.

./sign-in

On this page

Learning objectives

  • Describe a block header and how blocks link into a chain
  • Explain merkle trees for transaction inclusion proofs
  • Reason about proof-of-work and reorgs at a builder level

study // plan

Lessons are primers. Start with Step 1 (required reading) when present, then follow the numbered steps in the article. Depth comes from primary sources, labs, reflection, and evidence.

Research on Bitcoin Search
merkle treeblock headerproof-of-workchain reorganization

Step 1 // Required reading

Complete these before the numbered steps in the lesson body. Links are listed here once — not repeated below.

  • bookMastering Bitcoin

    Ch. 11: Bitcoin Blockchain

Interactive lab // Decoding Bitcoin

Open these Bitcoin Dev Project modules and tools before (or alongside) the graded lab. Capture evidence from the interactive path — do not only skim Pull.

  • Decoding Bitcoin: Reorg calculator

    Interactive tool - model reorg depth vs attacker hashrate before the lab.

Reflection prompts

  1. Explain Blocks & Chain to a teammate without jargon - what problem does it solve?
  2. What would break in production if you misunderstood Blocks & Chain?
  3. Using the Decoding Bitcoin reorg calculator, what confirmation depth would you defend for a mid-size merchant payment - and why?

Lab // Reorg risk + header check

Complete Steps 2–3. Use the Decoding Bitcoin reorg calculator to pick a confirmation policy, then on regtest inspect a block header and explain how the previous-block hash links the chain.

evidence required

  • ·Screenshot or notes from the Decoding Bitcoin reorg calculator with your assumed attacker share
  • ·getblockheader (or explorer) output for one regtest tip block
  • ·One-sentence confirmation policy you would ship, tied to the calculator output
  1. 01

    Worked mental model

    Re-read the diagrams in this lesson once out loud in plain language. If you cannot explain the flow to a friend without jargon, pause and revisit the Mastering Bitcoin / Mastering Lightning chapters linked in Resources. Chapter references are intentional, not decorative.

  2. 02

    Hands-on habit

    Every protocol idea should be paired with one local experiment. That habit turns reading into builder instinct.

    1. Reproduce the happy path on regtest (or Polar for Lightning)
    2. Break it on purpose (wrong fee, expired invoice, offline peer)
    3. Write down what error you saw and which layer produced it (wallet, node, mempool, peer)
  3. 03

    Glossary check

    Pick three terms from this lesson and define them in one sentence each without opening notes. Weak definitions mean the lesson is not finished yet.

  4. 04

    Resource order

    Use Resources in order: narrative book chapter first, then BIP/BOLT for precision, then implementation docs for commands. Jumping straight to RPC flags without the mental model creates brittle knowledge.

A blockchain is a linked list of blocks, each committing to a set of transactions and to the previous block’s hash, secured by proof-of-work.

Complete Step 1 // Required reading in the study plan above, then continue here.

Step 2 — Core idea: headers, merkle root, confirmations

Explorers, wallets, and payment processors must decide when a payment is “final enough.” That decision is about chain tips, confirmations, and reorg risk.

Analogy: Each block is a sealed evidence bag. The seal includes a fingerprint of the previous bag. To rewrite history, an attacker must reseal every bag after the change — and beat the honest network’s work.

A block contains:

  • A header (version, previous hash, merkle root, time, bits/difficulty, nonce)
  • A list of transactions (coinbase first)

The merkle root commits to all transactions so light clients can verify inclusion without downloading everything.

Loading diagram…

Headers commit to transactions and previous history; PoW makes rewriting expensive.

When your transaction appears in a block, it has 1 confirmation. Each block buried on top adds another. Deeper confirmations make reorgs that undo your payment less likely.

const confirmations = tipHeight - txBlockHeight + 1;

0-conf is a business risk

Accepting unconfirmed transactions can be fine for tiny amounts with controls, but it is not consensus finality.

Sometimes two miners find blocks near the same time. Nodes follow the heaviest valid chain. A short reorganization can drop a block you briefly saw — wallets should handle disappearing transactions gracefully.

Done when: You can point to prev-hash and merkle root in the Mermaid flow and define confirmations in one sentence.

Step 3 — Try it: reorg policy + header (lab)

Use the Decoding Bitcoin reorg calculator with an assumed attacker share. Then on regtest:

TIP=$(bitcoin-cli -regtest getbestblockhash)
bitcoin-cli -regtest getblockheader "$TIP"

Explain how previousblockhash links the tip to history. Write one confirmation policy you would ship for a mid-size merchant payment, tied to the calculator.

Common mistakes

  • Treating “seen in mempool” as settled
  • Ignoring that explorers can disagree briefly during races
  • Forgetting coinbase maturity when spending mining rewards on regtest

Done when: Lab evidence (calculator notes + getblockheader + confirmation policy sentence) is complete.

Next lesson

Transactions — the bytes wallets actually sign and broadcast.

further reading

  • articleBitcoin Whitepaper
  • articleBitcoin Optech: Chain reorganizations

progress // sign in

Reading is public. Sign in to mark lessons complete, sync across devices, and unlock your roadmap.

./sign-in-to-track

discussion

Discussion

prevKeys & AddressesnextTransactions

On this page

Press Shift + ? for keyboard shortcuts.

Press R to research on Bitcoin Search.

No questions yet — be the first to ask.