A data processing system, a blockchain-based data processing method and device
By editing transaction data into SQL statements and sending them in parallel to the database management system through the blockchain management device, the problem of low write efficiency when combining blockchain and SQL database is solved, and an efficient transaction data writing and verification process is achieved.
Patent Information
- Application Number
- CN202011111339.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-10-16
- Publication Date
- 2025-11-07
- Estimated Expiration
- 2040-10-16
AI Technical Summary
In existing blockchain solutions, writing transaction data to SQL databases is inefficient, and when combining blockchain with SQL databases, key-value interfaces need to be redeveloped, resulting in high learning costs and low query efficiency.
The blockchain management device edits transaction data into SQL statements and sends them to the database management system. After the data is written, it is verified. Multiple SQL statements and verification processes are executed in parallel to improve the writing speed.
This technology enables multiple transaction records to be written to the database system at once, improving the speed of writing transaction data to the database system. Parallel execution of the writing and verification processes also improves processing speed.
Smart Images

Figure CN114372051B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of blockchains, and in particular to a data processing system, a blockchain-based data processing method and equipment. BACKGROUND
[0002] A blockchain is a kind of chain-like data structure that combines blocks containing data in a sequential manner, and is a kind of distributed ledger that is guaranteed to be non-tamperable and non-forgery by cryptography. According to a decentralized protocol, the blockchain constructs a distributed structure system, generates block data after time stamping the data content, and sends the block data to each node in the distributed structure system through distributed propagation, to realize distributed storage.
[0003] In the existing blockchain scheme, storage is performed through a key-value (KV) database. The KV database is a kind of non-relational database, and data is organized, indexed and stored in the form of key-value pairs. For the KV database, if a user wants to make a complex query, all block data needs to be read in sequence and filtered one by one, and the query efficiency is very low. At the same time, if the user needs to migrate the existing structured query language (SQL) type application to the blockchain, the business code of the KV interface also needs to be redeveloped, and the learning cost is very high.
[0004] In the current scheme of combining the blockchain with the SQL database, the transactions of the blockchain are executed in sequence one by one, and often the execution result of a previous transaction is the input of a next transaction, so a transaction needs to be written into the SQL database only after the transaction is verified, which leads to low efficiency of writing the transaction into the SQL database. SUMMARY
[0005] The embodiments of the present application provide a data processing system and a blockchain-based data processing method, which are used to improve the speed of writing transaction data in the blockchain into a database system. The embodiments of the present application also provide corresponding equipment, computer storage media and computer program products, etc.
[0006] The first aspect of the present application provides a data processing system, which comprises a blockchain system and a database system, the blockchain system comprises a block node and a blockchain management device, and the database system comprises a database management device.
[0007] The blockchain management device is configured to receive one or more blocks sent by the block node, each block carrying a plurality of transaction data; send a plurality of first structured query language (SQL) statements to the database management device, wherein each first SQL statement includes a first transaction data in the transaction data carried by the one or more blocks, and a block number and a transaction number of the first transaction data, the block number indicating a block identification of a block to which the first transaction data belongs, and the transaction number indicating an index of the first transaction data in the plurality of transaction data of the block, and the first SQL statement further includes a first field indicating storage of the first transaction data.
[0008] The database management device is configured to store the first transaction data according to the first field, and store a plurality of attribute information of the first transaction data, the plurality of attribute information including the block number, the transaction number of the first transaction data, and validity information of the first transaction data; and return a message indicating that the first transaction data has been stored to the blockchain management device.
[0009] The blockchain management device is further configured to receive the message returned by the database management device that the first transaction data has been stored, and verify the first transaction data according to the block number and the transaction number of the first transaction data.
[0010] In the first aspect, data in the blockchain system is stored in the form of blocks, one block carries multiple transaction data, which are sequentially stored in the block, and one block is a collection of continuously generated multiple transaction data. "Transaction data" refers to data generated by a user in combination with business operations. In the blockchain system, there are orderers and blockchain management devices. The orderer is used to package transaction data generated by the terminal device into a block, and the orderer can be any node in the blockchain that generates a block. The blockchain management device is used to verify whether the transaction data in the block is valid, and submit the transaction data in the block to the database system. The blockchain management device and the orderer can be on the same physical machine or on different physical machines. The orderer and the blockchain management device can be physical machines or virtual machines. Whether the transaction data is valid usually refers to whether the transaction data is successfully operated, for example, a transfer transaction. If the transfer fails, it means that the transaction data generated by the transfer is invalid. Because each transaction data belongs to a block, and the number of blocks in the blockchain system is unique, each transaction data will have a corresponding block number. The transaction data in the same block is sequentially numbered, that is, the transaction number of the transaction data, the transaction number is the index of the transaction data in the block, and can also be expressed as the order identifier or position identifier of the transaction data in the block. The block number of each transaction data in the same block is different, and the transaction number in different blocks can be repeated. Therefore, the block number and the transaction number can uniquely locate a transaction data. When the blockchain management device analyzes the transaction data in the block, it can determine the block number and the transaction number of each transaction data.
[0011] In this application, a plurality of includes two or more, or at least two.
[0012] In the present application, the blockchain management device writes transaction data into a database system, which is a SQL-supported database system. Generally, SQL refers to a special programming language specially used for managing data stored in a relational database. SQL can refer to various types of data-related languages, including, for example, data definition language and data manipulation language, wherein the scope of SQL can include data writing, querying, updating, and deleting, etc. The database system generally includes a database management system (DBMS) and a data storage, which is described as a database management device in the present application. The blockchain management device sends each transaction data edited into the form of a first SQL statement to the database management system, and the DBMS parses the SQL statement to complete the writing of the transaction data to the data storage. The first field in the first SQL statement indicates the storage of the transaction data, and the first SQL statement includes the block number and the transaction number of the transaction data, and then the database management system stores the transaction data.
[0013] The plurality of attribute information of each transaction data in the database management device can be maintained in the form of a corresponding relationship, and the attributes of the plurality of transaction data can be maintained in the form of a target table. The attributes in the target table can add several attributes such as a "block number (block_num)" column and a "transaction number (tx_num)" column based on the original table for maintaining blockchain data. A "delete operation (isdelete)" column and a "valid (isvalid)" column can also be added. If it is a delete operation, the information in this column can be filled with "true", and if it is not a delete operation, it can be filled with "false". The isvalid column is filled with "true" when the transaction data is initially written. Of course, the attributes in the target table are not limited to the above several attributes, and can also include the starting position of the storage address of the transaction data in the data storage and the length of the transaction data, etc.
[0014] In the first aspect, the verification of the transaction data is performed after the transaction data is written into the database management device, which can write multiple transaction data at a time and improve the writing speed of the transaction data to the database system.
[0015] In a possible implementation manner of the first aspect, the blockchain management device is further configured to: synchronously execute sending a plurality of first structured query language (SQL) statements to the database management device and verifying second transaction data, wherein the second transaction data has been stored into the database system before the first transaction data.
[0016] In the possible implementation, the synchronization execution indicates parallel execution, and when the first transaction data is written, the second transaction data that has been written into the database system can be verified synchronously, so that the writing process of the first transaction data and the verification process of the second transaction data can be performed simultaneously. For example, the second transaction data in the block 1, the block 2 and the block 3 has been written into the database system, and the first transaction data in the block 4, the block 5 and the block 6 is being written, so that the writing of the second transaction data in the block 4, the block 5 and the block 6 and the verification of the first transaction data in the block 1, the block 2 and the block 3 can be performed simultaneously. As can be seen, the first aspect can perform the writing and verification processes in parallel for different transaction data, and the processing speed of the transaction data is improved.
[0017] In a possible implementation of the first aspect, the plurality of first SQL statements are sent in parallel by the blockchain management device.
[0018] In the possible implementation, the plurality of first transaction data corresponding to the plurality of first SQL statements can belong to a plurality of blocks or belong to one block, and the plurality of first transaction data can include at least two first transaction data in the same block. The blockchain management device can send the plurality of first SQL statements in parallel when sending the first SQL statements, and the database management device can perform the writing of the first transaction data in parallel, that is, perform the storage process of the plurality of first transaction data in parallel. In addition, for each block, the transaction data can be written in batches, so that the speed of writing the transaction data into the database management device can be greatly improved.
[0019] In a possible implementation of the first aspect, the blockchain management device is configured to: send a second SQL statement to the database management device, the second SQL statement including a second field, a block number and a transaction number of a transaction data to be verified, and the second field indicating the database management device to return validity information related to the transaction data to be verified.
[0020] The database management device is further configured to: return the validity information according to the second field, the block number and the transaction number of the transaction data to be verified.
[0021] The blockchain management device is configured to: receive the validity information returned by the database management device, and verify the transaction data to be verified according to the validity information.
[0022] In the possible implementation, the database management device can return the validity information according to the block number and the transaction number of the transaction data to be verified. The validity information can be the validity information of the latest transaction data generated before the transaction data to be verified. The returned validity information can also be at least one primary key and at least one corresponding validity information, or a database view table including at least one primary key and at least one corresponding validity information. The database view table can be filtered from a target table. The target table includes a plurality of transaction data relationship rows, and each relationship row includes a plurality of attribute information of a transaction data. In this application, the transaction data to be written can be written while the written transaction data is verified. Therefore, in the target table, the plurality of attribute information of some transaction data is generated before the transaction data to be verified, and the plurality of attribute information of some transaction data is generated after the transaction data to be verified. The plurality of attribute information of the transaction data generated after the transaction data to be verified does not affect the verification of the transaction data to be verified, so only the attribute information of the transaction data generated before the transaction data to be verified needs to be filtered. Considering that the transaction data generated before includes a plurality of transaction data of the same primary key, for example, an account name or a card number, the plurality of transaction data of the same primary key can be understood as the data generated by a plurality of transaction operations of the same account name. Because a plurality of operations can cause the data in the account name to be updated continuously, only the transaction data generated by the last transaction operation is meaningful to the transaction data to be verified. Therefore, the database view table can include the attribute information of the latest transaction data, and the latest transaction data refers to the data generated by the last transaction of the same primary key before the transaction data to be verified. In the case where the database management device does not know which primary key the transaction data verified by the blockchain management device belongs to, the database view table returns the attribute information of the latest transaction data of each primary key generated before the transaction data to be verified. During verification, if the validity information of the latest transaction data indicates that the latest transaction data is invalid, the transaction data to be verified is invalid. If the database management device returns the database view table, the blockchain management device first confirms whether the transaction data indicated by the description information in the database view table is valid. If the transaction data is valid, the transaction data to be verified is verified again. If the transaction data is invalid, it indicates that the previous transaction data on which the transaction data to be verified depends is incorrect, and the current transaction is necessarily invalid. Then, the transaction data to be verified is verified again, which improves the accuracy of the verification of the transaction data.
[0023] In a possible implementation of the first aspect, the blockchain management device is further configured to: send a third SQL statement to the database management device, the third SQL statement including a third field, the block number and the transaction number of the transaction data that fails the verification, and the third field indicating modification of the validity information.
[0024] The database management device is further configured to modify the validity information of the failed transaction data to invalid according to the third field and the block number and the transaction number of the failed transaction data.
[0025] In this possible implementation manner, when the transaction data fails to be verified, it indicates that the transaction data is invalid transaction data, but the transaction data has been written into the database management device, and thus the database management device needs to be notified to modify "true" in the isvalid column of the target table of the transaction data to "false". In this way, when there is a query for the transaction data, the corresponding result that the transaction data is invalid or the transaction data does not exist can be returned.
[0026] In a possible implementation manner of the first aspect, the blockchain management device is further configured to re-verify transaction data verified after the failed transaction data.
[0027] In this possible implementation manner, if other transaction data is verified after the failed transaction data, in order to ensure the accuracy of these transaction data, the present application re-verifies the transaction data verified after the failed transaction data, thereby improving the accuracy of transaction data verification.
[0028] In a possible implementation manner of the first aspect, the blockchain management device is further configured to send a fourth SQL statement to the database management device, the fourth SQL statement including a fourth field, and the fourth field indicating to clean up data.
[0029] The database management device is further configured to clean up expired transaction data or invalid transaction data and attribute information of the cleaned transaction data according to the fourth field.
[0030] In this possible implementation manner, the expired transaction data can be data generated by a previous transaction, which basically has no value after a subsequent transaction operation occurs for the account. The expired transaction data can be determined according to the time when the historical transaction data is generated. The invalid data can be the failed transaction data described above. Regularly cleaning up the expired transaction data or the invalid transaction data can reduce the size of the target table and improve the utilization rate of storage resources.
[0031] The second aspect of the application provides a data processing method based on a blockchain. The method is applied to a blockchain management device of the data processing system of the first aspect. The blockchain system further includes a block node and a database management device. The method includes: receiving one or more blocks sent by the block node, each block carrying a plurality of transaction data; sending a plurality of first structured query language (SQL) statements to the database management device, wherein each first SQL statement includes a first transaction data in the transaction data carried by one or more blocks, a block number of the first transaction data, and a transaction number of the first transaction data, the block number representing a block identifier of a block to which the first transaction data belongs, and the transaction number representing an index of the first transaction data in the plurality of transaction data of the block, and the first SQL statement further includes a first field indicating storage of the first transaction data; receiving a message returned by the database management device that the first transaction data has been stored, and verifying the first transaction data according to the block number and the transaction number of the first transaction data.
[0032] In a possible implementation manner of the second aspect, the method further includes: synchronously performing the sending of the plurality of first SQL statements to the database management device and the verifying of the second transaction data, the second transaction data having been stored into the database system before the first transaction data.
[0033] In a possible implementation manner of the second aspect, the sending of the plurality of first SQL statements to the database management device includes: sending the plurality of first SQL statements to the database management device in parallel.
[0034] In a possible implementation manner of the second aspect, the verifying of the first transaction data or the verifying of the second transaction data includes: sending a second SQL statement to the database management device, the second SQL statement including a second field, a block number, and a transaction number of a transaction data to be verified, the second field indicating that the database management device returns validity information related to the transaction data to be verified, the transaction data to be verified being the first transaction data or the second transaction data; receiving the validity information returned by the database management device; and verifying the transaction data to be verified according to the validity information.
[0035] In a possible implementation manner of the second aspect, the method further includes: sending a third SQL statement to the database management device, the third SQL statement including a third field, a block number, and a transaction number of a transaction data that fails to be verified, the third field indicating modification of the validity information.
[0036] In a possible implementation manner of the second aspect, the method further includes: re-verifying transaction data verified after the transaction data that fails to be verified.
[0037] In a possible implementation manner of the second aspect, the method further includes: sending a fourth SQL statement to the database management device, the fourth SQL statement including a fourth field, and the fourth field indicating the cleaned data.
[0038] The second aspect and the content in any possible implementation manner of the second aspect can be understood with reference to the corresponding content in the first aspect and any possible implementation manner of the first aspect, which will not be repeated here.
[0039] The third aspect of the present application provides a data processing method based on a blockchain. The method is applied to the data processing system described above, and the data processing system further includes a blockchain management device. The method includes: receiving a plurality of first structured query language (SQL) statements from the blockchain management device, wherein each first SQL statement includes a first transaction data carried by one or more blocks, a block number of the first transaction data, and a transaction number of the first transaction data. The block number represents a block identifier of a block to which the first transaction data belongs. The transaction number represents an index of the first transaction data in a plurality of transaction data of the block. The first SQL statement further includes a first field, and the first field indicates that the first transaction data is stored. The method further includes: storing the first transaction data according to the first field, and storing a plurality of attribute information of the first transaction data. The plurality of attribute information includes the block number, the transaction number, and validity information of the first transaction data. The method further includes: returning a message indicating that the first transaction data is stored to the blockchain management device.
[0040] In a possible implementation manner of the third aspect, the method further includes: receiving a second SQL statement from the blockchain management device, the second SQL statement including a second field, a block number, and a transaction number of a transaction data that needs to be verified. The second field indicates that the database management device returns validity information related to the transaction data that needs to be verified. The method further includes: returning the validity information to the blockchain management device according to the second field, the block number, and the transaction number of the transaction data that needs to be verified.
[0041] In a possible implementation manner of the third aspect, the method further includes: receiving a third SQL statement from the blockchain management device, the third SQL statement including a third field, a block number, and a transaction number of a transaction data that fails verification. The third field indicates that the validity information is modified. The method further includes: modifying the validity information of the transaction data that fails verification to invalid according to the third field, the block number, and the transaction number of the transaction data that fails verification.
[0042] In a possible implementation form of the third aspect, the method further includes: receiving a fourth SQL statement from the blockchain management device, the fourth SQL statement including a fourth field, the fourth field indicating to clean up the data; and cleaning up the expired transaction data or the invalid transaction data according to the fourth field, and attribute information of the cleaned transaction data.
[0043] The third aspect and the content in any possible implementation form of the third aspect can be understood with reference to the corresponding content in the first aspect and any possible implementation form of the first aspect, which will not be repeated here.
[0044] The fourth aspect of the present application provides a blockchain management device having a function of implementing the method of the second aspect or any possible implementation form of the second aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, for example: a receiving unit, a processing unit and a sending unit.
[0045] The fifth aspect of the present application provides a database management device having a function of implementing the method of the third aspect or any possible implementation form of the third aspect. The function can be implemented by hardware, or by hardware executing corresponding software. The hardware or software includes one or more modules corresponding to the above functions, for example: a receiving unit, a sending unit and a processing unit.
[0046] The sixth aspect of the present application provides a blockchain management device including at least one processor, a memory, an input / output (I / O) interface, and computer-executable instructions stored in the memory and executable on the processor, when the computer-executable instructions are executed by the processor, the processor executes the method of the second aspect or any possible implementation form of the second aspect.
[0047] The seventh aspect of the present application provides a database management device including at least one processor, a memory, an input / output (I / O) interface, and computer-executable instructions stored in the memory and executable on the processor, when the computer-executable instructions are executed by the processor, the processor executes the method of the third aspect or any possible implementation form of the third aspect.
[0048] The eighth aspect of the present application provides a computer-readable storage medium storing one or more computer-executable instructions, when the computer-executable instructions are executed by the processor, the processor executes the method of the second aspect or any possible implementation form of the second aspect.
[0049] The ninth aspect of the present application provides a computer readable storage medium storing one or more computer-executable instructions that, when executed by a processor, cause the processor to perform the method of the third aspect or any possible implementation of the third aspect.
[0050] The tenth aspect of the present application provides a computer program product storing one or more computer-executable instructions that, when executed by a processor, cause the processor to perform the method of the second aspect or any possible implementation of the second aspect.
[0051] The eleventh aspect of the present application provides a computer program product storing one or more computer-executable instructions that, when executed by a processor, cause the processor to perform the method of the third aspect or any possible implementation of the third aspect.
[0052] The twelfth aspect of the present application provides a chip system including at least one processor configured to implement the functions of the second aspect or any possible implementation of the second aspect. In one possible design, the chip system can further include a memory configured to store necessary program instructions and data for the blockchain management device. The chip system can be formed by a chip, or can include the chip and other discrete devices.
[0053] The thirteenth aspect of the present application provides a chip system including at least one processor configured to implement the functions of the third aspect or any possible implementation of the third aspect. In one possible design, the chip system can further include a memory configured to store necessary program instructions and data for the database management system. The chip system can be formed by a chip, or can include the chip and other discrete devices.
[0054] The embodiments of the present application perform verification on the transaction data only after the transaction data is written to the database management device, which can write multiple pieces of transaction data at a time and improve the writing speed of the transaction data to the database system. BRIEF DESCRIPTION OF DRAWINGS
[0055] Figure 1A FIG. 1 is an embodiment schematic diagram of a blockchain-based data processing system provided by the embodiments of the present application;
[0056] Figure 1B FIG. 2 is another embodiment schematic diagram of a blockchain-based data processing system provided by the embodiments of the present application;
[0057] Figure 1C FIG. 3 is another embodiment schematic diagram of a blockchain-based data processing system provided by the embodiments of the present application; FIG. 4 is another embodiment schematic diagram of a blockchain-based data processing system provided by the embodiments of the present application;
[0058] Figure 2 FIG. 1 is an embodiment schematic diagram of a data processing method based on a blockchain provided by an embodiment of the present application;
[0059] Figure 3 FIG. 2 is another embodiment schematic diagram of a data processing method based on a blockchain provided by an embodiment of the present application;
[0060] Figure 4 FIG. 3 is an embodiment schematic diagram of a scene example provided by an embodiment of the present application;
[0061] Figure 5 FIG. 4 is another embodiment schematic diagram of a scene example provided by an embodiment of the present application;
[0062] Figure 6 FIG. 5 is an embodiment schematic diagram of a blockchain management device provided by an embodiment of the present application;
[0063] Figure 7 FIG. 6 is an embodiment schematic diagram of a database management device provided by an embodiment of the present application;
[0064] Figure 8 FIG. 7 is a structure schematic diagram of a computer device provided by an embodiment of the present application. DETAILED DESCRIPTION
[0065] The embodiments of the present application will be described in detail with reference to the drawings, obviously, the described embodiments are only a part of the embodiments of the present application, not all the embodiments. Those skilled in the art can know that with the development of technology and the appearance of new scene, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems.
[0066] The terms "first", "second", "third", "fourth" and the like in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, not necessarily to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device including a series of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0067] The embodiments of the present application provide a data processing method based on a blockchain, which is used to improve the speed of writing transactions in the blockchain to a database system. The embodiments of the present application also provide corresponding devices, computer storage media and computer program products, etc. The following are described in detail respectively.
[0068] The data processing system provided in the embodiments of the present application can be understood with reference to the structure of the data processing system Figure 1A .
[0069] As shown in Figure 1A , the blockchain-based data processing system includes a blockchain system and a database system. The blockchain system includes a block generation node and a blockchain management device. The database system includes a database management system (DBMS) and a data storage. In the present application, the DBMS can also be referred to as a database management device. The block generation node is in communication connection with the blockchain management device, and is configured to package transaction data generated by a terminal device into a block and send the block to the blockchain management device. The blockchain management device is in communication connection with the DBMS, and is configured to send a structured query language (SQL) statement to the DBMS, wherein the SQL statement contains relevant information of the transaction data. The DBMS is in communication connection with the data storage, and is configured to store the transaction data into the data storage and manage the transaction data in the data storage.
[0070] The block generation node and the blockchain management device in the embodiments of the present application can be independent physical machines, such as servers, or virtual machines (VMs) or containers. The terminal device (also referred to as a user equipment (UE)) is a device with wireless transceiving function, which can be deployed on land, including indoors or outdoors, handheld or vehicle-mounted; can also be deployed on water surface (such as ships, etc.); and can also be deployed in the air (such as airplanes, balloons and satellites, etc.). The terminal can be a mobile phone, a pad, a computer with wireless transceiving function, an automatic teller machine (ATM) and other terminals with payment function.
[0071] The method provided by the embodiments of the present application can be applied to a single blockchain system and database system or a clustered blockchain system and database system. A database system generally consists of the following three parts: (1) a database (DB), which refers to a collection of organized and shareable data stored in a computer for a long time. The data in the database is organized, described and stored according to a certain mathematical model, has less redundancy, higher data independence and easy scalability, and can be shared by various users. (2) Hardware, including data storage required for storing data, such as memory and / or disk. (3) Software, including a DBMS, which is the core software of a database system and is a system software for scientifically organizing and storing data and efficiently obtaining and maintaining data. A database engine is the core component of a DBMS.
[0072] Specifically, the above Figure 1A is a schematic diagram of a single blockchain system and database system. In the single blockchain system and database system, the blockchain management device writes transaction data to the data storage through a DBMS. The database management system is used to provide services such as writing, querying, deleting and modifying the database, and the database management system stores data into the data storage. In the single blockchain system, the block node and the blockchain management device can be located on a single server. In the database system, the database management system and the data storage are usually located on a single server, such as a symmetric multi-processor (SMP) server. The SMP server includes multiple processors, and all the processors share resources such as a bus, memory and an I / O system. The functions of the database management system can be realized by one or more processors executing programs in the memory.
[0073] Figure 1B is a schematic diagram of a clustered blockchain system and database system using a shared-storage architecture. The blockchain system includes one block node and multiple blockchain devices, of course, there can be multiple block nodes, or one block node corresponding to one blockchain device. The correspondence between the block node and the blockchain device is not limited in the present application. The database system includes multiple nodes (such as Figure 1BThe database system can be a cluster database system. The cluster database system can include a plurality of nodes (e.g., node 1-N in FIG. 1). Each node can be deployed with a database management system to provide services such as query and modification of databases for users. The plurality of database management systems can store shared data in a shared data storage, and perform read and write operations on the data in the data storage through a switch. One blockchain device can correspond to one database management system. The shared data storage in the database system can be a shared disk array. The nodes in the cluster database system can be physical machines such as database servers, or virtual machines or containers running on abstracted hardware resources. When the nodes are virtual machines or containers, the database management system deployed in the nodes is a DBMS instance, which can be a process or a thread. When the nodes are physical machines, the switch can be a storage area network (SAN) switch, an Ethernet switch, a fiber switch, or other physical switching devices. When the nodes are virtual machines or containers, the switch can be a virtual switch.
[0074] Figure 1C FIG. 1 shows a schematic diagram of a cluster database system with a shared-nothing architecture. Each node has its own hardware resources (e.g., data storage), operating system, and database, and the nodes communicate with each other through a network. In this architecture, data is allocated to each node according to the database model and application characteristics, and query tasks are divided into several parts and executed in parallel on all nodes, with each other computing cooperatively to provide database services as a whole. All communication functions are implemented on a high-bandwidth network interconnection system. Figure 1B As described for the shared-storage architecture cluster database system, the nodes can be physical machines or virtual machines.
[0075] In all embodiments of the present application, the data storage of the database system includes, but is not limited to, solid state drives (SSDs), disk arrays, or other types of non-transitory computer readable media. Figures 1A-1C Although no database is shown in FIG. 1, it should be understood that the database is stored in the data storage. Those skilled in the art can understand that a database system can include fewer or more components than those shown in FIG. 1, or include different components from those shown in FIG. 1. Figures 1A-1C Although no database is shown in FIG. 1, it should be understood that the database is stored in the data storage. Those skilled in the art can understand that a database system can include fewer or more components than those shown in FIG. 1, or include different components from those shown in FIG. 1. Figures 1A-1C Although no database is shown in FIG. 1, it should be understood that the database is stored in the data storage. Those skilled in the art can understand that a database system can include fewer or more components than those shown in FIG. 1, or include different components from those shown in FIG. 1. Figures 1A-1C Only components more relevant to the implementation disclosed in the embodiments of the present application are shown. For example, although the database system in FIG. 1 includes a plurality of nodes, the database system can include fewer or more nodes than those shown in FIG. 1. Figure 1B Although no database is shown in FIG. 1, it should be understood that the database is stored in the data storage. Those skilled in the art can understand that a database system can include fewer or more components than those shown in FIG. 1, or include different components from those shown in FIG. 1. Figure 1CFour nodes have been described, but one skilled in the art can understand that a cluster database system can include any number of nodes. The database management system function of each node can be implemented by a suitable combination of software, hardware and / or firmware running on each node.
[0076] In the above blockchain-based data processing system, the blockchain-based data processing method of the present application is executed by the blockchain management device and the database management device. The following describes the blockchain-based data processing method of the present application in conjunction with Figure 2 The blockchain-based data processing method provided by the embodiments of the present application is described.
[0077] As shown in Figure 2 An embodiment of the blockchain-based data processing method provided by the embodiments of the present application includes:
[0078] 101. The blockchain management device receives one or more blocks sent by the block node, wherein each block carries a plurality of transaction data.
[0079] In the blockchain system, data is stored in the form of blocks, and a block includes a plurality of transaction data. These transaction data are sequentially stored in the block, and a block is a collection of a plurality of continuously generated transaction data. "Transaction data" refers to data generated by a user in combination with business operations.
[0080] In the present application, a plurality of includes two or more, which can also be described as at least two.
[0081] Optionally, 102, the blockchain management device determines the block number of each transaction data belonging to the block and the transaction number in the belonging block.
[0082] The block number represents the block identification of the block to which a transaction data belongs, and the transaction number represents the index of a transaction data in the plurality of transaction data in the belonging block.
[0083] Because each transaction data has a belonging block, and the number of blocks in the blockchain system is unique, each transaction data has a corresponding block number. The transaction data in the same block is sequentially numbered, which is the transaction number of the transaction data. The transaction number is the index of the transaction data in the block, which can also be represented as the sequential identification or position identification of the transaction data in the block. The block number of each transaction data in the same block is different, and the transaction number in different blocks can be repeated. Therefore, the block number and the transaction number can uniquely locate a transaction data. The blockchain management device can determine the block number and the transaction number of each transaction data when analyzing the transaction data in the block.
[0084] 103、The blockchain management device sends a plurality of first structured query language (SQL) statements to the database management device, and the database management device receives the plurality of first SQL statements.
[0085] Each of the first SQL statements includes one of transaction data carried by one or more blocks, and a block number and a transaction number of the one of the transaction data, the block number indicating a block identifier of a block to which the one of the transaction data belongs, and the transaction number indicating an index of the one of the transaction data in a plurality of transaction data of the block, and the first SQL statement further includes a first field indicating storage of the one of the transaction data.
[0086] In the present application, the database system is a SQL-supported database system. The blockchain management device sends each of the transaction data in the form of the first SQL statement to the DBMS, and the DBMS parses the SQL statement and then completes writing of the transaction data to the data storage. The first field in the first SQL statement indicates storage of the transaction data, and the first SQL statement includes the block number and the transaction number of the transaction data, so the database management device stores the transaction data in the data storage. The database management device can maintain a plurality of attribute information of each of the transaction data in the form of a corresponding relationship, and can maintain the attribute of a plurality of transaction data in the form of a target table, and the attribute in the target table can add several attributes such as a "block number (block_num)" column and a "transaction number (tx_num)" column on the basis of the original table for maintaining the blockchain data, and can further add a "deletion operation (isdelete)" column and a "validity (isvalid)" column. If it is a deletion operation, the information of the column can be filled with "true", and if it is not a deletion operation, it can be filled with "false". The isvalid column is filled with "true" when the transaction data is initially written. Of course, the attribute in the target table is not limited to the above-mentioned several attributes, and can further include a start position of a storage address of the transaction data in the data storage and a length of the transaction data, and the like.
[0087] The target table can be understood with reference to an example listed in Table 1.
[0088] Table 1: Target table
[0089] Primary Key Block Number Transaction Number Delete (isdelete) Valid (IsValid) Luo San 3 0 true true Luo San 3 100 false true Luo San 6 2 false true Long Da 8 4 false true Figure 3 6 2 Figure 3 Figure 2
[0090] The deletion column (isDelete): indicates that if the transaction data corresponds to a delete operation, the identification bit (isDelete) of the transaction data in the corresponding row of the target table is true.
[0091] isvalid: initially all true, if the transaction data of the row is invalid, the isValid of the row is modified to false, indicating that the transaction data corresponding to the row is invalid.
[0092] The primary key is a unique identifier in the database management device for recording transaction data corresponding to an object. The primary key is used to describe a property of the transaction data, such as account name or card number.
[0093] Table 1 is only an example, and in practice, the number of rows of the target table will be much larger.
[0094] 104、The database management device stores a first transaction data according to the first field, and stores a plurality of attribute information of the first transaction data.
[0095] The plurality of attribute information includes a block number, a transaction number of the first transaction data, and validity information of the first transaction data.
[0096] The corresponding relationship can be understood by referring to any row in Table 1.
[0097] 105、The database management device returns a message indicating that the first transaction data has been stored to the blockchain management device. Correspondingly, the blockchain management device receives the message returned by the database management device indicating that the first transaction data has been stored.
[0098] The message returned by the database management device to the blockchain management device can have multiple messages, and the multiple messages indicating that the first transaction data has been stored indicate that the first transaction data in the plurality of first SQL statements has been stored in the database system.
[0099] 106、The blockchain management device verifies the first transaction data according to the block number and the transaction number of the first transaction data.
[0100] The blockchain management device is used to verify whether the transaction data in the block is valid. Whether the transaction data is valid usually refers to whether the transaction data is successfully operated, such as a transfer transaction. If the transfer fails, the transaction data generated by the transfer is invalid.
[0101] In the embodiments of the present application, the verification of the transaction data is performed after the transaction data is written into the database management device. In this way, multiple transaction data can be written at a time, and the writing speed of the transaction data to the database system can be improved.
[0102] The blockchain management device is also used for: synchronously executing sending a plurality of first structured query language (SQL) statements to the database management device and verifying second transaction data, the second transaction data has been stored into the database system before the first transaction data.
[0103] In the present application, synchronous execution means parallel execution, when writing the first transaction data, the second transaction data previously written into the database system can be verified synchronously, so that the writing process of the first transaction data and the verification process of the second transaction data can be performed at the same time. For example, the second transaction data in block 1, block 2 and block 3 has been written into the database system, and the first transaction data in block 4, block 5 and block 6 is being written, so that the writing of the second transaction data in block 4, block 5 and block 6 and the verification of the first transaction data in block 1, block 2 and block 3 can be performed at the same time. It can be seen that the first aspect can perform the writing and verification processes in parallel for different transaction data, thereby improving the processing speed of transaction data.
[0104] Another embodiment of the above-mentioned blockchain-based data processing method can also refer to Primary Key for understanding.
[0105] As Block Number shown, another embodiment of the blockchain-based data processing method comprises:
[0106] 201. The block node receives the transaction data sent by the terminal device.
[0107] 202. The block node packs multiple transaction data into a block.
[0108] Generally, the number of transaction data included in one block is pre-configured, for example, one block includes 500 transaction data.
[0109] 203. The block node sends one or more blocks to the blockchain management device, and correspondingly, the blockchain management device receives one or more blocks.
[0110] 204. The blockchain management device parses each transaction data from the block.
[0111] When the blockchain management device parses the transaction data from the block, the block number of the block to which the transaction data belongs and the transaction number of the transaction data in the block are obtained.
[0112] 205. The blockchain management device sends multiple first SQL statements to the database management device.
[0113] 206. The database management device parses each first SQL statement and writes the block number and transaction number of the transaction data into the target table.
[0114] 207. The database management device stores the transaction data into the data storage.
[0115] The above steps 203 to 207 can refer to Transaction NumberThe corresponding embodiments are understood.
[0116] 208、The blockchain management device sends a second SQL statement to the database management device.
[0117] The second SQL statement includes a second field, a block number and a transaction number of the transaction data to be verified, and the second field indicates that the database management device returns the validity information related to the transaction data to be verified. The transaction data to be verified can be the first transaction data or the second transaction data.
[0118] 209、The database management device determines the validity information related to the transaction data to be verified according to the second field, the block number and the transaction number of the transaction data to be verified.
[0119] In the embodiments of the present application, the validity information can be the validity information of the latest transaction data generated before the transaction data to be verified, and the returned validity information can also be corresponding to one validity information for one primary key, wherein one or more validity information is the validity information of the latest transaction data corresponding to at least one primary key generated before the transaction data to be verified, and the primary key is an identifier used by the database management device to record the transaction data corresponding to an object.
[0120] The process can also return a database view table including the validity information of the latest transaction data corresponding to one or more primary keys generated before the transaction data to be verified.
[0121] The process of determining the corresponding database view table from the target table is a data filtering process, and the target table includes attribute information of many rows of transaction data.
[0122] Because the transaction data to be written can be written and the written transaction data can be verified at the same time in the present application, some attribute information of some transaction data in the target table is generated before the transaction data to be verified, and some attribute information of some transaction data is generated after the transaction data to be verified. For the attribute information of the transaction data generated after the transaction data to be verified, it does not affect the verification of the transaction data to be verified, so only the attribute information of the transaction data generated before the transaction data to be verified needs to be filtered.
[0123] Considering that the transaction data generated before includes multiple pieces of transaction data of the same primary key, for example, the primary key can be an account name, and the multiple pieces of transaction data of the same primary key can be understood as data generated by multiple transaction operations of the same account name, because multiple operations will cause the data in the account name to be updated constantly, only the multiple attribute information of the transaction data generated by the last transaction operation is meaningful to the transaction data to be verified. Therefore, the database view table can include the multiple attribute information of the latest transaction data, and the latest transaction data refers to the data generated by the last transaction of the same primary key before the transaction data to be verified. For example, under an account name, 1000 yuan is deposited for the first time, the balance under the account name is 1000 yuan. 500 yuan is transferred out for the second time, and the balance under the account name is 500 yuan. 300 yuan is deposited for the third time, and the balance under the account name is 800 yuan. Therefore, only the transaction data of the third time is meaningful, and the transaction data of the first two times has been modified by the transaction after that, because the transaction data to be verified is generated after that, so only the transaction data of the third time has reference significance to the transaction data to be verified.
[0124] In the case where the database system does not know which primary key the transaction data verified by the blockchain management device belongs to, the database view table returns the attribute information of the latest transaction data of each primary key generated before the transaction data to be verified.
[0125] The above process can be understood with reference to the following example. As the block number of the verified transaction data is 5 and the transaction number is 1, it can be represented as {5, 1}, and the database management device can filter out the database view table shown in Table 2 from Table 1 according to the filtering rules described above.
[0126] Table 2: Database view table filtered out according to {5, 1}
[0127] Delete (isdelete) Valid (IsValid) Luo San false true Primary Key 3 100 Block Number Transaction Number
[0128] According to the block number 5 and the transaction number 1, it can be determined from Table 1 that there are two rows located in block 5, which are the first row and the second row, because the transaction number of the first row is 1 and the transaction number of the second row is 100. It can be determined that the transaction data corresponding to the second row is generated after the transaction data corresponding to the first row, so the transaction data of the last transaction corresponding to the primary key "Luo San" before the block number is 5 and the transaction number is 1 is filtered out in Table 2.
[0129] If there are multiple second SQL statements, one second SQL statement corresponds to one transaction data to be verified. In this way, the database management device will filter out a corresponding database view table for each data to be verified, and one database view table corresponds to one transaction data to be verified.
[0130] For example, in addition to the second SQL statement described above including {5, 1}, another second SQL statement includes {7, 3}, and a second SQL statement includes {8, 5}. According to the principle of screening the database view table corresponding to {5, 1} described above, table 3 can be screened according to {7, 3}, and table 4 can be screened according to {8, 5}.
[0131] Table 3: Database view table screened according to {7, 3}
[0132] Delete (isdelete) Valid (IsValid) Luo San false true Long Da 6 2 false true Primary Key 6 2 Block Number Transaction Number
[0133] From the table 3, it can be seen that two different account names appear in the transactions before block 7, namely "Luo San" and "Long Da". For each account name, the row of the target table corresponding to the last generated transaction data is screened.
[0134] Table 4: Database view table screened according to {8, 5}
[0135] Delete (isdelete) Valid (IsValid) Luo San false true Long Da 8 4 false true Primary Key 6 2 Block Number Transaction Number
[0136] The screening process of table 4 is the same as the screening process of table 2 and table 3 described above, and will not be described here.
[0137] 210、The database management device sends the validity information related to the transaction data to be verified to the blockchain management device, and correspondingly, the blockchain management device receives the validity information related to the transaction data to be verified.
[0138] In the embodiments of the present application, the database view table can also be returned, which includes at least one primary key and at least one corresponding validity information.
[0139] 211、The blockchain management device verifies the transaction data to be verified according to the validity information related to the transaction data to be verified.
[0140] In the embodiments of the present application, the transaction data to be verified can also be verified according to the database view table.
[0141] If the validity information of the latest transaction data in the database view table indicates that the latest transaction data is invalid, the transaction data to be verified is invalid.
[0142] The blockchain management device will first confirm whether the transaction data indicated by the description information in the database view table is valid. If it is valid, the transaction data to be verified is verified again. If it is invalid, it means that the previous transaction data on which the transaction data to be verified depends is wrong, and this transaction must be invalid. Then the transaction data to be verified is verified again, which can improve the accuracy of transaction data verification.
[0143] For example, the balance of an account is 0, the first transaction stores 1000 yuan, but the transaction fails, and the balance of the account is still 0. If the second transaction for the account name is to transfer 500 yuan, the second transaction must be a failed transaction. If it is confirmed that the first transaction fails, there is no need to verify the transaction data of the second transaction, and it can be directly determined that the second transaction is a failed transaction. If the last transaction is successful, it can be confirmed whether the current transaction is successful through data comparison, such as confirming whether the 1000 yuan deposited has been in the balance.
[0144] If the blockchain management device receives multiple database view tables, each database view table can be used for verification. Because each transaction to be verified has a corresponding database view table, multiple transactions in the same block and multiple transactions in different blocks can be verified in parallel, which greatly improves the speed of transaction data verification.
[0145] The multiple transaction data verified in parallel can be transaction data in the same block or transaction data in different blocks.
[0146] 212、The blockchain management device sends a third SQL statement to the database management device.
[0147] The third SQL statement includes a third field, the block number and transaction number of the failed transaction data, and the third field indicates the modification of validity information.
[0148] 213、The database management device modifies the validity information of the failed transaction data to invalid according to the third field, the block number and the transaction number of the failed transaction data.
[0149] As shown in Table 5, this process can be understood by referring to the first row in Table 1, for example. The first row in Table 1 is an entry generated by a delete operation, and the entry is still in the valid state. If the block number and transaction number in the third SQL statement received by the database management device are {3, 0}, the isValid flag in the first row of Table 1 is modified from true to false. In this way, Table 1 becomes Table 5.
[0150] Table 5: Target Table
[0151] Delete (isdelete) Valid (IsValid) Luo San true false Luo San 3 0 false true Luo San 3 100 false true Luo San 6 2 false true Long Da 8 4 false true Primary Key 6 2 Block Number Transaction Number
[0152] 214、The blockchain management device re-verifies the transaction data verified after the failed transaction data.
[0153] If the other transaction data is verified after the transaction data that fails the verification, in order to ensure the accuracy of the transaction data, the application re-verifies the transaction data verified after the transaction data that fails the verification, thereby improving the accuracy of the transaction data verification.
[0154] For example, if the transaction data {3, 1}, {3, 2} and {3, 3} are verified after the transaction data {3, 0} is verified, the transaction data {3, 1}, {3, 2} and {3, 3} need to be re-verified.
[0155] 215. The blockchain management device sends a fourth SQL statement to the database management device.
[0156] The fourth SQL statement includes a fourth field, and the fourth field indicates to clean up the data.
[0157] 216. The database management device cleans up the expired transaction data or the invalid transaction data and the attribute information of the cleaned up transaction data according to the fourth field.
[0158] The expired transaction data can be the data generated by the previous transaction, which basically has no value after the subsequent transaction operation occurs for the account. The expired transaction data can be determined according to the time when the historical transaction data is generated. The invalid data can be the transaction data that fails the verification as described above.
[0159] For example, the transaction data {3, 0} is invalid data, and the invalid data can be deleted, and the first row in the target table can also be deleted. In this way, after the first row is deleted, the table 5 becomes the table 6.
[0160] Table 6: Cleaned up target table
[0161] Delete (isdelete) Valid (IsValid) Luo San false true Luo San 3 100 false true Luo San 6 2 false true Long Da 8 4 false true Figure 4 6 2 Figure 4 Figure 4
[0162] The expired transaction data or the invalid transaction data and the corresponding attribute information are periodically cleaned up, which can reduce the size of the target table and improve the utilization rate of the storage resource.
[0163] In the embodiment of the application, the three stages of writing the transaction data (insert), verifying the transaction data (confirm) and re-verifying the transaction data can be executed in parallel, except that the blocks processed in parallel are different. In the process of parallel execution, the blocks processed in the re-verification stage are the blocks for which the transaction data verification is completed, the blocks processed in the verification stage are the blocks for which the writing is completed, and the blocks processed in the writing stage are the blocks newly sent by the block node.
[0164] In the embodiments of the present application, the blocks in the writing stage are referred to as first blocks, the blocks in the verification stage are referred to as second blocks, and the blocks in the re-verification stage are referred to as third blocks. In the present application, there can be one or more first blocks, and similarly, there can be one or more second blocks and third blocks.
[0165] The parallel execution process of the three stages can be understood with reference to Figure 5 As shown in Figure 6 , there are four first blocks in the writing stage example, namely block 12, block 13, block 14 and block 15, there are eight second blocks in the verification stage example, namely block 4, block 5 to block 11, and there is one third block in the re-verification stage example, which is block 3.
[0166] In the writing stage, the steps 203 to 207 in the above embodiments can be referred to for understanding, in the verification stage, the steps 208 to 213 in the above embodiments can be referred to for understanding, and in the re-verification stage, the step 214 in the above embodiments can be referred to for understanding.
[0167] The blocks in the different stages described above enter the next stage in sequence after the block chain management device completes the task in the stage. For example, the blocks 4, 5 to 11 in the verification stage are sequentially derived from the writing stage, and when the writing stage is completed, they will enter the verification stage in order. For example, Figure 7 Block 11 in Figure 8 As shown in , taking blocks 0, 1 and 2 as an example, these three blocks can enter the verification stage only after completing writing to the database management device.
[0168] Similarly, the block 3 enters the re-verification stage only after completing the task in the verification stage by the block chain management device, and the block 3 has transaction data that fails verification, and only the data verified after the transaction data that fails verification needs to be re-verified.
[0169] The above describes a data processing method based on a block chain, and the following introduces a block chain management device provided by the embodiments of the present application in combination with the drawings.
[0170] As shown in Figures 2-5 , an embodiment of the block chain management device 30 provided by the embodiments of the present application includes: the block chain management device 30 is applied to a data processing system, the block chain system further includes a block generation node and a database management device, and the block chain management device includes:
[0171] The receiving unit 301 is configured to receive one or more blocks sent by the block generation node, and each block carries a plurality of transaction data.
[0172] The sending unit 302 is configured to send a plurality of first structured query language (SQL) statements to the database management device, wherein each first SQL statement comprises a first transaction data carried by one or more blocks, and a block number and a transaction number of the first transaction data, the block number indicating a block identifier of a block to which the first transaction data belongs, and the transaction number indicating an index of the first transaction data in a plurality of transaction data of the block, and the first SQL statement further comprises a first field indicating storage of the first transaction data.
[0173] The receiving unit 301 is further configured to receive a message returned by the database management device, indicating that the first transaction data has been stored.
[0174] The processing unit 303 is configured to verify the first transaction data according to the block number and the transaction number of the first transaction data.
[0175] In the embodiments of the present application, the verification of the transaction data is performed after the transaction data is written into the database management device, so that a plurality of transaction data can be written at one time, and the writing speed of the transaction data to the database system can be improved.
[0176] Optionally, the processing unit 303 is further configured to synchronously perform the sending of the plurality of first SQL statements to the database management device and the verification of the second transaction data, the second transaction data having been stored into the database system before the first transaction data.
[0177] Optionally, the sending unit 302 is configured to send the plurality of first SQL statements to the database management device in parallel.
[0178] Optionally, the sending unit 302 is further configured to send a second SQL statement to the database management device, the second SQL statement comprising a second field, a block number and a transaction number of a transaction data to be verified, and the second field indicating that the database management device returns validity information related to the transaction data to be verified, the transaction data to be verified being the first transaction data or the second transaction data.
[0179] The receiving unit 301 is further configured to receive the validity information returned by the database management device.
[0180] The processing unit 303 is configured to verify the transaction data to be verified according to the validity information.
[0181] Optionally, the sending unit 302 is further configured to send a third SQL statement to the database management device, the third SQL statement comprising a third field, a block number and a transaction number of a transaction data of which the verification fails, and the third field indicating modification of the validity information.
[0182] Optionally, the processing unit 303 is further configured to re-verify the transaction data that is verified after the transaction data that fails the verification.
[0183] Optionally, the sending unit 302 is further configured to send a fourth SQL statement to the database management device, the fourth SQL statement comprising a fourth field, the fourth field indicating the clean data.
[0184] The blockchain management device 30 described above can be understood with reference to the corresponding description in the foregoing method embodiment part, which will not be repeated here.
[0185] As shown in Figure 8 An embodiment of the database management device 40 provided by the present application is provided, which comprises a data processing system, and the data processing system further comprises a blockchain management device, and the database management device 40 comprises:
[0186] The receiving unit 401 is configured to receive a plurality of first structured query language (SQL) statements from the blockchain management device, wherein each first SQL statement comprises a first transaction data carried by one or more blocks, and a block number and a transaction number of the first transaction data, the block number indicating a block identifier of a block to which the first transaction data belongs, and the transaction number indicating an index of the first transaction data in a plurality of transaction data of the block, and the first SQL statement further comprises a first field, the first field indicating storage of the first transaction data.
[0187] The processing unit 402 is configured to store the first transaction data according to the first field, and store a plurality of attribute information of the first transaction data, the plurality of attribute information comprising the block number, the transaction number of the first transaction data, and validity information of the first transaction data.
[0188] The sending unit 403 is configured to return a message indicating that the first transaction data has been stored to the blockchain management device.
[0189] Optionally, the receiving unit 401 is further configured to receive a second SQL statement from the blockchain management device, the second SQL statement comprising a second field, a block number and a transaction number of a transaction data that needs to be verified, and the second field indicating that the database management device returns the validity information.
[0190] The processing unit 402 is further configured to determine the validity information according to the second field, the block number and the transaction number of the transaction data that needs to be verified.
[0191] The sending unit 403 is configured to send the validity information to the blockchain management device.
[0192] Optionally, the receiving unit 401 is further configured to receive a third SQL statement from the blockchain management device, the third SQL statement comprising a third field, a block number and a transaction number of the failed transaction data, and the third field indicating modification of the validity information.
[0193] The processing unit 402 is further configured to modify the validity information of the failed transaction data as invalid according to the third field, the block number and the transaction number of the failed transaction data.
[0194] Optionally, the receiving unit 401 is further configured to receive a fourth SQL statement from the blockchain management device, the fourth SQL statement comprising a fourth field, and the fourth field indicating cleaning of data.
[0195] The processing unit 402 is further configured to clean the expired transaction data or the invalid transaction data according to the fourth field, and a plurality of attribute information of the cleaned transaction data.
[0196] The database management device 40 described above can be understood with reference to the corresponding description of the database management device in the foregoing method embodiment part, which will not be repeated here.
[0197] Figures 2-5 As shown, it is a possible logical structure schematic diagram of the computer device 50 provided by the embodiments of the present application. The computer device 50 can be the blockchain management device 30 and the database management device 40 described above. The computer device 50 comprises a processor 501, a communication interface 502, a memory 503 and a bus 504. The processor 501, the communication interface 502 and the memory 503 are connected with each other through the bus 504. In the embodiments of the present application, the processor 501 is configured to control and manage the actions of the blockchain management device 30 or the database management device 40, for example, the processor 501 is configured to execute the processes of transaction data parsing, verification, re-verification and target table maintenance in the method embodiments of the present application, and the communication interface 502 is configured to support the communication of the blockchain management device 50. The memory 503 is configured to store the program code and data of the blockchain management device 50. Figures 2-5
[0198] The processor 501 can be a central processing unit, a general purpose processor, a digital signal processor, an application specific integrated circuit, a field programmable gate array, or other programmable logic device, transistor logic, hardware components, or any combination thereof. It can implement or execute various example logical blocks, modules, and circuits described in connection with the disclosure. The processor 501 can also be a combination of computing components, such as one or more microprocessors, a combination of a digital signal processor and a microprocessor, and so on. The bus 504 can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, and the like. The bus can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, Figures 2-5 Only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.
[0199] In another embodiment of the present application, a computer readable storage medium is also provided, and the computer readable storage medium stores computer executable instructions. When the processor of the device executes the computer executable instructions, the device executes the above-mentioned The data processing method based on the blockchain.
[0200] In another embodiment of the present application, a computer program product is also provided, and the computer program product includes computer executable instructions stored in a computer readable storage medium. When the processor of the device executes the computer executable instructions, the device executes the above-mentioned The data processing method based on the blockchain.
[0201] In another embodiment of the present application, a chip system is also provided, and the chip system includes a processor for implementing the above-mentioned The data processing method based on the blockchain. In a possible design, the chip system can also include a memory for storing the necessary program instructions and data of the inter-process communication device. The chip system can be composed of a chip, or can include a chip and other discrete devices.
[0202] Those skilled in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the embodiments of the present application.
[0203] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the system, device and unit described above can refer to the corresponding processes in the foregoing method embodiments, which will not be repeated here.
[0204] In several embodiments provided in the embodiments of the present application, it should be understood that the disclosed system, device and method can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.
[0205] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the embodiments of the present application.
[0206] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit.
[0207] If the functions are realized in the form of software function units and sold or used as independent products, they can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the embodiments of the present application essentially or say the parts that make contributions to the prior art or parts of the technical solutions can be embodied in the form of software product, and the computer software product is stored in a storage medium, including a plurality of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute all or part of the steps of the embodiments of the present application. The foregoing storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and various program codes that can be stored in the medium.
[0208] The above merely illustrates the specific implementation of the embodiments of the present application, but the protection scope of the embodiments of the present application is not limited to this. Any person skilled in the art can easily think of the changes or replacements within the technical range disclosed by the embodiments of the present application, which should be covered in the protection scope of the embodiments of the present application. Therefore, the protection scope of the embodiments of the present application should be subject to the protection scope of the claims.
Claims
1. A data processing system, characterized by The data processing system comprises a block node, a blockchain management device and a database management device; The blockchain management device is configured to receive one or more blocks sent by the block node, each block carrying a plurality of transaction data; The blockchain management device is configured to send a plurality of first structured query language (SQL) statements to the database management device, wherein each first SQL statement comprises a first transaction data in the transaction data carried by the one or more blocks, a block number of the first transaction data, and a transaction number of the first transaction data, the block number representing a block identification of a block to which the first transaction data belongs, and the transaction number representing an index of the first transaction data in the plurality of transaction data in the block, and the first SQL statement further comprises a first field indicating storage of the first transaction data; The database management device is configured to store the first transaction data according to the first field, and store a plurality of attribute information of the first transaction data, the plurality of attribute information comprising the block number, the transaction number, and validity information of the first transaction data; The database management device is configured to return a message indicating that the first transaction data has been stored to the blockchain management device; The blockchain management device is further configured to receive the message indicating that the first transaction data has been stored returned by the database management device, and verify the first transaction data according to the block number and the transaction number of the first transaction data.
2. The data processing system of claim 1, wherein The blockchain management device is further configured to synchronously execute the sending of the plurality of first SQL statements to the database management device and the verification of the second transaction data, which has been stored into the database system before the first transaction data.
3. The data processing system of claim 2, wherein, The plurality of first SQL statements are sent in parallel by the blockchain management device.
4. The data processing system of claim 2 or 3, wherein The blockchain management device is configured to send a second SQL statement to the database management device, the second SQL statement comprising a second field, a block number and a transaction number of a transaction data to be verified, and the second field indicating that the database management device returns validity information related to the transaction data to be verified, the transaction data to be verified being the first transaction data or the second transaction data; The database management device is further configured to return the validity information according to the second field, the block number and the transaction number of the transaction data to be verified; The blockchain management device is configured to receive the validity information returned by the database management device, and verify the transaction data to be verified according to the validity information.
5. The data processing system of any one of claims 1-3, wherein The blockchain management device is further configured to send a third SQL statement to the database management device, the third SQL statement comprising a third field, a block number and a transaction number of a transaction data of which the verification fails, and the third field indicating modification of validity information. The database management device is further configured to modify the validity information of the failed verification transaction data to be invalid according to the third field, the block number and the transaction number of the failed verification transaction data.
6. The data processing system of claim 5, wherein, The blockchain management device is further configured to re-verify transaction data verified after the failed verification transaction data.
7. The data processing system of any one of claims 1-3, wherein, The blockchain management device is further configured to send a fourth SQL statement to the database management device, the fourth SQL statement comprising a fourth field indicating cleaning data. The database management device is further configured to clean expired transaction data or invalid transaction data according to the fourth field, and attribute information of the cleaned transaction data. 8.A blockchain-based data processing method, characterized in that, The method is applied to a blockchain management device in a data processing system, the data processing system further comprising a block generation node and a database management device, and the method comprises: receiving one or more blocks sent by the block generation node, each block carrying a plurality of transaction data; sending a plurality of first structured query language (SQL) statements to the database management device, wherein each first SQL statement comprises a first transaction data in the transaction data carried by the one or more blocks, a block number of the first transaction data, and a transaction number of the first transaction data, the block number representing a block identifier of a block to which the first transaction data belongs, and the transaction number representing an index of the first transaction data in the plurality of transaction data in the block, and the first SQL statement further comprises a first field indicating storage of the first transaction data; receiving a message returned by the database management device that the first transaction data has been stored, and verifying the first transaction data according to the block number and the transaction number of the first transaction data.
9. The method of claim 8, wherein, The method further comprises: synchronously performing the sending of the plurality of first SQL statements to the database management device and the verifying of the second transaction data, the second transaction data having been stored into the database system before the first transaction data.
10. The method of claim 9, wherein, The sending of the plurality of first SQL statements to the database management device comprises: sending the plurality of first SQL statements to the database management device in parallel.
11. The method according to claim 9 or 10, characterized in that, The verifying of the first transaction data or the verifying of the second transaction data comprises: sending a second SQL statement to the database management device, the second SQL statement comprising a second field, a block number and a transaction number of a transaction data to be verified, and the second field indicating that the database management device returns validity information related to the transaction data to be verified, the transaction data to be verified being the first transaction data or the second transaction data; receiving the validity information returned by the database management device; verifying the transaction data to be verified according to the validity information.
12. The method according to any one of claims 8-10, characterized in that, The method further comprises: The database management device receives a third SQL statement, the third SQL statement including a third field, a block number and a transaction number of the transaction data whose verification fails, and the third field indicating modification of validity information.
13. The method of claim 12, wherein, The method further includes: re-verification of transaction data verified after the transaction data whose verification fails.
14. The method according to any one of claims 8-10, characterized by, The method further includes: The database management device receives a fourth SQL statement, the fourth SQL statement including a fourth field, and the fourth field indicating cleaning up data. 15.A blockchain-based data processing method, characterized in that, The method is applied to a database management device in a data processing system, the data processing system further including a blockchain management device, and the method includes: The database management device receives a plurality of first structured query language (SQL) statements from the blockchain management device, wherein each first SQL statement includes a first transaction data carried by one or more blocks, a block number of the first transaction data, and a transaction number of the first transaction data, the block number representing a block identifier of a block to which the first transaction data belongs, and the transaction number representing an index of the first transaction data in a plurality of transaction data of the block, and the first SQL statement further includes a first field indicating storage of the first transaction data; The database management device stores the first transaction data according to the first field, and stores a plurality of attribute information of the first transaction data, the plurality of attribute information including the block number, the transaction number, and validity information of the first transaction data; The database management device returns a message indicating that the first transaction data has been stored to the blockchain management device, and the message indicating that the first transaction data has been stored is used to instruct the blockchain management device to verify the first transaction data according to the block number and the transaction number of the first transaction data.
16. The method of claim 15, wherein, The method further includes: The database management device receives a second SQL statement from the blockchain management device, the second SQL statement including a second field, a block number and a transaction number of a transaction data to be verified, and the second field indicating that the database management device returns validity information related to the transaction data to be verified, the transaction data to be verified being the first transaction data or a second transaction data; The database management device returns validity information to the blockchain management device according to the second field, the block number and the transaction number of the transaction data to be verified.
17. The method according to claim 15 or 16, characterized in that, The method further includes: The database management device receives a third SQL statement from the blockchain management device, the third SQL statement including a third field, a block number and a transaction number of the transaction data whose verification fails, and the third field indicating modification of validity information. The database management device modifies validity information of the transaction data whose verification fails to invalid according to the third field, the block number and the transaction number of the transaction data whose verification fails.
18. The method of claim 15 or 16, wherein, The method further includes: The database management device receives a fourth SQL statement from the blockchain management device, the fourth SQL statement including a fourth field, and the fourth field indicating cleaning up data. The database management device cleans up expired transaction data or invalid transaction data and a plurality of attribute information of the cleaned up transaction data according to the fourth field. 19.A blockchain management device, characterized by, The blockchain management device is applied to a data processing system, and the data processing system further comprises a block node and a database management device. The receiving unit is configured to receive one or more blocks sent by the block node, each block carrying a plurality of transaction data; The sending unit is configured to send a plurality of first structured query language (SQL) statements to the database management device, wherein each first SQL statement comprises a first transaction data in the transaction data carried by the one or more blocks, a block number and a transaction number of the first transaction data, the block number representing a block identifier of a block to which the first transaction data belongs, and the transaction number representing an index of the first transaction data in the plurality of transaction data in the block, and the first SQL statement further comprises a first field indicating storage of the first transaction data. The receiving unit is further configured to receive a message returned by the database management device, indicating that the first transaction data has been stored. The processing unit is configured to verify the first transaction data according to the block number and the transaction number of the first transaction data.
20. A database management device characterized by comprising: The database management device is applied to a data processing system, and the data processing system further comprises a blockchain management device. The receiving unit is configured to receive a plurality of first structured query language (SQL) statements from the blockchain management device, wherein each first SQL statement comprises a first transaction data in the transaction data carried by one or more blocks, a block number and a transaction number of the first transaction data, the block number representing a block identifier of a block to which the first transaction data belongs, and the transaction number representing an index of the first transaction data in the plurality of transaction data in the block, and the first SQL statement further comprises a first field indicating storage of the first transaction data. The processing unit is configured to store the first transaction data according to the first field, and store a plurality of attribute information of the first transaction data, the plurality of attribute information comprising the block number, the transaction number of the first transaction data, and validity information of the first transaction data. The sending unit is configured to return a message indicating that the first transaction data has been stored to the blockchain management device, the message indicating that the first transaction data has been stored being used to instruct the blockchain management device to verify the first transaction data according to the block number and the transaction number of the first transaction data. 21.A blockchain management device, characterized by, The blockchain management device comprises a processor and a computer readable storage medium storing a computer program; The processor is coupled to the computer readable storage medium, and the computer program is executed by the processor to implement the method of any one of claims 8-14.
22. A database management device characterized by comprising: The database management device comprises a processor and a computer readable storage medium storing a computer program; The processor is coupled to the computer readable storage medium, and the computer program is executed by the processor to implement the method of any one of claims 15-18.
23. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, which when executed by a processor, implements the method of any one of claims 8-14.
24. A computer readable storage medium having stored thereon a computer program, characterized in that, The computer program, which when executed by a processor, implements the method of any one of claims 15-18.
25. A chip system, characterized by A computer program product comprising a processor, said processor being invoked to perform the method of any one of claims 8-14.
26. A chip system, characterized by A computer program product comprising a processor, said processor being invoked to perform the method of any one of claims 15-18.
Citation Information
Patent Citations
Parallel transaction validation and block generation in a blockchain
US20200052884A1
Systems, methods, and apparatuses for distributing a metadata driven application to customers and non-customers of a host organization using distributed ledger technology (DLT)
US20200250176A1
Cited By
Data processing system, data processing method based on blockchain, and device
WO2022077916A1