Perspectives

1.20 Blocks, Hashes and Transactions

CRYPTO SCHOOL · LESSON

1.20 Blocks, Hashes and Transactions

Estimated learning time: 9 minutes
BIG 5 CAPITAL · LEARNING VISUALTransactionRequestBlockGrouped dataNetworkVerificationLedgerShared stateUse the visual as a mental map while you work through the lesson.

1.20 Blocks, Hashes and Transactions

Hashes turn input data into fixed-length outputs with strong properties that make accidental collisions and undetected modification difficult. Blocks use hashes to commit to their contents and their position in the chain. This lesson connects the cryptographic building blocks to the ledger.

Learning objectives

  • Hash functions
  • Block headers
  • Merkle trees
  • Transaction commitments
  • Chain linkage

Why this matters

Hashing is the specific mechanism behind the informal claim that blockchains are "tamper-evident." Understanding it concretely, rather than treating it as unexplained magic, lets you evaluate that claim rather than just repeat it.

Core teaching

A cryptographic hash function takes any input data and produces a fixed-length output (a "digest") with two useful properties: it is deterministic (the same input always produces the same output), and a tiny change to the input produces a completely different, unpredictable output. Hashing "Big 5 Capital" and "big 5 capital" (a single changed letter) produces two totally unrelated results — there is no partial similarity to exploit.

Each block includes a hash of its own contents and a reference to the previous block's hash. If even one transaction inside an old block were altered, that block's hash would change completely, breaking the reference every subsequent block relies on — the tampering becomes visible to anyone recomputing the chain, rather than staying hidden. This is the concrete, checkable mechanism behind tamper-evidence — not an assumption, a direct consequence of how hash functions behave combined with how blocks reference each other.

Worked example

Take the text "Big 5 Capital" and hash it with SHA-256 (the same algorithm Bitcoin uses) — you get a completely different, fixed-length output than if you hash "big 5 capital" with a lowercase b, even though only one character changed. This property (small input changes produce unpredictably different outputs) is what makes hashes useful for detecting tampering: if even one transaction inside a block is altered after the fact, the block's hash changes completely, and since each block also references the previous block's hash, altering an old block breaks the chain of references for every block after it.

This is the concrete mechanism behind the informal claim that blockchains are "tamper-evident" — it is not magic, it is a direct consequence of how hash functions behave combined with how blocks reference each other.

Deeper analysis

Hashing creates a compact commitment to data. Because changing the input changes the resulting hash, hashes make tampering detectable when the expected hash is known. Bitcoin uses hashes in several places, including transaction identifiers, block references and proof-of-work. Hashing should not be confused with encryption: there is no secret key that allows a recipient to decrypt a hash back into the original data.

Blocks connect the current batch of transactions to prior history through references in the block header. If an earlier block is altered, its hash changes and the subsequent reference no longer matches. An attacker therefore faces a chain of work rather than a single editable database row. This is one reason the security of a proof-of-work blockchain depends on the relationship between historical work and the continuing work of honest miners.

Common misconceptions

  • A hash is not encryption.
  • A hash does not reveal the original data by being 'decoded'.
  • Merkle trees allow efficient proofs that a transaction belongs to a block.

Application lab

Use any free online SHA-256 hash calculator to hash two very similar pieces of text that differ by a single character or space. Compare the two resulting hashes and note how completely different they are despite the tiny input change.

Practical exercise

Write two sentences explaining, using the hash experiment above, why an attacker cannot simply edit one old transaction in a blockchain without it becoming detectable by anyone re-checking the chain of hashes.

Knowledge check

Question: If a single transaction inside a block that was confirmed months ago were secretly altered, what would happen to that block's hash, and why would that be detectable?

Model answer: The block's hash would change completely, because even a tiny input change produces an unpredictably different hash output. Since every later block references the original hash, the mismatch would be detectable by anyone recomputing and comparing the chain of hashes.

Case study prompt

Use any free online SHA-256 hash calculator (the algorithm Bitcoin uses) to hash two nearly identical short phrases that differ by a single character. Compare the two outputs and note how completely unrelated they look despite the tiny input difference.

Key takeaways

  • A hash function produces a fixed-length, deterministic output from any input
  • Small input changes produce completely unrelated outputs
  • Each block's hash depends on its contents; changing old data changes that hash
  • Chained hash references are what make old-data tampering detectable, not assumed

Further exploration

Lesson 1.21 looks at who actually checks these hashes and enforces the rules in practice: the different roles nodes, miners and other participants play on the network.

Register to save your progress, complete assessments and build your Crypto School profile.