Ethereum World State Review

achinta das
Coinmonks
2 min readAug 4, 2022

--

In this blog, I will talk about

  • Ethereum World State

Ethereum enriches the content of the account, and in addition to the rest, it can store as much data as you want. And use the maintainability of account data to build smart contract accounts. Ethereum is an account model refined to implement smart contracts. Securely isolate data by account. The information between accounts is independent and does not interfere with each other. Then cooperate with the Ethereum virtual machine to let the intelligent contract sandbox run. As a smart contract operation platform, Ethereum divides accounts into external accounts (EOAs) and contract accounts.

View my article if you want to know more about EOA and Contract accounts.

Ethereum World State

The world state is a mapping between account addresses (160-bit identifiers) and account states ( such as account balance). Merkle tree is used to maintain state.

The account state includes four pieces of data.

The corresponding code is as follows:

Ethereum data are organized in units of accounts, and changes in account data cause changes in account status. As a result, the state of Ethereum is changed.

Ethereum uses Merkle Patricia Tries Structure. Markle patricia trie used Ethereum instead of a naive map to store the key-value pair of <Worldstate>. Because it stores key-value pair and proof to prove a certain key-value pair in the trie. However these states are not directly stored on the blockchain but are maintained in the Merkle prefix tree, and only the corresponding tree Root value is recorded on the blockchain. A simple database is used to maintain the persistent content of the tree, and the database used to maintain the mapping is called State Database.

Now the question is How does StateDB manage the state?

From a programmer's point of view, State DB has a variety of uses.

1. Maintains a mapping of account state to the world state.

2. Support modification, rollback, and commit status.

3. Support for persisting state to the database.

4. Is the medium through which states go in and out of the Merkle tree.

StateDB acts as a coordinator of State, Tree, LevelDB(Storage)

Reference :

New to trading? Try crypto trading bots or copy trading

--

--