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

Reading a contract versus changing it

A local read can simulate execution; persistent updates need accepted transaction processing.

LET’S PICTURE IT

Looking at a scoreboard differs from submitting a score change to be recorded for everyone.

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.

Read a current value

An application can ask a node to simulate a call against a chosen state and return its result. A getter such as a balance query can be used this way without submitting a new state-changing transaction.

A read still depends on a data source

The node or provider supplies the view of state. Historical and latest-state queries can differ. A provider may have service limits even though the query does not itself create an onchain gas payment.

Write through accepted execution

To make a persistent state update, an authorized transaction must trigger the relevant code and be accepted into the chain. The contract can reject the action. A website cannot force a forbidden update merely by calling its button “save.”

View is not a universal free-computation label

Solidity view functions restrict state modification through that execution. Calling one inside a real onchain transaction still consumes execution resources. Context determines whether you are doing a local read or paid onchain work.

QUICK CHECK · NO PRESSURE

Does calling a view function inside an onchain transaction use execution gas?

Your progress stays in this browser.
Keep exploring the original referenceSolidity documentation ↗

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