Merkle Tree
Last updated
Last updated
Origins system has an important scalability feature: its transactions are stored in a multi-level data structure. The hash of a block is actually just the hash of the block header, which includes a timestamp, a random number, the hash of the previous block, and the root hash of a Merkle tree containing all the block transactions, with a length of approximately 200 tuples.
A Merkle tree is a binary tree composed of a set of leaf nodes, a set of intermediate nodes, and a root node. The numerous leaf nodes at the bottom contain the basic data, each intermediate node is the hash of its two child nodes, and the root node is also the hash of its two child nodes, representing the top of the Merkle tree. The purpose of the Merkle tree is to allow the block data to be transmitted in a scattered manner: nodes can download the block header from one source and the other parts of the tree related to it from another source while still being able to confirm that all the data is correct. This is possible because of the upward diffusion of the hash: if a malicious actor attempts to insert a fake transaction at the bottom of the tree, the changes will propagate to the nodes above, and ultimately to the root node and the hash of the block, resulting in the protocol recognizing it as a completely different block (almost certainly with an incorrect proof-of-work).
The Merkle tree protocol is crucial for the long-term viability of Origins. In the future, only businesses and enthusiasts will act as full nodes. The Simplified Payment Verification (SPV) protocol allows for the existence of another type of node known as a "light node," which downloads block headers, confirms proof-of-work using block headers, and then only downloads the Merkle tree "branches" related to its transactions. This allows light nodes to securely determine the state of any Origins transaction and the current balance of an account by downloading only a small portion of the entire blockchain.