Introduction to Ethereum Accounts

In the world of Ethereum, the term "Ethereum account" (以太坊账户英文) refers to a fundamental concept that defines how users interact with the Ethereum blockchain. Unlike traditional bank accounts, Ethereum accounts are digital entities that enable users to send, receive, and manage Ether (ETH) and other digital assets, as well as interact with decentralized applications (dApps). Understanding Ethereum accounts is crucial for anyone looking to navigate the Ethereum ecosystem, whether for transactions, staking, or participating in the decentralized web (Web3).

Types of Ethereum Accounts

Ethereum recognizes two primary types of accounts, each serving distinct purposes:

Externally Owned Accounts (EOAs)

Externally Owned Accounts (EOAs) are the most common type of Ethereum account, controlled directly by users through private keys. An EOA is identified by a public address (a 42-character string starting with "0x") and is used to:

  • Send and receive ETH.
  • Interact with smart contracts (e.g., approving token transfers or trading on decentralized exchanges).
  • Sign transactions to prove ownership of the account.

EOAs do not store code; they are purely for holding assets and initiating actions. The security of an EOA relies entirely on the safeguarding of its private key—losing the private key means losing access to the account permanently.

Contract Accounts

Contract accounts, also known as smart contracts, are controlled by code rather than a private key. These accounts are deployed to the Ethereum blockchain and execute predefined instructions when triggered by transactions or other events. For example:

  • A token contract manages the supply and transfer of a cryptocurrency.
  • A decentralized finance (DeFi) protocol automates lending, borrowing, or yield farming.

Contract accounts have a public address like EOAs but are distinguished by their ability to store and execute code. They cannot initiate transactions on their own; they rely from EOAs to trigger actions.

Key Components of an Ethereum Account

Both EOAs and contract accounts share core components, though their functionality differs:

Address

An Ethereum address is a unique identifier derived from the public key (for EOAs) or the contract’s bytecode (for contract accounts). It serves as the "account number" for receiving funds and interacting with the blockchain. Addresses are case-insensitive and typically formatted as 0x followed by 40 hexadecimal characters (e.g., 0x742d35Cc6634C0532925a3b844Bc454e4438f44e).

Balance

The balance refers to the amount of ETH (or other ERC-20 tokens) held in the account. Balances are stored on the Ethereum blockchain and updated in real-time as transactions occur.

Nonce

The nonce is a unique, sequential number that prevents replay attacks and ensures transactions are processed in the correct order. For EOAs, the nonce increments with each new transaction sent from the account. For contract accounts, the nonce tracks the number of contracts created (if the account is a contract) or the number of transactions executed.

Storage (for Contract Accounts)

Contract accounts have a storage mechanism to hold persistent data, such as user balances, contract states, or configuration parameters. This storage is part of the Ethereum blockchain and is modified only when the contract executes specific functions.

How Ethereum Accounts Work

When a user initiates a transaction from an EOA (e.g., sending ETH or interacting with a dApp), the following steps occur:

  1. Signing the Transaction: The user signs the transaction with their private key, proving ownership of the account.
  2. Broadcasting随机配图