In the patricia merkle tree, each shortnode represent a key-value mapping which saved in DB.

Key = Hash(Value)

Value = rlp.encode(node)

There is question that if a node been updated and the node's value changed. When the node saved to DB, the key of the node change! But i didn't find any reorgnization tree code.

How does patricia merkle tree work during the node updating?

2 Answers 2


Super high-level answer: all nodes, on the road from the changed node to the root, change.


Actually, the merkle tree in ethereum reorg the tree while update method called. And the subcall of update method is insert function.

That's to say, when we want to update a tree node's value, a new node will be created and insert to the appropriate position with specific key and the old node will be reserved to represent a historical state.

Here is a Link, which described the detail.

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.