Skip to content
Blockchain Association of Cameroon
BAC-L2-SUB-109Substrate / Polkadot SDKAdvanced

Events, errors and block hooks

What the chain tells the outside world, and what it executes automatically each block — the part of the runtime nobody triggers.

Level
L2Appchain developer
Duration
4 h
Track
Substrate / Polkadot SDK
Maintainer
Polkadot / Substrate Lead Architect

Learning objectives

  • 01Emit events an indexer can actually consume
  • 02Distinguish a business error from a dispatch failure
  • 03Use begin- and end-of-block hooks without endangering the chain

Guided lab

Add a periodic task via a hook and observe its effect on block production time.

Independent lab

Make the periodic task bounded and resumable, then show it never exceeds its budget.

Security angle

An unbounded hook halts the chain: build the evidence that yours will not.

Assessment

Bounded periodic task, demonstrated by a load test.