What is a Merkle Patricia Trie, and what is its application in Ethereum?

Maurice Smith
Maurice Smith
Researcher specializing in Ethereum DeFi; 专注于以太坊DeFi的研究员。

Alright, no problem. Let's talk in plain language about this rather daunting-sounding "Merkle Patricia Trie."


What is a Merkle Patricia Trie?

Imagine Ethereum as an incredibly vast, constantly updating global public ledger. To manage such an enormous amount of data without errors, prevent tampering, and ensure fast lookups, a truly robust data structure is essential. The Merkle Patricia Trie (MPT) is the "super filing cabinet system" chosen by Ethereum for this purpose.

To make it easier to understand, let's break it down into two parts: "Merkle" and "Patricia Trie".

First, let's break it down

1. Trie - A Clever 'Path-Compressed' Filing System

A "Trie" tree, you can think of it like the index you use to look up words in a dictionary. It's exceptionally good at storing and looking up 'key-value pairs,' such as (address, account balance).

Its cleverness lies in 'path sharing'.

For example, suppose we want to store two pieces of data:

  • The key cat corresponds to the value 🐱
  • The key car corresponds to the value 🚗

A typical system might store these as two completely independent data entries. But a Trie tree does this:

  • It notices that the first two letters, ca, of cat and car are the same, so it makes them share the path c -> a.
  • Then, at the node a, it branches off, one branch pointing to t (storing 🐱), and the other pointing to r (storing 🚗).