Parallel State Merkle Tree Update via Subtree Segmentation
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
The existing methods for updating a state Merkle tree in blockchain networks are inefficient due to the sequential and recursive updating process, which is computationally costly and time-consuming, especially with frequent transactions and a large number of accounts.
Innovation Solution
The proposed method divides the state Merkle tree into a root subtree and multiple independent subtrees, which are updated in parallel by multiple worker threads, and then the root subtree is updated based on the results, improving update efficiency and overall network performance.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Productivity
If sequential and recursive updating process is used for state Merkle tree, then correctness of account state is maintained, but update efficiency is low and computational cost is high
Solution Approach 1:
The state Merkle tree is divided into multiple independent subtrees based on the account address space. Each subtree corresponds to a specific range of account addresses and can be updated independently. This segmentation allows parallel processing of multiple subtrees simultaneously, dramatically improving update efficiency while maintaining the correctness of the overall account state.
2Speed
If sequential updating is performed on the state Merkle tree, then memory access is simplified, but processing speed decreases due to waiting for previous updates to complete
Solution Approach 1:
The state Merkle tree is divided into multiple independent subtrees based on the account address space. Each subtree corresponds to a specific range of account addresses and can be updated independently. This segmentation allows parallel processing of multiple subtrees simultaneously, dramatically improving update efficiency while maintaining the correctness of the overall account state.
Solution Approach 2:
The patent introduces parallelism as a new dimension for processing state updates. Instead of sequentially updating subtrees in a single-threaded manner, multiple worker threads simultaneously update different subtrees in parallel. This dimensional change from sequential to parallel processing significantly increases processing speed while the coordination mechanism manages the added complexity.
3Reliability
If the entire state Merkle tree is updated for each transaction, then consistency is maintained, but computational overhead increases significantly with frequent transactions
Solution Approach 1:
The patent extracts and updates only the specific subtrees that are affected by each transaction, rather than updating the entire state Merkle tree. By identifying which account addresses are involved in a transaction and locating the corresponding subtrees, the system performs minimal necessary updates. This extraction approach maintains state consistency while dramatically reducing computational overhead for frequent transactions.
Data Source
AI summary
Implementations of the present specification provide a method for updating a state Merkle tree, where the state Merkle tree is used to store a state of an account in a blockchain network. The method includes: accessing data related to a state Merkle tree that stores a state of an account in a blockchain network; determining to-be-updated nodes that need to be updated in the state Merkle tree due to a state change of the account; extracting one first subtree and M second subtrees from the state Merkle tree based on the to-be-updated nodes; allocating the M second subtrees to N worker threads, wherein two or more of the N worker threads process in parallel the M second subtrees to obtain each updated second subtree; and updating at least the first subtree based on hash values of root nodes of the updated second subtrees, to obtain an updated state Merkle tree.


