Skip to main content
PSUT / IoTEngineering learning studio
WORKSPACE
Offline-first portalDr. Mohammad Alja’afreh
Distributed Ledger StudioBlockchain for IoTExperimentsWorkspaces
ENGINEERING WORKSPACE
IoTPSUT IoT Engineering StudioPrincess Sumaya University for Technology · Dr. Mohammad Alja’afreh
BLOCKCHAIN FOR IOT
Blockchain for IoT

B06 · Telemetry commitments and replay resistance

Ask Dr. Mohammad · B06 →

Anchor off-chain telemetry using a bytes32 digest, per-device monotonic sequence and explicit authorization.

Design experiment & verify evidence →
B06 · Laboratory mentorAsk about the current experiment, its algorithms or Python notebook.
Ask Dr. MohammadAdaptive practice
Learning workflow · Blockchain foundationsB06 · Telemetry commitments and replay resistance

Before you start

Learning outcome: Anchor off-chain telemetry using a bytes32 digest, per-device monotonic sequence and explicit authorization.

Use fictional values only. Browser models work offline; actual Solidity compilation and Remix VM require the external Remix IDE and initial compiler download. No real funds or private credentials.

Recommended predecessors: B02, B05

Predict: Write down the expected positive and negative outcomes in the notebook before proceeding.

Related course access: IoT Security and Privacy — same laboratory, notebook and completion record.

B06 · Academic orientation

Scope and objectives

Scope of the experiment

Anchor off-chain telemetry using a bytes32 digest, per-device monotonic sequence and explicit authorization.

The focus of this experiment is to construct deterministic telemetry commitments and sequence checks. Students then compare changed, duplicate and fresh records, and verify integrity and replay decisions without assuming confidentiality. 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 deterministic telemetry commitments and sequence checks.
  • Compare changed, duplicate and fresh records.
  • Verify integrity and replay decisions without assuming confidentiality.
  • Identify the configured inputs (Original telemetry; Retrieved telemetry; Last committed sequence; Incoming sequence; Device authorized) 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 deterministic telemetry commitments and sequence checks, compare changed, duplicate and fresh records, and verify integrity and replay decisions without assuming confidentiality.

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 integrity and replay decisions without assuming confidentiality. Separate predicted values from observations.

Prerequisite knowledge and related learning

Review the following catalogue prerequisites before starting. After completion, continue to B07 · IoT dApp workflow and event evidence.

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.

Understand the experiment

Scientific architecture · Telemetry commitment and replay state

Telemetry commitment and replay — Telemetry / device, seq, value; Canonical encoding / deterministic bytes; Hash / commitment; Receiver / validate and check freshness; Decision / reject replay or mismatch
Scientific concept map: Telemetry record — Sequence + bytes; Canonical encoding — Deterministic input; Hash commitment — Ledger entry; Receiver — Freshness check; Decision — Reject reused sequence.

Scientific foundations and analytical reasoning

A digest binds exact serialized bytes; a per-device sequence prevents repeated anchors only when enforced. Authorization is separate.

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.

Scientific theory · Telemetry commitments and freshness

A commitment hashes exact canonical record bytes. A trusted commitment can later establish equality of supplied content, but not whether the sensor was truthful. Sequence enforcement is a separate stateful rule; hashes alone do not prevent replay.

Worked example and engineering interpretation

A record with sequence 11 can produce a valid digest and be anchored once. Replaying the same serialized record yields the same digest, so a contract must check accepted sequence or duplicate policy. Compare changed content with unchanged sequence and unchanged content with a new sequence.

Engineering principles · additional worked teaching example

Canonical bytes and sequence number must be bound to the commitment. Hash equality verifies bytes, while sequence monotonicity detects duplicates; neither proves physical accuracy.

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.

How to investigate B06 · Telemetry commitments and replay resistance

Anchor off-chain telemetry using a bytes32 digest, per-device monotonic sequence and explicit authorization.

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: Anchor off-chain telemetry using a bytes32 digest, per-device monotonic sequence and explicit authorization.

  1. Use authorized device and sequence 1 after 0. Observe accepted anchor and stored digest.
  2. Repeat sequence 1 and inspect replay rejection.
  3. Set last=1 or deactivate device; verify no new state is committed.
  4. Keep anchor unchanged and modify only retrieved temperature. Compare computed digest.

Reference check: Only authorized fresh unchanged sample reaches commit. Ledger storage estimate differs by placement; digest-only storage still requires off-chain availability.

Model boundary: Toy security gates with declared role and sequence; no actual cryptographic identity, privacy proof or production blockchain.

Independent task and submission evidence

2. Repeat sequence 1 and inspect replay rejection. 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.

Worked engineering reasoning and boundary conditions

Engineering reference configuration: Original telemetry = {"temp":25}; Retrieved telemetry = {"temp":25}; Last committed sequence = 0; Incoming sequence = 1; Device authorized = true; Repeat same anchor = true. In the classroom model, Anchor accepted = Yes; Replay accepted = No; Digest matches = Yes; Final sequence = 1. Sequence state advances only after a successful anchor. Actual SHA-256 with declared registry state and monotonic counter; no live chain.

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.

Concept animation · operation pathway

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.

B06 · Telemetry commitments and replay resistance: operation pathwayRegistryokSequenceokCommitokRead the active operation, then inspect the accumulated state.

Step 1 of 3 · Registry

Registry

Registry
ok

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

Recall the concept before revealing its explanation.

0 / 3 revealed
B06 · 01 / 08What goes on-chain?Reveal explanation
Engineering explanation

A digest and sequence, not the raw sensor measurement.

B06 · 02 / 08Why track sequence?Reveal explanation
Engineering explanation

Reject duplicated or older accepted values for each enrolled identity.

B06 · 03 / 08Does the digest guarantee sensor truth?Reveal explanation
Engineering explanation

No. It establishes equality of bytes against a commitment; compromised sensors can commit false readings.

B06 · 04 / 08Why commit a canonical serialization of telemetry?Reveal explanation
Engineering reasoning

Equivalent-looking records can serialize to different bytes; both parties must hash the same byte representation.

B06 · 05 / 08Why reject duplicate sequence values even with a matching digest?Reveal explanation
Engineering reasoning

A matching digest establishes byte integrity, not freshness; duplicate acceptance can replay a valid observation.

B06 · 06 / 08An off-chain measurement is committed. Select every technically valid statement. A. A digest binds the encoded payload to its commitment. B. A per-device sequence can enforce a monotonic acceptance policy. C. The digest itself stores the entire original payload reversibly. D. An unauthorized sender should advance the trusted sequence.Reveal explanation
Applied scenario

Correct: A. A digest binds the encoded payload to its commitment.; B. A per-device sequence can enforce a monotonic acceptance policy.

B06 · 07 / 08How do you carry out 5. Negative and recovery controls?Reveal explanation
Implementation recall

Repeat anchor at sequence 1; switch to owner and revoke account 1; switch to account 1 and try sequence 2. Reauthorize via owner and retry sequence 2.

B06 · 08 / 08For B06 · Telemetry commitments and replay resistance, which actual output or state confirms the prescribed practical run succeeded, and what does it not establish?Reveal explanation
Evidence & acceptance

Deploy TelemetryAnchor.sol from account 0, authorize account 1. Exact fictional UTF-8 text device-01:25.0 has SHA-256 0xd7aae1a6cca0a659dd989fab5f79b58c6832551afe8a11bac382b20a35d74e78. Use the whole 0x-prefixed 32-byte digest, no quotes or extra 0x, sequence 1; switch Remix caller to account 1. Require successful receipt, lastSequence=1, matching digest; duplicate must revert InvalidSequence. Owner revokes; account 1 seq 2 must revert Unauthorized. Reauthorize, seq 2 succeeds. VerifyLatest reads only latest commitment, not measurement truth.

Shared research workbenches · network designer & advanced studies
Concurrent-device simulation & Monte Carlo research
Distributed digital twin · topology, protocol & battery research
Loading experiment-specific apparatus…
Previous model / additional reference tools
Simulation task

Anchor off-chain telemetry using a bytes32 digest, per-device monotonic sequence and explicit authorization.

Explore the model using its own controls. Record a prediction before changing a condition. Compare the reference with a changed condition, then use the Experiment tab for the procedure, acceptance criteria and notebook. Model outputs and physical observations must remain separate.

Interactive engineering workbenchB06 · Existing model

Interactive simulation

The model is an independent teaching abstraction, not Solidity execution or Ethereum consensus. SHA-256 uses actual browser cryptography when available.

Loading executable simulation…

B06 · Model-linked instrumentation

Visual observation lens

Back to controls ↑

Browser ledger / digest abstraction; not EVM transaction execution.

Loading instrument…

Awaiting model display.

Experimental instrumentation · A/B

Compare two model conditions

Capture a baseline, change one experimental condition, run the model if required and capture the comparison. Snapshots contain visible controls and display text, not physical sensor readings. Review before exporting.

Open simulation view
Baseline A
Not captured
Comparison B
Not captured

Capture a baseline to begin.

Evidence portfolio →
V19.0 · Contextual AI workspace

Ask your engineering assistants

B06 · current context

Ask Dr. Mohammad locally, or prepare an experiment-aware prompt for ChatGPT, Gemini or Claude. The external providers open in their own tabs; nothing is automatically submitted.

Dr. Mohammad · offline
Dr. Mohammad

Offline curriculum-grounded assistance.

Open local tutor
B06 · Telemetry commitments and replay resistance

Public course objective, displayed commands, source excerpts and procedure. Private assessment content is not collected.

Prepare a contextual AI prompt

0 characters

Common secret and email patterns are redacted on preparation; this is not a comprehensive privacy filter. Review the entire editable prompt, including student work and unpublished research, before sharing. The providers apply their own accounts, privacy settings and limits.

Prepare → review → copy & open your selected provider → paste and submit there.

Run & verify — acceptance checklist

Build verification: Commitment/replay model tested; actual Solidity compilation/EVM pending.

Deploy TelemetryAnchor.sol from account 0, authorize account 1. Exact fictional UTF-8 text device-01:25.0 has SHA-256 0xd7aae1a6cca0a659dd989fab5f79b58c6832551afe8a11bac382b20a35d74e78. Use the whole 0x-prefixed 32-byte digest, no quotes or extra 0x, sequence 1; switch Remix caller to account 1. Require successful receipt, lastSequence=1, matching digest; duplicate must revert InvalidSequence. Owner revokes; account 1 seq 2 must revert Unauthorized. Reauthorize, seq 2 succeeds. VerifyLatest reads only latest commitment, not measurement truth.

Record the actual output, source (mock/model or physical), and any error. A missing tool, timeout or untested external service is not a pass.

Complete lab-by-lab verification report →Open automated verification center → Ask Engineering Copilot →

Independent theoretical exercises

Before the simulation or practical, solve both experiment-specific tasks. List the given inputs, show the intermediate calculation or state trace, identify the expected observation, and state a limitation. Show formulas and intermediate calculations where relevant, or draw the requested state/sequence diagram. These are independent classroom fixtures; where they differ from the reference configuration below, do not treat them as measured values. Compare your predictions with the corresponding experiment afterwards.

01 · Predict and derive using the given inputs

For last sequence 0, evaluate authorized seq 1, duplicate 1, unauthorized seq 2 and authorized seq 2 with changed retrieved bytes.

02 · Compare or justify using evidence

Distinguish on-chain acceptance from off-chain content verification. Write the digest equality check and identify which state advances.

03 · State tracing

State tracing · Independent work

Last committed sequence5. Submit seq6 with matching digest, replay seq6, then seq7 whose retrieved content differs. Predict outcomes.

Work is saved locally when browser storage is available. Export it for submission; no remote upload or automatic grade is assigned.

Expanded independent theoretical exercise bank

Progress from calculation and interpretation to diagnosis and controlled engineering design. Complete the questions without opening the simulation first; show intermediate steps.

Intermediate · Explain a changed-input result

Independent theoretical exercise · B06-01

Use the reference configuration (Original telemetry = {"temp":25}; Retrieved telemetry = {"temp":25}; Last committed sequence = 0; Incoming sequence = 1; Device authorized = true; Repeat same anchor = true), but change Last committed sequence = 2. The model reports Anchor accepted = No. Explain the governing rule and assumptions that make this output plausible; identify an independent verification method.

Intermediate · Interpret a state transition

Independent theoretical exercise · B06-02

The reference model reports Anchor accepted: Yes. Under Last committed sequence = 2 it reports No. Explain which configured condition changed and what the two outputs establish, and what they do not establish.

Intermediate · Interpret a technical trace

Independent theoretical exercise · B06-03

For Incoming sequence = 3, the model supplies this excerpt from Anchor transaction: Device active · Incoming sequence · Before · After · Commit digest Yes · 3 · 0 · 3 · eb5900fadba304239b346d5db792249dbb33ef0154043679f8eb26301bf09fca Count rows whose Incoming sequence value is exactly “3”, and identify the displayed row numbers. Explain what the count describes.

Advanced · Reverse reasoning

Independent theoretical exercise · B06-04

An observation is Final sequence = 3. Candidate A uses Original telemetry = {"temp":25}; Retrieved telemetry = {"temp":25}; Last committed sequence = 0; Incoming sequence = 1; Device authorized = true; Repeat same anchor = true. Candidate B changes the listed settings (Incoming sequence = 3) and keeps the remaining settings fixed. Which is consistent with the observation? If both can explain it, say what additional evidence is required.

Advanced · Diagnose a reported mismatch

Independent theoretical exercise · B06-05

A student configures Repeat same anchor = false while preserving all other reference settings, but copies the reference report of Replay accepted = No. Evaluate whether the report is justified. Identify the first configuration/output check to perform.

Challenging · Design a controlled verification

Independent theoretical exercise · B06-06

Design a controlled comparison for B06 · Telemetry commitments and replay resistance using reference Original telemetry = {"temp":25}; Retrieved telemetry = {"temp":25}; Last committed sequence = 0; Incoming sequence = 1; Device authorized = true; Repeat same anchor = true and test Last committed sequence = 2. Specify the changed setting(s), measured metric Anchor accepted, controls, repetitions, an acceptance check and what evidence can distinguish an actual implementation from the model.

Step-by-step experimental procedure

Commit an off-chain record digest and enforce strictly increasing device sequence.

1 · Reference workbench configuration

Use the named reference workbench and its reference inputs. Additional live instruments may have different controls; use the matching instrument. Record virtual and practical results separately.

Original telemetry{"temp":25}
Retrieved telemetry{"temp":25}
Last committed sequence0
Incoming sequence1
Device authorizedYes
Repeat same anchorYes

2 · Perform the investigation in order

  1. Use authorized device and sequence 1 after 0. Observe accepted anchor and stored digest.
  2. Repeat sequence 1 and inspect replay rejection.
  3. Set last=1 or deactivate device; verify no new state is committed.
  4. Keep anchor unchanged and modify only retrieved temperature. Compare computed digest.
  5. Compile and deploy TelemetryAnchor in Remix; run positive, replay and unauthorized controls using fictional data.

3 · Compare controlled trials

TrialIndependent changeExpected checkObservation
Anchor and replayUse reference inputs aboveAnchor accepted: Yes; Replay accepted: No; Digest matches: YesRecord actual result
Inactive sensorDevice authorized = NoAnchor accepted: NoRecord actual result
Old sequenceLast committed sequence = 1Anchor accepted: NoRecord actual result
Alter off-chainRetrieved telemetry = {"temp":35}Digest matches: NoRecord actual result

4 · Analyze and report

Explain why a hash commitment does not authenticate the sensor by itself.

Required evidence: Anchor state and digest/replay traces.

Model boundary: Actual SHA-256 with declared registry state and monotonic counter; no live chain.

Controlled investigation · reproducible evidence

Method. Use the existing reference workbench configuration and the named controlled changes below. A controlled variable stays fixed while the independent variable is intentionally changed; the dependent variable is the resulting observed output. First predict each trial from the Concepts page. Run the baseline, then change only the specified setting and record the outcome. For deterministic traces one execution per case and a repeated verification are sufficient; for timing or stochastic measurements repeat at least five times, recording each run, median and range. Reset to the reference state between independent comparisons.

TrialIndependent changeDependent observation
Anchor and replayUse reference inputs aboveRecord actual outcome and units
Inactive sensorDevice authorized = NoRecord actual outcome and units
Old sequenceLast committed sequence = 1Record actual outcome and units
Alter off-chainRetrieved telemetry = {"temp":35}Record actual outcome and units

Evidence: attach the completed comparison table, one trace or screenshot per condition, and actual practical terminal/hardware evidence where applicable. Explain any prediction mismatch and distinguish modeled behavior from measured results.

Loading laboratory-specific procedure…

Independent implementation sequence

  1. 1. Create fictional telemetry
  2. 2. Test duplicate and change
  3. 3. Compile and deploy TelemetryAnchor
  4. 4. Generate digest and anchor
  5. 5. Negative and recovery controls

Complete practical procedure

Open Remix IDE ↗ · Official deployment guide

1. Create fictional telemetry

Use the model as owner to authorize sensor, switch to sensor, sequence 1, Hash and submit.

✓ Expected: The commitment is accepted; sequence becomes 1 and digest is stored.

2. Test duplicate and change

Submit again at sequence 1, then modify the telemetry and Verify latest commitment.

✓ Expected: The duplicate is rejected; modified bytes do not match.

3. Compile and deploy TelemetryAnchor

Use B04 compiler settings and Remix VM; deploy from account 0. Register account 1 with setDevice(account 1,true).

✓ Expected: active(account 1) becomes true.

4. Generate digest and anchor

Reset the model, authorize sensor as owner, switch to sensor, enter sequence 1 and device-01:25.0, then hash/submit. Copy the 64 hexadecimal digest from output; prepend 0x. Switch Remix to account 1. Call anchor(1,0x followed by the digest).

✓ Expected: Receipt succeeds; lastSequence(account 1) is 1, lastDigest matches.

5. Negative and recovery controls

Repeat anchor at sequence 1; switch to owner and revoke account 1; switch to account 1 and try sequence 2. Reauthorize via owner and retry sequence 2.

✓ Expected: Duplicate and revoked writes revert; reauthorized fresh write succeeds. verifyLatest for the latest sequence/digest returns true.

Experimental notebook

Record your own results. Values are not prefilled or independently verified.

Source & scientific method

The SHA-256 commitment covers exact UTF-8 bytes, not Ethereum keccak256. The contract receives a bytes32 commitment and does not validate source sensor data. Only the latest digest is stored; prior events remain visible.

TelemetryAnchor.sol

Download source file
Solidity
// SPDX-License-Identifier: MIT
pragma solidity 0.8.28;
/// @notice Store only a digest and monotonic sequence, never raw private telemetry.
/// A commitment proves equality with supplied bytes, not truth of sensor measurements.
contract TelemetryAnchor {
    address public immutable owner;
    mapping(address => bool) public active;
    mapping(address => uint64) public lastSequence;
    mapping(address => bytes32) public lastDigest;
    event DeviceStatus(address indexed device, bool enabled);
    event Anchored(address indexed device, uint64 sequence, bytes32 digest);
    error NotOwner();
    error InvalidDevice();
    error Unauthorized();
    error InvalidSequence();
    error EmptyDigest();
    constructor() { owner = msg.sender; }
    function setDevice(address device, bool enabled) external {
        if (msg.sender != owner) revert NotOwner();
        if (device == address(0)) revert InvalidDevice();
        active[device] = enabled;
        emit DeviceStatus(device, enabled);
    }
    function anchor(uint64 sequence, bytes32 digest) external {
        if (!active[msg.sender]) revert Unauthorized();
        if (sequence <= lastSequence[msg.sender]) revert InvalidSequence();
        if (digest == bytes32(0)) revert EmptyDigest();
        lastSequence[msg.sender] = sequence;
        lastDigest[msg.sender] = digest;
        emit Anchored(msg.sender, sequence, digest);
    }
    function verifyLatest(address device, uint64 sequence, bytes32 digest) external view returns (bool) {
        return sequence != 0 && lastSequence[device] == sequence && lastDigest[device] == digest;
    }
}

Toolkit instructions and references · Download complete blockchain toolkit

Verification, troubleshooting and reflection

Compare each observation with its expected result. If a check fails, identify whether the issue is the environment, contract selection, caller identity, sequence, byte encoding or model setup. Do not infer success from a timeout or a missing receipt. In Remix inspect the compiler errors and revert message; do not bypass the negative control.

Reset the browser model for a fresh run. Resetting Remix VM removes its deployed state. Keep screenshots and receipts before reset. For actual EVM execution, save compiler/fork/settings and transaction receipts. Explain limitations and propose one additional independent test.

Python / Google Colab laboratory

B06 · 9 notebook cells · 2 executable Python cells

Complete the theoretical investigation first. Run the cells in order, record actual outputs and compare against your prediction.

How to execute

  1. Download this notebook and open Google Colab. Select File → Upload notebook and choose the downloaded .ipynb.
  2. Read the Markdown instructions before each executable cell. Use a Python runtime, run cells from top to bottom, and resolve imports if necessary.
  3. Perform the baseline and controlled changes. Save the notebook with actual outputs and your written interpretation.

Execution scope: Toy security gates with declared role and sequence; no actual cryptographic identity, privacy proof or production blockchain. Default computational cells passed isolated local Python execution; physical equipment and live services require separate verification.

01Instructions · Markdown
# B06 · B06 · Telemetry commitments and replay resistance **PSUT IoT Engineering Studio — Dr. Mohammad Alja’afreh** ## 1. Scientific objective Commit an off-chain record digest and enforce strictly increasing device sequence. Complete the analytical worksheet in the portal first. Record your predictions before running this notebook. This notebook is a bounded local computational investigation; use the portal’s separate WSL, hardware or Remix procedure for real interfaces.
02Instructions · Markdown
## Experiment-specific preparation Anchor off-chain telemetry using a bytes32 digest, per-device monotonic sequence and explicit authorization. **Reference procedure (use the matching simulator/WSL tool where named, not an unrelated service):** 1. Use authorized device and sequence 1 after 0. Observe accepted anchor and stored digest. 2. Repeat sequence 1 and inspect replay rejection. 3. Set last=1 or deactivate device; verify no new state is committed. 4. Keep anchor unchanged and modify only retrieved temperature. Compare computed digest. 5. Compile and deploy TelemetryAnchor in Remix; run positive, replay and unauthorized controls using fictional data. **Evidence:** Only authorized fresh unchanged sample reaches commit. Ledger storage estimate differs by placement; digest-only storage still requires off-chain availability. **Boundary:** Toy security gates with declared role and sequence; no actual cryptographic identity, privacy proof or production blockchain.
03Instructions · Markdown
## 2. Reference configuration and investigation 1. Use authorized device and sequence 1 after 0. Observe accepted anchor and stored digest. 2. Repeat sequence 1 and inspect replay rejection. 3. Set last=1 or deactivate device; verify no new state is committed. 4. Keep anchor unchanged and modify only retrieved temperature. Compare computed digest. 5. Compile and deploy TelemetryAnchor in Remix; run positive, replay and unauthorized controls using fictional data. Run cells in order; do not substitute model results for physical measurements.
04Instructions · Markdown
## 3. Construct a stable telemetry byte representation and commitment.
05Python · executable cell
PYTHON · Code cell
# =====================================================================
# B06 | Code cell 01 | B06 · Telemetry commitments and replay resistance
# Purpose: 3. Construct a stable telemetry byte representation and commitment.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
import json,hashlib,hmac
# Set record for the next computation or reference condition.
record={"device":"A","seq":4,"temperature":25}
# Set raw for the next computation or reference condition.
raw=json.dumps(record,sort_keys=True,separators=(",",":" )).encode()
# Prepare key; retain only the scope required for this trial.
key=b"fictional-lab-key"
# Set tag for the next computation or reference condition.
tag=hmac.digest(key,raw,"sha256")
print(raw,hashlib.sha256(raw).hexdigest())
Ask Dr. Mohammad about this cell
06Instructions · Markdown
## 4. Check authentication, authorization and sequence independently.
07Python · executable cell
PYTHON · Code cell
# =====================================================================
# B06 | Code cell 02 | B06 · Telemetry commitments and replay resistance
# Purpose: 4. Check authentication, authorization and sequence independently.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Define the reusable operation accept; keep its logic separate from the trial.
def accept(payload,tag,previous,authorized):
    if not authorized or not hmac.compare_digest(hmac.digest(key,payload,"sha256"),tag):return False
    return json.loads(payload)["seq"]>previous
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert accept(raw,tag,3,True)
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert not accept(raw,tag,4,True)
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert not accept(raw.replace(b"25",b"26"),tag,3,True)
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert not accept(raw,tag,3,False)
Ask Dr. Mohammad about this cell
08Instructions · Markdown
## Experimental analysis and submission 1. Record the reference input, predicted output and actual result. 2. Modify one independent variable and run the relevant cells again. 3. Explain the result using the theory and identify model limitations. 4. Save the notebook with outputs and retain the separate theoretical worksheet. **Your derivation and conclusion:** (Complete independently.)
09Instructions · Markdown
## Guided reasoning and evidence A controlled comparison changes one independent input while keeping the other relevant inputs fixed; the dependent variable is the recorded output. Use this lab’s reference condition above. **Independent task:** 2. Repeat sequence 1 and inspect replay rejection. Record the named input, prediction, actual output and one limitation; restore the original condition and repeat. | Trial | Input/configuration | Prediction | Observation | Evidence / limitation | |---|---|---|---|---| | A | Reference | | | | | B | Changed input | | | | | A repeat | Reference | | | | A conclusion is supported only when it cites the recorded values or observed states and explains them with the experiment theory.