Transaction data processing method, device, equipment and storage medium

By analyzing contract correlation, sharding processing and generating credibility units in the blockchain network, the problem of unreliable time sequence of transaction data is solved, and the transaction processing capability and overall performance of the system are improved.

CN119762222APending Publication Date: 2025-04-04CHINA UNIONPAY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411618803.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-12
Publication Date
2025-04-04

AI Technical Summary

Technical Problem

In the existing blockchain network, the time sequence of transaction data is unreliable and cannot be verified, resulting in transaction congestion and low processing capabilities.

Method used

By analyzing all contracts in the pre-built directed acyclic graph, the correlation between each contract is obtained and sharded according to the correlation. A credential unit is generated for each shard, the order of each transaction related to the contract is recorded, and the transactions are executed in sequence in the credential unit.

Benefits of technology

It improves transaction processing capabilities in the network, solves the potential congestion problem during peak transactions, and ensures the order reliability of transaction data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119762222A_ABST
    Figure CN119762222A_ABST
Patent Text Reader

Abstract

The embodiments of the present application provide a transaction data processing method, device, equipment and storage medium. The method includes: analyzing all contracts in a pre-constructed directed acyclic graph to obtain the correlation between the contracts; sharding each contract according to the correlation to obtain multiple shards; for each shard, generating a credibility unit corresponding to the shard, wherein the credibility unit is used to record the order of each transaction related to the contract; for a node in a shard, when executing a transaction related to the contract, the transactions are executed in sequence from front to back according to the order in the credibility unit corresponding to the shard. The present application processes transaction data by sharding, and configures a credibility unit for each shard to execute the transactions related to the contract in sequence according to the order in the credibility unit, thereby improving the transaction processing capacity in the network and solving the potential congestion problem of each contract-related transaction during the peak transaction period of the directed acyclic graph.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to blockchain technology, and in particular to a transaction data processing method, device, equipment and storage medium. Background Art

[0002] The blockchain consists of a series of sequentially linked blocks, where each block references the previous block to form a chain structure. DAG (Directed Acyclic Graph) is a graph data structure. If a directed graph cannot start from any vertex and return to that point through several edges, then this graph is a DAG. The combination of blocks and DAG structure is a new blockchain technology that integrates many blocks into a DAG structure by setting up rules. The typical representative of this type of structure is the Conflux blockchain. Each block needs to reference an edge of its parent block (Parent Edges). Each block can also reference the edges of the blocks that occurred before it and have not been referenced as their reference edges (ReferenceEdges). The parent edge and the reference edge determine the order relationship between the blocks, realize the overall framework of DAG, increase the number of blocks processed together in the same period, and improve the speed of the public chain.

[0003] Mainstream blockchain networks generally use consensus algorithms to ensure the normal execution of blockchain protocol rules. However, decentralized blockchain consensus algorithms represented by PoW often require a large number of complex calculations, and only one participant can win the computing power competition and provide valid blocks to the main chain. Other transactions that are not packaged into blocks and other blocks generated at the same time will be abandoned. Since each blockchain has a limited size, each blockchain can only accommodate a limited number of transactions. When the number of transactions on the network exceeds the capacity limit of the blockchain, the transactions will be crowded, causing congestion. Summary of the invention

[0004] The embodiments of the present application provide a transaction data processing method, apparatus, device and storage medium to solve the problem that the time sequence between transactions is unreliable and unverifiable.

[0005] In a first aspect, an embodiment of the present application provides a transaction data processing method, including:

[0006] Analyze all contracts in the pre-built directed acyclic graph to obtain the correlation between the contracts;

[0007] According to the association, each of the contracts is processed into fragments to obtain multiple fragments;

[0008] For each shard, generate a credibility unit corresponding to the shard, where the credibility unit is used to record the order of transactions related to the contract;

[0009] For a node in a shard, when executing transactions related to a contract, each transaction is executed in sequence from front to back based on the order in the trust unit corresponding to the shard.

[0010] In a possible implementation, analyzing all contracts in a pre-constructed directed acyclic graph to obtain the correlation between the contracts includes:

[0011] Obtaining the associated data between the contracts;

[0012] Analyze the associated data to obtain the association between the contracts;

[0013] The associated data includes any one or more of the calling relationship, shared data, and historical transaction data of each contract.

[0014] In a possible implementation, the sharding of each contract according to the association to obtain multiple shards includes:

[0015] Aggregate contracts whose correlation meets preset conditions into the same shard;

[0016] Evenly distribute the contracts whose relevance does not meet the preset conditions to the remaining shards.

[0017] In a possible implementation manner, the determination method of satisfying the preset condition includes:

[0018] If there is a direct reference relationship between the two contracts, it is considered that the preset conditions are met.

[0019] In a possible implementation, the directed acyclic graph includes a plurality of trusted nodes;

[0020] The step of generating a credibility unit corresponding to each shard includes:

[0021] Select multiple trusted nodes from the directed acyclic graph as information publishers, where the number of trusted nodes is the same as the number of shards in the directed acyclic graph;

[0022] For each information publisher, a credibility unit corresponding to a shard is generated; wherein the information publisher corresponds to the shard one-to-one.

[0023] In a possible implementation manner, after generating the credibility unit corresponding to the shard, the method further includes:

[0024] A preset number of trusted nodes are selected from the remaining trusted nodes to verify the generated public credibility unit. After the verification is passed, it is published to the directed acyclic graph so that each node receives each public credibility unit.

[0025] In a possible implementation, for a previous transaction that has been verified and referenced by a public trust unit, the status of the previous transaction is determined so that it cannot be referenced again by a new transaction.

[0026] In a possible implementation, the method further includes:

[0027] When the transaction volume in the directed acyclic graph increases, the number of shards and the number of information publishers are increased, and the newly added shards correspond one-to-one to the newly added information publishers.

[0028] In a possible implementation, the method further includes:

[0029] During the data processing process, if the load of a shard is less than the first preset load, or greater than the second preset load, the contract on the shard is dynamically adjusted to balance the load of each shard.

[0030] In a possible implementation, the method further includes:

[0031] After a transaction on a shard is executed, the transaction information related to the transaction is synchronized to other shards in the directed acyclic graph to ensure state consistency.

[0032] In a possible implementation, the credibility unit records the order of transactions related to the contract, including:

[0033] The credibility unit refers to the hash value of each transaction related to the contract, and determines and records the order of each transaction according to each hash value.

[0034] In a second aspect, an embodiment of the present application provides a transaction data processing device, including:

[0035] The analysis module is used to analyze all contracts in the pre-built directed acyclic graph to obtain the correlation between the contracts;

[0036] A shard processing module, used for sharding each of the contracts according to the association to obtain multiple shards;

[0037] A credibility unit generation module, used to generate a credibility unit corresponding to each shard, wherein the credibility unit is used to record the order of transactions related to the contract;

[0038] The execution module is used to execute transactions related to the contract for the nodes in a shard, in order from front to back according to the order in the public trust unit corresponding to the shard.

[0039] In a third aspect, an embodiment of the present application provides a computer device, including: a memory, a processor;

[0040] The memory stores computer-executable instructions;

[0041] The processor executes the computer-executable instructions stored in the memory, so that the processor executes the above first aspect and / or various possible implementations of the first aspect.

[0042] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the first aspect above and / or various possible implementations of the first aspect.

[0043] In a fifth aspect, an embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the above first aspect and / or various possible implementation methods of the first aspect.

[0044] The transaction data processing method, device, equipment and storage medium provided in the embodiments of the present application analyze all contracts in a pre-constructed directed acyclic graph to obtain the correlation between the contracts; then, based on the correlation, each contract is processed in shards to obtain multiple shards; for each shard, a credibility unit corresponding to the shard is generated, wherein the credibility unit is used to record the order of transactions related to the contract; for a node in a shard, when executing transactions related to the contract, the transactions are executed in sequence from front to back based on the order in the credibility unit corresponding to the shard. The present application processes transaction data by sharding, and configures a credibility unit for each shard to execute transactions related to the contract in sequence according to the order in the credibility unit, thereby improving the transaction processing capacity in the network and solving the potential congestion problem of transactions related to the contract during the peak period of transactions in the directed acyclic graph. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0046] Figure 1 A schematic diagram of a scenario of a transaction data processing method in one embodiment;

[0047] Figure 2 A flowchart of a transaction data processing method in one embodiment;

[0048] Figure 3 A flowchart of steps for obtaining the association between contracts in one embodiment;

[0049] Figure 4 A schematic diagram of a flow chart of steps for generating a public trust unit corresponding to a shard in one embodiment;

[0050] Figure 5 A schematic diagram of the structure of a transaction data processing device in one embodiment;

[0051] Figure 6 FIG. 1 is a schematic diagram of the structure of a computer device in an embodiment.

[0052] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0053] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0054] A transaction data processing method provided in an embodiment of the present application can be applied to Figure 1 In the application environment shown, the terminal 102 communicates with the server 104 through a network. The data storage system can store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or placed on the cloud or other network servers.

[0055] Among them, the user can build a DAG structure on the server 104 through the terminal 102 according to the transaction requirements, so that the server 104 analyzes all the contracts in the pre-built directed acyclic graph to obtain the correlation between the contracts; then, according to the correlation, each contract is processed in pieces to obtain multiple pieces; for each piece, a public trust unit corresponding to the piece is generated, wherein the public trust unit is used to record the order of each transaction related to the contract; for a node in a piece, when executing a transaction related to the contract, according to the order in the public trust unit corresponding to the piece, each transaction is executed in sequence from front to back. In this way, the server 104 feeds back the transaction execution result to the terminal 102.

[0056] The above transaction data processing method obtains the correlation between the contracts by analyzing all the contracts in the pre-constructed directed acyclic graph; then, each contract is processed in shards according to the correlation to obtain multiple shards; for each shard, a credibility unit corresponding to the shard is generated, wherein the credibility unit is used to record the order of each transaction related to the contract; for a node in a shard, when executing transactions related to the contract, each transaction is executed in sequence from front to back according to the order in the credibility unit corresponding to the shard. This application processes transaction data by sharding, and configures a credibility unit for each shard to execute transactions related to the contract in sequence according to the order in the credibility unit, thereby improving the transaction processing capacity in the network and solving the potential congestion problem of each contract-related transaction during the peak transaction period of the directed acyclic graph.

[0057] The terminal 102 may be, but is not limited to, various personal computers, laptop computers, smart phones, tablet computers, etc. The server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0058] It should be noted that the network communication between the terminal 102 and the server 104 is applicable to different network standards, for example, it can be applicable to global system of mobile communication (GSM), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time division synchronous code division multiple access (TD-SCDMA), long term evolution (LTE) system and future 5G and other network standards. Optionally, the above communication system can be a system in the scenario of ultra-reliable and low latency communications (URLLC) transmission in a 5G communication system.

[0059] Therefore, optionally, the above-mentioned base station can be a base station (Base Transceiver Station, referred to as BTS) and / or a base station controller in GSM or CDMA, or a base station (NodeB, referred to as NB) and / or a radio network controller (Radio Network Controller, referred to as RNC) in WCDMA, or an evolved base station (EvolutionalNode B, referred to as eNB or eNodeB) in LTE, or a relay station or access point, or a base station (gNB) in the future 5G network, etc., and the present application is not limited here.

[0060] The terminal 102 can be a wireless terminal or a wired terminal. A wireless terminal can be a device that provides voice and / or other service data connectivity to a user, a handheld device with a wireless connection function, or other processing devices connected to a wireless modem. A wireless terminal can communicate with one or more core network devices via a radio access network (Radio Access Network, referred to as RAN). A wireless terminal can be a mobile terminal, such as a mobile phone (or "cellular" phone) and a computer with a mobile terminal, for example, a portable, pocket-sized, handheld, computer-built-in or vehicle-mounted mobile device, which exchanges language and / or data with a radio access network. For another example, a wireless terminal can also be a personal communication service (Personal Communication Service, referred to as PCS) phone, a cordless phone, a Session Initiation Protocol (Session Initiation Protocol, referred to as SIP) phone, a wireless local loop (Wireless Local Loop, referred to as WLL) station, a personal digital assistant (Personal Digital Assistant, referred to as PDA) and other devices. A wireless terminal may also be referred to as a system, a subscriber unit, a subscriber station, a mobile station, a mobile station, a remote station, a remote terminal, an access terminal, a user terminal, a user agent, or a user device or user equipment, without limitation herein.

[0061] In one embodiment, a transaction data processing method is provided. This embodiment uses the method applied to the server 104 as an example. Figure 2As shown, the transaction data processing method includes:

[0062] Step 202: Analyze all contracts in the pre-constructed directed acyclic graph to obtain the correlation between the contracts.

[0063] Specifically, the structure of the directed acyclic graph (DAG) is constructed in advance by the service provider according to the design requirements, and a software environment such as an operating system and a database is built on the server 104, and then the constructed DAG structure is deployed on the server 104 to form a DAG network.

[0064] A contract usually refers to a smart contract, which is a self-executing code running on the blockchain. It specifies the key elements of the contract, such as the participants, transaction conditions, and execution logic. It can automatically execute the agreement according to the preset conditions, that is, automatically process contract-related transactions. At the same time, in the DAG network, each contract or transaction has a unique hash value, which can be used to identify and reference the contract or transaction. Transactions in the DAG network are connected to each other through hash references to form a transaction chain. The correlation between contracts represents the mutual dependence or influence relationship between the two in logic, data or operation, which is formed by multiple factors.

[0065] Step 204: Segment each contract according to its relevance to obtain multiple segments.

[0066] Specifically, the purpose of sharding is to distribute data on multiple nodes to improve the scalability and performance of the system. In the prior art, there are a variety of sharding strategies, such as sharding based on node attributes, edge attributes, and graph partitioning algorithms. In practical applications, a suitable distribution strategy can be selected as needed, and this application does not limit this.

[0067] Step 206: For each shard, generate a credibility unit corresponding to the shard, where the credibility unit is used to record the order of transactions related to the contract.

[0068] Specifically, after the contract is deployed on the DAG network, users can call the functions in the contract by issuing transactions to execute the contract. Transactions belonging to the same contract are associated with each other. When a node issues a new transaction, the contract to which the transaction belongs and other associated transactions can be known through the association.

[0069] In a DAG network, a transaction (Tx) is created and published by any node. A node usually refers to a device or entity that has the ability to verify transactions. Specifically, in a server cluster or distributed system, a node usually refers to an independent server. Each server node has its own processor, memory, storage, and network interface, and can independently perform specific tasks.

[0070] In this embodiment, the credibility unit is a special transaction, which operates in the DAG network in the same way as ordinary transactions. It can refer to previous transactions and be referenced by new transactions. It needs to be fixed in the network after sufficient transaction verification. The difference between the two is that transactions can be created and published by any node, while the publisher of the credibility unit is a credible trusted node (TN), where a trusted node refers to a node in the DAG network that is elected or designated through a consensus mechanism such as PoW, PoS or DPoS, responsible for verifying transactions, building a trust network, and helping the network reach a consensus. Furthermore, the main content of ordinary transactions is the addresses of the two parties to the transfer and the amount of the transfer, while the credibility unit does not carry the transfer information of ordinary transactions, but records the order of transactions related to the selected contract.

[0071] Step 208: For a node in a shard, when executing transactions related to a contract, each transaction is executed in sequence from front to back according to the order in the public trust unit corresponding to the shard.

[0072] Specifically, the nodes that execute transactions related to the contract in this embodiment refer to nodes with execution capabilities in the DAG network. After receiving the trust unit published by the trusted node to the DAG network, these nodes store the trust unit and the transactions referenced by the trust unit.

[0073] Furthermore, before each transaction is allowed to be published to the DAG network, it needs to verify multiple previous transactions, and the number of previous transactions depends on the specific rules of the DAG network. This verification mechanism allows the DAG network to asynchronously and concurrently write many transactions, and ultimately form a topological tree structure, greatly improving the scalability and transaction speed of the system.

[0074] Furthermore, verifying multiple previous transactions under the constraints of preset verification rules can ensure that the transaction initiator strictly executes the transaction in accordance with the set requirements, while also avoiding the same address sending a large number of transactions in a short period of time, thereby effectively reducing the verification cost.

[0075] The above transaction data processing method obtains the correlation between the contracts by analyzing all the contracts in the pre-constructed directed acyclic graph; then, each contract is processed in shards according to the correlation to obtain multiple shards; for each shard, a credibility unit corresponding to the shard is generated, wherein the credibility unit is used to record the order of each transaction related to the contract; for a node in a shard, when executing transactions related to the contract, each transaction is executed in sequence from front to back according to the order in the credibility unit corresponding to the shard. This application processes transaction data by sharding, and configures a credibility unit for each shard to execute transactions related to the contract in sequence according to the order in the credibility unit, thereby improving the transaction processing capacity in the network and solving the potential congestion problem of each contract-related transaction during the peak transaction period of the directed acyclic graph.

[0076] See also Figure 3 , Optionally, analyze all contracts in the pre-built directed acyclic graph to obtain the correlation between the contracts, including:

[0077] Step 302: Obtain the associated data between the contracts.

[0078] Step 304: Analyze the associated data to obtain the association between the contracts, wherein the associated data includes any one or more of the call relationship, shared data, and historical transaction data of the contracts.

[0079] Specifically, the contracts in the DAG network are allowed to be processed in parallel, and the execution order of each contract is not completely consistent with the order in which the transaction occurs. Therefore, in the embodiment of the present application, the reference relationship, execution order and other information of each contract are obtained by obtaining the associated data between the contracts. Among them, each contract is regarded as a node in the DAG network, and the call relationship between the contracts is regarded as a directed edge between the nodes. The call path of each contract is analyzed, and the closeness between the contracts is measured by parameters such as call frequency or call depth. Furthermore, by determining which data is shared by multiple contracts, and based on the flow and use of these data, the dependency relationship generated by the contract based on the shared data can be constructed. Furthermore, by parsing historical transaction data such as transaction time, transaction amount, and transaction parties, the trend of the transaction can be identified, thereby identifying the correlation between the contracts.

[0080] Optionally, each contract is sharded according to its relevance to obtain multiple shards, including:

[0081] Aggregate contracts whose correlation meets preset conditions into the same shard;

[0082] Evenly distribute the contracts whose relevance does not meet the preset conditions to the remaining shards.

[0083] Specifically, most contracts in the DAG network are not related to each other. Therefore, in the embodiment of the present application, contracts whose relevance meets the preset conditions are aggregated together, and contracts that do not meet the preset conditions are distributed as evenly as possible in multiple shards, so that transactions related to the contract can also be distributed more evenly in each shard. At the same time, since the interaction between the shards is not large, it is convenient to generate corresponding public trust units for each shard in parallel.

[0084] Optionally, the determination method of satisfying the preset condition includes:

[0085] If there is a direct reference relationship between two contracts, it is considered that the preset conditions are met.

[0086] Specifically, by analyzing the associated data between the contracts, the dependency between the two contracts can be obtained. For example, this embodiment determines whether the two contracts are directly referenced based on the associated data. If so, it is considered that the closeness between the two contracts meets the requirements, and the two contracts are divided into one shard. In actual applications, other parameters can also be set to select contracts on the same shard, such as by setting a call frequency threshold, which is considered to be highly correlated if it is greater than the threshold; in addition, key shared data can also be set. If both contracts call the key shared data, it is considered to be highly correlated.

[0087] The above transaction data processing method aggregates contracts whose relevance meets preset conditions into one shard, which can reduce cross-shard communication caused by mutual references between contracts and improve the system's response speed and throughput. Evenly distributing contracts whose relevance does not meet preset conditions to multiple shards can make full use of the parallel processing capabilities of the DAG network. Each shard can independently process its internal transactions and contracts without waiting for the processing results of other shards. This helps to improve the overall processing speed and concurrency of the system.

[0088] See also Figure 4 Optionally, the directed acyclic graph includes multiple trusted nodes; for each shard, generating a trust unit corresponding to the shard includes:

[0089] Step 402: Select multiple trusted nodes from the directed acyclic graph as information publishers, where the number of trusted nodes is the same as the number of shards in the directed acyclic graph.

[0090] Step 404: Generate a credibility unit corresponding to each slice for each information publisher; wherein the information publisher corresponds to the slice one by one.

[0091] Specifically, the DAG network includes multiple nodes, among which the nodes that have been offline certified for technology, assets and other qualifications are trusted nodes. Since the credibility unit plays an important role in the DAG network, such as sorting and determining the network status, it is published by a trusted node to ensure that the content of the credibility unit is strictly verified and audited, thereby effectively preventing malicious attacks and fraud.

[0092] By randomly selecting a number of trusted nodes from multiple trusted nodes as information publishers to generate credibility units and process transaction sorting, the processing capacity of the credibility units can be enhanced while ensuring state consistency.

[0093] For example: Assuming that there are n contracts [C1, C2, ... Cn] on the DAG network, the embodiment of the present application sorts out the relevance of these contracts, and distributes all contracts to 10 shards [Shard1, Shard2, ... Shard10] according to the relevance, so that each shard manages part of the contracts, and at the same time, there is no direct reference relationship between the contracts of different shards. Further, assuming that there are a total of m trusted nodes in the entire DAG network, and the relevant set is [TN1, TN2, ... TNm]. When the contract transaction has been split into the above 10 shards and a new credibility unit needs to be generated, 10 TNs are randomly selected from the trusted node set [TN1, TN2, ... TNm] as the publishers of this round. Then the 10 publishers [TN1, TN2, ... TN10] are mapped to the 10 shards [Shard1, Shard2, ... Shard10], and each publisher TN generates a corresponding credibility unit for a shard. For example, publisher TN1 generates the corresponding credibility unit Order1 for shard Shard1, and publisher TN2 generates the corresponding credibility unit Order2 for shard Shard2. The final credibility unit set is [Order1, Order2, …Order10].

[0094] Optionally, after generating the credibility unit corresponding to the shard, the process further includes:

[0095] A preset number of trusted nodes are selected from the remaining trusted nodes to verify the generated public credibility unit. After the verification is passed, it is published to the directed acyclic graph so that each node receives each public credibility unit.

[0096] Specifically, the newly generated credibility units in the DAG network must be verified by multiple trusted nodes before they are allowed to be released, in order to reduce the possibility of malicious transactions or fraud and ensure the authenticity and security of transactions. For example, the 10 orders in the newly generated credibility unit set can only be released to the DAG network after being verified by the remaining trusted nodes [TN11, TN12, ... TNm].

[0097] Optionally, for a previous transaction that has been verified and referenced by a public trust unit, the status of the previous transaction is determined so that it cannot be referenced again by a new transaction.

[0098] Specifically, when a new public credibility unit is released, it needs to be verified by a sufficient number of nodes before it can be confirmed and added to the DAG network. Furthermore, when each new public credibility unit is released, a certain number of previous transactions will be selected for reference and verification according to a preset algorithm or preset rules. When a previous unit is referenced by a new public credibility unit, the status of the previous unit will be locked immediately to prevent it from being changed or rolled back, reducing the possibility of the DAG network being attacked by parasitic chains and enhancing network security.

[0099] Optionally, the transaction data processing method of the embodiment of the present application further includes:

[0100] When the transaction volume in the directed acyclic graph increases, the number of shards and the number of information publishers are increased, and the newly added shards correspond one-to-one to the newly added information publishers.

[0101] Specifically, distributing the contracts in the DAG network to multiple shards can make each shard process fewer transactions and contracts, thereby reducing the load on a single shard. It also helps the system support more users and transactions, and improves the scalability of the system. When the transaction volume increases, the shards can be independently expanded without affecting the current allocation, and more trusted nodes can be selected as new information publishers to generate the corresponding credibility units of the expanded shards.

[0102] Optionally, the transaction data processing method of the embodiment of the present application further includes:

[0103] During the data processing process, if the load of a shard is less than the first preset load, or greater than the second preset load, the contract on the shard is dynamically adjusted to balance the load of each shard.

[0104] Specifically, the purpose of load balancing is to evenly distribute network traffic or tasks to multiple servers or nodes to avoid single-point overload and improve overall performance and availability, which is related to the performance, reliability and resource utilization of the entire network. During data processing, the load status of each shard can be obtained by detecting the traffic information of each shard in real time. For example, if at a certain moment, the traffic of shard Shard1 is less than the first preset load, the traffic of shard Shard2 is greater than the second preset load, and the contract on shard Shard1 is not directly referenced by the contract on shard Shard2, then some contracts on shard Shard2 can be divided into shard Shard1.

[0105] Optionally, the transaction data processing method of the embodiment of the present application further includes:

[0106] After a transaction on a shard is executed, the transaction information related to the transaction is synchronized to other shards in the directed acyclic graph to ensure state consistency.

[0107] Specifically, the transaction information on each slice needs to be kept in sync to ensure the consistency and reliability of the DAG network. The transaction information includes the verification status, transaction order, transaction content, and transaction execution results of the transaction.

[0108] Optionally, the trust unit records the order of transactions related to the contract, including:

[0109] The credibility unit references the hash value of each transaction related to the contract, and determines and records the order of transactions based on each hash value.

[0110] Specifically, each transaction in the DAG network generates a corresponding hash value when it is created, and the hash value is the unique identifier of the transaction. For a selected contract, the credibility unit regularly collects transactions related to the contract from the DAG network, and sorts each transaction based on the hash value of each contract according to the pre-agreed rules. Exemplarily, a preliminary sorting can be performed according to the natural order of the string or number of the hash value, and then sorted according to the reference relationship of each transaction; in addition, if there are some transactions that are generated at the same time and have close hash values, the sorting can be further refined by the timestamp of the transaction. For example, a group of transactions Tx1, Tx2, Tx3, and Tx4 belonging to the same contract have the following reference relationships in the DAG network: Tx3 references Tx1, and Tx4 references Tx2 and Tx3; each transaction has a unique hash value H(Tx1), H(Tx2), H(Tx3), and H(Tx4). First, perform a preliminary sorting in the natural order of the hash values. For example, the preliminary sorting order is H(Tx1), H(Tx2), H(Tx3), H(Tx4). Then, based on the reference relationship of each transaction, ensure that Tx3 is executed after Tx1, and Tx4 is executed after Tx2 and Tx3. The final order is Tx1, Tx3, Tx2, Tx4. In this way, when the node executes the above transactions, Tx1, Tx3, Tx2, Tx4 can be executed in the order in the public trust unit.

[0111] The transaction data processing method above publishes a credibility unit in the DAG network. The credibility unit determines the execution order of each transaction by referencing the hash value of each transaction related to the contract. When any node receives the credibility unit and executes the contract, it can execute each transaction in sequence according to the execution order recorded in the credibility unit, helping the DAG network to sort common transactions by consensus and improving the reliability of the transaction order in the network.

[0112] The above transaction data processing method obtains the correlation between the contracts by analyzing all the contracts in the pre-constructed directed acyclic graph; then, each contract is processed in shards according to the correlation to obtain multiple shards; for each shard, a credibility unit corresponding to the shard is generated, wherein the credibility unit is used to record the order of each transaction related to the contract; for a node in a shard, when executing transactions related to the contract, each transaction is executed in sequence from front to back according to the order in the credibility unit corresponding to the shard. This application processes transaction data by sharding, and configures a credibility unit for each shard to execute transactions related to the contract in sequence according to the order in the credibility unit, thereby improving the transaction processing capacity in the network and solving the potential congestion problem of each contract-related transaction during the peak transaction period of the directed acyclic graph.

[0113] It should be understood that, although the steps in the flowcharts involved in the above embodiments are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence according to the order indicated by the arrows. Unless there is a clear explanation in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages, and these steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these steps or stages is not necessarily carried out in sequence, but can be executed in turn or alternately with other steps or at least a part of the steps or stages in other steps.

[0114] Based on the same inventive concept, the embodiment of the present application also provides a transaction data processing device for implementing the transaction data processing method involved above. The implementation solution provided by the device to solve the problem is similar to the implementation solution recorded in the transaction data processing method above, so the specific limitations in one or more device embodiments provided below can refer to the limitations of the transaction data processing method above, and will not be repeated here.

[0115] See also Figure 5 In one embodiment, a transaction data processing device is provided, including: an analysis module, a sharding processing module, a credibility unit generation module and an execution module.

[0116] The analysis module is used to analyze all contracts in the pre-built directed acyclic graph to obtain the correlation between the contracts;

[0117] The shard processing module is used to shard each contract according to its relevance to obtain multiple shards;

[0118] A credibility unit generation module, used to generate a credibility unit corresponding to each shard, wherein the credibility unit is used to record the order of transactions related to the contract;

[0119] The execution module is used to execute transactions related to the contract for the nodes in a shard, in order from front to back according to the order in the public trust unit corresponding to the shard.

[0120] Optionally, the analysis module analyzes all contracts in the pre-built directed acyclic graph to obtain the correlation between the contracts, including: obtaining correlation data between the contracts; analyzing the correlation data to obtain the correlation between the contracts. The correlation data includes any one or more of the call relationship, shared data, and historical transaction data of the contracts.

[0121] Optionally, the sharding processing module performs sharding processing on each contract according to the relevance to obtain multiple shards, including: aggregating each contract whose relevance meets the preset condition into the same shard; and evenly distributing the contracts whose relevance does not meet the preset condition into the remaining shards. Optionally, the determination method of satisfying the preset condition includes: if there is a direct reference relationship between two contracts, it is considered that the preset condition is satisfied.

[0122] Optionally, the directed acyclic graph includes multiple trusted nodes; the credibility unit generation module generates a credibility unit corresponding to each shard for each shard, including: selecting multiple trusted nodes from the directed acyclic graph as information publishers, wherein the number of trusted nodes is the same as the number of shards in the directed acyclic graph; step 404, generating a credibility unit corresponding to the shard for each information publisher; wherein the information publisher corresponds to the shard one-to-one.

[0123] Optionally, after generating the credibility unit corresponding to the shard, the credibility unit generation module is further used to select a preset number of trusted nodes from the remaining trusted nodes, verify the generated credibility unit, and publish it to the directed acyclic graph after the verification, so that each node receives each credibility unit.

[0124] Optionally, the transaction data processing device of the present application further includes: a status locking module.

[0125] The state locking module is used to determine the state of the previous transaction that has been verified and referenced by the public trust unit so that it cannot be referenced again by a new transaction.

[0126] Optionally, the shard processing module is also used to increase the number of shards and the number of information publishers when the transaction volume in the directed acyclic graph increases, and the newly added shards correspond one-to-one to the newly added information publishers.

[0127] Optionally, the shard processing module is also used to dynamically adjust the contract on a shard to balance the loads of the shards if the load of the shard is less than a first preset load or greater than a second preset load during data processing.

[0128] Optionally, the transaction data processing device of the present application further includes: an information synchronization module.

[0129] The information synchronization module is used to synchronize the transaction information related to a transaction on a shard to other shards of the directed acyclic graph after the transaction is executed on the shard to ensure state consistency.

[0130] Optionally, the credibility unit generated by the credibility unit generation module records the order of transactions related to the contract, including: the credibility unit references the hash value of each transaction related to the contract, and determines and records the order of each transaction according to each hash value.

[0131] The transaction data processing device analyzes all contracts in a pre-constructed directed acyclic graph to obtain the correlation between the contracts; then, based on the correlation, each contract is processed in shards to obtain multiple shards; for each shard, a credibility unit corresponding to the shard is generated, wherein the credibility unit is used to record the order of transactions related to the contract; for a node in a shard, when executing transactions related to the contract, the transactions are executed in sequence from front to back based on the order in the credibility unit corresponding to the shard. The present application processes transaction data by sharding, and configures a credibility unit for each shard to execute transactions related to the contract in sequence according to the order in the credibility unit, thereby improving the transaction processing capacity in the network and solving the potential congestion problem of transactions related to the contract during the peak period of transactions in the directed acyclic graph.

[0132] Each module in the above device can be implemented in whole or in part by software, hardware or a combination thereof. Each module can be embedded in or independent of a processor in a computer device in the form of hardware, or can be stored in a memory in a computer device in the form of software, so that the processor can call and execute operations corresponding to each module above.

[0133] See also Figure 6 , Figure 6 The figure is a schematic diagram of the structure of the computer device provided by the present application. The computer device 60 provided in this embodiment includes: at least one processor 601 and a memory 602. Optionally, the computer device 60 also includes a communication component 603. The processor 601, the memory 602 and the communication component 603 are connected via a bus.

[0134] In a specific implementation process, at least one processor 601 executes the computer execution instructions stored in the memory 602, so that at least one processor 601 executes the above method.

[0135] The specific implementation process of the processor 601 can refer to the above-mentioned transaction data processing method embodiment, and its implementation principle and technical effect are similar, so this embodiment will not be repeated here.

[0136] In the above embodiments, it should be understood that the processor may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), etc. A general-purpose processor may be a microprocessor or any conventional processor. The steps of the method disclosed in the invention may be directly implemented as being executed by a hardware processor, or may be executed by a combination of hardware and software modules in the processor.

[0137] The memory may include a high-speed memory (Random Access Memory, RAM), and may also include a non-volatile memory (Non-volatile Memory, NVM), such as at least one disk memory.

[0138] The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the bus in the drawings of the present application is not limited to only one bus or one type of bus.

[0139] The present application also provides a computer program product, including a computer program, which implements the above-mentioned transaction data processing method when executed by a processor.

[0140] The present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When a processor executes the computer-executable instructions, the above-mentioned transaction data processing method is implemented.

[0141] The above-mentioned readable storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special-purpose computer.

[0142] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (Application Specific Integrated Circuits, referred to as: ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.

[0143] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0144] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0145] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0146] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the methods of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0147] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0148] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present invention after considering the specification and practicing the invention disclosed herein. The present invention is intended to cover any variations, uses or adaptations of the present invention, which follow the general principles of the present invention and include common knowledge or customary technical means in the art not disclosed by the present invention, are not limited to the precise structure described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.

Claims

1. A transaction data processing method, characterized in that: The method comprises: Analyze all contracts in the pre-built directed acyclic graph to obtain the correlation between the contracts; According to the association, each of the contracts is processed into fragments to obtain multiple fragments; For each shard, generate a credibility unit corresponding to the shard, where the credibility unit is used to record the order of transactions related to the contract; For a node in a shard, when executing transactions related to a contract, each transaction is executed in sequence from front to back based on the order in the trust unit corresponding to the shard.

2. The method according to claim 1, characterized in that: The analysis of all contracts in the pre-constructed directed acyclic graph obtains the correlation between the contracts, including: Obtaining the associated data between the contracts; Analyze the associated data to obtain the association between the contracts; The associated data includes any one or more of the calling relationship, shared data, and historical transaction data of each contract.

3. The method according to claim 1, characterized in that: According to the association, each of the contracts is processed in fragments to obtain multiple fragments, including: Aggregate contracts whose correlation meets preset conditions into the same shard; Evenly distribute the contracts whose relevance does not meet the preset conditions to the remaining shards.

4. The method according to claim 3, characterized in that The determination method of satisfying the preset conditions includes: If there is a direct reference relationship between the two contracts, it is considered that the preset conditions are met.

5. The method according to claim 1, characterized in that The directed acyclic graph includes a plurality of trusted nodes; The step of generating a credibility unit corresponding to each shard includes: Select multiple trusted nodes from the directed acyclic graph as information publishers, where the number of trusted nodes is the same as the number of shards in the directed acyclic graph; For each information publisher, a credibility unit corresponding to a shard is generated; wherein the information publisher corresponds to the shard one-to-one.

6. The method according to claim 5, characterized in that After generating the credibility unit corresponding to the shard, the method further includes: A preset number of trusted nodes are selected from the remaining trusted nodes to verify the generated public credibility unit. After the verification is passed, it is published to the directed acyclic graph so that each node receives each public credibility unit.

7. The method according to claim 6, characterized in that: For the previous transaction that has been verified and referenced by the public trust unit, the status of the previous transaction is determined so that it cannot be referenced again by a new transaction.

8. The method according to claim 5, characterized in that The method further comprises: When the transaction volume in the directed acyclic graph increases, the number of shards and the number of information publishers are increased, and the newly added shards correspond one-to-one to the newly added information publishers.

9. The method according to claim 1, characterized in that: The method further comprises: During the data processing process, if the load of a shard is less than the first preset load, or greater than the second preset load, the contract on the shard is dynamically adjusted to balance the load of each shard.

10. The method according to claim 1, characterized in that The method further comprises: After a transaction on a shard is executed, the transaction information related to the transaction is synchronized to other shards in the directed acyclic graph to ensure state consistency.

11. The method according to claim 1, characterized in that: The credibility unit records the order of transactions related to the contract, including: The credibility unit refers to the hash value of each transaction related to the contract, and determines and records the order of each transaction according to each hash value.

12. A transaction data processing device, characterized in that: include: The analysis module is used to analyze all contracts in the pre-built directed acyclic graph to obtain the correlation between the contracts; A shard processing module, used for sharding each of the contracts according to the association to obtain multiple shards; A credibility unit generation module, used to generate a credibility unit corresponding to each shard, wherein the credibility unit is used to record the order of transactions related to the contract; The execution module is used to execute transactions related to the contract for the nodes in a shard, in order from front to back according to the order in the trust unit corresponding to the shard.

13. A computer device, characterized in that: include: Memory, processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory, so that the processor performs the method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 11 when executed by a processor.

15. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 11 when being executed by a processor.