The Everyday Lab.TECHNOLOGY EXPLAINED
THE RULES ISSUE
A small machine. A big idea.

What if a contract could execute itself?

Imagine buying a snack without asking anyone for permission. A few simple rules decide what happens next. That is the idea behind a smart contract.

Try the vending machine
Play money only · No wallet needed · 2 min experiment
IF / THEN2.00RULESNOT GUESSWORK1
FIG 01 · A MACHINE THAT FOLLOWS RULES
IF Check conditions
THEN Execute logic
RESULT Update state
Hands-on experiment

Can you make it dispense?

Pick a snack, add play money, then press the button. Try changing one condition at a time to see why the same program can produce different results.

RULE MACHINE / 01DEMO ONLY
Choose your product
DISPENSE SLOT
Waiting for a valid request
PLAY MONEY INSERTED$0.00Selected: Soda / $2.00
Add play money
Ready to experiment

Choose a product and add play money. The machine will evaluate your conditions only when you run the rules.

NOT RUNProduct selectedSoda
NOT RUNEnough money?$0.00 / $2.00
NOT RUNAvailable?In stock

A simplified teaching model. No real money, wallet, on-chain transaction or network fee. Inventory is a simulated condition, not a live stock count.

Inside the machine

The rules are the program.

A vending machine does not negotiate. It checks whether you selected an item, whether you paid enough and whether the item is available. If a condition fails, it does not dispense.

A smart contract is a program deployed to a blockchain. On Ethereum, a transaction can call a function and cause the network to execute the code. The resulting state changes follow the programmed logic.

That means fewer manual steps for a well-defined task, not a guarantee that the rules are fair, safe or correct.

Pseudocode / illustration
WHEN purchase is called:
  IF item is selected
  AND payment is enough
  AND stock is available:
    dispense item
    return change
  ELSE:
    reject request
1
Trigger

A user or another system calls the contract.

2
Check & execute

The network evaluates the programmed conditions.

3
Record the outcome

Successful state changes are recorded; failed calls may still consume network fees.

Beyond the snack machine

Same logic. Different worlds.

Switch between three hypothetical applications. Turn conditions on or off, then run the rules.

Example 01

A ticket without a ticket clerk

Set the conditions
Set the conditions and run the rules.
What the analogy leaves out

Automatic does not mean infallible.

01

Code can be wrong

A bug or unexpected input may produce an unwanted outcome. Testing, independent review and careful permissions matter.

02

Outside facts need a bridge

A blockchain cannot independently know whether a package arrived or a flight was delayed. An external data service, often called an oracle, supplies that information.

03

Execution needs a trigger

A condition becoming true is not usually enough by itself. A transaction or automation service must call the relevant function. A state-changing transaction may incur gas.

Quick answers

Things worth knowing.

Is a smart contract the same as a legal contract?

Not necessarily. A smart contract is executable code. Whether an arrangement creates legal obligations depends on its terms and applicable law.

Can someone change the rules after deployment?

Some contracts have immutable code, while others use upgradeable architectures or administrative controls. Check how a particular system is designed before assuming its rules cannot change.

Does a smart contract always cost money to use?

Reading existing Ethereum contract data does not require an on-chain transaction. Changing blockchain state generally requires a transaction and network fees, even if someone else covers them.

Does the machine analogy mean there is no human involvement?

People still write and review code, design interfaces, authorize transactions, maintain systems and handle disputes. Automated execution replaces certain steps, not all responsibility.

Can a failed transaction still cost a fee?

Yes. On Ethereum, a transaction that is included but reverts can still consume gas because the network performed computation. This demo deliberately does not model real fees.

Further reading & sources

Ethereum.org — Introduction to smart contracts: program execution, vending machine analogy and external data limitations.

Ethereum.org — Smart contracts and their benefits: conditional execution and use cases.

Ethereum.org — Interacting with smart contracts: reading, writing and transaction requirements.

Rules first. Results second.

Try a different product or switch off the stock condition. See exactly what changes.

Play again