Blocks and Chains
Linking blocks together with cryptographic link hashes
Definition
A block is the fundamental data structure in a blockchain, containing a batch of validated transactions, a Timestamp, and a cryptographic reference to the previous block. Each block has a header (metadata including the previous block hash, Merkle Root, Timestamp, difficulty target, and Nonce) and a body (the list of transactions). The header is what gets hashed during mining, and its contents ensure the integrity of the entire block. Key concepts include Orphan Block.
The Chain structure is what makes blockchain immutable. Each block's header contains the hash of the previous block's header, creating a sequence that goes back to the genesis block. If any transaction in an older block is changed, that block's hash changes, which means all subsequent blocks' previous-hash references become invalid. To successfully tamper with one block, an attacker would need to recalculate every subsequent block — a computationally infeasible task.
Real-Life Example
Think of blocks like shipping containers on a cargo ship. Each container (block) is sealed and labeled with its contents (transactions). Containers are stacked in order (Chain), and each one has a label showing the seal number of the container below it (Previous Hash). If someone breaks into a container at the bottom of the stack and changes the contents, the seal number changes, and every container above it would need new labels. The dock master (network) would immediately notice the mismatch.
A real-world example: The government of Sweden has been testing a blockchain-based land registry system since 2018. Each property transaction is recorded as a block in the Chain. When a house is sold, the sale is verified by multiple parties (buyer, seller, bank, government), recorded in a block, and added to the Chain. The Chain provides a complete, tamper-proof history of every ownership change for every property in the registry.
Interactive Diagram
Launch the interactive diagram to see this in action.
Open Interactive DiagramThe interactive diagram for this chapter demonstrates Introduction to Blockchain. It shows a blockchain visualized as a chain of blocks, each linked to the previous one with a cryptographic hash.
What to explore:
- click to add a block; watch it link to the previous block; see the chain grow; try to modify a block and watch the chain break
- a blockchain is a chain of blocks where each block contains data and is cryptographically linked to the one before it
Introduction
The name 'blockchain' tells you exactly what it is: blocks linked in a Chain. But what is inside a block, and how are blocks linked together? Understanding the structure of blocks and the Chain is essential to understanding why blockchain is secure. Every element in a block serves a specific purpose, and the way blocks connect creates the immutability that makes blockchain revolutionary.
A block has three main parts: the header (containing metadata like the Timestamp and the previous block's hash), the body (containing the list of transactions or data), and the block hash (a unique fingerprint of everything in the block). The previous block's hash in the header is what links blocks together into a Chain. This seemingly simple mechanism has profound implications for security.
In this chapter, you will explore the internal structure of a block, understand how cryptographic hashing creates the Chain, and learn how the Chain structure makes tampering with historical data practically impossible. By the end, you will understand why the Chain is so secure.
How It Works
The Block Header contains critical metadata: version (which set of rules this block follows), previous block hash (the fingerprint of the previous block — this is what creates the Chain), Merkle Root (a single hash representing all transactions in the block), Timestamp (when the block was created), difficulty target (how hard the Proof of Work puzzle is), and Nonce (the number that miners change to find a valid hash). This header is what miners hash repeatedly to find a valid block.
The block body contains the actual data — the list of transactions (or other records, depending on the blockchain). These transactions are organized into a Merkle tree structure. The Merkle Root in the header is a single hash that summarizes all transactions. If any transaction changes, the Merkle Root changes, which changes the block hash, which breaks the link to the next block. This is how even tiny changes are detected.
Household Object Analogy
Think of blocks as pages in a tamper-proof ledger. Each page (block) has a page number (Block Height), a list of transactions (body), and a special seal made from the previous page's contents (Previous Hash). If someone goes back and changes a transaction on page 5, the seal on page 5 changes, which means page 6's seal (which was made from page 5's seal) no longer matches, and so on down the entire book. Tampering is immediately obvious.
Deeper Dive
The Block Height is the position of a block in the Chain. Block 0 is the genesis block. Block 1 comes after it. Block 759,000 is the 759,001st block. The height tells you how many blocks have been added since the beginning. However, blockchain forks can temporarily create multiple blocks at the same height. The network resolves this by eventually accepting the Chain with the most cumulative work (longest Chain rule).
The difficulty target in the Block Header determines how hard the Proof of Work puzzle is. The target is a number, and a valid block hash must be numerically lower than this target. The Bitcoin network adjusts the target every 2,016 blocks (approximately 2 weeks) to maintain the 10-minute average block time. If blocks are being found too quickly, the target is lowered (making the puzzle harder). If too slowly, the target is raised.
The Nonce field is a 32-bit number (0 to about 4.3 billion). If miners try all possible Nonce values without finding a valid hash, they can modify other parts of the Block Header (like the Timestamp or the transaction order) to create new hash possibilities. This is called 'extra Nonce'. On modern Bitcoin mining hardware, all 4.3 billion Nonce values can be tried in less than a second.
Key Insight
The previous block hash creates a Chain that goes all the way back to the very first block. This is why blockchain is called a 'Chain' — each block is literally chained to the one before it through cryptographic hashes. Breaking any link breaks the entire Chain from that point forward.
Advanced
The Merkle tree (or binary hash tree) is a data structure that enables efficient verification of transactions. Transactions are paired and hashed together repeatedly until a single hash (the root) remains. This allows a 'light client' (a node that does not store the full blockchain) to verify that a transaction is included in a block by downloading only the Merkle branch (a few hashes) rather than the entire list of transactions. SPV (Simplified Payment Verification) uses Merkle proofs for this purpose.
Block explorers are websites that let anyone view the contents of any block on a blockchain. They display Block Height, Timestamp, hash, previous block hash, Merkle Root, list of transactions, and more. Popular Bitcoin block explorers include Blockchain.com and Blockstream.info. These tools make the blockchain transparent and verifiable by anyone, which is a fundamental principle of the technology.
A blockchain fork occurs when the blockchain splits into two competing Chain. Soft forks are backward-compatible rule changes where the new rules are stricter than the old ones. Hard forks introduce new rules that are incompatible with old nodes, potentially splitting the community and creating a new cryptocurrency (like Bitcoin Cash splitting from Bitcoin). Understanding forks is essential for following blockchain governance debates.
Vocabulary Table
| Term | Definition |
|---|---|
| Block Header | The part of a block containing metadata: previous hash, timestamp, nonce, and Merkle root. |
| Merkle Root | A single hash representing all transactions in a block, used for efficient verification. |
| Previous Hash | The cryptographic hash of the preceding block, linking blocks together. |
| Timestamp | A digital label indicating when a block was created. |
| Nonce | A number miners adjust to produce a hash meeting the network's difficulty target. |
| Chain | The sequence of blocks linked by cryptographic hashes from the genesis block to the latest. |
| Block Height | The number of blocks preceding a given block in the chain. |
| Orphan Block | A valid block that is not part of the main chain because another block was accepted first. |
Fun Facts
The Bitcoin genesis block (block 0) was mined on January 3, 2009. It contained a single transaction of 50 BTC (the block reward) sent to Satoshi Nakamoto's address.
Block 1 was mined 6 days later, on January 9, 2009. The gap between blocks 0 and 1 was much longer than 10 minutes because very few miners were active in the early days.
The largest Bitcoin block ever mined was about 2.5 MB, achieved using SegWit (Segregated Witness), a protocol upgrade that separates transaction signatures from transaction data.
The deepest orphaned block in Bitcoin history was 5 blocks deep — meaning 5 blocks were mined on top of it before the network switched to a competing Chain.
Each Bitcoin Block Header is exactly 80 bytes. The block body can be up to about 4 MB (with SegWit). Total block size varies.
Common Misconceptions
Misconception: Blocks are added at exactly 10-minute intervals.
Truth: 10 minutes is the average target. Individual blocks can be mined in seconds (if lucky) or take hours (if unlucky). The difficulty adjustment ensures the average stays near 10 minutes.
Misconception: All blockchains have the same block structure.
Truth: While all blockchains use blocks linked by hashes, the specific structure varies. Ethereum blocks contain different fields than Bitcoin blocks, and private blockchains may have entirely different block structures.
Misconception: The genesis block contains special rules.
Truth: The genesis block is hardcoded into the blockchain software and has no previous block to reference. Otherwise, it follows the same rules as any other block.
Misconception: Block Height is always unique and guaranteed.
Truth: During a fork, two blocks at the same height can exist simultaneously. The network resolves this by eventually accepting only one Chain, and the other block becomes orphaned.
Knowledge Check
1. What piece of data links one block to the next in a blockchain?
Answer: The previous block's hash
2. What is a Merkle root used for?
Answer: To summarize all transactions in a block for efficient verification
3. What happens if an attacker tries to edit the data in Block 2 of a 100-block chain?
Answer: Block 2 and all subsequent blocks become invalid
