Blockchain & Cryptocurrency

Lesson 2 of 8

Hashes & Blocks

How hash functions fingerprint data and link blocks together so tampering is instantly visible.

🟡 Intermediate 50 XP

Learn it

A hash function turns any data — a word, a file, a whole block — into a fixed-length fingerprint, like 3a7bd3e2... The same input always gives the same fingerprint.

Hashes are one-way: easy to calculate from the data, practically impossible to reverse. And changing even one letter of the input completely changes the hash.

Each block in a blockchain contains the hash of the previous block. That is the 'chain': change an old block and its hash changes, which breaks every block after it.

This is why blockchains are tamper-evident: anyone can recalculate the hashes and spot that history was meddled with.

Key terms

Hash function
A one-way function that turns any data into a fixed-length fingerprint.
SHA-256
The hash function used by Bitcoin; output is 256 bits.
Avalanche effect
A tiny change in input completely changes the hash output.
Tamper-evident
Designed so that any change to the data is easy to detect.
Block header
The part of a block holding the previous hash, timestamp and other metadata.

Break the chain

  1. 1Try a hash: Use an online SHA-256 tool (or the blockchain demo linked below) to hash your first name. Then change one letter and compare — how much of the fingerprint changed?
  2. 2Chain three blocks: In the demo, give block 2 the hash of block 1 and block 3 the hash of block 2. Now edit block 1's data. What happens to the blocks after it?
  3. 3Explain: In one sentence: why does changing an old block break every newer block?

A three-block chain

textBLOCK 1            BLOCK 2            BLOCK 3
data: A pays B 5   data: B pays C 2   data: C pays A 1
prev: 0000...      prev: 9f2c...      prev: 71ab...
hash: 9f2c...      hash: 71ab...      hash: 04d8...

Edit BLOCK 1's data -> its hash becomes e550...
BLOCK 2 still says prev: 9f2c... -> CHAIN BROKEN, tampering visible

Because each block stores the previous block's fingerprint, editing history breaks the link. Everyone checking the chain can see it instantly.

Try it

Match each hash property to what it means.

Deterministic
One-way
Avalanche
Fixed length
Tamper-evident

Challenge

A classmate says: 'If hackers changed one transaction in an old Bitcoin block, nobody would notice.' Using hashes and the chain of previous-block fingerprints, explain exactly why the change would be noticed, and what the attacker would also have to do to hide it.

Pick whichever way suits you — every mode earns the same bonus XP.

Write at least 40 more characters to submit.

Mark your own work

Guided walkthrough — 0/2 clues revealed

  1. Clue 1 locked — reveal it only if you get stuck.
  2. Clue 2 locked — reveal it only if you get stuck.

Each clue costs 3 XP (never below 13 XP). You'd earn 25 XP right now.

Quiz time

Question 1 of 3Score 0

What does a hash function produce?

Sources & further reading

Connected courses