Merkle tree with level db log merge tree

324 Views Asked by At

I was reading about blockchain Merkle tree and level DB. my query is related to the tree used in blockchain. As in most of the blockchain, level-DB is used to store the data in key-value pair structure and even level DB use merge log-tree. So why it is required to use Merkle tree even level DB is also use a tree structure to store data.

1

There are 1 best solutions below

0
On BEST ANSWER

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.