Compare payload byte budgets and design paired EVM gas measurements without substituting byte counts for gas.
The focus of this experiment is to compare batching configurations under controlled transaction conditions. Students then calculate per-record bytes and gas from observed results, and distinguish storage estimates from actual EVM measurements. 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
Compare batching configurations under controlled transaction conditions.
Calculate per-record bytes and gas from observed results.
Distinguish storage estimates from actual EVM measurements.
Identify the configured inputs (Number of records; Bytes per sample) 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 compare batching configurations under controlled transaction conditions, calculate per-record bytes and gas from observed results, and distinguish storage estimates from actual EVM measurements.
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 distinguish storage estimates from actual EVM measurements. Separate predicted values from observations.
Prerequisite knowledge and related learning
Review the following catalogue prerequisites before starting. After completion, continue to Local IoT dApp and contract acceptance.
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.
B14 · learning outcome
Understand the experiment
Scientific architecture · Batching and controlled gas experiments
Scientific concept map: Incoming reports — Arrival rate; Batch policy — Size or interval; Transaction construction — Gas estimate; Capacity limit — Queue / block; Measure — Gas per record and latency.
Scientific foundations and analytical reasoning
Batch size trades transaction count, delay and payload overhead. A gas experiment must measure actual executed transactions under matched conditions.
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 · Batching cost and latency trade-offs
Batching reduces the number of submissions by grouping records but can increase per-transaction execution and waiting time. Gas is determined by actual execution, including calldata and storage. A controlled study holds contract version, state and input workload fixed, and compares receipt gas rather than a byte-count proxy.
Worked example and engineering interpretation
With 24 readings and batch size 5, ceil(24/5)=5 transactions, the final batch containing four. At one reading per second the first record waits up to four additional seconds before a full batch is formed. Report both cost and latency, including the incomplete final batch.
Engineering principles · additional worked teaching example
A controlled gas experiment holds contract, compiler, chain configuration and record encoding fixed. Report measured gasUsed per record and per batch separately; avoid assuming gas scales linearly.
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 Batching and controlled gas experiments
Compare payload byte budgets and design paired EVM gas measurements without substituting byte counts for gas.
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: Compare payload byte budgets and design paired EVM gas measurements without substituting byte counts for gas.
Save baseline, vary record count and byte size independently. Record payload bytes only; do not report gas from the model.
Follow B08: compile GasStudy with 0.8.28, Shanghai, optimizer disabled. Use two fresh deployments per pair, identical payload of 32, 128, 512 or 1024 bytes, and three repetitions. Call storeRaw(bytes) on one, storeDigest(bytes32) on the other. Verify both storage values.
Use the existing automated runner: from portal root run python3 verification/runner.py --profile evm --output gas-evidence.json after installing the blockchain dependencies as described in B15. Expected twelve measured pairs if the runner completes. If blocked, report pending. Compare receipt gasUsed; exclude deployment gas and report setup/configuration.
Reference check: Sample count is conserved; batching reduces commitments using ceil(samples/batch). Overload grows backlog if arrivals exceed service.
Model boundary: Fixed payload 64 B/digest 32 B, no protocol overhead, gas, mining or empirical latency.
Independent task and submission evidence
2. Follow B08: compile GasStudy with 0.8.28, Shanghai, optimizer disabled. Use two fresh deployments per pair, identical payload of 32, 128, 512 or 1024 bytes, and three repetitions. Call storeRaw(bytes) on one, storeDigest(bytes32) on the other. Verify both storage values. 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.
Trial
Changed setting
Fixed settings
Predicted result
Actual observation / units
Evidence / uncertainty
A: baseline
Reference
Record
Predict
Record
Record
B: one change
Record
Same as A
Predict
Record
Record
A: repeat
Restore
Same as A
Predict
Record
Record
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.
Compare payload byte budgets and design paired EVM gas measurements without substituting byte counts for gas.
Payload counts exclude calldata ABI overhead, proof transmission and off-chain storage. Actual gas depends on state, compiler, transaction bytes and EVM fork.
Worked engineering reasoning and boundary conditions
Engineering reference configuration: Number of records = 4; Bytes per sample = 128. In the classroom model, Raw sample bytes = 512; Per-record commitments = 128; One batch root = 32; Raw minus root = 480. These are payload bytes, not gas. Compare fresh instances of GasStudy with identical compiler settings and actual receipts; roots require off-chain records/proofs. No estimated gas is presented as a measurement. Payload counts exclude calldata ABI overhead, proof transmission and off-chain storage. Actual gas depends on state, compiler, transaction bytes and EVM fork.
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
Storage budget
N records each contain b raw bytes or a d-byte digest. This is a byte budget; transaction gas must be measured using the actual contract and EVM execution conditions.
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.
Step 1 of 3 · Raw payload
Raw payload
Raw payload
512 B
Per-record digests
Raw payload
512 B
Per-record digests
128 B
Batch root
Raw payload
512 B
Per-record digests
128 B
Batch root
32 B
Teaching example only; inspect live calculations or real practical evidence separately.
Recall the concept before revealing its explanation.
0 / 3 revealed
B14 · 01 / 08Is gas proportional to raw bytes?Reveal explanation
Engineering explanation
Not universally; calldata, execution and storage transitions contribute.
B14 · 03 / 08What does batching sacrifice?Reveal explanation
Engineering explanation
Immediate per-sample on-chain availability and the need to retain off-chain records/proofs.
B14 · 04 / 08Why vary count and record size separately?Reveal explanation
Engineering reasoning
It isolates two factors affecting raw bytes, commitment size and measured execution costs.
B14 · 05 / 08What distinguishes a gas experiment from a byte-budget model?Reveal explanation
Engineering reasoning
An actual EVM run yields transaction gas usage under specified contract and network settings; byte counts alone do not.
B14 · 06 / 08Raw payload and batch commitment costs are compared. Select every technically valid statement.
A. Keep the EVM experiment conditions paired.
B. Report byte budgets separately from measured gas.
C. A batch root has the same storage size as all original payloads.
D. Byte counts determine every EVM gas cost exactly.Reveal explanation
Applied scenario
Correct: A. Keep the EVM experiment conditions paired.; B. Report byte budgets separately from measured gas.
B14 · 07 / 08In Batching and controlled gas experiments, which reference and changed settings are prescribed for Number of records?Reveal explanation
Controlled configuration
Number of records: 4 → 16; hold the remaining settings fixed.
B14 · 08 / 08What expected result distinguishes the reference and changed trials in Batching and controlled gas experiments?Reveal explanation
Loading experiment-specific apparatus…Previous model / additional reference tools
Simulation task
Compare payload byte budgets and design paired EVM gas measurements without substituting byte counts for gas.
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 workbenchB14 · Existing model
Readout from the original computational model; not physical measurements.
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.
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.
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.
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 4 records of 128 bytes compare 512 raw bytes versus a 32-byte commitment; calculate percentage reduction.
Engineering method — A controlled gas experiment holds contract, compiler, chain configuration and record encoding fixed. Report measured gasUsed per record and per batch separately; avoid assuming gas scales linearly. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
02 · Compare or justify using evidence
Design paired gas experiments for sizes 1,4,8 with the same contract, network and initial state; identify why raw bytes alone cannot predict gas.
Engineering method — A controlled gas experiment holds contract, compiler, chain configuration and record encoding fixed. Report measured gasUsed per record and per batch separately; avoid assuming gas scales linearly. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
03 · Data analysis
Data analysis · Independent work
Given hypothetical measured gasUsed 60000 for 2 records and 100000 for 5, calculate gas/record. What further observations are needed?
Data analysis — A controlled gas experiment holds contract, compiler, chain configuration and record encoding fixed. Report measured gasUsed per record and per batch separately; avoid assuming gas scales linearly. Apply this method to the assigned values independently; compare your reasoning with the relevant simulator or practical implementation.
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 · B14-01
Use the reference configuration (Number of records = 4; Bytes per sample = 128), but change Number of records = 1. The model reports Raw sample bytes = 128. Explain the governing rule and assumptions that make this output plausible; identify an independent verification method.
Intermediate · Interpret a state transition
Independent theoretical exercise · B14-02
The reference model reports Raw sample bytes: 512. Under Number of records = 1 it reports 128. 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 · B14-03
For Bytes per sample = 32, the model supplies this excerpt from Calculated trace:
Item · Value · Explanation
Records · 4 ·
Payload per record · 32 ·
Actual gas · Not measured ·
Count rows whose Value value is exactly “4”, and identify the displayed row numbers. Explain what the count describes.
Advanced · Reverse reasoning
Independent theoretical exercise · B14-04
An observation is Raw sample bytes = 128. Candidate A uses Number of records = 4; Bytes per sample = 128. Candidate B changes the listed settings (Bytes per sample = 32) 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 · B14-05
A student configures Number of records = 16 while preserving all other reference settings, but copies the reference report of Raw sample bytes = 512. Evaluate whether the report is justified. Identify the first configuration/output check to perform.
Challenging · Design a controlled verification
Independent theoretical exercise · B14-06
Design a controlled comparison for Batching and controlled gas experiments using reference Number of records = 4; Bytes per sample = 128 and test Number of records = 1. Specify the changed setting(s), measured metric Raw sample bytes, controls, repetitions, an acceptance check and what evidence can distinguish an actual implementation from the model.
Challenging numerical variant 1
Calculation · Independent work
A byte-budget comparison stores 12 records of 124 bytes each, plus 21 bytes of per-record metadata. A batch alternative stores one 32-byte root plus 21 bytes of metadata. How many bytes are saved? This is not a gas measurement.
Challenging numerical variant 2
Calculation · Independent work
A byte-budget comparison stores 4 records of 126 bytes each, plus 27 bytes of per-record metadata. A batch alternative stores one 32-byte root plus 27 bytes of metadata. How many bytes are saved? This is not a gas measurement.
Challenging numerical variant 3
Calculation · Independent work
A byte-budget comparison stores 5 records of 128 bytes each, plus 33 bytes of per-record metadata. A batch alternative stores one 32-byte root plus 33 bytes of metadata. How many bytes are saved? This is not a gas measurement.
Step-by-step experimental procedure
Compare payload byte budgets and design paired EVM gas measurements without substituting byte counts for gas.
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.
Number of records4
Bytes per sample128
2 · Perform the investigation in order
Save baseline, vary record count and byte size independently. Record payload bytes only; do not report gas from the model.
Follow B08: compile GasStudy with 0.8.28, Shanghai, optimizer disabled. Use two fresh deployments per pair, identical payload of 32, 128, 512 or 1024 bytes, and three repetitions. Call storeRaw(bytes) on one, storeDigest(bytes32) on the other. Verify both storage values.
Use the existing automated runner: from portal root run python3 verification/runner.py --profile evm --output gas-evidence.json after installing the blockchain dependencies as described in B15. Expected twelve measured pairs if the runner completes. If blocked, report pending. Compare receipt gasUsed; exclude deployment gas and report setup/configuration.
Payload counts exclude calldata ABI overhead, proof transmission and off-chain storage. Actual gas depends on state, compiler, transaction bytes and EVM fork.
Required evidence: Record the batching and controlled gas experiments comparison and justify the changed outcome from the calculated trace.
Model boundary: Payload counts exclude calldata ABI overhead, proof transmission and off-chain storage. Actual gas depends on state, compiler, transaction bytes and EVM fork.
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.
Trial
Independent change
Dependent observation
Reference
Use reference inputs above
Record actual outcome and units
Controlled change
Number of records = 16
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.
✓ Expected baseline and controlled change: 4 × 128 = 512 raw bytes; 128 per-record digest bytes; 32 root bytes. With 16 records: 2048, 512, 32 bytes.
Save baseline, vary record count and byte size independently. Record payload bytes only; do not report gas from the model.
Follow B08: compile GasStudy with 0.8.28, Shanghai, optimizer disabled. Use two fresh deployments per pair, identical payload of 32, 128, 512 or 1024 bytes, and three repetitions. Call storeRaw(bytes) on one, storeDigest(bytes32) on the other. Verify both storage values.
Use the existing automated runner: from portal root run python3 verification/runner.py --profile evm --output gas-evidence.json after installing the blockchain dependencies as described in B15. Expected twelve measured pairs if the runner completes. If blocked, report pending. Compare receipt gasUsed; exclude deployment gas and report setup/configuration.
Export observed evidence, restore baseline and record limitations. Do not treat browser-model output as actual hardware or EVM evidence.
Experimental notebook
Record your own results. Values are not prefilled or independently verified.
Download this notebook and open Google Colab. Select File → Upload notebook and choose the downloaded .ipynb.
Read the Markdown instructions before each executable cell. Use a Python runtime, run cells from top to bottom, and resolve imports if necessary.
Perform the baseline and controlled changes. Save the notebook with actual outputs and your written interpretation.
Execution scope: Fixed payload 64 B/digest 32 B, no protocol overhead, gas, mining or empirical latency. Default computational cells passed isolated local Python execution; physical equipment and live services require separate verification.
01Instructions · Markdown
# B14 · Batching and controlled gas experiments
**PSUT IoT Engineering Studio — Dr. Mohammad Alja’afreh**
## 1. Scientific objective
Compare payload byte budgets and design paired EVM gas measurements without substituting byte counts for gas.
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
Compare payload byte budgets and design paired EVM gas measurements without substituting byte counts for gas.
**Reference procedure (use the matching simulator/WSL tool where named, not an unrelated service):**
1. Save baseline, vary record count and byte size independently. Record payload bytes only; do not report gas from the model.
2. Follow B08: compile GasStudy with 0.8.28, Shanghai, optimizer disabled. Use two fresh deployments per pair, identical payload of 32, 128, 512 or 1024 bytes, and three repetitions. Call storeRaw(bytes) on one, storeDigest(bytes32) on the other. Verify both storage values.
3. Use the existing automated runner: from portal root run python3 verification/runner.py --profile evm --output gas-evidence.json after installing the blockchain dependencies as described in B15. Expected twelve measured pairs if the runner completes. If blocked, report pending. Compare receipt gasUsed; exclude deployment gas and report setup/configuration.
**Evidence:** Sample count is conserved; batching reduces commitments using ceil(samples/batch). Overload grows backlog if arrivals exceed service.
**Boundary:** Fixed payload 64 B/digest 32 B, no protocol overhead, gas, mining or empirical latency.
03Instructions · Markdown
## 2. Reference configuration and investigation
1. Save baseline, vary record count and byte size independently. Record payload bytes only; do not report gas from the model.
2. Follow B08: compile GasStudy with 0.8.28, Shanghai, optimizer disabled. Use two fresh deployments per pair, identical payload of 32, 128, 512 or 1024 bytes, and three repetitions. Call storeRaw(bytes) on one, storeDigest(bytes32) on the other. Verify both storage values.
3. Use the existing automated runner: from portal root run python3 verification/runner.py --profile evm --output gas-evidence.json after installing the blockchain dependencies as described in B15. Expected twelve measured pairs if the runner completes. If blocked, report pending. Compare receipt gasUsed; exclude deployment gas and report setup/configuration.
Run cells in order; do not substitute model results for physical measurements.
04Instructions · Markdown
## 3. Compare raw records, digest bytes and a root commitment.
05Python · executable cell
PYTHON · Code cell
# =====================================================================
# B14 | Code cell 01 | Batching and controlled gas experiments
# Purpose: 3. Compare raw records, digest bytes and a root commitment.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Set records for the next computation or reference condition.
records=16; size=64
# Set raw for the next computation or reference condition.
raw=records*size; digests=records*32; root=32
print(raw,digests,root)
# Check the expected invariant so a mismatch fails visibly instead of appearing successful.
assert (raw,digests,root)==(1024,512,32)
## 4. Change the assumed transaction count and gas budget. These are assumed costs, not measured EVM gas.
07Python · executable cell
PYTHON · Code cell
# =====================================================================
# B14 | Code cell 02 | Batching and controlled gas experiments
# Purpose: 4. Change the assumed transaction count and gas budget. These are assumed costs, not measured EVM gas.
# Inputs: the explicit fixture/settings below and any preceding cell state.
# Output: inspect printed values, returned records or assertions; record evidence.
# =====================================================================
# Set base for the next computation or reference condition.
base=21000; anchor=20000
# Repeat the same operation for each configured input so observations are comparable.
for count in (1,4,16,32):
print(count,"separate",count*(base+anchor),"batch",base+anchor)
## 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. Follow B08: compile GasStudy with 0.8.28, Shanghai, optimizer disabled. Use two fresh deployments per pair, identical payload of 32, 128, 512 or 1024 bytes, and three repetitions. Call storeRaw(bytes) on one, storeDigest(bytes32) on the other. Verify both storage values. 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.
Shared research workbenches · network designer & advanced studiesConcurrent-device simulation & Monte Carlo research