Part 1.2 of 8

Blockchain Architecture & Components

100 minutes
Technical Level

Understanding Block Structure

A block is the fundamental unit of a blockchain. Each block serves as a container for a set of transactions and metadata that links it to the previous block in the chain. Understanding block structure is essential for comprehending how blockchains maintain data integrity and enable trustless verification.

Block Definition

A block is a data structure containing a header with metadata and a body containing transaction data. The header includes cryptographic references that create an immutable link to the previous block, while the body contains the actual transaction records.

Every block consists of two primary components: the block header and the block body. The header contains metadata crucial for maintaining the blockchain's integrity, while the body contains the actual transactions or data being recorded.

Block Structure Overview
Block Header
Version 0x20000000
Prev Hash 00000...a3f2
Merkle Root 4a5e1e...c2d8
Timestamp 1704067200
Difficulty 386877668
Nonce 2083236893
Block Body (Transactions)
TX1: A -> B: 0.5 BTC
TX2: C -> D: 1.2 BTC
TX3: E -> F: 0.3 BTC
+ more transactions...

Block Header Components

The block header is a compact summary of the block's contents and its place in the chain. In Bitcoin's implementation, the header is exactly 80 bytes and contains six fields that together create the cryptographic backbone of the blockchain.

Version Number

The version number indicates which set of block validation rules the block follows. This allows for soft forks and protocol upgrades while maintaining backward compatibility. Nodes use the version to determine how to validate the block.

Previous Block Hash

This 32-byte field contains a SHA-256 hash of the previous block's header. This cryptographic link is what creates the "chain" in blockchain. If any data in a previous block is altered, its hash changes, which would invalidate all subsequent blocks.

Why This Matters

The previous block hash is the critical element that makes blockchains tamper-evident. To modify a transaction in block 100, an attacker would need to recalculate the hashes for blocks 100, 101, 102, and every subsequent block, all faster than the rest of the network is producing new blocks. This becomes exponentially more difficult as more blocks are added.

Merkle Root

The Merkle root is a single 32-byte hash that represents all transactions in the block. It's calculated using a Merkle tree structure, which allows efficient and secure verification of transaction inclusion without needing to download the entire block.

Timestamp

A Unix timestamp representing when the block was created. While timestamps don't need to be perfectly accurate, they must fall within certain bounds to be accepted by the network (typically within 2 hours of median time of previous blocks).

Difficulty Target

The difficulty target (or "bits" field) specifies the threshold that the block's hash must be below for the block to be valid. This target adjusts periodically to maintain consistent block times despite changes in network hash rate.

Nonce

The nonce (number used once) is a 4-byte field that miners increment while searching for a valid block hash. Combined with the other header fields, miners vary the nonce to find a hash below the difficulty target.

// Simplified block header structure { "version": "0x20000000", "previousBlockHash": "000000000000000000...", "merkleRoot": "4a5e1e4baab89f3a32...", "timestamp": 1704067200, "difficultyTarget": "0x1702c4e7", "nonce": 2083236893 }

Merkle Trees Explained

A Merkle tree (also called a hash tree) is a data structure used in blockchains to efficiently summarize and verify large sets of data. Named after computer scientist Ralph Merkle, this structure enables several critical blockchain capabilities.

Merkle Tree Structure
Merkle Root
Hash(AB + CD)
Hash AB
Hash(A + B)
Hash CD
Hash(C + D)
Hash A
Hash(TX1)
Hash B
Hash(TX2)
Hash C
Hash(TX3)
Hash D
Hash(TX4)

How Merkle Trees Work

  • Leaf nodes: Each transaction is hashed individually to create leaf nodes
  • Branch nodes: Pairs of hashes are concatenated and hashed together to form parent nodes
  • Root: The process continues until a single hash (the Merkle root) remains
  • Odd transactions: If there's an odd number of transactions, the last one is duplicated

Benefits of Merkle Trees

Simplified Payment Verification (SPV)

Light clients can verify a transaction is included in a block by downloading only the Merkle proof (a path from the transaction to the root) rather than the entire block. This requires only log2(n) hashes instead of all n transactions.

Efficient Data Integrity

Any change to a single transaction will cause the Merkle root to change completely. This makes it easy to detect tampering while storing only the root in the block header.

Parallel Verification

Different branches of the tree can be verified independently and in parallel, improving processing efficiency for large blocks.

Chain Structure and Linking

The "blockchain" derives its name from the chain of blocks linked through cryptographic hashes. Each block contains a reference to its predecessor, creating an ordered, append-only data structure that stretches back to the genesis block.

Blockchain Chain Structure
Block N-1
Prev Hash ...8f7c
Hash ...a3f2
Block N
Prev Hash ...a3f2
Hash ...b5d1
Block N+1
Prev Hash ...b5d1
Hash ...c7e3

The Genesis Block

The genesis block (Block 0) is the first block in any blockchain. It's the only block without a reference to a previous block. The genesis block is typically hardcoded into the client software and serves as the foundation for the entire chain.

Block Height and Depth

  • Block height: The number of blocks between a given block and the genesis block
  • Block depth: The number of confirmations, or blocks built on top of a given block
  • Chain tip: The most recent block in the longest valid chain

Network Node Types

Blockchain networks consist of various types of nodes, each serving different functions. Understanding these roles is crucial for grasping how blockchains maintain consensus and distribute data.

Full Nodes

Store complete blockchain history, validate all transactions and blocks independently, and enforce consensus rules. They provide the highest level of security and decentralization.

Mining/Validator Nodes

Compete to create new blocks through proof-of-work mining or are selected to validate blocks in proof-of-stake systems. They secure the network and earn rewards.

Light Nodes (SPV)

Store only block headers and rely on full nodes for transaction verification. They enable mobile wallets and resource-constrained devices to participate in the network.

Archive Nodes

Store all historical blockchain states, not just the current state. Essential for block explorers, analytics services, and applications requiring historical data queries.

Network Topology

Blockchain networks use a peer-to-peer (P2P) topology where nodes communicate directly without central servers. This architecture is fundamental to the decentralized nature of blockchain systems.

P2P Network Characteristics

  • No central authority: Any node can join or leave without affecting the network
  • Gossip protocol: Information spreads through nodes sharing with their peers
  • Redundancy: Multiple paths for data transmission increase reliability
  • Censorship resistance: No single point where transactions can be blocked

Message Propagation

When a new transaction or block is created, it propagates through the network via the gossip protocol. Each node that receives valid data forwards it to its connected peers, allowing information to spread exponentially across the network.

Network Latency Considerations

Message propagation time affects blockchain security. Longer propagation times increase the chance of temporary chain forks and can impact the fairness of mining. Networks optimize for fast propagation through techniques like compact block relay and FIBRE (Fast Internet Bitcoin Relay Engine).

Key Takeaways

  • Blocks contain headers and bodies - headers store metadata and cryptographic links, while bodies contain transaction data.

  • The previous block hash creates immutability - changing any historical data would invalidate all subsequent blocks.

  • Merkle trees enable efficient verification - allowing light clients to verify transactions with minimal data.

  • Different node types serve different purposes - from full validation to lightweight access to historical archiving.

  • P2P network topology ensures decentralization - with no central point of failure or control.