A blockchain sharding and cross-sharding transaction processing method based on granular computing
Patent Information
- Application Number
- CN202610329190.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-18
- Publication Date
- 2026-10-20
AI Technical Summary
[0005]本发明提供了一种基于粒球计算的区块链分片及跨分片交易处理方法,该方法解决了现有区块链分片技术中跨分片交易比例高、分片负载失衡及跨分片交易处理效率低的问题,为区块链分片系统的扩容优化和交易处理效率提升提供了新的思路
[0026]进一步地,本方法中所述基于粒球结构的跨分片交易批量处理机制,在粒球归属识别阶段完成跨分片交易的精准筛选,仅将跨分片跨粒球交易纳入批量处理流程,粒球内交易和同分片跨粒球交易由验证分片本地直接处理,无需跨分片协调,进一步提升系统的交易处理效率。
Smart Images

Figure FT_1 
Figure FT_2 
Figure SMS_1
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer blockchain technology, and in particular to a blockchain sharding and cross-shard transaction processing method based on granular computing. Background Technology
[0002] Blockchain technology, with its decentralized, immutable, transparent and traceable characteristics, has been widely used in financial transactions, supply chain management, digital assets and other fields. However, its single-chain architecture has technical bottlenecks such as low transaction processing efficiency and poor scalability. As the number of accounts and transaction volume in the blockchain network continue to grow, all nodes in the network need to verify and store all transaction data simultaneously, which leads to a surge in node computing and storage load, a significant increase in transaction confirmation delay, and difficulty in adapting to high-concurrency transaction scenarios.
[0003] To address the scalability issue of blockchain, sharding technology has become the mainstream on-chain scaling solution. This technology divides the blockchain network into multiple independent shards, each of which can process local transactions in parallel. Coordination between shards only occurs when there are cross-shard transactions, effectively improving the overall transaction processing capacity of the blockchain system. Existing blockchain sharding technologies primarily employ random allocation, static partitioning, or simple graph clustering for shard construction. These methods have significant drawbacks: First, they fail to adequately consider the transaction associations between accounts, resulting in a large number of accounts with high transaction interactions being assigned to different shards. This leads to a persistently high proportion of cross-shard transactions, which require complex consensus and coordination communication among multiple shards, significantly increasing transaction processing overhead. Second, shard construction focuses solely on balancing the number of nodes without optimizing for transaction load, easily leading to shard load imbalances. Some shards experience congestion due to excessive transaction load, while others remain idle, reducing the overall system resource utilization. Third, cross-shard transactions often employ a single-transaction relay and verification approach, lacking a batch processing mechanism integrated with the sharding structure. This further exacerbates processing latency for cross-shard transactions and fails to fully leverage the scalability advantages of sharding technology.
[0004] While some existing technologies attempt to reduce the proportion of cross-shard transactions through clustering or simple batch processing, the former lacks a multi-dimensional shard merging evaluation model, making it difficult to simultaneously consider the closeness of transaction correlation and shard load balancing. The latter does not use shard clustering units as the standard for batch processing, and the merging dimension selection is unreasonable, failing to fundamentally reduce the number of cross-shard coordination operations. Therefore, a novel blockchain sharding method is urgently needed, particularly one employing artificial intelligence-related technologies to achieve efficient aggregation of accounts with high transaction interaction during the sharding construction phase, while simultaneously considering shard load balancing to reduce the proportion of cross-shard transactions. Furthermore, it should design a cross-shard transaction batch processing mechanism adapted to the sharding structure to improve the overall performance of the blockchain sharding system. Particle-based computing is precisely such a core artificial intelligence technology, providing a powerful new approach for blockchain sharding. Summary of the Invention
[0005] This invention provides a blockchain sharding and cross-shard transaction processing method based on particle sphere computing. This method solves the problems of high cross-shard transaction ratio, unbalanced shard load, and low cross-shard transaction processing efficiency in existing blockchain sharding technologies, and provides a new approach for the expansion and optimization of blockchain sharding systems and the improvement of transaction processing efficiency.
[0006] To address the aforementioned issues, this application proposes a blockchain sharding method based on sphere computing, comprising the following steps:
[0007] S1: Model the blockchain account network as a weighted graph and initialize the weighted graph as a structure containing multiple coarse-grained spheres, laying the foundation for subsequent sphere splitting and fragment merging;
[0008] S2: Perform iterative splitting operations on coarse-grained spheres to aggregate accounts with high transaction interactions into the same sub-sphere, thereby increasing the transaction correlation between accounts within the sphere;
[0009] S3: Construct a two-factor evaluation model that includes the connection strength between particles and the load balance, calculate the sharding and merging score of candidate particle combinations, screen qualified particle combinations and merge them in sequence to form the target number of blockchain shards, thereby minimizing the cross-shard transaction ratio.
[0010] S4: Design a batch processing mechanism for cross-shard transactions based on a sphere structure, using spheres as units to perform batch relay processing on cross-shard transactions, thereby improving the processing efficiency of cross-shard transactions.
[0011] Furthermore, the blockchain account network is modeled as a weighted graph, and this weighted graph is initialized into a structure containing multiple coarse-grained spheres. Specifically, each account in the blockchain is treated as a node in the weighted graph, the transactions between accounts are treated as edges in the weighted graph, and the number or frequency of transactions between accounts within a preset statistical period is treated as the weight of the edges. This constructs a blockchain account network weighted graph G=(V,E,W) that reflects the transaction association characteristics and transaction activity of accounts, where V is the set of account nodes, E is the set of transaction edges between accounts, and W is the set of edge weights. The number of coarse-grained spheres generated is determined by the square root of the number of account nodes in the weighted graph. The weighting degree of each account node is calculated, and the account with the highest weighting degree is selected as the sphere center. The surrounding nodes are traversed and clustered using a breadth-first search until the preset number of coarse-grained spheres are generated, thus completing the sphere initialization operation.
[0012] Furthermore, an iterative splitting operation is performed on the coarse-grained spheres to aggregate accounts with high transaction interaction into the same sub-sphere. Specifically: for each initialized coarse-grained sphere, the two accounts with the highest weighted degree within the sphere are selected as dual split centers. A breadth-first search is initiated simultaneously from the two split centers to assign each account node within the sphere to the sub-sphere corresponding to the split center where that node is first traversed, resulting in two sub-spheres. The overall transaction cohesion of the two sub-spheres after splitting is calculated using the following formula:
[0013] Furthermore, an iterative splitting operation is performed on the coarse-grained spheres to aggregate accounts with high transaction interaction into the same sub-sphere. Specifically: for each coarse-grained sphere, the two accounts with the highest weighted degree within the sphere are selected as dual splitting centers, and a breadth-first search is performed simultaneously to assign nodes to the corresponding sub-spheres; the transaction cohesion of the sphere is calculated.
[0014]
[0015] In the formula, E(GB) is the set of edges within the sphere GB, and V(GB) is the set of nodes within the sphere GB. The transaction cohesion of the two sub-spheres is added together and compared with the transaction cohesion of the original coarse-grained sphere. If the overall transaction cohesion after splitting is higher, the splitting result is retained and the two sub-spheres are used as new spheres to be split. The above splitting operation is repeated until no valid splitting result is generated, thus completing the iterative splitting of all spheres and realizing the aggregation of sub-spheres of accounts with high transaction interaction.
[0016] Furthermore, a two-factor evaluation model incorporating inter-particle connectivity strength and load balancing is constructed to calculate the piecewise merging score of candidate particle-particle combinations. Specifically, the formula for calculating inter-particle connectivity strength is:
[0017]
[0018] in, Transgranular and The set of all transaction edges, , They are respectively , The set of account nodes within; load balancing is used to characterize the rationality of load balancing after merging two balls, and the calculation formula is:
[0019]
[0020] In the formula, , They are granules , The transaction load (i.e., the sum of the weights of all transaction edges within the particle). The system's preset ideal load for sharding (K is the target number of shards). A load tolerance parameter (with a value ranging from 0.1 to 0.3, used to allow for reasonable load deviations) is introduced; a weighting coefficient is then introduced. Construct a sharded merging scoring model:
[0021]
[0022] Merge the particles according to their scores from highest to lowest. After each merge, update the relevant information of the particles and recalculate the merge score of all particle combinations. Repeat the merge operation until the target number of blockchain shards are formed. Finally, a blockchain shard structure that balances transaction correlation and load balancing is formed, minimizing the proportion of cross-shard transactions.
[0023] Furthermore, a cross-shard transaction batch processing mechanism based on a granular structure is designed to perform batch relay processing of cross-shard transactions using granules as units. Specifically, a two-layer processing architecture is built based on a coordination shard and a verification shard. The coordination shard maintains the three-layer mapping relationship of "account-granule-shard" across the entire network, while each verification shard maintains the granule structure and local blockchain data within its shard. Using granule pairs as the core classification dimension, the processing steps of granule ownership identification, transaction batch merging, targeted relay, two-layer verification, and batch consensus on-chain are executed sequentially. Cross-shard transactions are classified and merged according to "source granule-target granule" pairs, generating standardized transaction batches, which are then forwarded to the target verification shard. After legality verification, batch consensus and on-chain operations are performed on valid batches, realizing batch relay processing of cross-shard transactions based on the granule structure, reducing the number of cross-shard coordinations and transaction processing overhead.
[0024] Furthermore, in this method, the node weighting degree is the sum of the weights of all connected edges of an account node, used to characterize the transaction activity of the account; the transaction cohesion is the ratio of the sum of the weights of all edges within the grain to the number of nodes within the grain, used to characterize the closeness of transaction interactions between accounts within the grain. The higher the transaction cohesion, the closer the transaction association between accounts within the grain.
[0025] Furthermore, the weight coefficients of the two-factor evaluation model described in this method range from 0 to 1, and can be flexibly adjusted according to the actual application needs of the blockchain system. If the system is more concerned with reducing the proportion of cross-shard transactions, the weight ratio of the connection strength between shards can be increased; if the system is more concerned with the balance of shard load, the weight ratio of load balance can be increased, thereby achieving personalized optimization of shard construction.
[0026] Furthermore, the cross-segment transaction batch processing mechanism based on the particle structure described in this method completes the accurate screening of cross-segment transactions during the particle ownership identification stage. Only cross-segment cross-particle transactions are included in the batch processing flow. Transactions within a particle and cross-particle transactions within the same segment are directly processed locally by the verification segment without the need for cross-segment coordination, thereby further improving the transaction processing efficiency of the system. Attached Figure Description
[0027] Figure 1 is a complete flowchart illustrating a blockchain sharding and cross-shard transaction processing method based on granular computing according to some embodiments of this specification.
[0028] Figure 2 is a schematic diagram of a two-layer transaction processing architecture based on a granular structure, built upon coordination sharding and verification sharding, according to some embodiments of this specification. Detailed Implementation
[0029] The following detailed description, in conjunction with the accompanying drawings and specific embodiments, illustrates the blockchain sharding and cross-shard transaction processing method based on particle-based computation of the present invention. This embodiment takes 10,000 active accounts from a system over the past 30 days as the research object, constructing a weighted undirected graph G=(V,E,W) as the basic data model for sharding, where V is the set of accounts (|V|=10000), E is the set of transaction relationship edges between accounts, and W is the set of edge weights (the edge weight is the number of transactions for the corresponding account pair).
[0030] like Figure 1 The illustrated method for blockchain sharding and cross-shard transaction processing based on granular computing includes the following steps:
[0031] Step 1: Model the blockchain account network as a weighted graph and initialize it as a structure containing multiple coarse-grained spheres:
[0032] The core of this step is to generate a coarse-grained sphere structure based on account interaction density, providing the basic unit for subsequent partitioning. Specifically, the entire weighted undirected graph G is initialized as a coarse-grained sphere. Calculate its weighted average degree (the formula is the ratio of the sum of all edge weights within the sphere to the number of nodes). Since the total number of accounts is 10000 and the square root is 100, 100 initial spheres are generated: Calculate... The weighted degree of each account is calculated, and the account with the largest weighted degree is selected as the first center. The nodes are traversed by breadth-first search. When the number of nodes in a certain layer exceeds 100, the search stops and the first initial sphere is formed. The process is repeated from the remaining nodes until 100 initial spheres are generated.
[0033] Step 2: Perform an iterative splitting operation on the coarse-grained spheres to aggregate accounts with high transaction interactions into the same sub-sphere, thereby increasing the transaction correlation between accounts within the sphere:
[0034] In the iterative splitting operation, this embodiment further refines the granular structure for accounts with high transaction interaction.
[0035] With an initial ball containing 80 accounts For example, the two accounts with the highest weighted degrees are selected as the dual centers, and a breadth-first search is performed simultaneously to split the sphere into two sub-spheres. , .
[0036] To determine whether the splitting was effective, the transaction cohesion of the spheres is calculated:
[0037]
[0038] If the cohesion of the protosphere is 8.2, after splitting... The cohesion is 11.5. If the cohesion is 10.3 and the sum of the two is greater than the original sphere, then this split is retained.
[0039] Repeat the above process until all spheres can no longer increase cohesion through splitting, ultimately resulting in a batch of highly concentrated fine spheres.
[0040] Step 3: Construct a two-factor evaluation model that includes the strength of inter-shard connections and load balancing, calculate the candidate shard merging score, and select qualified shard combinations to form shards, in order to minimize the cross-shard transaction ratio.
[0041] During the fragmentation and merging phase, this embodiment constructs a two-factor evaluation model that comprehensively considers the connection strength between particles and the load balance. The connection strength index between particles is defined as follows:
[0042]
[0043] This indicator reflects the closeness of transactions between the two balls; the higher the value, the more cross-shard transactions can be reduced after the merger.
[0044] Meanwhile, to ensure that the load on each shard is neither overloaded nor idle after the merger, a load balancing index is introduced, the calculation formula of which is:
[0045]
[0046] In the formula, , They are granules , The transaction load is the sum of the weights of all transaction edges within the sphere;
[0047] The ideal shard load under the system's target sharding is obtained by dividing the total network transaction load by the target number of shards K:
[0048]
[0049] This is the load tolerance factor, typically ranging from 0.1 to 0.3, used to allow the segmented load to fluctuate within a reasonable range, avoiding overly rigid merging.
[0050] Load balancing The closer it is to 1, the closer the load after merging the two balls is to the ideal value, and the more balanced the sharding is.
[0051] Based on this, construct a combined scoring function:
[0052]
[0053] in Configurable weights are used to adjust the priority of connection strength and load balancing.
[0054] Generally, the weighting coefficient is taken as... (Connection strength factor has higher priority). In specific implementation, the preset target number of shards is 16. By traversing the merge score of all granular pairs, granular pairs with scores higher than the preset threshold (such as 0.75) are merged first, and finally 16 shards are formed. Each verification shard contains about 50 fine-grained granular balls. The coordination shard is responsible for global transaction collection, graph maintenance and transaction relay.
[0055] Step 4: After the sharding structure is determined, the system enters the cross-sharding transaction batch processing stage based on the granular structure:
[0056] like Figure 2In the illustrated two-layer transaction processing architecture, the verification shard is responsible for receiving transactions and maintaining account status and granular information; the coordination shard maintains a global "account-granular-shard" mapping table and uniformly schedules cross-shard transactions. When a transaction enters the verification shard, the system queries its granular and shard based on the initiating account and target account to determine whether the transaction is an intra-granular transaction, a cross-granular transaction within the same shard, or a cross-shard cross-granular transaction. For the first two types of transactions, execution and on-chain processing are completed directly within the current verification shard; only cross-shard cross-granular transactions are submitted to the coordination shard for batch processing.
[0057] After receiving cross-shard transactions, the coordinating shard classifies the transactions into the corresponding sub-transaction pools based on the "source-target" pair.
[0058] When the transaction volume in the transaction pool reaches the threshold or the waiting time reaches the upper limit of the window, the coordinated sharding merges transactions of the same pair of balls into a batch and generates a relay header containing ball identifiers, transaction hash lists, sharding target addresses and signature information, forming a transaction batch that can be uniformly verified.
[0059] Subsequently, the coordinated shards will send the transaction batches to the target verification shards to avoid bandwidth waste caused by broadcasting across the entire network.
[0060] Upon receiving a transaction batch, the target verification shard performs two-layer verification:
[0061] The first layer verifies the legitimacy of the relay header, including the validity of the signature and the correctness of the mapping relationship between the sphere and the fragment;
[0062] The second layer verifies the legality of all transactions within the batch, including account balances and transaction numbers.
[0063] If all verifications pass, the target verification shard uses a practical Byzantine fault-tolerant algorithm to achieve consensus and upload the entire batch of transactions to the blockchain at once.
[0064] If only some transactions are invalid, the abnormal transactions are removed and the batch is regenerated and verified; if the entire batch is invalid, the batch is returned to the source for verification and split into individual transactions for reprocessing.
[0065] After the batch on-chain data is completed, the target verification shard will synchronize the block height, transaction status, and execution result to the coordination shard and the source verification shard.
[0066] The source verification shard updates the status of the initiating account based on the execution result, coordinates the shards to update the transaction statistics of the entire network, and provides data support for subsequent adjustments to the shards.
[0067] Through the above process, the system realizes cross-shard transactions based on the granular structure dimension for aggregation, batch relay, and batch verification, significantly reducing cross-shard communication overhead and consensus latency, and improving the overall throughput and scalability of the blockchain sharding system.
[0068] The above are embodiments of the present invention. The above embodiments and specific parameters are only for clearly illustrating the inventor's invention verification process and are not intended to limit the patent protection scope of the present invention. The patent protection scope of the present invention is still determined by its claims. Similarly, any equivalent structural changes made based on the description and drawings of the present invention should also be included within the protection scope of the present invention.
Claims
1. A blockchain sharding and cross-shard transaction processing method based on particle sphere computing, characterized in that, Includes the following steps: Step 1: Model the blockchain account network as a weighted graph and initialize it as a structure containing multiple coarse-grained spheres; Step 2: Aggregate accounts with high transactional interactions into sub-spheres through iterative splitting operations; Step 3: Construct a two-factor evaluation model that includes the connection strength between particles and the load balance, calculate the candidate shard merging score, and select qualified particle combinations to form shards in order to minimize the cross-shard transaction ratio; Step 4: Design a cross-shard transaction processing mechanism based on a granular structure to achieve batch processing of cross-shard transactions using granules as units.
2. The method according to claim 1, characterized in that, In the weighted graph of the blockchain account network, nodes represent blockchain accounts, edges represent transactions between accounts, and edge weights are the number of transactions or transaction frequency between accounts within a preset period. The initialization method of the coarse-grained spheres is to divide the weighted graph into a corresponding number of initial spheres according to the square root of the number of account nodes, select the account with the highest node weight as the sphere center, and complete node clustering to form coarse-grained spheres through breadth-first search.
3. The method according to claim 2, characterized in that, The node weighting degree is the sum of the weights of all connected edges of the node, used to characterize the transaction activity of the account; the termination condition of the breadth-first search is that the number of traversed nodes reaches a preset threshold, ensuring that the node size of each coarse-grained sphere tends to be balanced.
4. The method according to claim 1, characterized in that, The specific process of the iterative splitting operation described in step two is as follows: For each coarse-grained sphere, select the two accounts with the highest weighted degree of nodes within the sphere as dual splitting centers, and initiate a breadth-first search simultaneously from the two centers to assign nodes within the sphere to the sub-sphere corresponding to the splitting center that first traverses that node; calculate the overall transaction cohesion of the two sub-spheres after splitting; if the cohesion is higher than that of the original coarse-grained sphere, retain the splitting result and repeat the splitting operation on its sub-spheres until no valid splitting result is generated, thus completing the aggregation of sub-spheres of accounts with high transaction interaction.
5. The method according to claim 4, characterized in that, The transaction cohesion is the ratio of the sum of the weights of all edges within a grain to the number of nodes within the grain, used to characterize the tightness of transaction interactions between accounts within the grain.
6. The method according to claim 1, characterized in that, In step three, the inter-sphere connection strength of the two-factor evaluation model is the ratio of the sum of the weights of all cross-sphere transaction edges between the two spheres to the total number of nodes in the two spheres, representing the degree of transaction interaction between the spheres; the load balance is the quantified value of the deviation between the overall transaction load after merging the two spheres and the preset ideal shard load, representing the rationality of the load distribution of the merged shards; the model obtains the candidate shard merging score by introducing a weight coefficient in the range of 0 to 1 to weight and sum the connection strength and load balance. The weight coefficient can be adjusted according to the actual needs of the system for cross-shard transaction optimization or load balancing.
7. The method according to claim 6, characterized in that, The specific method for selecting qualified particle combinations to form shards in step three is as follows: using the candidate shard merging score not lower than the preset score threshold as the screening criterion, the particles are merged in pairs according to the merging score from high to low. After each merging is completed, the relevant information of the particle is updated and the merging score is recalculated. The merging operation is repeated until the target number of blockchain shards are formed, thereby minimizing the cross-shard transaction ratio.
8. The method according to claim 1, characterized in that, The cross-shard transaction batch processing mechanism based on the granular structure described in step four relies on a two-layer architecture of coordinating shards and verifying shards. The coordinating shard maintains the three-layer mapping relationship of "account-granular-shard" across the entire network, while the verifying shard maintains the granular structure and local blockchain data within its shard. The batch relay processing uses granular pairs as the core classification dimension and sequentially performs granular ownership identification, transaction batch merging, targeted relay, two-layer verification, and batch consensus on-chain operations.
9. The method according to claim 8, characterized in that, In step four, after the verifier receives the transaction, the source and target granules of the transaction are determined according to the "account-granule-shard" mapping relationship. Cross-shard and cross-granule transactions are filtered out and submitted to the coordinating shard. The transaction batch is merged into a coordinating shard. The cross-shard and cross-granule transactions are classified into "source granule-target granule" pairs, and after lightweight filtering, they are merged into a transaction batch and a relay transaction header with digital signature is generated.
10. The method according to claim 9, characterized in that, The targeted relay described in step four coordinates the forwarding of transaction batches to the target verification shard. The target verification shard first verifies the legality of the relay transaction header, and then performs joint validity verification on the transactions within the batch. For valid batches that pass both layers of verification, a practical Byzantine fault-tolerant consensus algorithm is used to achieve batch consensus and on-chain processing, thus completing the efficient processing of cross-shard transactions.