In this track: Meet smart contracts
beginner · 3 MIN READ

A vending machine analogy and its limits

An everyday comparison is useful only while its boundaries remain clear.

LET’S PICTURE IT

Insert the right coins, choose a snack and watch a machine follow a rule. Then ask which parts of that picture do not carry over to Ethereum.

SEE IT FOR YOURSELF
A valid counter call, step by stepStep 1 / 4
A valid counter call, step by stepFunction requestincrement()No argumentsBefore executionstored count0A local teaching example with a defined starting stateIncoming callCheck function dispatchCheck coded conditionsRules passConditions passContinue executionA failed check can revert insteadCalculation0 + 1Result: 1Storage writecount = 1Persists if call succeedsCalculating a local value and storing it are separate stepsPersistent statecount1Later readGetter reports 1No new incrementState, logs and browser display have different roles

This example begins with count zero and a request to call increment(). No real contract is deployed.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

The useful part is explicit rules

A machine checks inputs and follows programmed conditions. A smart contract similarly executes defined logic. You can study a counter or transfer function by identifying its input, rule and resulting state.

Physical delivery needs extra evidence

An ordinary contract does not reach into the real world to verify that a snack actually dropped. If an application promises physical delivery, its reporting and enforcement mechanisms exist beyond the simple onchain calculation.

The machine may have a maintainer

A real vending machine has an operator, and a contract application may have administrators or upgrade powers. Public code does not automatically mean nobody can change the effective application behavior.

Use the analogy as a starting point

Once the rule-following idea makes sense, switch to precise concepts: transactions trigger execution, storage persists values, and consensus coordinates the accepted history. Those terms explain where the classroom comparison stops.

QUICK CHECK · NO PRESSURE

Does the vending-machine analogy prove that a contract can observe physical delivery?

Your progress stays in this browser.
Keep exploring the original referenceethereum.org ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.