Pebellslearn by building
0%
RoadmapsMatrixCoursesSandboxSign in
Introduction to Blockchain  ›  Lesson

Blocks and the Chain

Blockchain Structure 12 minEach block holds a batch of transactions and a header containing the previous block's hash, so changing any old block breaks every link after it.

Blocks and the Chain

Suppose Ravi opens his own copy of the co-op chain and changes one old entry from "Ravi pays Meera 3" to "Ravi pays Meera 1". On a blockchain that edit cannot hide. It breaks something visible, and every other node can see the break. The reason is the way blocks are joined together.

The rule

Each block stores the previous block's hash, so one edit breaks every later link.

A hash is a short fingerprint computed from data. The same data always gives the same fingerprint, and changing even one character gives a completely different one. Section 2 shows how hash functions work; for now, "fingerprint" is enough.

A block has two parts:

  • Body: the batch of transactions the block adds.
  • Header: a small summary. It holds the hash of the previous block, a timestamp, and one hash that summarises every transaction in the body, called the Merkle root (section 2). Proof-of-work chains add a nonce, a number miners adjust (section 3).

A block's own hash is computed from its header. Because the header contains the Merkle root, that hash depends on every transaction in the block as well.

Block 0 (genesis)   Block 1                Block 2                  Block 3
prev: none          prev: hash(Block 0)    prev: hash(Block 1)      prev: hash(Block 2)
co-op opens         Asha pays Ravi 5       Ravi pays Meera 3        Kabir pays Asha 1

The first block, the genesis block, has no parent. A block's position is its height, counted from zero, so the genesis block has height 0 and the newest block is the tip.

The shortcut

Picture the chain as dominoes of fingerprints. Change a block and its hash changes. The next block's "prev" field no longer matches. To hide that, you must rebuild the next block too, and the one after it, all the way to the tip.

Ravi edits Block 2 on his copyStep 1 of 4
  1. The edit

    Ravi changes "Ravi pays Meera 3" to "Ravi pays Meera 1". Block 2's transactions are now different.

To make the lie consistent, Ravi would have to rebuild every block from the one he changed up to the tip, and then persuade the whole network to adopt his version. Section 3 shows why consensus rules make that extremely expensive. Hash links make tampering evident; consensus makes it impractical.

The trap is to think blocks are "locked" or encrypted. They are not hidden at all: anyone can read them. They are linked, which is a different thing.

Drills

Answer fast — trust the rule.

quick drill

Which header field joins a block to the chain?

quick drill

What is the height of the genesis block?

quick drill

A chain has blocks at heights 0 to 9. Ravi edits Block 2. To make his copy consistent again, which blocks must he rebuild?

quick drill

Why does a block's hash change when one of its transactions changes?

quick drill

What do hash links on their own give a blockchain?

Remember

  • Each block stores the previous block's hash, so one edit breaks every later link.
  • Shortcut: dominoes of fingerprints. Edit one block and you must rebuild everything after it.
  • Trap: linked is not locked. Anyone can read the blocks; hashes make tampering evident, and consensus makes it impractical.

Practice — level up

0/1 solved

Write your answer, then compare it with a rubric and a model answer.

ExplainFollow the broken links

A chain has blocks at heights 0 to 19. Someone changes an amount inside Block 5 on their own copy. Walk through, link by link, why the change is detected, and what they would have to do to hide it.