blockchainethereummerkle-tree

Merkle tree with level DB log merge tree


While reading about the blockchain Merkle tree and level DB, I got a query related to the tree used in blockchain. In most blockchains, level DB is used to store the data in a key-value pair structure, and even level DB uses a merge log-tree. So why is it required to use a Merkle tree even if level DB also uses a tree structure to store data?


Solution

  • Merkle tree is needed for quickly recompute Merkle root for block hash, when mempool contains is changed. Just aware: To a miner, each second come in new transaction, and miner must add these transaction into mempool, and maybe - remove some "non interesting" transactions from a mempool. As result, after each update, miner must recompute block hash. And there is performance affecting - rehash linearly entire block (~1MB), or just Merkle branch only (<1K).

    Storing block within wallet DB - this is another task, irrelevant to MT-structure within block.