Skip to main content

Overview

AccountState represents the four fields of an Ethereum account as defined in the Yellow Paper (section 4.1). Every account has a nonce, balance, storage root, and code hash.

Type Definition

Fields:
  • nonce - Transaction count (EOA) or contract creations (contract)
  • balance - Account balance in Wei
  • storageRoot - Merkle Patricia Trie root of storage slots
  • codeHash - Keccak256 hash of EVM bytecode

Creating AccountState

from

Universal constructor from object with required fields.

createEmpty

Creates an empty EOA (Externally Owned Account) with zero balance and nonce.

Account Type Detection

isEOA

Checks if account is an Externally Owned Account (has no bytecode).

isContract

Checks if account is a contract (has bytecode).

Comparing AccountStates

equals

Compares all four fields for equality.

Constants

EOA vs Contract Accounts

See Also