In this track: Inside the EVM
advanced · 4 MIN READ

STATICCALL explained

Read-only execution context prohibits state-changing operations.

LET’S PICTURE IT

An inspection visit permits observation while forbidding edits to the records.

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.

Enter static execution

STATICCALL calls a target without transferring value and executes under a static restriction. It is a runtime property of the call context.

Propagate the restriction

Nested calls cannot evade static restrictions merely by entering another contract. Operations that violate the static context cause execution failure.

Do not equate read-only with harmless

A static call can still revert, consume gas or return misleading data. Lack of state writes does not authenticate the answer or ensure cheap execution.

Distinguish source annotations

Solidity view and pure declarations help the compiler enforce expectations. Static EVM context is a separate runtime mechanism, and arbitrary supplied bytecode needs its own analysis.

Trace the idea

STATICCALL target
allowed: read state, compute output
prohibited: persistent state writes and other disallowed effects
possible: revert or consume supplied gas

Stack examples list the bottom first and the top last. These small traces omit gas and surrounding dispatch unless stated.

QUICK CHECK · NO PRESSURE

Does STATICCALL guarantee an honest answer?

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.