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

STOP, RETURN and REVERT

Halting instructions differ in output and state outcome.

LET’S PICTURE IT

An activity can finish silently, finish with a report or abandon its changes with an explanation.

SEE IT FOR YOURSELF
Follow a revert and decode its error dataStep 1 / 4
Follow a revert and decode its error dataRequested actionTransfer 100 raw unitsExample inputsAvailable balance40 raw unitsCheck the ruleA deliberately failing local scenario, not a live transactionCondition fails100 > 40Request rejectedRollbackNo successful transferConsumed gas still mattersTop-level failure and a caught nested failure have different contextsError selector0x08c379a04 bytesMessage tailNot enough tokensDynamic string encodingCustom errors and Panic use different selectors and schemasDecoded messageNot enough tokensA diagnostic clueFurther evidenceCaller and code pathRelevant stateError bytes can be constructed by code; decoding is not authentication

This fictional call requests a transfer of one hundred raw units while the relevant balance is forty.

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

Recognize a normal stop

STOP ends the current frame successfully without an explicit output payload. Success does not require that the function return a nonempty byte sequence.

Return a memory range

RETURN ends successfully and selects output bytes from memory. The caller still needs the right schema to interpret those bytes as values.

Revert the current scope

REVERT ends with failure, rolls back the scope’s effects and can provide bytes from memory. It does not inherently consume every unit of remaining gas.

Separate exceptional halts

Invalid operations and out-of-gas failures are different from an ordinary REVERT path. Do not assume every failure has the same gas behavior or diagnostic payload.

Trace the idea

STOP → success, empty output
RETURN → success, selected memory output
REVERT → failure, rollback, optional revert bytes

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

QUICK CHECK · NO PRESSURE

Can a successful STOP have empty output?

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.