Disclosure of Invention
The embodiment of the invention provides a data analysis method and device based on a block chain. The data analysis method and the device have the advantages that the data analysis data are contained in the block chain data structure, the distributed structure of the block chain is used for calculation, the resource utilization rate is improved, and the data analysis is more convenient and faster.
In one aspect, an embodiment of the present invention provides a data analysis method based on a block chain. The method comprises the following steps:
sending a first data analysis indication to at least one first node, the first data analysis indication including current transaction information; so that the at least one first node performs data analysis according to the current transaction information to obtain a first result;
receiving a first result sent by at least one first node;
adding the first result and the transaction information in a blockchain.
Optionally, before sending the data analysis instruction to the at least one first node, the method further includes:
receiving blockchain synchronization data, the synchronization data including a plurality of historical transaction information;
performing data analysis according to the synchronous data to obtain a second result;
determining a plurality of third nodes of the plurality of second nodes according to the efficiency of the plurality of second nodes on the analysis of the synchronous data and the second result, wherein the plurality of third nodes comprise the at least one second node.
Optionally, the block chain synchronization data includes a pre-fabricated algorithm model, and the performing data analysis according to the synchronization data to obtain a second result includes:
and analyzing data according to the synchronous data and the algorithm model to obtain a second result.
Optionally, the sending a data analysis indication to at least one first node includes:
selecting the at least one second node from the plurality of third nodes according to a preset rule;
a first data analysis indication is sent to at least one first node.
Optionally, the method further comprises:
receiving a second data analysis instruction sent by a fourth node, wherein the second data analysis instruction comprises transaction information of the fourth node;
performing data analysis according to the transaction information of the fourth node to obtain a third result;
sending the third result to the fourth node so that the fourth node adds the third result in a blockchain.
On the other hand, the embodiment of the invention provides a data analysis device based on a block chain. The method comprises the following steps:
a sending unit, configured to send a first data analysis instruction to at least one first node, where the first data analysis instruction includes current transaction information; so that the at least one first node performs data analysis according to the current transaction information to obtain a first result;
a receiving unit, configured to receive a first result sent by at least one first node;
a processing unit, configured to add the first result and the transaction information in a blockchain.
Optionally, the receiving unit is further configured to receive blockchain synchronization data, where the synchronization data includes a plurality of historical transaction information;
the processing unit is further used for carrying out data analysis according to the synchronous data to obtain a second result;
the processing unit is further configured to determine a plurality of third nodes of the plurality of second nodes according to the efficiency of the plurality of second nodes on the analysis of the synchronization data and the second result, wherein the plurality of third nodes includes the at least one second node.
Optionally, the block chain synchronization data includes a pre-manufactured algorithm model, and the processing unit is further configured to perform data analysis according to the synchronization data and the algorithm model to obtain a second result.
Optionally, the processing unit is further configured to, in the plurality of third nodes, select the at least one second node according to a preset rule;
the sending unit is further configured to send a first data analysis indication to at least one first node.
Optionally, the receiving unit is further configured to receive a second data analysis instruction sent by a fourth node, where the second data analysis instruction includes transaction information of the fourth node;
the processing unit is further used for carrying out data analysis according to the transaction information of the fourth node to obtain a third result;
the sending unit is further configured to send the third result to the fourth node, so that the fourth node adds the third result to the blockchain.
In yet another aspect, the present application provides a computer storage medium for storing computer software instructions for the above block chain based data analysis apparatus, which includes a program designed to execute the above first aspect and optionally implement the same.
In yet another aspect, embodiments of the present application provide a computer program product for storing computer software instructions for the above block chain based data analysis apparatus, which includes a program designed to execute the above first aspect and optionally implement the same.
According to the embodiment of the invention, the block chain contains data for data analysis, and the distributed structure of the block chain is utilized for calculation, so that the resource utilization rate is improved, and the data analysis is more convenient and faster. Further, distributed computing resources can be efficiently used by defining algorithms and models at specific data portions of the blockchain.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention provides a data analysis method and device based on a block chain. The method is suitable for the application scenario shown in fig. 1, and as shown in fig. 1, the method includes: one ormore clients 101, such as notebook computers, desktop computers, mobile terminals, and the like; one ormore blockchain nodes 102, one ormore mining machines 103, etc., e.g., computers with greater graphical computing power; wherein one ormore clients 101, one ormore mining machines 103, are connected with one ormore blockchain nodes 102.
One ormore blockchain nodes 102 store blockchains; theclient 101 is used for generating transaction information; the mining machine is used for packaging the transaction information generated in a period of time and putting the transaction information into the block chain.
The client, the block link point and the mining machine respectively comprise a processor, a memory and a transceiver, wherein the transceiver is used for receiving and transmitting data in the interaction process with other equipment.
Note that, in the embodiment of the present application, the processor has various circuits, which are connected to each other through a main line. Specifically, the processor may include: an image input control circuit that applies image data from the A/D converter to the main line; an image processing circuit that performs predetermined digital signal processing based on image data that has been input; a video Memory (VRAM) for storing image data representing an image to be displayed; and a display control circuit that controls an image displayed on the display unit, the image being based on the image data stored in the VRAM.
The memory may include a storage program area and a storage data area, wherein the storage program area may store an operating system, a program required for at least one function, and the like; the storage data area may store data created according to use of the device, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
According to the embodiment of the invention, the block chain contains data for data analysis, and the distributed structure of the block chain is utilized for calculation, so that the resource utilization rate is improved, and the data analysis is more convenient and faster. Further, distributed computing resources can be efficiently used by defining algorithms and models at specific data portions of the blockchain.
For the purpose of facilitating understanding of the embodiments of the present invention, the following description will be further explained with reference to specific embodiments, which are not to be construed as limiting the embodiments of the present invention.
Fig. 2 is a flowchart of a data analysis method based on a block chain according to an embodiment of the present invention. As shown in fig. 2, the method specifically includes:
s210, sending a first data analysis instruction to at least one first node, wherein the first data analysis instruction comprises current transaction information; therefore, the at least one first node carries out data analysis according to the current transaction information to obtain a first result.
An algorithm and an algorithm model can be defined in a data structure of the block chain, after data synchronization is carried out on the nodes, operation can be carried out according to the algorithm model in the data structure, a statistical result is obtained, and the statistical result is added into the block chain.
It should be noted that the nodes in the embodiment of the present invention may include a block chain node, a user terminal or a client, an ore machine, and the like.
Wherein the blockchain is composed of a plurality of blocks linked together. Each tile corresponds to transaction information, typically generated by a client, that is bundled and linked in a chain of tiles by an ore machine. The algorithm and the algorithm model may be pre-fabricated in blocks. For example, the transaction information generation module may be pre-manufactured, and the client generally generates the transaction information according to the transaction situation. For example, transaction information is generated according to the roll-out address, the roll-in address, the transfer amount and the like, and at the same time, statistical calculation can be carried out according to a pre-established algorithm model.
In addition, after the data are synchronized, each node can operate according to the algorithm and the algorithm model in the data structure to obtain a statistical result. And optimizing each node according to the operation efficiency of each node and the accuracy of the statistical result to obtain an optimized node list.
And selecting a certain number of nodes in the preferred nodes as statistical nodes (namely at least one first node), wherein the statistical nodes are used for carrying out data analysis according to the transaction information after receiving data analysis instructions sent by other nodes to obtain analysis results (namely first results).
In the block chain, each node is zone-centric, so that each node is structurally the same, and each node can perform the node-preferred process and maintain a preferred node list.
Specifically, each block chain link point receives block chain synchronization data, wherein the synchronization data comprises a plurality of historical transaction information; performing data analysis according to the synchronous data and a prefabricated algorithm model to obtain a second result; determining a plurality of third nodes (i.e. preferred nodes) of the plurality of second nodes according to the efficiency of the plurality of second nodes on the analysis of the synchronous data and the second result, wherein the plurality of third nodes comprise the at least one second node (i.e. statistical node).
After determining new synchronous data or generating new transaction information (i.e., current transaction information), each node may send a data analysis instruction (i.e., a first data analysis instruction) to the statistical node to instruct the statistical node to perform an operation according to the new synchronous data or the new transaction information and an algorithm model pre-built in a data structure, so as to obtain a first result. And the statistical node sends the generated first node to a node sending the data analysis indication.
Specifically, after new synchronization data is determined, or a node of new transaction information is generated, in the plurality of third nodes, the at least one second node is selected according to a preset rule; a first data analysis indication is sent to at least one first node.
The statistical node needs to execute the following steps: receiving a second data analysis instruction sent by a fourth node (i.e. a node which determines new synchronous data or generates new transaction information), wherein the second data analysis instruction comprises the transaction information of the fourth node; performing data analysis according to the transaction information of the fourth node to obtain a third result; sending the third result to the fourth node so that the fourth node adds the third result in a blockchain.
S220, receiving a first result sent by at least one first node.
After receiving the first result sent by at least one first node, the node can compare the at least one first result and synthesize to obtain a statistical result. In this way, the accuracy of the statistical results can be ensured.
In addition, the preferred node list is re-determined based on the efficiency of the at least one first node and the accuracy of the resulting results. For example, the first node with too low efficiency or too much difference between the operation result and the comprehensive result is deleted from the preferred node list.
S230, adding the first result and the transaction information in a blockchain.
After receiving the statistical result sent by the statistical node, the node may add or fill the statistical result in the transaction information, deliver the transaction information to an ore machine for packaging, and link the transaction information in a block chain.
Therefore, the block chain contains the statistical result which is well counted, and the demand side does not need to count again according to the information in the block chain, so that the resources are saved, and the operation efficiency is improved.
According to the embodiment of the invention, the block chain contains data for data analysis, and the distributed structure of the block chain is utilized for calculation, so that the resource utilization rate is improved, and the data analysis is more convenient and faster. Further, distributed computing resources can be efficiently used by defining algorithms and models at specific data portions of the blockchain. Model analysis and calculation are carried out in a distributed mode through the block chains, and existing resources are fully utilized. And the optimal node is selected in a distributed mode through the block chain to perform model calculation, so that the operation efficiency is improved.
Fig. 3 is a schematic structural diagram of a data analysis apparatus based on a block chain according to an embodiment of the present invention. As shown in fig. 3, the device specifically comprises
A sendingunit 301, configured to send a first data analysis instruction to at least one first node, where the first data analysis instruction includes current transaction information; so that the at least one first node performs data analysis according to the current transaction information to obtain a first result;
a receivingunit 302, configured to receive a first result sent by at least one first node;
aprocessing unit 303, configured to add the first result and the transaction information in a blockchain.
Optionally, the receivingunit 302 is further configured to receive blockchain synchronization data, where the synchronization data includes a plurality of historical transaction information;
theprocessing unit 303 is further configured to perform data analysis according to the synchronization data to obtain a second result;
theprocessing unit 303 is further configured to determine a plurality of third nodes of the plurality of second nodes according to the efficiency of the plurality of second nodes on the analysis of the synchronization data and the second result, where the plurality of third nodes includes the at least one second node.
Further, the block chain synchronization data includes a pre-manufactured algorithm model, and theprocessing unit 303 is further configured to perform data analysis according to the synchronization data and the algorithm model to obtain a second result.
In another implementation, theprocessing unit 303 is further configured to select, in the plurality of third nodes, the at least one second node according to a preset rule;
the sendingunit 301 is further configured to send a first data analysis indication to at least one first node.
In addition, the receivingunit 302 is further configured to receive a second data analysis instruction sent by the fourth node, where the second data analysis instruction includes transaction information of the fourth node;
theprocessing unit 303 is further configured to perform data analysis according to the transaction information of the fourth node to obtain a third result;
the sendingunit 301 is further configured to send the third result to the fourth node, so that the fourth node adds the third result in a block chain.
Those of skill would further appreciate that the various illustrative components and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied in hardware, a software module executed by a processor, or a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only illustrative of the present invention and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the scope of the present invention should be included in the scope of the present invention.