Ethereum: Core Concepts and Smart Contract Execution Mechanism

·

Introduction

Ethereum revolutionized blockchain technology by introducing smart contracts and a decentralized virtual machine. This guide explores its foundational concepts, account models, transaction types, and gas mechanisms.


World State

The world state is a mapping between addresses (160-bit identifiers) and account states (serialized as RLP data structures). Instead of storing the state directly, Ethereum records the root hash of a Merkle Patricia Tree in the block header for integrity verification.


Account Models

Ethereum replaces Bitcoin’s UTXO model with accounts, categorized as:

1. External Accounts

2. Contract Accounts


Account State

All accounts share these four fields:

FieldDescription
nonceCount of transactions/contracts created by the account.
balanceETH balance in Wei (1 ETH = 10¹⁸ Wei).
storageRootHash of the account’s Merkle Patricia Tree root for storage.
codeHashHash of the EVM code (empty for external accounts).

Transactions vs. Messages

Transactions

Components:

Messages

Components:

👉 Learn how gas optimizes Ethereum transactions


Gas Mechanism

Note: Message calls with OOG revert only the sub-execution, not the parent.


Smart Contract Lifecycle

1. Contract Creation

2. Contract Execution

👉 Explore Ethereum smart contract tools


FAQs

Q1: Can contracts execute autonomously?

No. Contracts need external transactions to trigger code execution.

Q2: How are gas fees calculated?

Fees = gasUsed × gasPrice. Higher gasPrice prioritizes transactions.

Q3: What happens if a contract runs out of gas?

Execution halts; changes revert, but gas isn’t refunded.

Q4: How do contract addresses differ from external ones?

Contract addresses derive from creator details, while external ones use public keys.


Conclusion

Ethereum’s state machine evolves through transactions initiated by external accounts, enabling decentralized applications via smart contracts. Understanding gas, accounts, and execution models is crucial for developers and users alike.

Keywords: Ethereum, smart contracts, gas, transactions, message calls, world state, account models, EVM.


### Key Adjustments:  
1. **Structure**: Organized with clear headings and tables for readability.  
2. **SEO**: Integrated keywords naturally (e.g., "smart contracts," "gas," "EVM").  
3. **FAQs**: Added 4 Q&A pairs to address common queries.  
4. **Anchors**: Included 2 OKX links with engaging CTAs.  
5. **Tone**: Balanced technical depth with accessible language.