Detailed Description
The following description of the embodiments of the present invention will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are some, but not all embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
It should be understood that the terms "comprises" and "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It is also to be understood that the terminology used in the description of the invention herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the invention. As used in this specification and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise.
It should be further understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
Referring to fig. 1-1, fig. 1-1 is a flow chart of a data processing method based on a blockchain, which is provided by an embodiment of the present invention, and the data processing method based on the blockchain is applied to a server, and the method is executed by an execution program of the server, and the server is a terminal device for executing the data processing method based on the blockchain, and the server may be a server for providing various services. It should be noted that, the data processing method based on the blockchain provided by the embodiment of the invention is generally executed by a server, and accordingly, the data processing device based on the blockchain is generally configured in the server. As shown in fig. 1-1, the method includes steps 101-105.
101. And acquiring transaction information of the user.
In this embodiment, the transaction information may be a plurality of acquired original data, and the transaction information of the user may be acquired through network communication or may be acquired through a database. The original data generally obtained have a large amount of noise and invalid data, if the original data are directly used, the computing server can calculate a large amount of invalid junk data, so that the operation of the server is easy to overload, the server is crashed, and therefore, part of junk data needs to be filtered through a side chain, and the load of the server is reduced.
102. And filtering the transaction information of the user through a side chain to obtain target data.
In this embodiment, as shown in fig. 1-2, for example, since government projects are open for all citizens or enterprises in the present city, any user can fill and apply for government projects, so that many enterprise data which are not in compliance with conditions can be always stored in the database (the transaction information includes many invalid data), thereby increasing nodes of the blockchain and affecting the efficiency of the blockchain. The side chain is an independent blockchain, the side chain has an intelligent contract, all enterprises can register in the side chain through the intelligent contract, only the enterprises preliminarily identified through the intelligent contract (the target data) are added into the main blockchain, the side chain does not adopt a consensus mechanism, and the swallowing amount (Transaction Per Second, TPS) of the system can be greatly improved.
103. Acquiring preset main chain fragment information, and acquiring at least one fragment area information according to the preset main chain fragment information.
In this embodiment, the main chain may be understood as an formally online and independent blockchain network, and the slicing information refers to a slicing rule, which is specifically applied to how to slice the main chain, where the slicing rule may be obtained by using an SHA256 encryption algorithm, and then hash calculation is performed to obtain slicing region information according to the result of the hash calculation. Or the method can be obtained by other methods, and the calculation and the segmentation are carried out according to specific application scenes. Taking Shenzhen administrative regions as a segmentation rule as an example, encrypting the area code of each region by an encryption algorithm, performing hash operation on the encrypted result to obtain a corresponding result, and dividing the region according to the corresponding result. Backbone refers to a generic term for all blockchains that adhere to the side-chain protocol. The fragmented area refers to a node area where data is processed. For example, how to distribute fragments can be determined according to transaction fragmentation, taking Shenzhen as a blockchain main chain, in this case, there are 11 regions (main chain fragmentation information) of Shenzhen, so that the Shenzhen can be divided into a plurality of fragments according to the administrative region of Shenzhen, for example, the administrative region of Shenzhen has a southern mountain region, a Dragon region, a Futian region and a Baoan region. The system can distribute one slice according to the address of a request sender, data submitted by the south mountain area can be added into the slice area where the south mountain area is located if the intelligent contract is verified, all nodes in the south mountain area can store one slice, and each node is only responsible for hosting own slice data and does not need to store the complete block chain state.
104. And searching the corresponding slicing area information according to the target data to obtain a target slicing area.
In this embodiment, it may be specifically understood that the target data is checked by a preset rule, and then a corresponding target area, such as a certificate number, a unified social credit code, a company type, a legal person/natural person, is allocated according to the preset rule, so as to obtain corresponding feature data, and the certificate number is taken as an example, and the certificate of the user is a certificate number of the Shenzhen south mountain area, and then the node processing of the Shenzhen south mountain area is automatically allocated to the node processing of the Shenzhen south mountain area, where the blockchain area where the Shenzhen south mountain area is located is a second segment area, and the second segment area (an area formed by nodes of the Shenzhen south mountain area) is the target segment area. A sliced area is made up of multiple nodes, where the nodes are where blocks are connected, the blocks need to be chained to be useful. The node properties include transparency, open answer, information non-tampering and decentralization, the slicing technique is to divide the chain into individual areas, one area is called a slice, each slice bears the function of full time, and the node is also scattered to each slice to process the corresponding work. In this way, during processing, the transaction information is divided into nodes on the target fragments to be processed simultaneously, so that the nodes are shared as if each department is working in cooperation, and each node processes only a small part of transactions in the network, so that the processing efficiency of the chain can be greatly improved naturally.
105. And processing the target data through the target slicing area to obtain a processing result.
In the embodiment, the processing result can provide federal service, compliance service and integrated bridge docking service, and provide SDKs of various versions, which is suitable for micro payment and has extremely low commission; matching is completed on a distributed transaction chain, so that automatic currency exchange is facilitated; based on time events, multi-signature and authority hierarchical control, the service security is higher than the network activity, and an exquisite consensus mechanism provides access to various APIs which reach the bottom layer first for external applications, so that various business applications can be accessed quickly.
According to the invention, the transaction information of the user is filtered through the side chain to obtain the target data, so that the interference of invalid data on the main chain operation is reduced. And acquiring preset main chain slicing information so as to calculate slicing areas corresponding to the main chain of corresponding processing, and finally distributing data to the corresponding slicing areas for processing, thereby improving the throughput of data processing in the block chain.
In some embodiments, the obtaining the preset main chain fragment information, and obtaining at least one fragment area information according to the preset main chain fragment information, includes:
111. acquiring preset main chain fragment information;
112. carrying out hash calculation on the preset main chain fragment information by adopting an SHA256 algorithm to obtain transaction hash, wherein the transaction hash at least comprises the id of a user, a transaction timestamp and the transaction information of the user;
113. A hash result is obtained through calculation of Const signature=SHA256 (user_id+tx_timestamp+tx_data), wherein user_id represents user id, tx_timestamp represents transaction timestamp, tx_data represents transaction information of the user, and Const signature is the hash result;
114. Generating a transaction proposal through a client application programming interface by the hash result;
115. serializing the transaction proposal into a structured text format to obtain a text transaction proposal;
116. at least one fragmented region information is generated for the text transaction proposal based on a private key of an encryption algorithm.
In the above embodiment, as shown in fig. 1-3, the flowchart is shown, for example, where the Shenzhen has 11 regions, which can be divided into 11 segments, and the system can allocate one segment according to the address of the sender, for example, allocate the segment to the south mountain region for operation, generate a transaction hash according to the information of the south mountain region and the user request, where the transaction hash contains multiple transaction information, perform encryption operation through SHA256 to obtain the final encryption result, automatically generate a proposal through an application programming interface, and convert the proposal into a corresponding text through a serialization technology. By the method, the safety of the transaction can be ensured.
In some embodiments, after the generating the at least one fragmented area information for the text transaction proposal according to the private key of the encryption algorithm, the method further comprises:
121. extracting target character segments from at least two target data according to a preset rule;
122. if the target character segments are identical, stopping the transaction.
In the above embodiment, the flowcharts are shown in fig. 1-4, for example, the transaction center company wants to repeatedly submit government projects and get subsidies, and one data will contain multiple transaction information, such as company name, company address, etc., but the unified social credit code (target character segment) is unique. If there are two target data, the unified social credit codes they appear are consistent. Since the unified social credit code of each business is unique, it is determined in this way that the double-flower phenomenon occurs, and the transaction is stopped. Two transactions are generated by the above embodiment, resulting in a double flower.
In some embodiments, after the searching the corresponding tile region information according to the target data to obtain a target tile region, the method further includes:
131. Carrying out random slicing on the nodes of the target slicing area through a random slicing technology to obtain at least one target processing node;
the processing the target data through the target slicing area to obtain a processing result comprises the following steps:
132. And processing the target data through the at least one target processing node to obtain a processing result.
In the above embodiment, as shown in fig. 1-5, another very important mechanism of the slicing technique is a random allocation mechanism, and by using the network slicing technique, the network can randomly extract the node-forming slices by using a VRF method, so as to prevent a malicious node from occupying a slice. After the fragmented areas are obtained, the nodes are randomly extracted to operate, so that a hacker cannot accurately blacken the corresponding nodes, the cost of hacking is increased, and the safety of the block chain is improved.
In some embodiments, the filtering the transaction information of the user through a side chain to obtain target data includes:
141. inputting transaction information of the user to a side chain;
142. Extracting feature data from transaction information of the user through a side chain;
143. and verifying the transaction information of the user according to the characteristic data to obtain target data.
In the above embodiment, the flowcharts are shown in fig. 1 to 6, and the user inputs corresponding information first and saves the information in the side chain. The side chains are then checked according to some necessary information (e.g. certificate number, unified social credit code, company type, legal/natural person.) and after checking, the data meeting the conditions are screened out, the state is modified and synchronized to the main chain. For example, the method can only be declared by the key enterprise, and the judgment of whether the key enterprise is the key enterprise can be obtained according to the tax amount, the company scale, the company type and the like. The method specifically can be understood as inputting the transaction information of the user into a side chain, extracting corresponding characteristic data such as a certificate number, a unified social credit code, a company type and a legal person/natural person through a preset extraction rule, obtaining the corresponding characteristic data, checking whether the data are in compliance, and judging the compliance rule as target data.
In some embodiments, the extracting feature data from the transaction information of the user through the side chain includes:
151. Creating a database main library and blockchain side chains, wherein the blockchain side chains are a plurality of expandable channels;
152. Constructing a transaction proposal based on the transaction information, and sending the transaction proposal to the corresponding expandable channel;
153. Preprocessing the transaction proposal through the side chain to obtain characteristic data;
154. storing the characteristic data into the blockchain side chain;
155. blocks of the blockchain side chains are sent into the backbone.
In the above embodiment, the flow chart is shown in fig. 1-7, where each expandable channel corresponds to one channel database; the database is used for creating a developer user table, and the extensible channels are used for receiving transactions of developer users, and each developer user joins one extensible channel.
In some embodiments, after the processing the target data by the target tile region, the method further comprises:
161. Verifying whether the format of the processing result is correct;
162. If the format of the processing result is correct, verifying the processing result through the public key of the encryption algorithm to obtain a verification result;
163. and if the verification result is successful, storing the processing result into a database.
In the above embodiment, as shown in fig. 1-8, since the data stored in the database is to satisfy the preset rule arrangement, if the arrangement modes of the data are different, the data cannot be stored in the database. When the processing result meets the storage format of the storage, if the format meets the uploading requirement, the processing result is checked through an encryption algorithm, and if the processing result cannot be decrypted through a public key, the data is not stored. The method verifies whether the processing result is correct. Preventing erroneous results from being saved to the database.
The technical method can be applied to application scenes including block chain-based data processing such as intelligent government affairs, intelligent urban management, intelligent community, intelligent security, intelligent logistics, intelligent medical treatment, intelligent education, intelligent environmental protection, intelligent traffic and the like, so that construction of intelligent cities is promoted.
In the data processing method based on the blockchain, provided by the embodiment of the invention, transaction information of a user is obtained; filtering transaction information of a user through a side chain to obtain target data; acquiring preset main chain fragment information, and acquiring at least one fragment area information according to the preset main chain fragment information; searching corresponding slicing area information according to the target data to obtain a target slicing area; and processing the target data through the target slicing area to obtain a processing result. The invention relates to a data processing technology based on a block chain, which belongs to the field of block chains, the invention divides the data in the blockchain into a plurality of subsets according to a certain rule by a transaction fragmentation technology, and the subsets are verified by different fragments. The throughput of the blockchain-based data processing is improved.
The embodiment of the invention also provides a data processing device based on the block chain, which is used for executing any embodiment of the data processing method based on the block chain. In particular, referring to FIG. 2, FIG. 2 is a schematic block diagram of a blockchain-based data processing device in accordance with an embodiment of the present invention. The blockchain-based data processing device may be configured in a user terminal.
As shown in fig. 2, the blockchain-based data processing device 200 includes a user transaction information acquisition unit 210, a transaction information filtering unit 220, a main chain information acquisition unit 230, a tile region information search unit 240, and a processing unit 250, as shown in fig. 2.
A transaction information acquisition unit 210 for acquiring transaction information of a user;
a transaction information filtering unit 220, configured to filter the transaction information of the user through a side chain to obtain target data;
a main chain information obtaining unit 230, configured to obtain preset main chain fragment information, and obtain at least one fragment area information according to the preset main chain fragment information;
A sliced area information searching unit 240, configured to search the corresponding sliced area information according to the target data to obtain a target sliced area;
and the processing unit 250 is configured to process the target data through the target tile area, and obtain a processing result.
In some optional implementations of this embodiment, the backbone information acquisition unit includes a backbone information acquisition subunit, a transaction hash calculation subunit, a hash result calculation subunit, a transaction proposal generation subunit, a serialization subunit, and a fragment area information generation subunit.
The main chain information acquisition subunit is used for acquiring preset main chain fragment information;
A transaction hash calculation subunit, configured to perform hash calculation on the preset main chain fragment information by using an SHA256 algorithm to obtain a transaction hash, where the transaction hash at least includes an id of a user, a transaction timestamp, and transaction information of the user;
A hash result calculation subunit for
A hash result is obtained through calculation of Const signature=SHA256 (user_id+tx_timestamp+tx_data), wherein user_id represents user id, tx_timestamp represents transaction timestamp, tx_data represents transaction information of the user, and Const signature is the hash result;
A transaction proposal generation subunit, configured to generate a transaction proposal from the hash result through a client application programming interface;
a serialization subunit, configured to serialize the transaction proposal into a structured text format, and obtain a text transaction proposal;
and the segmentation region information generation subunit is used for generating at least one segmentation region information for the text transaction proposal according to the private key of the encryption algorithm.
In some optional implementations of this embodiment, the apparatus 200 further includes: the verification module, the verification module includes: and an extraction subunit and a judgment subunit.
The extraction subunit is used for extracting target character segments from at least two target data according to preset rules;
and the judging subunit is used for stopping the transaction if the target character segments are identical.
In some optional implementations of this embodiment, the apparatus 200 further includes: a slicing module, the slicing module comprising: the partition subunit and the node processing subunit.
The segmentation subunit is used for carrying out random segmentation on the nodes of the target segmentation area through a random segmentation technology to obtain at least one target processing node;
the processing the target data through the target slicing area to obtain a processing result comprises the following steps:
And the node processing subunit is used for processing the target data through the at least one target processing node to obtain a processing result.
In some optional implementations of this embodiment, the transaction information filtering unit includes a side-chain input subunit, a user transaction information extraction subunit, and a fragmented region verification subunit.
A side chain input subunit for inputting transaction information of the user to a side chain;
A user transaction information extraction subunit, configured to extract feature data from the transaction information of the user through a side chain;
and the fragmented area verification sub-unit is used for verifying the transaction information of the user according to the characteristic data to obtain target data.
In some alternative implementations of this embodiment, the fragmented region check subunit includes a backbone side chain building subunit, a transaction proposal building subunit, a preprocessing subunit, a side chain storage subunit, and a backbone storage subunit.
The main chain side chain building subunit is used for creating a database main library and a blockchain side chain, wherein the blockchain side chain is a plurality of expandable channels;
A transaction proposal construction subunit, configured to construct a transaction proposal based on the transaction information, and send the transaction proposal to the corresponding expandable channel;
the preprocessing subunit is used for preprocessing the transaction proposal through the side chain to obtain characteristic data;
A side chain storage subunit for storing the characteristic data into the blockchain side chain;
and a main chain storage subunit for transmitting blocks of the blockchain side chains into the main chain.
In some optional implementations of this embodiment, the apparatus 200 further includes: a transaction verification unit, the transaction verification unit comprising: a format verification subunit, a processing result verification subunit and an encryption algorithm verification subunit.
A format verification subunit, configured to verify whether the format of the processing result is correct;
A processing result verification subunit, configured to verify the processing result by using the public key of the encryption algorithm if the format of the processing result is correct, so as to obtain a verification result;
and the encryption algorithm verification subunit is used for storing the target data into a database if the verification result is that the verification is successful.
The data processing device based on the block chain provided by the embodiment of the invention is used for acquiring the transaction information of the user by applying the data processing method based on the block chain; filtering transaction information of a user through a side chain to obtain target data; acquiring preset main chain fragment information, and acquiring at least one fragment area information according to the preset main chain fragment information; searching corresponding slicing area information according to the target data to obtain a target slicing area; and processing the target data through the target slicing area to obtain a processing result. According to the invention, the corresponding segmented region of the main chain for corresponding processing can be calculated by acquiring the preset main chain segmented information, and finally, the data is distributed to the corresponding segmented region for processing, so that the throughput of data processing based on the blockchain is improved.
The blockchain-based data processing apparatus described above may be implemented in the form of a computer program that can run on a computer device as shown in fig. 3.
Referring to fig. 3, fig. 3 is a schematic block diagram of a computer device according to an embodiment of the present invention. The computer device may be a user terminal for performing a blockchain-based data processing method for blockchain-based data processing.
With reference to FIG. 3, the computer device 300 includes a processor 302, a memory, and a network interface 305, which are connected by a system bus 301, wherein the memory may include a non-volatile storage medium 303 and an internal memory 304.
The non-volatile storage medium 303 may store an operating system 3031 and a computer program 3032. The computer program 3032, when executed, may cause the processor 302 to perform a blockchain-based data processing method.
The processor 302 is used to provide computing and control capabilities to support the operation of the overall computer device 300.
The internal memory 304 provides an environment for the execution of a computer program 3032 in the non-volatile storage medium 303, which computer program 3032, when executed by the processor 302, causes the processor 302 to perform a blockchain-based data processing method.
The network interface 305 is used for network communication, such as providing for transmission of data information, etc. It will be appreciated by those skilled in the art that the structure shown in FIG. 3 is merely a block diagram of some of the structures associated with the present inventive arrangements and does not constitute a limitation of the computer device 300 to which the present inventive arrangements may be applied, and that a particular computer device 300 may include more or less components than those shown, or may combine some of the components, or have a different arrangement of components.
The processor 302 is configured to execute a computer program 3032 stored in a memory to implement the corresponding functions in the block chain-based data processing method described above.
Those skilled in the art will appreciate that the embodiment of the computer device shown in fig. 3 is not limiting of the specific construction of the computer device, and in other embodiments, the computer device may include more or less components than those shown, or certain components may be combined, or a different arrangement of components. For example, in some embodiments, the computer device may include only a memory and a processor, and in such embodiments, the structure and function of the memory and the processor are consistent with the embodiment shown in fig. 3, and will not be described again.
It should be appreciated that in embodiments of the present invention, the Processor 302 may be a central processing unit (Central Processing Unit, CPU), the Processor 302 may also be other general purpose processors, digital signal processors (DIGITAL SIGNAL processors, DSPs), application SPECIFIC INTEGRATED Circuits (ASICs), off-the-shelf Programmable gate arrays (Field-Programmable GATE ARRAY, FPGA) or other Programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. Wherein the general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
In another embodiment of the invention, a computer-readable storage medium is provided. The computer readable storage medium may be a non-volatile computer readable storage medium. The computer readable storage medium stores a computer program which when executed by a processor implements the steps included in the blockchain-based data processing method described above.
It will be clearly understood by those skilled in the art that, for convenience and brevity of description, specific working procedures of the apparatus, device and unit described above may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein. Those of ordinary skill in the art will appreciate that the elements and algorithm steps described in connection with the embodiments disclosed herein may be embodied in electronic hardware, in computer software, or in a combination of the two, and that the elements and steps of the examples have been generally described in terms of function in the foregoing description to clearly illustrate the 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 solution. 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.
In the several embodiments provided by the present invention, it should be understood that the disclosed apparatus, device and method may be implemented in other manners. For example, the apparatus embodiments described above are merely illustrative, and for example, the division of the units is merely a logical function division, there may be another division manner in actual implementation, or units having the same function may be integrated into one unit, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. In addition, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices, or elements, or may be an electrical, mechanical, or other form of connection.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiment of the present invention.
In addition, each functional unit in the embodiments of the present invention may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention is essentially or part of what contributes to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a computer-readable storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned computer-readable storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a magnetic disk, an optical disk, or other various media capable of storing program codes.
While the invention has been described with reference to certain preferred embodiments, it will be understood by those skilled in the art that various changes and substitutions of equivalents may be made and equivalents will be apparent to those skilled in the art without departing from the scope of the invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.