DUCAT’SBitcoin Guild
All curriculum
COMPLETE BLOCKCHAIN GUIDE

The Bitcoin blockchain, chainstate and reorganizations

The blockchain is a validated history of blocks, while chainstate is the current set of spendable outputs derived from that history. Follow headers, proof of work, transaction validation, atomic state updates and temporary branch changes without treating a block explorer or miner as the source of truth.

28 connected lessons Practice in every lesson
01

See the whole system first

Each specialist lesson expands one relationship in this end-to-end map.

  1. 01
    Receive a candidate

    A peer announces a header or block but does not make it trusted.

  2. 02
    Check the header

    The prior hash, target, time, Merkle root and proof of work must satisfy contextual rules.

  3. 03
    Check transactions

    Every transaction, Script, amount, fee and issuance claim must be valid in order.

  4. 04
    Update chainstate

    The node removes spent UTXOs and creates new UTXOs only after the whole block passes.

  5. 05
    Compare work

    Among valid branches, the node selects the chain with the most accumulated proof of work.

  6. 06
    Reorganize if needed

    Disconnecting one valid branch and connecting another reverses and reapplies exact state changes.

You will be able to trace a block from peer announcement to chainstate, compare competing branches by accumulated work and explain exactly what disconnects and reconnects during a reorganization.

02

Run the mechanism here

Predict first, execute exact bytes or rules, then change one input and inspect the first failed boundary.

EXACT MECHANISM WORKBENCH

Parse raw blocks and blk.dat record boundaries

Read mainnet magic, little-endian block length, the complete 80-byte header, CompactSize transaction count, nBits exponent and coefficient, target, proof of work, and the next record offset.

Predict the result
Required cases complete: 0/3.
4 LIVE BITCOIN UTILITIES

Calculate the bitcoin blockchain, chainstate and reorganizations

Use real learner input rather than a prewritten answer. Every result is calculated locally from the fields shown and invalid data fails closed.

Hashes

HASH256

Apply SHA-256 twice to UTF-8 text.

Ready to calculate

Change any field, predict what should change, then run the utility.

Safety boundary: This learning surface does not store inputs. Never paste a live seed phrase, private key, wallet backup, or confidential transaction.

03

Follow the mechanism in order

Start at the top for a guided route, or open any lesson directly.

01

How Bitcoin works

Follow one payment from Alice's wallet to Bob, through independent node checks, a miner's candidate block, and confirmations.

Teach, predict, run, explain
02

Transactions, outputs, locks, keys, and addresses

Build one payment from spendable outputs and follow how an address becomes a locking script, a key authorizes an input, and change becomes a new output.

Teach, predict, run, explain
03

Blocks, mining, difficulty, and validation

See how a candidate block is assembled, how proof of work is found, how difficulty is encoded, and why full nodes still decide whether the block is valid.

Teach, predict, run, explain
04

Full nodes, the blockchain, and reorgs

Connect peer messages, mempool, block index, chainstate, most-work selection, confirmations, and temporary reorganizations into one full-node view.

Teach, predict, run, explain
05

Block structure

A block header commits to version, prior block, transaction Merkle root, time, target, and nonce.

Teach, predict, run, explain
06

Proof of work

Mining searches header variations for a hash below the target, making history costly to extend and rewrite.

Teach, predict, run, explain
07

Difficulty adjustment

Bitcoin retargets periodically to keep average block production near ten minutes despite changing hash rate.

Teach, predict, run, explain
08

Block validation

Full nodes independently check proof of work, transactions, scripts, issuance, weight, and contextual consensus rules.

Teach, predict, run, explain
09

Chain selection and reorgs

Nodes follow the valid chain with the most accumulated work and may disconnect blocks during reorganization.

Teach, predict, run, explain
10

Coinbase and subsidy

The coinbase creates permitted subsidy and collects fees, with maturity rules before its outputs can be spent.

Teach, predict, run, explain
11

Mining pools and templates

Pools coordinate work and payouts; Stratum and template negotiation affect miner autonomy and centralization.

Teach, predict, run, explain
12

Attacks and security budget

Double-spends, selfish mining, censorship, pool concentration, and fee-market uncertainty require economic analysis.

Teach, predict, run, explain
13

Raw block anatomy and blk.dat

Decode disk framing, the 80-byte header, CompactSize transaction count, coinbase, ordinary transactions, witness commitment, and neighbouring block links.

Teach, predict, run, explain
14

Mining lifecycle and candidate blocks

Follow mempool selection, ancestor packages, template construction, coinbase and witness commitments, target search, broadcast, and independent full-node validation.

Teach, predict, run, explain
15

Block time, MedianTimePast, and future limits

Validate a candidate timestamp against the median of the previous eleven blocks and the receiving node's two-hour future-time limit.

Teach, predict, run, explain
16

Version bits and soft-fork activation

Decode the block-version marker and deployment bits, then follow period thresholds through DEFINED, STARTED, LOCKED_IN, ACTIVE, or FAILED.

Teach, predict, run, explain
17

Block height and BIP34 coinbase commitments

Encode the block height as the first minimally encoded Script number in the coinbase ScriptSig and keep it distinct from header fields.

Teach, predict, run, explain
18

Soft forks, hard forks, and compatibility

Run one block through old and new rule sets to see subset restrictions, rule expansions, activation risk, and persistent chain splits.

Teach, predict, run, explain
19

Peer discovery and handshakes

Nodes discover peers, negotiate services, and exchange inventory without a central network registry.

Teach, predict, run, explain
20

Transaction and block relay

Compact blocks, headers-first synchronization, feefilters, and relay policies reduce bandwidth and latency.

Teach, predict, run, explain
21

Initial block download

A new node downloads and validates historical headers and blocks before reaching the current tip.

Teach, predict, run, explain
22

UTXO set and chainstate

Bitcoin Core separates block storage, indexes, mempool state, and the active UTXO database.

Teach, predict, run, explain
23

Pruning and assumeutxo

Resource-saving modes change storage or bootstrap work without replacing final validation guarantees.

Teach, predict, run, explain
24

RPC and ZMQ

RPC controls a node while event interfaces support applications that need chain and mempool updates.

Teach, predict, run, explain
25

Consensus changes and BIPs

Soft forks tighten validity rules and require deployment coordination across users, miners, software, and markets.

Teach, predict, run, explain
26

Code review and release process

Bitcoin Core changes undergo adversarial review, testing, backport discipline, and reproducible release work.

Teach, predict, run, explain
27

Full node architecture

Connect peers, message parsing, validation, mempool, block index, chainstate, wallet, RPC, ZMQ, indexes, pruning, and reorg handling in one system map.

Teach, predict, run, explain
28

Bitcoin P2P message bytes

Parse network magic, command, payload length, checksum, and payload from a byte stream before applying command-specific limits and validation.

Teach, predict, run, explain
04

Keep these boundaries clear

These distinctions stop the most consequential mistakes in this topic.

  • The blockchain is not one file or one website. Each full node derives its own validated view.
  • Longest means most accumulated proof of work among valid chains, not the greatest block count.
  • A reorganization changes confirmation history, so confirmation depth reduces risk rather than promising absolute finality.