Merkle Trees are a core component of blockchain architecture and design. For the Accumulate network, Merkle Trees are the glue that ties together Accumulate’s chains-of-chains architecture and enables disparate networks to remain in sync with one another even as they operate independently.
What is a Merkle Tree?
A Merkle Tree is a hierarchical data structure that succinctly encodes large batches of data in the form of a Merkle root or hash.
There are several layers that make up a blockchain network, the most foundational of which is the data layer. This is where data about the digital signatures and hashes that make up all transactions within a blockchain are stored.
The Data layer consists of the 3 main components: blocks, merkle trees and digital signatures.
- Blocks are data structures that are used to bundle sets of transactions and distribute them to all nodes on the network.
- A Merkle tree is a binary tree of hashes. Hashes cryptographically record details from the previous block in the chain, including the timestamp and transaction values. The hash is then used to chain a new block to the previous block.
- Digital signatures are signatures that use asymmetric cryptography to secure information about the block, transactions and transacting parties. Transactions are digitally signed on the blockchain to ensure the security and integrity of the data stored on it.
As the name suggests, Merkle trees are essentially the connective tissue for not just individual blocks within a chain but also independent blockchains that want to stay synchronized.
Hashes are like certificates that allow you to verify the history of transactions within a Merkle tree through simple computation. Using root hashes, each chain on the Accumulate network connects to the other to form a growing Merkle tree of data. This tree is where we get the concept of a ‘chain of chains’, as every chain within a Block Validator Network (BVN) or Directory Network (DN) can be considered a side chain of its respective BVN/DN root anchor chain.
Accumulate Chains-of-Chains architecture connected by merkle tree & hashes:
Each BVN can contain multiple accounts, each of which has a Signature Chain and a Main Chain. Each BVN (and the DN) has a Synthetic Transaction Chain, a Root Anchor Chain, and one or more Intermediate Anchor Chains. These are collectively referred to as system chains, as they are not tied to any specific account and are used by the system as a whole.
Binary Patricia Trie (BPT)
The Binary Patricia Trie (BPT) is another component of Accumulate’s chains of chains architecture. It is responsible for collecting hashes that represent the current state and history of all accounts in a BVN or DN, thereby helping to keep the entire network in sync.
Use Cases: Cross-Chain Lending and Audit Trails
Merkle Trees and BPTs are both essential components of Accumulates modular architecture and play a key role in the implementation of various use cases, particularly around interoperability and cross chain bridging.
By inputting hashes of one chain’s data into another, blockchains can keep an updated record of the state of other chains, enabling value transfer between chains to occur with little friction and full transparency.
Markle Trees and BPTs also serve a critical role in helping Accumulate function as an audit layer for cross-chain activities. This can include bridge transactions, managed or delegated transactions between organizations, or transferring and storing of real-world assets.
Let’s say you are developing a cross-chain lending protocol that aims to process loans as managed transactions to different Accumulate accounts/chains.
Merkle Trees would provide you with a transparent audit trail of all loan transactions that occur across different chains. The BPT would enable you to tie these activities together to the BVN and DN, ensuring that the broader network is able to update its own state to reflect these lending transactions.
You could even extend loans to blockchains outside of the Accumulate network and use hashes to record those transactions on various chains. This would make it easier to expand credit throughout the web3 ecosystem without incurring risks due to a lack of coordination between smart contracts.
Ultimately, Merkle trees serve as a critical mapping infrastructure for data that is recorded on a blockchain and across blockchains. The ability to cryptographically record details about a transaction in the form of a hash that links to other hashes and forms a merkle tree insures that no matter how expansive and complex the web3 ecosystem becomes there will always be a transparent audit trail for users to look back on to ensure that the data is correct, verified and can be trusted.