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

Smart contracts, simply

Programs that apply rules on Ethereum.

LET’S PICTURE IT

A vending machine follows instructions: the right payment and selection release a snack. A smart contract follows code, with the network checking the result.

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.

A program with an address

A smart contract has code and an address on Ethereum. A user sends it a transaction to request an action. Its functions describe actions that can run, and its storage holds values that persist between calls.

An example: a shared counter

Imagine a counter that starts at zero. Calling increment() adds one. The transaction gives the network an instruction, the code calculates the new value, and everyone can verify the same result. The contract does not need a person to approve each increment if its rules allow anyone to call it.

Code has limits

Contracts do not spontaneously wake up or directly read any website they want. An outside transaction triggers work, and external facts need to be supplied through mechanisms such as oracles. A bug or unsafe permission in the code can still cause harm. Public code is inspectable, not automatically safe.

What developers use

Solidity is one language for writing these programs. An ABI describes the interface, and the EVM executes compiled instructions. Start with the little counter experiment, then move to encoding a real function call in the ABI lab.

QUICK CHECK · NO PRESSURE

What usually triggers a contract to change its state?

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.