Skip to main content
Distributed Ledger StudioBlockchain for IoTExperimentsWorkspaces
IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
BLOCKCHAIN FOR IoT · BC-M06
Blockchain for IoT

Blockchain elements: Merkle trees and light clients

Dr. Mohammad Alja’afreh · Princess Sumaya University for Technology

H0H1H2H3H01H23Root
Design experiment & verify evidence →
BC-M06 · Laboratory mentorAsk about the current experiment, its algorithms or Python notebook.
Ask Dr. MohammadAdaptive practice

← Lecture-aligned module experiments · All blockchain labs · Setup wizard

Introduction

Hash-linked blockchain headers

Thin-client proof and authenticated header — Transaction / recompute leaf H2; Proof siblings / H3 and H01 in order; Trusted header / Merkle root commitment; Compare recomputed root / H(H01||H(H2||H3)); Membership result / not full block validity
A successor commits to the previous header hash; the Merkle root commits to transaction data

Scientific architecture · Merkle tree, block header and thin-client verification

Light client links transaction to header — Transaction / leaf hash; Sibling path / recompute root; Block header / committed Merkle root; Trusted header chain / verify header context; Compare / membership only, not all validity
Scientific concept map: Transactions — Leaf hashes; Merkle tree — Pairwise ordered hashes; Root — Header commitment; Header — Previous hash + nonce; Light client — Verify inclusion path.

Scientific foundations and analytical reasoning

A block header commits the previous block and Merkle root. Inclusion proofs verify an ordered leaf against a trusted root.

Before operating the equipment or executing the program, derive the expected outcome using the required theoretical work in Experiment. Use the diagram to identify the variables and system boundaries.

BC-M06 · Academic orientation

Scope and objectives

Scope of the experiment

Build the eight-transaction binary hash tree shown in the module. Inspect ordered hash inputs, root and logarithmic inclusion proof with a trusted header root.

The focus of this experiment is to construct a Merkle root from ordered leaf digests. Students then trace an inclusion proof and sibling ordering, and verify the trusted root and explain what inclusion does not prove. The Concepts view explains the operation before the practical work; the Simulation view is used to examine reference and changed inputs, not to substitute for actual measurements.

Learning objectives

  • Construct a Merkle root from ordered leaf digests.
  • Trace an inclusion proof and sibling ordering.
  • Verify the trusted root and explain what inclusion does not prove.
  • Identify the configured inputs (Ordered transactions (semicolon separated); Leaf index (zero based); Candidate transaction; Proof modification; Previous block hash (teaching header)) and record the corresponding observed outputs with units where applicable.
  • Compare the reference calculation or decision with an independent implementation or authorized observation; state any discrepancy and the applicable model boundary.

Expected learning outcomes

On completion, students can construct a Merkle root from ordered leaf digests, trace an inclusion proof and sibling ordering, and verify the trusted root and explain what inclusion does not prove.

Required deliverables

Submit the derivation or state trace for the named operation, the exact reference and changed configurations, the associated simulator or practical evidence, and a short validation statement addressing verify the trusted root and explain what inclusion does not prove. Separate predicted values from observations.

Prerequisite knowledge and related learning

Review the foundational terminology in Concepts and confirm readiness using the existing setup instructions. After completion, continue to Mining, nonce search and double spending.

Environment and experimental methodology

The listed browser model and experiment-specific local Python, Solidity or EVM workflow, where provided. Do not treat a model as a deployed ledger.

Begin with a manual prediction, record the baseline, change one independent condition at a time, and compare the resulting trace or measurements with the original prediction. Record observations and uncertainty separately from reference values. Follow the experiment’s specific procedure, safety limits, and acceptance checks.

Scientific theory · Header commitment and inclusion

A block header links to the previous header and commits transactions through a Merkle root. A light client verifies inclusion using sibling hashes and orientation against a trusted header; it does not download every transaction in this model. Header authenticity and consensus are additional checks.

Worked example and engineering interpretation

A balanced four-leaf Merkle tree requires two sibling hashes for an inclusion proof. Modify one leaf, recompute its ancestor hashes and compare against the original trusted root. A locally recomputed root is not the same as a proof against the original commitment.

Engineering principles · additional worked teaching example

A Merkle proof contains sibling hashes and left/right ordering. In a four-leaf tree with h0…h3, leaf2 proof uses h3 then H(h0‖h1); compute H(h2‖h3), then combine with left subtree. The trusted root is essential.

From theory to experiment

Predict the reference result before operating the workbench; check the actual intermediate state, units and constraints. The existing simulation, implementation and procedure below are distinct sources of evidence.

Worked engineering reasoning and boundary conditions

Engineering reference configuration: Ordered transactions (semicolon separated) = T1;T2;T3;T4;T5;T6;T7;T8; Leaf index (zero based) = 2; Candidate transaction = T3; Proof modification = none; Previous block hash (teaching header) = 0000000000000000000000000000000000000000000000000000000000000000; Header nonce = 0. In the classroom model, Verified = Yes; Tree hash operations = 15; Proof bytes = 96 B; Full leaf hashes = 256 B. The original tree and header trust anchor are calculated from the editable transaction set; the independent candidate and sibling order are then verified. Actual SHA-256 with explicit domain-separated UTF-8 teaching encoding. Not Bitcoin wire serialization or Ethereum Keccak.

Use the diagram to follow the calculation or state progression. Keep the teaching configuration separate from the independent exercise values; compare observations with the actual model and implementation.

Mathematical representation and interpretation

Merkle parent construction

The child digests are concatenated in the defined order using the same byte representation; membership depends on the independently trusted root.

\[h_{i,j}=H(h_i\parallel h_j)\]

Concept animation · independent state notebook

Explore the teaching example independently of the simulator. Each step reveals an operation, data relationship or calculated state. The Simulation view has separate editable inputs.

Blockchain elements: Merkle trees and light clients: independent state notebook1234Tree level 0Node 05007e18fe7ee36c0a92636757635b432fde39d91bc…Node 1fe7e75c1572c03c58331fc8aa03d5731199605a63e…Node 250de762b8fd96e8569a78309bf140d660cb5abe719…Node 3f9f9a347a66a8b7fa96b148ea420c8ce38d978dfcd…Node 449aa635fb1c8d0a6d6f29ecf01efa2a4c5b3c2dd15…Node 5e081de1d966214383f5612d3a6bcb46bb5e25ff470…

Step 1 of 4 · Tree level 0

Tree level 0

phase
Tree level 0
Node 0
5007e18fe7ee36c0a92636757635b432fde39d91bc46c0a3118ba68f44addace
Node 1
fe7e75c1572c03c58331fc8aa03d5731199605a63eccf186a4fcdf28e02964ba
Node 2
50de762b8fd96e8569a78309bf140d660cb5abe719615cd93bd9d2c025f1d957
Node 3
f9f9a347a66a8b7fa96b148ea420c8ce38d978dfcded7e6b6c509b83a94da624
Node 4
49aa635fb1c8d0a6d6f29ecf01efa2a4c5b3c2dd1565f3abaf0aadec9adeb358
Node 5
e081de1d966214383f5612d3a6bcb46bb5e25ff470e2bc466dcc7c626e6ca7d2

Teaching example only; inspect live calculations or real practical evidence separately.

How to investigate Blockchain elements: Merkle trees and light clients

Build the eight-transaction binary hash tree shown in the module. Inspect ordered hash inputs, root and logarithmic inclusion proof with a trusted header root.

Analytical investigation means collecting an observation, identifying the mechanism, using a calculation or state trace to explain it, and checking your conclusion against evidence. Controlled comparison means changing one independent variable, holding the remaining relevant conditions constant, and measuring a dependent variable against a baseline. Experimental validation means comparing a predicted result to a reproducible observation or assertion; agreement inside a model does not certify hardware. Evidence-based reasoning connects a specific observation to a theoretical rule and states uncertainty, not merely an opinion. Performance characterization records a named metric and its units across conditions; sensitivity analysis changes one parameter across several values. A threat assessment links an asset, threat, consequence and evidence to a mitigation.

Experiment-specific guided practice

Objective: Build the eight-transaction binary hash tree shown in the module. Inspect ordered hash inputs, root and logarithmic inclusion proof with a trusted header root.

  1. Use T1 through T8, zero-based leaf index 2, candidate T3. Inspect all eight leaf hashes, four first parents, two second parents and one root. Confirm 15 tree hashes.
  2. Inspect each exact hash input: leaf: followed by the JSON-encoded record; node: followed by two ordered 64-hex digests. Explain why left/right order matters.
  3. Change only candidate to T3 modified; trusted root must stay fixed and computed root must change. Restore candidate and modify one sibling or its order.
  4. Use four records and leaf 2. Calculate 7 hashes and 64 raw proof bytes; compare with 8 records (15 hashes, 96 bytes).

Reference check: Four leaves require 7 digests and 2 proof siblings; eight require 15 digests and 3 siblings. Modified candidate fails against the original root.

Model boundary: Domain-separated UTF-8 encoding matches the existing teaching labs; not Bitcoin double-SHA256 byte serialization or Ethereum Keccak. Inclusion does not establish finality or source truth.

Independent task and submission evidence

2. Inspect each exact hash input: leaf: followed by the JSON-encoded record; node: followed by two ordered 64-hex digests. Explain why left/right order matters. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat.

Before execution write the independent variable and its levels, dependent observation with units where applicable, baseline, controlled variables, measurement method and expected result. For a state machine use state/event/output rather than inventing a numeric metric. Record failures and repeat the baseline. A weak conclusion is “it works”; a supported conclusion names the changed setting, observed value/state, corresponding rule and one limitation.

TrialChanged settingFixed settingsPredicted resultActual observation / unitsEvidence / uncertainty
A: baselineReferenceRecordPredictRecordRecord
B: one changeRecordSame as APredictRecordRecord
A: repeatRestoreSame as APredictRecordRecord

Completion: submit the filled table, relevant simulator screenshot or terminal/notebook output, reasoning with units/assumptions, and one limitation. Preserve the independent assessment questions; this guide does not fill their answers.

Build the eight-transaction binary hash tree shown in the module. Inspect ordered hash inputs, root and logarithmic inclusion proof with a trusted header root.

Learning goals

  1. Explain the mechanism using the actual intermediate states in this experiment.
  2. Predict and verify the reference and modified conditions described below.
  3. Interpret the acceptance criteria and identify the limits of the model.

Module flashcards · 12 questions

Browse all 12 questions and explanations
What is a leaf hash?

The digest of one encoded record.

How are internal hashes constructed here?

SHA-256 of the node prefix and ordered hexadecimal child digests.

How many siblings prove membership in an eight-leaf complete tree?

Three 32-byte sibling digests plus ordering/index information.

What happens if the verifier replaces the trusted root after tampering?

The comparison no longer checks against the original commitment.

Why is child order important?

H(left || right) generally differs from H(right || left).

How many total hashes for four leaves?

Seven: four leaves, two parents and the root.

How many total hashes for eight leaves?

Fifteen: eight leaves, four first-level parents, two next-level parents and the root.

What changes when one of eight leaves is edited?

Its leaf and three ancestor digests change; unrelated subtree hashes remain unchanged.

How many total digests are computed for four leaves?

Seven: four leaf digests and three internal digests.

How many total digests are computed for eight leaves?

Fifteen: eight leaf digests and seven internal digests.

How many sibling hashes are needed in the eight-leaf membership proof?

Three, one per level.

Why must the original root remain trusted during the tampering trial?

Replacing the trusted root with a new root would invalidate the integrity comparison.

BC-M06 engineering diagram
Engineering diagram · BC-M06. Use the interactive workstation to investigate the calculated state.
Shared research workbenches · network designer & advanced studies
Concurrent-device simulation & Monte Carlo research
Distributed digital twin · topology, protocol & battery research