0Pricing
Web3 & DApp Development Fundamentals · درس

الحسابات والحالة

EOAs والعقود

الحسابات والحالة درس مجاني في Web3 & DApp Development Fundamentals على CoddyKit. هذا هو الدرس 4 من أصل 4. يمكنك قراءة الدرس كاملاً أدناه مجاناً — ثم تمرن عليه مباشرة في المتصفح باستخدام محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7. هذا الدرس جزء من مسار التعلم في Web3 & DApp Development Fundamentals، وتقدمك يتزامن عبر الويب وتطبيق CoddyKit. تتضمن دورة Web3 & DApp Development Fundamentals 4 دروس في المجموع.

بعض أجزاء هذا الدرس لم تُترجم بعد وتظهر باللغة الإنجليزية.

What Is the World State?

Ethereum's world state is the complete snapshot of all accounts and their data at a given moment.

Every transaction transforms this state from one valid version to the next. Accounts are the building blocks of that state.

Two Types of Accounts

Ethereum has exactly two account types:

  • Externally Owned Accounts (EOAs) — controlled by private keys (users)
  • Contract Accounts — controlled by their code

Both share the same 20-byte address format.

Externally Owned Accounts

An EOA is controlled by a private key. It can initiate transactions: send ETH or call contracts.

EOAs have no code of their own — they are simply key-controlled accounts that humans (or bots) operate.

EOA {
  address: 0xAbc...123
  balance: 4.2 ETH
  nonce:   17
  code:    none
}

Contract Accounts

A contract account holds code (bytecode) and storage. It has no private key and cannot start a transaction on its own.

It only acts when called by an EOA or another contract, running its code in response.

Contract {
  address: 0xDef...456
  balance: 10 ETH
  code:    0x6080604052...
  storage: { slot0: ..., slot1: ... }
}

The Four Account Fields

Every account stores four fields:

  • nonce — transaction count (EOA) or contracts created (contract)
  • balance — ETH held, in wei
  • storageRoot — hash of the account's storage
  • codeHash — hash of the account's code

EOA vs Contract Differences

The key distinction:

  • Only EOAs can initiate transactions
  • Only contracts have code and significant storage
  • An EOA's codeHash is empty; a contract's is not

How State Changes

State changes only through transactions. A transaction can move ETH, deploy a contract, or call a contract that updates its storage.

After each block, the world state advances to a new, agreed-upon version.

The State Trie

All accounts are stored in a giant Merkle Patricia Trie. Its root hash — the state root — is recorded in each block header.

This single hash commits to the entire world state, just as a Merkle root commits to all transactions.

block header includes:
  stateRoot   -> all accounts
  txRoot      -> all transactions
  receiptRoot -> all receipts

Account Creation

An EOA effectively exists the moment a key pair is generated — no on-chain step is needed until it transacts.

A contract account is created when a deployment transaction runs constructor code and stores the resulting bytecode.

Smart Contract Interaction

To interact with a contract, an EOA sends a transaction specifying the contract address and the function data.

The EVM looks up the contract's code by its codeHash and executes it, possibly updating storage.

Putting It Together

Ethereum's state is a collection of accounts. EOAs are key-controlled and initiate transactions; contracts hold code and storage and react to calls.

The state root in each block commits to all of it.

Quick Check

Test your accounts knowledge.

Recap: Accounts and State

You learned that:

  • Ethereum has EOAs (key-controlled) and contract accounts (code-controlled)
  • Only EOAs can initiate transactions
  • Each account has a nonce, balance, storageRoot, and codeHash
  • The state root commits to all accounts

You have completed the Web3 fundamentals track.

الأسئلة الشائعة

هل درس «الحسابات والحالة» مجاني؟

نعم — نص درس «الحسابات والحالة» كامل متاح مجاناً هنا على الويب. لتمرينه بشكل تفاعلي (محرر أكواد مدمج ومدرس ذكاء اصطناعي متاح 24/7) وفتح باقي دورة Web3 & DApp Development Fundamentals، انتقل إلى CoddyKit PRO. تتضمن دورة Web3 & DApp Development Fundamentals 4 دروس في المجموع.

ماذا ستتعلم في «الحسابات والحالة»؟

EOAs والعقود تتمرن على Web3 & DApp Development Fundamentals مع أكواد عملية تشغلها مباشرة في المتصفح، ومدرس ذكاء اصطناعي متاح 24/7 يجيب على أسئلتك أثناء عملك.

هل أحتاج إلى خبرة سابقة لأبدأ Web3 & DApp Development Fundamentals؟

لا تُشترط خبرة سابقة. Web3 & DApp Development Fundamentals على CoddyKit منظم للمبتدئين حتى المتقدمين، لذا يمكنك البدء من هنا أو من البداية والتقدم بسرعتك الخاصة. هذا هو الدرس 4 من أصل 4.

كم من الوقت يستغرق درس «الحسابات والحالة»؟

معظم دروس CoddyKit تستغرق حوالي 5–10 دقائق. كل منها موجز وتفاعلي، لذا تحرز تقدماً مستمراً وتستأنف من حيث توقفت عبر الويب والتطبيق.

هل يمكنني كتابة وتشغيل أكواد في درس Web3 & DApp Development Fundamentals هذا؟

نعم. كل درس في Web3 & DApp Development Fundamentals يتضمن محرر أكواد مدمج، لذا تكتب وتشغل أكواداً حقيقية مباشرة في متصفحك وتحصل على تعليقات فورية من الذكاء الاصطناعي — بدون إعداد محلي.

جميع الدروس في هذه الدورة

  1. آلة Ethereum الافتراضية
  2. التخزين والذاكرة والمكدس
  3. Opcodes
  4. الحسابات والحالة
← العودة إلى Web3 & DApp Development Fundamentals