Ethereum: Core Concepts and Smart Contract Execution Mechanism

·

Ethereum is more than just a cryptocurrency—it's a decentralized computing platform that enables developers to build and deploy smart contracts and decentralized applications (dApps). Understanding its foundational components is crucial for anyone entering the blockchain space. This guide breaks down Ethereum’s core architecture, focusing on accounts, transactions, messages, gas, and smart contract execution—all while maintaining clarity and technical accuracy.


The World State and Account Model

At the heart of Ethereum lies the world state, a dynamic mapping between 160-bit addresses and their corresponding account states. Unlike traditional blockchains that store full state data directly in blocks, Ethereum stores only the root hash of a Merkle Patricia Trie in each block header. This design ensures efficient verification and scalability, allowing nodes to validate state changes without storing every detail.

Ethereum replaces Bitcoin’s UTXO (Unspent Transaction Output) model with a more intuitive account-based model. There are two types of accounts:

Both share the same structure but differ in control and functionality.

👉 Discover how blockchain accounts power decentralized finance today.


Externally Owned Accounts vs. Contract Accounts

Externally Owned Accounts (EOAs)

Controlled by private keys, EOAs have no associated code. Their 20-byte address is derived from the public key. Users interact with the network through EOAs by signing transactions—this is how value transfers or contract interactions are initiated.

Key capabilities:

Contract Accounts

These are controlled by their own code and are created when an EOA or another contract deploys a new contract. The address is deterministically generated using the creator’s address and their nonce (transaction count).

Important characteristics:

All account types can hold Ether, but only contract accounts execute logic in response to external stimuli.


Account State: The Four Key Fields

Regardless of type, each account maintains a state composed of four fields:

  1. Nonce:

    • For EOAs: number of transactions sent
    • For contracts: number of contracts created
      Ensures replay protection and transaction ordering.
  2. Balance:
    The account’s Ether balance measured in wei (1 ETH = 10¹⁸ wei).
  3. Storage Root:
    Hash of the root node of a Merkle Patricia Trie storing the contract’s persistent data.
  4. Code Hash:

    • For EOAs: hash of an empty string (no code)
    • For contracts: hash of compiled EVM bytecode
      Immutable once set; used for secure code retrieval.

Transactions: The Engine of Change

A transaction is a signed data packet sent from an EOA to another account. It triggers state changes and is permanently recorded on the blockchain after validation by miners.

Every transaction includes:

Transactions fall into two categories:

Once broadcast, a transaction returns only a transaction hash immediately—it’s asynchronous. Finality comes after mining confirmation.


Messages and Message Calls: Internal Execution Flow

While transactions originate externally, messages facilitate internal interactions between accounts. They carry value and data but exist only within Ethereum’s execution environment—they are not stored on-chain.

A message call is the act of sending such a message. It resembles a function call in programming:

Crucially, all message calls stem from an initial transaction. Even nested calls between contracts trace back to an EOA-initiated action.

“Ethereum is fundamentally a transaction-driven state machine.”
— Starting from genesis, each transaction advances the global state.

Gas: Fueling Computation

To prevent spam and infinite loops in Turing-complete environments, Ethereum uses gas as a metering unit for computational effort.

Each operation—whether storage, arithmetic, or logging—consumes a predefined amount of gas. Users set:

Total upfront cost: Gas Limit × Gas Price
Any unused gas is refunded post-execution. However, if execution exceeds the limit (out-of-gas error), the entire operation reverts—except gas payment, which miners keep as compensation for computation.

Miners prioritize higher-priced transactions, creating a market-driven fee system. Most wallets suggest optimal gas prices based on network congestion.

👉 Learn how real-time gas optimization improves transaction success rates.


Contract Creation: From Transaction to Deployment

A contract is created when:

The new contract’s address is derived from:

keccak256(creator_address ++ nonce)

The payload executes once in the EVM, returning the final bytecode to be stored. If execution fails due to OOG or invalid opcodes:

Note: While contracts can create other contracts, only EOAs pay for the entire process—the original transaction sender bears all costs.


Contract Execution and Message Calls

When a contract receives a message call:

  1. EVM loads its bytecode
  2. Executes instructions based on input data
  3. Modifies state (storage, balance, etc.)
  4. Returns output or triggers further calls

Execution follows these principles:

This behavior supports robust error handling in dApps.


Can Smart Contracts Self-Execute?

No. Contracts cannot autonomously check conditions or run at scheduled times. They require an external trigger—an EOA-initiated transaction—to activate any function.

However, workarounds exist:

These solutions maintain decentralization while enabling time-based automation.


Frequently Asked Questions (FAQ)

Q1: What’s the difference between a transaction and a message?

A transaction is signed by an EOA and recorded on-chain. A message is a virtual object representing internal value/data transfer, often triggered by transactions or other messages—it’s never stored directly.

Q2: Who pays for gas in nested contract calls?

The original EOA that initiated the root transaction covers all gas costs across all subsequent message calls—even if dozens of contracts interact.

Q3: Can a contract modify its own code?

No. Code is immutable after deployment. To upgrade functionality, developers use proxy patterns or deploy new instances.

Q4: Why does out-of-gas not refund anything?

Gas pays for actual computation performed before failure. Refunding would allow attackers to consume resources for free.

Q5: How is a contract address determined?

Using RLP encoding of the creator’s address and their current nonce, then hashing with Keccak-256.

Q6: Is Ethereum’s world state stored in every block?

No. Only the root hash of the state trie appears in the block header. Full nodes reconstruct state by applying all transactions since genesis.


Final Thoughts

Ethereum operates as a globally synchronized state machine driven entirely by transactions from externally owned accounts. Every smart contract execution, token transfer, or dApp interaction traces back to a user-initiated action. By combining cryptographic security, economic incentives via gas, and deterministic execution, Ethereum creates a trustless environment where code truly becomes law.

Whether you're building your first dApp or auditing smart contracts, mastering these fundamentals unlocks deeper understanding and better decision-making in the Web3 ecosystem.

👉 Start building on Ethereum with tools designed for real-world blockchain development.