In this track: Execution traces and low-level calls
advanced · 4 MIN READ

Contract creation with CREATE

Creation executes initialization code and may return runtime code.

LET’S PICTURE IT

Setting up a new shop runs an opening procedure before normal customer service begins.

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.

Provide initialization code

CREATE executes supplied init code in a creation context. A Solidity constructor is part of creation-time behavior, not an ordinary later callable runtime function.

Derive the address context

The ordinary CREATE address depends on the creator and its nonce through the specified derivation. It is not selected by the human-readable contract name.

Return deployable runtime

Successful initialization returns the bytes that become deployed runtime code, subject to applicable limits and validation. Creation can fail before that result is installed.

Check the actual outcome

A factory must handle creation failure and initialization assumptions. A predicted address alone does not prove that the expected runtime was successfully deployed there.

Follow the execution

Factory → CREATE(init code)
init code runs setup
init code returns runtime bytes
creation succeeds → runtime installed at derived address

A local conceptual trace with explicit assumptions; this is not a trace of a live transaction.

QUICK CHECK · NO PRESSURE

Is constructor code an ordinary runtime function callable again later?

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.