1

I am learning Ethereum from yellow paper, I have some questions.

The world state is talked in the paper. It seems that there is only one world state for all accounts in the whole blockchain from genesis to latest block.

The world state (state), is a mapping between addresses (160-bit identifiers) and account states (a data structure serialised as RLP, see Appendix B).

My understanding:
States (like nonce, balance, storage root, etc) for all accounts are saved in the same merkle patricia trie. For every new block, some of the states are changed and new header will be generated based on newly updated state node in the trie. Header hash are used to verify if the state storage latest or not.

[Q1] Is my understanding correct?
[Q2] Is "world state" in quote the same thing as state storage?

Except for state storage, there are 2 other storage: transaction trie and receipt trie. Unlike state trie, they are immutable.
[Q3] Are they, like state storage, saved in their own big tries respectively?

1 Answer 1

0

Each node in the world state trie represents an address, and maps to an account state. The state of the account includes the nonce, balance, storage root, and code hash.

The storage root of each account is itself the root of another trie, where this trie stores the storage for that account. So we have "tries within a trie".

[Q1] Is my understanding correct?

Almost.

[Q2] Is "world state" in quote the same thing as state storage?

As above, the world state trie is a mapping of address to account state, where one field in an account's state is the root of its own storage trie.

[Q3] Are they, like state storage, saved in their own big tries respectively?

Yes, correct.

The big diagram in this answer makes things clear.

2
  • Thanks Richard! you answer is very helpful. I just want to ask one more question: State root in block header is just a value instead of path right? The reason state root changes is because some accounts' state in the trie updated. We only use state root to verify the if the state trie in disk is corresponding to latest block in chain. Is that correct?
    – Frank Kong
    Commented Jun 9, 2018 at 6:49
  • Yep, the state root field in the block header is a hash of the root of the trie, so just a value. Yes, it changes when one or more accounts' states change. And yes, when a full node syncs its state, it can manually re-run all transactions and state changes, and check the resulting state matches what's in the block headers (which are synced separately to the state data). Commented Jun 9, 2018 at 6:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.