A data persistence and parallel processing method and device based on blockchain
By classifying and decoupling the correlation and dependencies of blockchain transaction data, and using parallel processing methods of main block and microblock, the problems of low throughput and slow transaction speed of blockchain network are solved, and the problem of low blockchain network throughput and slow transaction speed is realized. More efficient transaction data processing and throughput improvements.
Patent Information
- Application Number
- CN202110481149.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-30
- Publication Date
- 2024-12-31
- Estimated Expiration
- 2041-04-30
AI Technical Summary
The blockchain network has problems such as long transaction confirmation time, small data throughput, and network congestion, which leads to low throughput and slow transaction speed, making it difficult to meet the needs of a large number of transaction scenarios in a short period of time.
By classifying and decoupling transaction data in the blockchain according to its correlation and dependencies, the parallel processing of main blocks and microblocks is adopted to realize parallel processing of transaction data, and improve data processing speed and throughput.
Transform the transaction data processing mode of the blockchain system from serial processing to parallel processing, make full use of computer resources, improve the speed of transaction data processing, reduce user waiting time, and increase data throughput.
Smart Images

Figure CN113159953B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Internet financial technology, and in particular to a data persistence and parallel processing method and device based on blockchain. Background Art
[0002] Blockchain is essentially a new application model of technologies such as decentralization, distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm. It is considered to be one of the emerging technologies that will bring about disruptive changes in human society. Its main application areas include: digital assets, digital currencies, smart contracts, identity authentication, e-commerce, etc., and its application areas are very wide.
[0003] Blockchain has problems such as long transaction confirmation time, low data throughput, and network congestion. Since blockchain is a decentralized, distributed storage, and peer-to-peer transmission system, nodes need to communicate frequently, which will bring huge load to the distributed network. In severe cases, it will cause network congestion, communication delays, request timeouts, etc. Statistics of multiple blockchain applications show that compared with traditional centralized systems, the current blockchain network has a lower throughput TPS, slow transaction data writing, and long transaction waiting time, which makes it difficult to meet the scenario of generating a large number of transactions in a short period of time.
[0004] The factors that restrict the throughput and transaction speed of blockchain networks are mainly: block capacity, consensus mechanism, network bandwidth, and network transmission methods. In order to solve the above problems, without considering the hardware infrastructure, the existing technology has made improvements in the following two aspects: on the one hand, it is to expand the block capacity, and on the other hand, it is to optimize the data structure of the block and improve the consensus mechanism. Both of these improvement methods have theoretical basis and practice, but there are still shortcomings.
[0005] The first method is based on block expansion, which directly changes the capacity of the block, such as increasing the block capacity from 1M to 2M. This is a feasible solution, but as the transaction volume increases, the block capacity will continue to increase. Large-capacity blocks will increase the verification time and easily lead to chain forks. As for the block capacity standard, there are still large differences and no unified standard has been formed. The second method of optimizing the data structure of the block and improving the consensus mechanism is more abundant, such as the workload consensus mechanism (PoW), the equity consensus mechanism (PoS), the share authorization proof mechanism (DPoS) and the practical Byzantine fault tolerance (PBFT). The consensus efficiency can be improved by changing the consensus mechanism algorithm. These consensus algorithms have been implemented in different blockchain applications and are still being explored.
[0006] The transaction data of the blockchain is related and dependent, so when logical requests are processed simultaneously or in the wrong order, it may lead to block verification errors or failure to reach consensus. If the transaction data with related or dependent relationships is not put together for classification and decoupling, parallel processing cannot be performed, such as failure to pass verification, etc.
[0007] Currently, blockchain can only process blockchain data in a serial manner, which cannot take advantage of the multi-core processors of network nodes, resulting in waste of resources, slow processing speed, long waiting time, and low throughput. Summary of the invention
[0008] In view of the existing technology without considering the hardware infrastructure, the existing technology is improved from the following two aspects: on the one hand, the block capacity is expanded, and on the other hand, the data structure of the block is optimized and the consensus mechanism is improved. Both of these improvement methods have theoretical basis and practice, but there are still some problems. The present invention provides a data persistence and parallel processing method and device based on blockchain. According to the characteristics of the data, the data rows with correlation and dependency are classified and decoupled, and the processing mechanism is configured to realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into the main block and micro block, and nodes are set to process the main block and micro block to realize block parallel processing, that is, to realize parallel processing of transaction data; because the transaction data inside the micro block has a strong correlation and dependency, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block, realize the parallel processing of the main block and the micro block, and also improve the verification speed of the block. The present invention changes the processing mode of transaction data of the blockchain system from serial processing to parallel processing, makes full use of computer resources, improves the speed of processing transaction data, increases data throughput, and reduces user waiting time.
[0009] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0010] In a first aspect, the present invention provides a data persistence method based on blockchain, comprising:
[0011] The transaction data summaries in the blockchain are persisted in each block according to the dependency relationship between the transaction data summaries; the blocks include main blocks and micro blocks, each micro block includes a transaction data summary of a class of dependency relationship; at least one micro block is coupled between every two adjacent main blocks.
[0012] In a preferred embodiment, it also includes:
[0013] Preprocessing the transaction data summary to obtain transaction data features;
[0014] Dependencies between the transaction data summaries are determined according to the transaction data characteristics.
[0015] In a preferred embodiment, the preprocessing of the transaction data summary includes:
[0016] The transaction data summary is input into a preset machine learning model, and the machine learning model outputs the transaction data features; wherein the machine learning model is trained using historical transaction data summaries with labeled transaction data features.
[0017] In a preferred embodiment, it also includes:
[0018] Build the machine learning model.
[0019] In a preferred embodiment, it also includes:
[0020] Take the current time point as the end point of the time window and collect the transaction data summary within the set time period;
[0021] Acquire transaction data features corresponding to the transaction data summary, and perform feature marking on the transaction data summary;
[0022] The original historical transaction data summary is replaced with the transaction data summary with the labeled transaction data features to form updated training data.
[0023] In a preferred embodiment, it also includes:
[0024] Get the timestamp of the most recent persistent transaction data summary of the microblock;
[0025] In the process of reading the summary of the transaction data to be persisted, if the difference between the current time point and the timestamp is greater than a set threshold, the summary of the transaction data to be persisted is refused to be persisted in the micro-block.
[0026] In a second aspect, the present invention provides a data parallel processing method based on blockchain, comprising:
[0027] Performing a first process, the first process comprising processing a digest of transaction data persisted in a main block of the blockchain;
[0028] During the execution of the first process, a second process is executed, the second process comprising: if there is no dependency relationship between the micro-block within the set range and the main block executing the first process, processing the transaction data summary persisted in the micro-block in parallel;
[0029] There is at least one micro-block coupled between every two adjacent main blocks, the set range is defined by the main block executing the first process and the next main block adjacent to the main block, and each micro-block includes a transaction data summary of a type of dependency relationship.
[0030] In a preferred embodiment, the second process further comprises:
[0031] Obtaining dependency classifications of all micro-tiles within the set range;
[0032] According to the dependency classification and the transaction data summary in the main block where the first processing is performed, it is determined whether there is a dependency relationship between the micro block and the main block.
[0033] In a preferred embodiment, the second process further comprises:
[0034] If all micro-tiles within the setting range have a dependency relationship, a micro-tile is regenerated after executing the first processed main tile.
[0035] In a preferred embodiment, the parallel processing includes: verification processing, block packaging processing and consensus operation processing.
[0036] In a preferred embodiment, the second process further comprises:
[0037] If all micro-blocks within the set range have dependencies, a search is performed in the blockchain network according to the header information of the micro-blocks within the set range, and the found micro-blocks are added to the processing queue.
[0038] In a third aspect, the present invention provides a data persistence device based on blockchain, comprising:
[0039] A persistence module persists the transaction data summaries in the blockchain to each block according to the dependency relationship between the transaction data summaries; the blocks include main blocks and micro blocks, each micro block includes a transaction data summary of a class of dependency relationship; at least one micro block is coupled between every two adjacent main blocks.
[0040] In a preferred embodiment, it also includes:
[0041] A transaction data feature acquisition module pre-processes the transaction data summary to acquire transaction data features;
[0042] The dependency determination module determines the dependency between the transaction data summaries according to the transaction data characteristics.
[0043] In a preferred embodiment, the transaction data feature acquisition module is specifically used to:
[0044] The transaction data summary is input into a preset machine learning model, and the machine learning model outputs the transaction data features; wherein the machine learning model is trained using historical transaction data summaries with labeled transaction data features.
[0045] In a preferred embodiment, it also includes:
[0046] A model building module builds the machine learning model.
[0047] In a preferred embodiment, it also includes:
[0048] The transaction data summary collection module takes the current time point as the end point of the time window and collects the transaction data summary within the set time period;
[0049] A marking module, which obtains transaction data features corresponding to the transaction data summary and performs feature marking on the transaction data summary;
[0050] The updating module replaces the original historical transaction data summary with the transaction data summary with the marked transaction data features to form updated training data.
[0051] In a preferred embodiment, it also includes:
[0052] Timestamp acquisition module, which obtains the timestamp of the micro-block's most recent persistent transaction data summary;
[0053] The rejection module, in the process of reading the summary of the transaction data to be persisted, refuses to persist the summary of the transaction data to be persisted in the micro-block if the difference between the current time point and the timestamp is greater than a set threshold.
[0054] In a fourth aspect, the present invention provides a data parallel processing device based on blockchain, comprising:
[0055] A first processing module, performing a first process, wherein the first process includes processing a summary of transaction data persisted in a main block of the blockchain;
[0056] A second processing module, executing a second processing during the execution of the first processing, wherein the second processing includes: if there is no dependency between the micro-block within the set range and the main block executing the first processing, processing the persistent transaction data summary in the micro-block in parallel;
[0057] There is at least one micro-block coupled between every two adjacent main blocks, the set range is defined by the main block executing the first process and the next main block adjacent to the main block, and each micro-block includes a transaction data summary of a type of dependency relationship.
[0058] In a preferred embodiment, the second process further comprises:
[0059] Obtaining dependency classifications of all micro-tiles within the set range;
[0060] According to the dependency classification and the transaction data summary in the main block where the first processing is performed, it is determined whether there is a dependency relationship between the micro block and the main block.
[0061] In a preferred embodiment, the second process further comprises:
[0062] If all micro-tiles within the setting range have a dependency relationship, a micro-tile is regenerated after executing the first processed main tile.
[0063] In a preferred embodiment, the parallel processing includes: verification processing, block packaging processing and consensus operation processing.
[0064] In a preferred embodiment, the second process further comprises:
[0065] If all micro-blocks within the set range have dependencies, a search is performed in the blockchain network according to the header information of the micro-blocks within the set range, and the found micro-blocks are added to the processing queue.
[0066] In a fifth aspect, the present invention provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the blockchain-based data persistence method when executing the program.
[0067] In a sixth aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the blockchain-based data persistence method.
[0068] It can be seen from the above technical scheme that the present invention provides a data persistence and parallel processing method and device based on blockchain. According to the characteristics of the data, the data rows with correlation and dependency are classified and decoupled, and the processing mechanism is configured to realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into the main block and the micro block, and the node is set to process the main block and the micro block to realize block parallel processing, that is, to realize parallel processing of transaction data; because the transaction data inside the micro block has a strong correlation and dependency relationship, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block, realize the parallel processing of the main block and the micro block, and also improve the verification speed of the block. The present invention changes the processing mode of transaction data of the blockchain system from serial processing to parallel processing, makes full use of computer resources, improves the speed of processing transaction data, increases data throughput, and reduces user waiting time. BRIEF DESCRIPTION OF THE DRAWINGS
[0069] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0070] Figure 1 FIG. 4 is a schematic diagram of the relationship between the micro-block and the main block in an embodiment of the present invention.
[0071] Figure 2 This is a schematic diagram of the parallel processing of multiple blockchains in an embodiment of the present invention.
[0072] Figure 3 It is a flowchart of a data persistence method based on blockchain in an embodiment of the present invention.
[0073] Figure 4 It is a structural diagram of a blockchain-based data persistence device in an embodiment of the present invention.
[0074] Figure 5 It is a schematic diagram of the structure of an electronic device in an embodiment of the present invention. DETAILED DESCRIPTION
[0075] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0076] It should be noted that the method and device for data persistence and parallel processing based on blockchain disclosed in the present invention can be used in the financial field, and can also be used in any field other than the financial field. The application field of the method and device for data persistence and parallel processing based on blockchain disclosed in the present invention is not limited.
[0077] The factors that restrict the throughput and transaction speed of blockchain networks are mainly: block capacity, consensus mechanism, network bandwidth, and network transmission methods. In order to solve the above problems, without considering the hardware infrastructure, the existing technology has made improvements in the following two aspects: on the one hand, it is to expand the block capacity, and on the other hand, it is to optimize the data structure of the block and improve the consensus mechanism. Both of these improvement methods have theoretical basis and practice, but there are still shortcomings.
[0078] The first method is based on block expansion, which directly changes the capacity of the block, such as increasing the block capacity from 1M to 2M. This is a feasible solution, but as the transaction volume increases, the block capacity will continue to increase. Large-capacity blocks will increase the verification time and easily lead to chain forks. As for the block capacity standard, there are still large differences and no unified standard has been formed. The second method of optimizing the data structure of the block and improving the consensus mechanism is more abundant, such as the workload consensus mechanism (PoW), the equity consensus mechanism (PoS), the share authorization proof mechanism (DPoS) and the practical Byzantine fault tolerance (PBFT). The consensus efficiency can be improved by changing the consensus mechanism algorithm. These consensus algorithms have been implemented in different blockchain applications and are still being explored.
[0079] The transaction data of the blockchain is related and dependent, so when logical requests are processed simultaneously or in the wrong order, it may lead to block verification errors or failure to reach consensus. If the transaction data with related or dependent relationships is not put together for classification and decoupling, parallel processing cannot be performed, such as failure to pass verification, etc.
[0080] Currently, blockchain can only process blockchain data in a serial manner, which cannot take advantage of the multi-core processors of network nodes, resulting in waste of resources, slow processing speed, long waiting time, and low throughput.
[0081] Based on the above content, in response to the above problems, the present invention starts from the transaction data characteristics of the blockchain, specifically from the perspective of the correlation and dependency of the transaction data. First, the transaction data is labeled and classified. Then, the data with correlation and dependency are put into the same block to decouple the block data. Then, data parallel processing is realized through micro-blocks and main blocks, ultimately achieving the purpose of improving the speed of processing transaction data, increasing data throughput, and reducing user waiting time.
[0082] The present invention provides a data persistence and parallel processing method and device based on blockchain for implementing one or more embodiments of the present invention. Specifically, transaction data summaries in the blockchain are persisted to each block according to the dependency relationship between transaction data summaries; the block includes a main block and a micro block, each micro block includes a transaction data summary of a class of dependency relationship; at least one micro block is coupled between every two adjacent main blocks. According to the characteristics of the data, the present invention classifies and decouples the data rows with correlation and dependency, and configures a processing mechanism, so as to realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into the main block and micro block, and nodes are set to process the main block and micro block to realize block parallel processing, that is, to realize parallel processing of transaction data; since the transaction data inside the micro block has a strong correlation and dependency, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block, realize the parallel processing of the main block and the micro block, and also improve the verification speed of the block. The present invention changes the processing mode of the transaction data of the blockchain system from serial processing to parallel processing, makes full use of computer resources, improves the speed of processing transaction data, increases data throughput, and reduces user waiting time.
[0083] The blockchain system provided by the present invention includes multiple nodes, each of which performs data transactions or consensus operations, and then records the transaction data summary of the blockchain on the block, and each block forms a chain.
[0084] Among them, the data parallel processing device and the data persistence device are each node in the blockchain system, that is, when data persistence is performed, each node participating in the consensus in the blockchain can be recognized as a data persistence device, and when the node performs data parallel processing, each node processing data in the blockchain can be recognized as a data coexistence processing device, which is not elaborated in the present invention.
[0085] It is understandable that the nodes in the blockchain can be servers or mobile terminals, for example, smart phones, tablet electronic devices, portable computers, desktop computers, personal digital assistants (PDAs), smart wearable devices, etc. Among them, the smart wearable devices can include smart glasses, smart watches, smart bracelets, etc.
[0086] Each of the above-mentioned terminal devices has a communication module, which can communicate with a remote server (such as a bank server, etc.) to achieve data transmission with the server. For example, the communication unit can broadcast the transaction data generated by the mobile terminal to the blockchain so that each node in the blockchain can store and process the transaction data.
[0087] The above nodes and nodes, and nodes and blockchain systems can communicate using any suitable network protocol, including network protocols that have not been developed on the date of submission of the present invention. The network protocols may include, for example, TCP / IP protocol, UDP / IP protocol, HTTP protocol, HTTPS protocol, etc. Of course, the network protocols may also include, for example, RPC protocol (Remote Procedure Call Protocol) and REST protocol (Representational State Transfer) used on top of the above protocols.
[0088] The present invention provides a data persistence and parallel processing method and device based on blockchain. According to the characteristics of the data, data rows with correlation and dependency are classified and decoupled, and a processing mechanism is configured to realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into a main block and a micro block, and nodes are set to process the main block and the micro block to realize block parallel processing, that is, to realize parallel processing of transaction data; because the transaction data inside the micro block has a strong correlation and dependency relationship, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block to realize the parallel processing of the main block and the micro block, and also can improve the verification speed of the block. The present invention changes the processing mode of transaction data of the blockchain system from serial processing to parallel processing, makes full use of computer resources, improves the speed of processing transaction data, increases data throughput, and reduces user waiting time.
[0089] The details are described through the following multiple embodiments and application examples.
[0090] In order to solve the problem of existing technology without considering hardware infrastructure, the existing technology has been improved from the following two aspects: one is to expand the block capacity, and the other is to optimize the data structure of the block and improve the consensus mechanism. Both of these improvement methods have theoretical basis and practice, but there are still some shortcomings. The present invention provides an embodiment of a data persistence method based on blockchain, see Figure 3 , specifically including the following contents:
[0091] Step S101: persisting the transaction data summaries in the blockchain to each block according to the dependency relationship between the transaction data summaries; the blocks include main blocks and micro blocks, each micro block includes a transaction data summary of a class of dependency relationship; at least one micro block is coupled between every two adjacent main blocks.
[0092] In the present invention, each block in the blockchain stores a summary of transaction data, which records all transaction information of each transaction. In the prior art, blocks are not divided into main blocks and micro blocks, and all transaction data summaries are recorded and packaged in the order of recording to form blocks. By analogy, each blockchain is connected to form a blockchain. The present invention improves the chain structure in the blockchain, and through the cooperation of the main block and the micro block, a micro block coupling the two main blocks is formed between any two adjacent main blocks.
[0093] In the present invention, the main block and micro block are only terminological definitions, and the specific structures thereof are the same. The micro block's persistent space can be set to be smaller than the main block, and the present invention does not limit this.
[0094] Furthermore, there are one or more micro-blocks between two main blocks, and each micro-block contains at least one type of transaction data summary of dependency relationship.
[0095] It can be seen from the above technical scheme that the data persistence method based on blockchain provided by the present invention classifies and decouples data rows with correlation and dependency relationships according to the characteristics of the data, and configures a processing mechanism, which can realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into main blocks and micro blocks, and nodes are set to process main blocks and micro blocks to realize block parallel processing, that is, to realize parallel processing of transaction data; since the transaction data within the micro block has a strong correlation and dependency relationship, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block, realize the parallel processing of the main block and the micro block, and also improve the verification speed of the block. The present invention changes the processing mode of transaction data of the blockchain system from serial processing to parallel processing, making full use of computer resources.
[0096] In order to provide a new method for determining dependency relationships, one or more embodiments of the present invention further include:
[0097] Preprocessing the transaction data summary to obtain transaction data features;
[0098] Dependencies between the transaction data summaries are determined according to the transaction data characteristics.
[0099] Specifically, in order to provide a new method for acquiring transaction data features, in one or more embodiments of the present invention, the preprocessing of the transaction data summary includes:
[0100] The transaction data summary is input into a preset machine learning model, and the machine learning model outputs the transaction data features; wherein the machine learning model is trained using historical transaction data summaries with labeled transaction data features.
[0101] In this embodiment, the transaction data is preprocessed, and the characteristics of the transaction data are obtained through machine learning or experience, and then based on the main characteristics of the transaction data, a tag field is added to the transaction data to obtain labeled data.
[0102] Blockchain network nodes classify the marked data and package the transactions into blocks. Blocks are divided into main blocks and micro blocks. The data structures of the two are consistent, both containing: block header and block body, but micro blocks contain much less transaction data than main blocks. Figure 1 Schematic diagram of the relationship between micro-blocks and main blocks. There are one or more micro-blocks between two main blocks.
[0103] Furthermore, there are one or more micro-blocks between two main blocks, and each micro-block contains at least one type of transaction data summary of dependency relationship.
[0104] More specifically, the data is classified according to the transaction information and label of the last confirmed block to obtain one or more data classifications, and a processing mechanism is configured for the classified data. The same processing mechanism can be configured for data of the same category.
[0105] In this embodiment, the clustering method is used to divide transactions, the purpose of which is to separate closely related and dependent data from other data to achieve data decoupling. Due to the huge number of transactions and the wide variety of types, it may not be possible to decouple all transaction data, but it should be ensured that the main transactions or closely related data are reasonably classified to achieve partial data decoupling.
[0106] Furthermore, it can be understood that the machine learning model in the present invention can be established online or offline, that is, the establishment step may be included in the implementation steps of the present invention, or may not be included in the implementation steps of the present invention, and the present invention is not limited to this.
[0107] Specifically, in one or more embodiments of the present invention, it also includes: establishing the machine learning model.
[0108] Furthermore, in order to enable the model to be self-updated, one or more embodiments of the present invention further provide a method for self-updating model parameters, which specifically includes:
[0109] Take the current time point as the end point of the time window and collect the transaction data summary within the set time period;
[0110] Acquire transaction data features corresponding to the transaction data summary, and perform feature marking on the transaction data summary;
[0111] The original historical transaction data summary is replaced with the transaction data summary with the labeled transaction data features to form updated training data.
[0112] In this embodiment, a reasonable time T can be set to collect data for training. This also has the advantage of providing a reasonable threshold for subsequent updates of new transaction data to prevent new data from affecting old data.
[0113] Furthermore, in order to completely decouple data during data persistence, the following are also included:
[0114] Get the timestamp of the most recent persistent transaction data summary of the microblock;
[0115] In the process of reading the summary of the transaction data to be persisted, if the difference between the current time point and the timestamp is greater than a set threshold, the summary of the transaction data to be persisted is refused to be persisted in the micro-block.
[0116] In this embodiment, a valid time interval T is set for the micro-block, and the time is calculated by the difference between the timestamp of the micro-block and the current time. If the micro-block exceeds the valid time range T, it is invalid. This prevents new transaction data from being dependent on old transaction data, and the dependency relationship is too long, causing errors in previous verification.
[0117] In the present invention, the blockchain network node packages one or more classified transaction data and other unclassified data into the main block according to normal circumstances. Due to the huge number of transactions and the size limit of the main block, the main block only packages part of the transactions, and the remaining transaction data is screened, and the data with the same or related tags are packaged into the micro block. At this time, ideally, the transaction data of the main block and the micro block have no dependency or association, and the data is completely decoupled, while the data inside the main block can be related or dependent, or it can be completely non-existent.
[0118] Furthermore, the permissions for processing micro-blocks are set for blockchain network nodes. According to the actual application situation, it is allowed to set different permissions for micro-blocks and main blocks for the same node.
[0119] In actual use, both the main block and the micro block are sent to the blockchain network, such as Figure 2 As shown. The node will sort the transaction data within the block. For data that is associated or dependent, it will be sorted according to the transaction request sequence, including: request occurrence sequence, reception time sequence, transfer amount sequence or other sequence, to obtain a logical request queue to be processed.
[0120] Furthermore, if the marked transaction data contained in the main block and the micro block have the same mark, they can be processed according to the same processing mechanism to speed up the processing.
[0121] Furthermore, if there is a close dependency between transaction data, the sequence graph records the processing order of the transactions and sends the sequence graph to other nodes, instructing other nodes to generate transaction requests according to the sequence graph, so as to achieve rapid verification.
[0122] Furthermore, due to the existence of main blocks and micro blocks, multiple blockchains can be used to process data, utilizing the multi-core processing power of computers to achieve parallel data processing.
[0123] In this embodiment, the main block can be verified by the node, and any consensus mechanism, such as the workload consensus mechanism (PoW), the equity consensus mechanism (PoS), the share authorization proof mechanism (DPoS) and the practical Byzantine fault tolerance (PBFT) can be used to perform the consensus process to obtain the consensus result. If the consensus is successful, the main block is a valid block and is added to the main chain to continue the next round. If the consensus is unsuccessful, other blocks are verified and consensus is performed. At the same time, the node verifies the micro block, but there is no need to reach a consensus, such as Figure 2 shown.
[0124] Furthermore, the role of micro-blocks is to provide a prediction direction for nodes when packaging transaction data into the main block, avoiding nodes from blindly and arbitrarily packaging transactions. Since transaction data has been classified and then packaged into micro-blocks, there is no correlation or very little correlation between micro-blocks issued by the same node.
[0125] Furthermore, the nodes of the blockchain network should uniformly adopt classification algorithms with the same effect, and try to ensure that the same or similar classification results are obtained. The purpose is to reduce the correlation of micro-blocks of each node, avoid repeated calculations, and waste resources.
[0126] It can be seen from the above technical scheme that the data persistence method based on blockchain provided by the present invention classifies and decouples data rows with correlation and dependency relationships according to the characteristics of the data, and configures a processing mechanism, which can realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into main blocks and micro blocks, and nodes are set to process main blocks and micro blocks to realize block parallel processing, that is, to realize parallel processing of transaction data; since the transaction data within the micro block has a strong correlation and dependency relationship, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block, realize the parallel processing of the main block and the micro block, and also improve the verification speed of the block. The present invention changes the processing mode of transaction data of the blockchain system from serial processing to parallel processing, making full use of computer resources.
[0127] In order to solve the problem of existing technology without considering the hardware infrastructure, the existing technology has been improved from the following two aspects: one is to expand the block capacity, and the other is to optimize the data structure of the block and improve the consensus mechanism. Both of these improvement methods have theoretical basis and practice, but there are still some shortcomings. In one or more embodiments of the present invention, the present invention provides a data persistence device based on blockchain, such as Figure 4 As shown, including:
[0128] The persistence module 11 persists the transaction data summaries in the blockchain to each block according to the dependency relationship between the transaction data summaries; the blocks include main blocks and micro blocks, each micro block includes a transaction data summary of a class of dependency relationship; at least one micro block is coupled between every two adjacent main blocks.
[0129] In the present invention, each block in the blockchain stores a summary of transaction data, which records all transaction information of each transaction. In the prior art, blocks are not divided into main blocks and micro blocks, and all transaction data summaries are recorded and packaged in the order of recording to form blocks. By analogy, each blockchain is connected to form a blockchain. The present invention improves the chain structure in the blockchain, and through the cooperation of the main block and the micro block, a micro block coupling the two main blocks is formed between any two adjacent main blocks.
[0130] In the present invention, the main block and micro block are only terminological definitions, and the specific structures thereof are the same. The micro block's persistent space can be set to be smaller than the main block, and the present invention does not limit this.
[0131] Furthermore, there are one or more micro-blocks between two main blocks, and each micro-block contains at least one type of transaction data summary of dependency relationship.
[0132] It can be seen from the above technical scheme that the present invention provides a data persistence device based on blockchain. The device classifies and decouples data rows with correlation and dependency relationships according to the characteristics of the data, and configures a processing mechanism to realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into main blocks and micro blocks, and nodes are set to process main blocks and micro blocks to realize block parallel processing, that is, to realize parallel processing of transaction data; since the transaction data within the micro block has a strong correlation and dependency relationship, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block, realize the parallel processing of the main block and the micro block, and also improve the verification speed of the block. The present invention changes the processing mode of transaction data of the blockchain system from serial processing to parallel processing, making full use of computer resources.
[0133] In order to provide a new method for determining dependency relationships, one or more embodiments of the present invention further include:
[0134] A transaction data feature acquisition module pre-processes the transaction data summary to acquire transaction data features;
[0135] The dependency determination module determines the dependency between the transaction data summaries according to the transaction data characteristics.
[0136] Specifically, in order to provide a new method for acquiring transaction data features, in one or more embodiments of the present invention, the transaction data feature acquisition module is specifically used to:
[0137] The transaction data summary is input into a preset machine learning model, and the machine learning model outputs the transaction data features; wherein the machine learning model is trained using historical transaction data summaries with labeled transaction data features.
[0138] In this embodiment, the transaction data is preprocessed, and the characteristics of the transaction data are obtained through machine learning or experience, and then based on the main characteristics of the transaction data, a tag field is added to the transaction data to obtain labeled data.
[0139] Blockchain network nodes classify the marked data and package the transactions into blocks. Blocks are divided into main blocks and micro blocks. The data structures of the two are consistent, both containing: block header and block body, but micro blocks contain much less transaction data than main blocks. Figure 1 Schematic diagram of the relationship between micro-blocks and main blocks. There are one or more micro-blocks between two main blocks.
[0140] Furthermore, there are one or more micro-blocks between two main blocks, and each micro-block contains at least one type of transaction data summary of dependency relationship.
[0141] More specifically, the data is classified according to the transaction information and label of the last confirmed block to obtain one or more data classifications, and a processing mechanism is configured for the classified data. The same processing mechanism can be configured for data of the same category.
[0142] In this embodiment, the clustering method is used to divide transactions, the purpose of which is to separate closely related and dependent data from other data to achieve data decoupling. Due to the huge number of transactions and the wide variety of types, it may not be possible to decouple all transaction data, but it should be ensured that the main transactions or closely related data are reasonably classified to achieve partial data decoupling.
[0143] Furthermore, it can be understood that the machine learning model in the present invention can be established online or offline, that is, the establishment step may be included in the implementation steps of the present invention, or may not be included in the implementation steps of the present invention, and the present invention is not limited to this.
[0144] Specifically, in one or more embodiments of the present invention, it also includes:
[0145] A model building module builds the machine learning model.
[0146] Furthermore, in order to enable the model to be self-updated, one or more embodiments of the present invention further provide a method for self-updating model parameters, which specifically includes:
[0147] The transaction data summary collection module takes the current time point as the end point of the time window and collects the transaction data summary within the set time period;
[0148] A marking module, which obtains transaction data features corresponding to the transaction data summary and performs feature marking on the transaction data summary;
[0149] The updating module replaces the original historical transaction data summary with the transaction data summary with the marked transaction data features to form updated training data.
[0150] In this embodiment, a reasonable time T can be set to collect data for training. This also has the advantage of providing a reasonable threshold for subsequent updates of new transaction data to prevent new data from affecting old data.
[0151] Furthermore, in order to completely decouple data during data persistence, the following are also included:
[0152] Timestamp acquisition module, which obtains the timestamp of the micro-block's most recent persistent transaction data summary;
[0153] The rejection module, in the process of reading the summary of the transaction data to be persisted, refuses to persist the summary of the transaction data to be persisted in the micro-block if the difference between the current time point and the timestamp is greater than a set threshold.
[0154] In the process of reading the summary of the transaction data to be persisted, if the difference between the current time point and the timestamp is greater than a set threshold, the summary of the transaction data to be persisted is refused to be persisted in the micro-block.
[0155] In this embodiment, a valid time interval T is set for the micro-block, and the time is calculated by the difference between the timestamp of the micro-block and the current time. If the micro-block exceeds the valid time range T, it is invalid. This prevents new transaction data from being dependent on old transaction data, and the dependency relationship is too long, causing errors in previous verification.
[0156] In the present invention, the blockchain network node packages one or more classified transaction data and other unclassified data into the main block according to normal circumstances. Due to the huge number of transactions and the size limit of the main block, the main block only packages part of the transactions, and the remaining transaction data is screened, and the data with the same or related tags are packaged into the micro block. At this time, ideally, the transaction data of the main block and the micro block have no dependency or association, and the data is completely decoupled, while the data inside the main block can be related or dependent, or it can be completely non-existent.
[0157] Furthermore, the permissions for processing micro-blocks are set for blockchain network nodes. According to the actual application situation, it is allowed to set different permissions for micro-blocks and main blocks for the same node.
[0158] In actual use, both the main block and the micro block are sent to the blockchain network, such as Figure 2 As shown. The node will sort the transaction data within the block. For data that is associated or dependent, it will be sorted according to the transaction request sequence, including: request occurrence sequence, reception time sequence, transfer amount sequence or other sequence, to obtain a logical request queue to be processed.
[0159] Furthermore, if the marked transaction data contained in the main block and the micro block have the same mark, they can be processed according to the same processing mechanism to speed up the processing.
[0160] Furthermore, if there is a close dependency between transaction data, the sequence graph records the processing order of the transactions and sends the sequence graph to other nodes, instructing other nodes to generate transaction requests according to the sequence graph, so as to achieve rapid verification.
[0161] Furthermore, due to the existence of main blocks and micro blocks, multiple blockchains can be used to process data, utilizing the multi-core processing power of computers to achieve parallel data processing.
[0162] In this embodiment, the main block can be verified by the node, and any consensus mechanism, such as the workload consensus mechanism (PoW), the equity consensus mechanism (PoS), the share authorization proof mechanism (DPoS) and the practical Byzantine fault tolerance (PBFT) can be used to perform the consensus process to obtain the consensus result. If the consensus is successful, the main block is a valid block and is added to the main chain to continue the next round. If the consensus is unsuccessful, other blocks are verified and consensus is performed. At the same time, the node verifies the micro block, but there is no need to reach a consensus, such as Figure 2 shown.
[0163] Furthermore, the role of micro-blocks is to provide a prediction direction for nodes when packaging transaction data into the main block, avoiding nodes from blindly and arbitrarily packaging transactions. Since transaction data has been classified and then packaged into micro-blocks, there is no correlation or very little correlation between micro-blocks issued by the same node.
[0164] Furthermore, the nodes of the blockchain network should uniformly adopt classification algorithms with the same effect, and try to ensure that the same or similar classification results are obtained. The purpose is to reduce the correlation of micro-blocks of each node, avoid repeated calculations, and waste resources.
[0165] It can be seen from the above technical scheme that the data persistence device based on blockchain provided by the present invention classifies and decouples data rows with correlation and dependency relationships according to the characteristics of the data, and configures a processing mechanism, which can realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into the main block and the micro block, and nodes are set to process the main block and the micro block to realize block parallel processing, that is, to realize parallel processing of transaction data; because the transaction data inside the micro block has a strong correlation and dependency relationship, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block, realize the parallel processing of the main block and the micro block, and also improve the verification speed of the block. The present invention changes the processing mode of the blockchain system for transaction data from serial processing to parallel processing, making full use of computer resources.
[0166] In order to realize parallel processing of blockchain data, further, one or more embodiments of the present invention further provide a data parallel processing method based on blockchain, including:
[0167] Performing a first process, the first process comprising processing a digest of transaction data persisted in a main block of the blockchain;
[0168] During the execution of the first process, a second process is executed, the second process comprising: if there is no dependency relationship between the micro-block within the set range and the main block executing the first process, processing the transaction data summary persisted in the micro-block in parallel;
[0169] There is at least one micro-block coupled between every two adjacent main blocks, the set range is defined by the main block executing the first process and the next main block adjacent to the main block, and each micro-block includes a transaction data summary of a type of dependency relationship.
[0170] It can be seen from the above technical scheme that the data parallel processing method based on blockchain provided by the present invention classifies and decouples data rows with correlation and dependency relationships according to the characteristics of the data, and configures a processing mechanism, which can realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into the main block and the micro block, and nodes are set to process the main block and the micro block to realize block parallel processing, that is, to realize parallel processing of transaction data; because the transaction data inside the micro block has a strong correlation and dependency relationship, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block, realize the parallel processing of the main block and the micro block, and also improve the verification speed of the block. The present invention changes the processing mode of transaction data of the blockchain system from serial processing to parallel processing, making full use of computer resources.
[0171] In order to provide one of the specific processing modes of the second processing of the present invention, in one or more embodiments of the present invention, the second processing further includes:
[0172] Obtaining dependency classifications of all micro-tiles within the set range;
[0173] According to the dependency classification and the transaction data summary in the main block where the first processing is performed, it is determined whether there is a dependency relationship between the micro block and the main block.
[0174] In order to provide a second specific processing method of the second processing of the present invention, in one or more embodiments of the present invention, the second processing further includes:
[0175] If all micro-tiles within the setting range have a dependency relationship, a micro-tile is regenerated after executing the first processed main tile.
[0176] Furthermore, the parallel processing includes: verification processing, block packaging processing and consensus operation processing.
[0177] Specifically, ideally, if there is no correlation or dependency between the multiple micro-blocks received by the node and the transaction verification is successful, these micro-blocks can be directly packaged to form a main block, thus avoiding the node from blindly and arbitrarily packaging transactions, thereby improving the block verification pass rate.
[0178] Furthermore, when there is no correlation or dependency between the main block and the micro block, micro blocks and micro blocks as well as micro blocks and the main block can be processed in parallel, including operations such as verification, block packaging, and consensus.
[0179] If the micro-block received by the node has no dependency relationship with the main block currently being processed, the next processing logic request is started and processed in parallel with the current request; if there is a dependency relationship, no parallel processing is performed and only the main block is processed. Micro-blocks and main blocks realize parallel processing of some logics, which improves processing efficiency.
[0180] In order to provide a third specific processing method of the second processing of the present invention, in one or more embodiments of the present invention, the second processing further includes:
[0181] If all micro-blocks within the set range have dependencies, a search is performed in the blockchain network according to the header information of the micro-blocks within the set range, and the found micro-blocks are added to the processing queue.
[0182] Furthermore, if the node does not find a micro-block that meets the adding rule in the local block group to be processed, the node can further search in the network using the micro-block header information and add the found micro-block to the processing queue.
[0183] It can be seen from the above technical scheme that the present invention starts from the transaction data characteristics of the blockchain, specifically from the perspective of the correlation and dependency of the transaction data. First, the transaction data is labeled and classified, and then the data with correlation and dependency are put into the same block to decouple the block data. Then, data parallel processing is realized through micro-blocks and main blocks, ultimately achieving the purpose of improving the speed of processing transaction data, increasing data throughput, and reducing user waiting time.
[0184] Advantage 1: According to the characteristics of the data, the data rows with correlation and dependency relationships are classified and decoupled, and the processing mechanism is configured to realize parallel data processing, improve data processing speed, and reduce waiting time.
[0185] Advantage 2: Pack the decoupled data into main blocks and micro blocks, and set up nodes to process main blocks and micro blocks to achieve parallel processing of blocks, that is, parallel processing of transaction data.
[0186] Advantage 3: The transaction data within the micro-block has a strong correlation and dependency, and has no correlation or very weak correlation with other micro-blocks or main blocks. Therefore, the node can directly package the micro-block into the main block to achieve parallel processing of the main block and micro-block, and also improve the verification speed of the block.
[0187] Advantage 4: Change the blockchain system's transaction data processing mode from serial processing to parallel processing, make full use of computer resources, increase the speed of processing transaction data, increase data throughput, and reduce user waiting time.
[0188] Furthermore, based on the same inventive concept, the present invention also provides a data parallel processing device based on blockchain, comprising:
[0189] A first processing module, performing a first process, wherein the first process includes processing a summary of transaction data persisted in a main block of the blockchain;
[0190] A second processing module, executing a second processing during the execution of the first processing, wherein the second processing includes: if there is no dependency between the micro-block within the set range and the main block executing the first processing, processing the persistent transaction data summary in the micro-block in parallel;
[0191] There is at least one micro-block coupled between every two adjacent main blocks, the set range is defined by the main block executing the first process and the next main block adjacent to the main block, and each micro-block includes a transaction data summary of a type of dependency relationship.
[0192] In a preferred embodiment, the second process further comprises:
[0193] Obtaining dependency classifications of all micro-tiles within the set range;
[0194] According to the dependency classification and the transaction data summary in the main block where the first processing is performed, it is determined whether there is a dependency relationship between the micro block and the main block.
[0195] In a preferred embodiment, the second process further comprises:
[0196] If all micro-tiles within the setting range have a dependency relationship, a micro-tile is regenerated after executing the first processed main tile.
[0197] In a preferred embodiment, the parallel processing includes: verification processing, block packaging processing and consensus operation processing.
[0198] In a preferred embodiment, the second process further comprises:
[0199] If all micro-blocks within the set range have dependencies, a search is performed in the blockchain network according to the header information of the micro-blocks within the set range, and the found micro-blocks are added to the processing queue.
[0200] It can be known that the effect of the parallel processing device provided by the present invention is similar to that of the above technical solution, and will not be described in detail here.
[0201] From the hardware level, in order to solve the problem in the prior art without considering the hardware infrastructure, the prior art is improved from the following two aspects: on the one hand, the capacity of the block is expanded, and on the other hand, the data structure of the block is optimized and the consensus mechanism is improved. Both of these improvements have theoretical basis and practice, but there are still some shortcomings. The present invention provides an embodiment of an electronic device for implementing all or part of the content of the data persistence method based on blockchain, and the electronic device specifically includes the following content:
[0202] Figure 5 FIG. 9 is a schematic block diagram of the device structure of the electronic device 9600 according to an embodiment of the present invention. Figure 5 As shown, the electronic device 9600 may include a central processor 9100 and a memory 9140; the memory 9140 is coupled to the central processor 9100. It is worth noting that Figure 5 is exemplary; other types of structures may also be used to supplement or replace this structure to implement telecommunication functions or other functions.
[0203] In one embodiment, the blockchain-based data persistence function can be integrated into the central processing unit.
[0204] The central processing unit may be configured to perform the following control:
[0205] Step S101: persisting the transaction data summaries in the blockchain to each block according to the dependency relationship between the transaction data summaries; the blocks include main blocks and micro blocks, each micro block includes a transaction data summary of a class of dependency relationship; at least one micro block is coupled between every two adjacent main blocks.
[0206] It can be seen from the above technical scheme that an electronic device provided by the present invention can classify and decouple data rows with correlation and dependency relationships according to the characteristics of the data, and configure a processing mechanism to realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into main blocks and micro blocks, and nodes are set to process the main blocks and micro blocks to realize block parallel processing, that is, to realize parallel processing of transaction data; since the transaction data within the micro block has a strong correlation and dependency relationship, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block to realize the parallel processing of the main block and the micro block, and at the same time, it can also improve the verification speed of the block. The present invention changes the processing mode of transaction data of the blockchain system from serial processing to parallel processing, making full use of computer resources.
[0207] In another embodiment, the server can be configured separately from the central processor 9100. For example, the server can be a chip connected to the central processor 9100, and the blockchain-based data persistence function can be implemented through the control of the central processor.
[0208] like Figure 5 As shown, the electronic device 9600 may also include: a communication module 9110, an input unit 9120, an audio processor 9130, a display 9160, and a power supply 9170. It is worth noting that the electronic device 9600 does not necessarily have to include Figure 5 In addition, the electronic device 9600 may also include Figure 5 For components not shown, reference may be made to the prior art.
[0209] like Figure 5 As shown, the central processing unit 9100 is sometimes also referred to as a controller or an operation control, and may include a microprocessor or other processor device and / or logic device. The central processing unit 9100 receives input and controls the operation of various components of the electronic device 9600.
[0210] The memory 9140 may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices. The above-mentioned information related to the failure may be stored, and a program for executing the relevant information may also be stored. The CPU 9100 may execute the program stored in the memory 9140 to implement information storage or processing, etc.
[0211] The input unit 9120 provides input to the central processing unit 9100. The input unit 9120 is, for example, a key or a touch input device. The power supply 9170 is used to provide power to the electronic device 9600. The display 9160 is used to display display objects such as images and texts. The display may be, for example, an LCD display, but is not limited thereto.
[0212] The memory 9140 may be a solid-state memory, such as a read-only memory (ROM), a random access memory (RAM), a SIM card, etc. It may also be a memory that saves information even when the power is off, can be selectively erased, and is provided with more data, examples of which are sometimes referred to as EPROMs, etc. The memory 9140 may also be some other type of device. The memory 9140 includes a buffer memory 9141 (sometimes referred to as a buffer). The memory 9140 may include an application / function storage unit 9142, which is used to store application programs and function programs or processes for executing the operation of the electronic device 9600 through the central processor 9100.
[0213] The memory 9140 may also include a data storage unit 9143 for storing data, such as contacts, digital data, pictures, sounds, and / or any other data used by the electronic device. The driver storage unit 9144 of the memory 9140 may include various drivers for communication functions of the electronic device and / or for executing other functions of the electronic device (such as messaging applications, address book applications, etc.).
[0214] The communication module 9110 is a transmitter / receiver 9110 that sends and receives signals via an antenna 9111. The communication module (transmitter / receiver) 9110 is coupled to the central processor 9100 to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal.
[0215] Based on different communication technologies, multiple communication modules 9110 may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless LAN module, etc. The communication module (transmitter / receiver) 9110 is also coupled to a speaker 9131 and a microphone 9132 via an audio processor 9130 to provide an audio output via the speaker 9131 and receive an audio input from the microphone 9132, thereby realizing a common telecommunication function. The audio processor 9130 may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor 9130 is also coupled to the central processor 9100, so that recording can be performed on the local machine through the microphone 9132, and the sound stored on the local machine can be played through the speaker 9131.
[0216] The embodiment of the present invention also provides a computer-readable storage medium capable of implementing all the steps of the data persistence method based on blockchain in the above embodiment. The computer-readable storage medium stores a computer program. When the computer program is executed by a processor, all the steps of the data persistence method based on blockchain in the above embodiment are implemented by the execution subject being a server or a client. For example, when the processor executes the computer program, the following steps are implemented:
[0217] Step S101: persisting the transaction data summaries in the blockchain to each block according to the dependency relationship between the transaction data summaries; the blocks include main blocks and micro blocks, each micro block includes a transaction data summary of a class of dependency relationship; at least one micro block is coupled between every two adjacent main blocks.
[0218] It can be seen from the above technical solutions that the computer storage medium provided by the present invention classifies and decouples data rows with correlation and dependency relationships according to the characteristics of the data, and configures a processing mechanism, so as to realize data parallel processing, improve data processing speed, and reduce waiting time; the decoupled data is packaged into main blocks and micro blocks, and nodes are set to process the main blocks and micro blocks to realize block parallel processing, that is, to realize parallel processing of transaction data; since the transaction data within the micro block has a strong correlation and dependency relationship, and has no correlation or very weak correlation with other micro blocks or main blocks, the node can directly package the micro block into the main block, realize the parallel processing of the main block and the micro block, and also improve the verification speed of the block. The present invention changes the processing mode of transaction data of the blockchain system from serial processing to parallel processing, making full use of computer resources.
[0219] It will be appreciated by those skilled in the art that embodiments of the present invention may be provided as methods, devices, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0220] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (apparatus), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0221] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0222] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0223] The present invention uses specific embodiments to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea. At the same time, for those skilled in the art, according to the idea of the present invention, there will be changes in the specific implementation methods and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.
Claims
1. A data persistence method based on blockchain, characterized in that: include: Preprocess the transaction data summary to obtain transaction data features; Determining the dependency relationship between the transaction data summaries according to the transaction data characteristics; Persisting the transaction data summaries in the blockchain into each block according to the dependency relationship between the transaction data summaries; the blocks include main blocks and micro blocks, and each micro block includes a transaction data summary of a class of dependency relationships; At least one micro-block is coupled between every two adjacent main blocks; The preprocessing of the transaction data summary includes: Inputting the transaction data summary into a preset machine learning model, and the machine learning model outputs the transaction data features; The machine learning model is trained using a summary of historical transaction data with labeled transaction data features.
2. According to the data persistence method based on blockchain in claim 1, it is characterized in that: Also includes: Build the machine learning model.
3. The data persistence method based on blockchain according to claim 1 is characterized in that: Also includes: Take the current time point as the end point of the time window and collect the transaction data summary within the set time period; Acquire transaction data features corresponding to the transaction data summary, and perform feature marking on the transaction data summary; The original historical transaction data summary is replaced with the transaction data summary with the labeled transaction data features to form updated training data.
4. The data persistence method based on blockchain according to claim 1 is characterized in that: Also includes: Get the timestamp of the most recent persistent transaction data summary of the microblock; In the process of reading the summary of the transaction data to be persisted, if the difference between the current time point and the timestamp is greater than a set threshold, the summary of the transaction data to be persisted is refused to be persisted in the micro-block.
5. A data parallel processing method based on blockchain, characterized in that: include: Performing a first process, the first process comprising processing a digest of transaction data persisted in a main block of the blockchain; During the execution of the first process, a second process is executed, wherein the second process comprises: if there is no dependency relationship between the micro-block within the set range and the main block executing the first process, processing the persistent transaction data summary in the micro-block in parallel; if all micro-blocks within the set range have a dependency relationship, regenerating a micro-block after executing the main block executing the first process; There is at least one micro-block coupled between every two adjacent main blocks, the set range is defined by the main block executing the first process and the next main block adjacent to the main block, and each micro-block includes a transaction data summary of a type of dependency relationship.
6. The data parallel processing method according to claim 5, characterized in that: The second process further includes: Obtaining dependency classifications of all micro-tiles within the set range; According to the dependency classification and the transaction data summary in the main block where the first processing is performed, it is determined whether there is a dependency relationship between the micro block and the main block.
7. The data parallel processing method according to claim 5, characterized in that: The parallel processing includes: verification processing, block packaging processing and consensus operation processing.
8. The data parallel processing method according to claim 5, characterized in that: The second process further includes: If all micro-blocks within the set range have dependencies, a search is performed in the blockchain network according to the header information of the micro-blocks within the set range, and the found micro-blocks are added to the processing queue.
9. A data persistence device based on blockchain, characterized in that: include: A transaction data feature acquisition module pre-processes the transaction data summary to acquire transaction data features; A dependency determination module, which determines the dependency between the transaction data summaries according to the transaction data characteristics; A persistence module, which persists the transaction data summaries in the blockchain to each block according to the dependency relationship between the transaction data summaries; the blocks include main blocks and micro blocks, each micro block includes a transaction data summary of a class of dependency relationship; at least one micro block is coupled between every two adjacent main blocks; The transaction data feature acquisition module is specifically used for: Inputting the transaction data summary into a preset machine learning model, and the machine learning model outputs the transaction data features; The machine learning model is trained using a summary of historical transaction data with labeled transaction data features.
10. The data persistence device based on blockchain according to claim 9 is characterized in that: Also includes: A model building module builds the machine learning model.
11. The data persistence device based on blockchain according to claim 9 is characterized in that: Also includes: The transaction data summary collection module takes the current time point as the end point of the time window and collects the transaction data summary within the set time period; A marking module, which obtains transaction data features corresponding to the transaction data summary and performs feature marking on the transaction data summary; The updating module replaces the original historical transaction data summary with the transaction data summary with the marked transaction data features to form updated training data.
12. The data persistence device based on blockchain according to claim 9, characterized in that: Also includes: Timestamp acquisition module, which obtains the timestamp of the micro-block's most recent persistent transaction data summary; The rejection module, in the process of reading the summary of the transaction data to be persisted, refuses to persist the summary of the transaction data to be persisted in the micro-block if the difference between the current time point and the timestamp is greater than a set threshold.
13. A data parallel processing device based on blockchain, characterized in that: include: A first processing module, performing a first process, wherein the first process includes processing a summary of transaction data persisted in a main block of the blockchain; A second processing module executes a second processing during the execution of the first processing, wherein the second processing includes: if there is no dependency relationship between the micro-block within the set range and the main block executing the first processing, processing the persistent transaction data summary in the micro-block in parallel; if all micro-blocks within the set range have a dependency relationship, regenerating a micro-block after executing the main block executing the first processing; There is at least one micro-block coupled between every two adjacent main blocks, the set range is defined by the main block executing the first process and the next main block adjacent to the main block, and each micro-block includes a transaction data summary of a type of dependency relationship.
14. The data parallel processing device according to claim 13, characterized in that: The second process further includes: Obtaining dependency classifications of all micro-tiles within the set range; According to the dependency classification and the transaction data summary in the main block where the first processing is performed, it is determined whether there is a dependency relationship between the micro block and the main block.
15. The data parallel processing device according to claim 13, characterized in that: The parallel processing includes: verification processing, block packaging processing and consensus operation processing.
16. The data parallel processing device according to claim 13, characterized in that: The second process further includes: If all micro-blocks within the set range have dependencies, a search is performed in the blockchain network according to the header information of the micro-blocks within the set range, and the found micro-blocks are added to the processing queue.
17. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 8 is implemented.
18. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 8 is implemented.
Citation Information
Patent Citations
Parallel processing method and device of block chain data, equipment and storage medium
CN108537543A
Block chain data processing method, apparatus and device, and storage medium
CN108804706A
Block chain transaction data processing method and device and terminal device
CN109360095A
Data processing method for Internet of Things based on blockchain, Internet of Things and storage medium
CN110730225A
Blockchain transaction execution and data storage method based on account classification
CN111080290A