1

I have read that Ethereum uses a modified Merkle Patricia Trie to store information such as accounts and its balance, when updating a balance to an address does it just go thru the tree and update the value in the leaf or does it create a new set of nodes and insert this new nodes in the database?

What got me confuse is if it replace or update the value on the leaf, then how can we retrieve what is the balance of the account in previous blocks, so I assume it replaces it? but how will it replace when only the value change and the path to that value stays the same as the address has not changed?

Can somebody enlighten this part for me please, thanks.

1 Answer 1

0

The path will always change when a value changes. The address will be the same but the trie will traverse all new nodes to find it.

Whether or not the nodes are replaced or added depends what Geth setting you are running. If you run in archive mode it will save more data.

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.