Architecture
Ethereum Accounts
nonce
– a counter that increments with every transaction sent from the account. This ensures transactions are only processed once. For contract accounts, it the number of contracts created by the account.balance
– amount of wei owned by the addresscodeHash
– the hash of the code of an account on the EVM. Contract accounts contain code fragments that can perform different operations. This code gets executed if the account receives a message call. It cannot be changed, unlike the other account fields. For EOAs, the codeHash field is the hash of an empty string.storageRoot
– keccak256 hash of the root node of a Merkle Patricia trie that encodes the storage contents of the account. empty by default.
Block Header
The block header of each block contains information on an Ethereum block.
The block header contains the following fields:
Prev Hash - Keccak hash of the parent block
Nonce - Used in proof of work computation
Timestamp - Scale value of the output of UNIX time( )
Uncles Hash - Keccak hash for uncled blocks
Beneficiary - Beneficiary address, mining fee recipient
LogsBloom - Bloom filter of two fields, log address & log topic in the receipts
Difficulty - Scalar value of the difficulty of the previous block
Extra Data - 32 byte data relevant to this block
Block Num - Scalar value of the number of ancestor blocks
Gas Limit - Scalar value of the current limit of gas usage per block
Gas Used - Scalar value of the total gas spent on transactions in this block
Mix Hash - 256-bit value used with a nonce to prove proof of work computation
State Root - Keccak Hash of the root node of state trie (post-execution)
Transaction Root - Keccak Hash of the root node of transaction trie
Receipt Root - Keccak Hash of the root node of receipt trie
State Root
The state root is the root of the Merkle Patricia Trie which stores a key-value pair for every Ethereum account on the network, where the key is an Ethereum address and the value is the Ethereum account object.
Accounts
The Ethereum account is the consensus representation for an Ethereum address. It is made up of 4 items.
Nonce - Number of transactions made by the account
Balance - Balance of the account in Wei
Code Hash - Hash of the bytecode stored in the contract/account
Storage Root - Keccak Hash of the root node of storage trie (post-execution)
Storage Root
The storage root is the root of a Merkle Patricia Trie, where the keys are the storage slots and the values are the data in each slot.
Any change in contract storage will impact the Storage Root, which in turn will impact the State Root which in turn will impact the Block Header.
Last updated