Skip to the workspace
Pebellslearn by building
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.

blockchain / Blocks and the Chain

Explore each scene at your own pace.

01 · The rule

The rule

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.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.