7

In section 4.1 of the Ethereum yellow-paper (http://gavwood.com/Paper.pdf) the following is written:

The world state (state), is a mapping between addresses (160-bit identifiers) and account states (a data structure serialised as RLP, see Appendix B). Though not stored on the blockchain, it is assumed that the implementation will maintain this mapping in a modified Merkle Patricia tree (trie, see Appendix D). The trie requires a simple database backend that maintains a mapping of bytearrays to bytearrays; we name this underlying database the state database. This has a number of benefits; firstly the root node of this structure is cryptographically dependent on all internal data and as such its hash can be used as a secure identity for the entire system state. Secondly, being an immutable data structure, it allows any previous state (whose root hash is known) to be recalled by simply altering the root hash accordingly. Since we store all such root hashes in the blockchain, we are able to trivially revert to old states.

I understand Merkle trees and that the root node is a digital fingerprint of the tree leafs ... but how does this fact make it possible to "trivially revert to old states"??

Let's say I am at block/state N. Now I want to revert to state N-1. I know the root hash of state N-1. How does this knowledge help me to reconstruct the state of the tree leafs (tree leafs == Ethereum Accounts) in state N-1? The root hash in state N-1 could result from many different combinations of tree leaf-values ... I can easily compute the root hash given the tree leafs ... but the whole point of a hash is to make it impossible to get from a hash back to its input ...

So why does knowing the root hash of a past world state help me to reconstruct this world states?

1 Answer 1

2

Root hash cannot help you to reconstruct the state; it used only for other nodes can validate the state at the block number.

To reset state, you can sync your chain to the block number that you want. But note that it will remove all the blocks after also.

1
  • So basically, the yellow paper is wrong?
    – arcticmatt
    Oct 4, 2021 at 17:02

Your Answer

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

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