How Does Blockchain Work? Blocks, Hashes, and Chains Explained

Introduction

Blockchain is often described as a “digital ledger,” but how does it actually function? What makes it different from a regular database? The answer lies in three core concepts: blocks, hashes, and chains.

In this guide, we’ll break down blockchain’s inner workings in simple terms. You’ll learn:
✅ What a block is and what it contains
✅ How hashing secures blockchain data
✅ Why chaining blocks together prevents tampering
✅ How miners and nodes keep the network running

By the end, you’ll understand blockchain’s structure well enough to explain it to anyone!


Chapter 1: What Is a Block in Blockchain?

Definition of a Block

A block is a container that stores:

  • Transactions (e.g., “Alice sends Bob 1 Bitcoin”)
  • A timestamp (when the block was created)
  • A unique identifier called a hash (more on this later)
  • The hash of the previous block (this forms the “chain”)

Example: Bitcoin Block Structure

Block ComponentExample Data
Block Number (Height)840,000
Transactions2,500 Bitcoin transfers
Timestamp2024-07-15 14:22:18 UTC
Previous Block Hash00000000000000000003a…
Current Block Hash0000000000000000000a1…

Each new block typically holds hundreds or thousands of transactions, depending on the blockchain.


Chapter 2: What Is a Hash? (The Blockchain Fingerprint)

Definition of a Hash

A hash is a unique digital fingerprint for data. It’s created by a cryptographic hash function (like SHA-256 in Bitcoin).

Key properties:

  1. Deterministic → Same input always produces the same hash.
  2. Fast to compute → Easy to generate from data.
  3. Irreversible → Can’t guess the input from the hash.
  4. Unique → Changing one letter in input completely changes the hash.

Example of Hashing

  • Input: "Blockchain" → Hash (SHA-256):
    ef7797e13d3a75526946a3bcf00daec9
  • Input: "blockchain" (lowercase) → Hash:
    4f9c2f5031c5c2b5f3a3d3f4e344e3d1

Even a tiny change creates a totally different hash!

How Hashing Secures Blockchain

  • Each block’s hash depends on its transactions + the previous block’s hash.
  • If someone tampers with an old block, its hash changes, breaking the chain.

Chapter 3: How Blocks Are Chained Together

The Blockchain Structure

  • Block 1 → Contains Hash A
  • Block 2 → Includes Hash A + Generates Hash B
  • Block 3 → Includes Hash B + Generates Hash C

This creates an immutable chain—if you alter Block 1, Hash A changes, making Hash B invalid, and so on.

Why Tampering Is Nearly Impossible

To successfully hack a blockchain:

  1. You’d need to change a block’s data.
  2. Then recalculate its hash and all future hashes.
  3. And do this on 51% of the network’s computers at once.

This is computationally infeasible for large blockchains like Bitcoin.


Chapter 4: How New Blocks Are Added (Mining & Consensus)

Step 1: Transactions Are Pooled

  • Pending transactions wait in the mempool (memory pool).

Step 2: Miners Compete to Solve a Puzzle

  • They bundle transactions into a candidate block.
  • They must find a nonce (a random number) that makes the block’s hash meet certain rules (e.g., starts with “0000”).

Step 3: The First Miner to Solve It Wins

  • The winner broadcasts the block to the network.
  • Other nodes verify it’s correct.
  • If approved, it’s added to the blockchain.

Step 4: The Miner Gets Rewarded

  • In Bitcoin, the miner receives newly minted BTC + transaction fees.

Chapter 5: Real-World Example (Bitcoin Blockchain)

Let’s track a Bitcoin transaction:

  1. You send 0.1 BTC to a friend.
  2. Miners pick up your transaction from the mempool.
  3. A miner includes it in Block 840,001.
  4. The block is hashed and chained to Block 840,000.
  5. After 6 confirmations (~1 hour), the transaction is final.

Conclusion

  • Blocks store transaction data.
  • Hashes act as tamper-proof seals.
  • Chaining blocks makes the ledger immutable.
  • Mining secures the network and adds new blocks.

Blockchain’s design ensures security, transparency, and decentralization—no banks or middlemen needed!

What’s Next?

  • Learn about smart contracts (Ethereum’s innovation).
  • Explore blockchain forks (how networks upgrade).

Questions? Ask below! 🚀