Hi, my name is Steven, studying and working in data. Looking forward to learning a lot from https://epf.wiki/#/ and meeting new amazing people. X/tele/ig: @im24steven
Referencing: https://epf.wiki/#/wiki/protocol/data-structures?id=data-structures-in-ethereum
(Delving into the data structures of eth for a better understanding of building relational databases for eth transactions.)
-
Merkle Patricia Trie as the primary data structure for storing the execution layer state. PT: all data is stored in the leaf nodes. Space efficient.
3 types of nodes in ETH MPT:
- Branch Nodes: 1 node value + 16 branches = 17-element array.
- Extension Nodes: optimized, compressed, eliminating redundant branch nodes with single children.
- Leaf Nodes: key-value pairs. Value = node content; Key = node hash.
(The root is also an extension node)
-
Within one ETH block, 4 different modified MPTs:
- Transaction Trie: Nonce, from, to, value, etc.
- Receipt Trie: logs, status code, etc.
- World State Trie: nonce, balance, storageRoot, etc.
- Account State(Storage) Trie, storageRoot
Insight: 1. Efficient data retrieval in MPT. 2. translating MPT into relational schemas, different parts of the Merkle tree can be stored in different tables. For building/saving historical data as relational databases using schemas with certain normalization levels, tables can be stored separately--nodes table, accounts state table, transactions table, etc.
- TODO: On Merkle Trees in ETH and ZKP: how ZKP project tables could be generated?
-
More MPT: ETH vs ZKP
Iden3 as an example:
Store & validate claims:
Able to design such a circuit which recreates the calculation model of the root of a merkle tree to verify the received proofs by recalculating the root of the merkle tree.
-
Verkle Update: A better MPT, optimized by reducing witness size.
-
"The main difference between the Verkle tree and the Merkle tree structure is that the Verkle tree is much flatter, meaning there are fewer intermediate nodes linking a leaf to the root, and therefore less data required to generate a proof." eth org