Blockchain-based data processing method, device, equipment, and readable storage medium

By introducing a relational database and structured query language into the blockchain, the problem of difficult description of complex business data association relationships under key-value storage is solved, and efficient and accurate data processing is achieved.

CN115114372BActive Publication Date: 2025-08-26TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210609432.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-31
Publication Date
2025-08-26
Estimated Expiration
2042-05-31

AI Technical Summary

Technical Problem

The existing key-value storage methods are difficult to accurately describe the relationship between complex business data in blockchain, resulting in inefficient data processing and increased labor and time costs.

Method used

The relationship database and structured query language are adopted, and the structured query language instructions for transaction data are pre-executed, combined with data integrity constraint rules, the blocks are recognized and stored in the blockchain, so as to achieve flexible and accurate relationship operations of transaction data.

Benefits of technology

It improves the flexibility and accuracy of the relationship operation of business data in blockchain, improves data processing efficiency, and reduces labor and time costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115114372B_ABST
    Figure CN115114372B_ABST
Patent Text Reader

Abstract

The present application discloses a data processing method, apparatus, device, and readable storage medium based on blockchain. The method includes: a first node receives a request for a block to be uploaded to the blockchain sent by a second node; based on the request to upload to the blockchain, a first pre-execution result of the transaction data in the block is obtained; according to the first pre-execution result and the data integrity constraint rules indicated by the relational data model, a consensus is reached on the block to obtain a consensus result of the block; the first pre-execution result refers to the execution result obtained after the first node pre-executes the transaction-related operations involved in the transaction data based on the structured query language instructions corresponding to the transaction data; when the consensus result of the block is a consensus-passed result, the block is stored in a relational database. By adopting this application, the flexibility of relational operations of business data can be improved in blockchain business, thereby improving data processing efficiency and accuracy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a blockchain-based data processing method, apparatus, device, and readable storage medium. Background Art

[0002] Blockchain is a novel application model for computer technologies, integrating distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. It primarily organizes data in chronological order and encrypts it into a ledger, rendering it tamper-proof and forgery-proof. It also enables data verification, storage, and updates. Blockchain also enables encrypted data transmission, node identification, and secure access, making it an advanced distributed infrastructure. Currently, blockchain applications are increasing due to its immutability and authenticity.

[0003] Typically, blockchains use key-value pairs to store on-chain data. For example, unspent transaction output (UTXO) data, account data, and transaction status data can all be stored using key-value pairs.

[0004] While key-value storage is a relatively simple data storage method that can handle simple business scenarios, as blockchain applications expand, the relationships between business data generated by these scenarios are becoming increasingly complex, making it difficult for simple key-value storage methods to accurately describe these relationships. Accurately describing complex relationships between business data using simple key-value storage requires numerous data operations, which is inefficient and increases time and labor costs. Summary of the Invention

[0005] The embodiments of the present application provide a blockchain-based data processing method, apparatus, device, and readable storage medium, which can improve the flexibility of relational operations on business data in blockchain business, thereby improving data processing efficiency and accuracy.

[0006] On the one hand, an embodiment of the present application provides a data processing method based on blockchain, including:

[0007] The first node receives a request for uploading a block from the second node. The uploading request is used to request that the block be stored in a relational database corresponding to the blockchain. A relational database refers to a database established based on a relational data model.

[0008] Obtaining a first pre-execution result of the transaction data in the block based on the on-chain request, and reaching consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result of the block; the first pre-execution result refers to the execution result obtained by the first node after pre-executing the transaction-related operations involved in the transaction data based on the structured query language instructions corresponding to the transaction data; the structured query language instructions refer to instructions for operating a relational database to execute the transaction-related operations;

[0009] When the consensus result of the block is a consensus-passed result, the block is stored in a relational database.

[0010] On the one hand, an embodiment of the present application provides a data processing device based on blockchain, including:

[0011] a request receiving module, configured to receive a request for uploading a block from a second node; the uploading request is used to request that the block be stored in a relational database corresponding to the blockchain, where a relational database is a database established based on a relational data model;

[0012] An execution result acquisition module, configured to acquire a first pre-execution result of transaction data in a block based on an on-chain request;

[0013] a block consensus module, configured to reach consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model, thereby obtaining a consensus result for the block; the first pre-execution result refers to the execution result obtained after the first node pre-executes the transaction-related operations involved in the transaction data based on the structured query language instructions corresponding to the transaction data; the structured query language instructions refer to instructions for operating a relational database to execute the transaction-related operations;

[0014] The block storage module is used to store the block in a relational database when the consensus result of the block is a consensus-passed result.

[0015] In one embodiment, the execution result acquisition module includes:

[0016] A transaction creation unit, used to create an initial database transaction for a block based on an on-chain request;

[0017] An instruction execution unit, configured to execute, in an initial database transaction, a structured query language instruction indicated by the transaction-related operation and obtain an instruction execution result;

[0018] The result determination unit is configured to determine the instruction execution result as the first pre-execution result of the transaction data.

[0019] In one embodiment, the block storage module includes:

[0020] a target transaction acquisition unit, configured to acquire a target database transaction associated with the block; the target database transaction includes a structured query language instruction in the transaction data and a first pre-execution result;

[0021] The transaction storage unit is used to store the target database transaction in the relational database.

[0022] In one embodiment, the on-chain request carries a second pre-execution result, which refers to the execution result obtained after the second node pre-executes the transaction relationship operation in the transaction data based on the structured query language instruction in the transaction data;

[0023] The block consensus module includes:

[0024] A result comparison unit, configured to compare the first pre-execution result with the second pre-execution result to obtain a comparison result;

[0025] a factor consensus unit, configured to obtain, if a comparison result between the first pre-execution result and the second pre-execution result is a match result, a primary key value included in the structured query language instruction, a foreign key value included in the structured query language instruction, and a data type corresponding to the structured query language instruction based on a data integrity constraint rule indicated by the relational data model;

[0026] The factor consensus unit is also used to reach consensus on primary key values, foreign key values, and data types, and obtain the factor consensus results corresponding to the primary key values, foreign key values, and data types;

[0027] A first result determination unit, configured to determine the factor consensus result as the consensus result of the block;

[0028] The second result determination unit is configured to set the consensus result of the block as a consensus failure result if the comparison result between the first pre-execution result and the second pre-execution result is a mismatch result.

[0029] In one embodiment, the number of the second nodes is at least two, and the number of the second pre-execution results is at least two;

[0030] The result comparison unit includes:

[0031] an identical result obtaining subunit, configured to form a pre-execution result set based on at least two second pre-execution results and the first pre-execution result, and determine identical pre-execution results in the pre-execution result set as pre-execution results to be counted;

[0032] An operation subunit is used to count the number of pre-execution results to be counted, and use the number of pre-execution results to be counted as the statistical number;

[0033] a quantity counting subunit, configured to count the total number of results corresponding to the first pre-execution result and at least two second pre-execution results;

[0034] a ratio determination subunit, for determining a quantity ratio between an operation quantity and a total quantity of results;

[0035] The comparison result determination subunit is used to determine the comparison result between the first pre-execution result and the second pre-execution result according to the quantity ratio.

[0036] In one embodiment, the comparison result determination subunit is further specifically configured to compare the quantity ratio with a ratio threshold;

[0037] The comparison result determination subunit is further specifically configured to determine the comparison result between the first pre-execution result and the second pre-execution result as a matching result if the quantity ratio is greater than a ratio threshold;

[0038] The comparison result determination subunit is further specifically configured to determine the comparison result between the first pre-execution result and the second pre-execution result as a mismatch result if the quantity ratio is less than a ratio threshold.

[0039] In one embodiment, the factor consensus unit includes:

[0040] The first factor consensus sub-unit is used to reach a consensus on the primary key value and obtain the first factor consensus sub-result corresponding to the primary key value;

[0041] The second factor consensus sub-unit is used to reach a consensus on the foreign key value and obtain the second factor consensus sub-result corresponding to the foreign key value;

[0042] The third factor consensus sub-unit is used to reach consensus on the data type and obtain the third factor consensus sub-result corresponding to the data type;

[0043] The consensus result determination subunit is used to determine the factor consensus result corresponding to the primary key value, the foreign key value and the data type based on the first factor consensus sub-result, the second factor consensus sub-result and the third factor consensus sub-result.

[0044] In one embodiment, the data integrity constraint rule includes a uniqueness constraint rule configured for the primary key value;

[0045] The first factor consensus sub-unit is further specifically used to obtain the target entity object indicated by the primary key value;

[0046] The first factor consensus sub-unit is further specifically used to traverse the set of existing entity objects contained in the relational database based on the uniqueness constraint rule;

[0047] The first factor consensus sub-unit is further specifically configured to, if there is no existing entity object identical to the target entity object in the set of existing entity objects, determine the target entity object as a unique entity object, and determine the first factor consensus sub-result corresponding to the primary key value as a factor consensus pass result;

[0048] The first factor consensus sub-unit is further specifically configured to determine the target entity object as a duplicate entity object if there is an existing entity object identical to the target entity object in the existing entity object set, and determine the first factor consensus sub-result corresponding to the primary key value as a factor consensus failure result.

[0049] In one embodiment, the data integrity constraint rules include referential validity constraint rules configured for foreign key values;

[0050] The second factor consensus sub-unit is further specifically configured to determine, based on the reference validity constraint rule, the reference object indicated by the foreign key value in the structured query language instruction and the object file to which the reference object belongs;

[0051] The second factor consensus subunit is also specifically used to obtain object files and traverse the object files;

[0052] The second factor consensus sub-unit is further specifically configured to, if the object file contains a reference object, determine the reference object as a valid reference object, and determine the second factor consensus sub-result corresponding to the foreign key value as a factor consensus pass result;

[0053] The second factor consensus sub-unit is further specifically configured to determine the reference object as an invalid reference object if the object file does not contain the reference object, and determine the second factor consensus sub-result corresponding to the foreign key value as a factor consensus failure result.

[0054] In one embodiment, the data integrity constraint rules include a set of standard data types supported by the relational database;

[0055] The third factor consensus subunit is also specifically used to traverse the standard data type set;

[0056] The third factor consensus sub-unit is further specifically configured to determine the data type as a valid data type if a standard data type identical to the data type exists in the standard data type set, and determine the third factor consensus sub-result corresponding to the data type as a factor consensus pass result;

[0057] The third factor consensus sub-unit is further specifically configured to determine the data type as an invalid data type if there is no standard data type identical to the data type in the standard data type set, and determine the third factor consensus sub-result corresponding to the data type as a factor consensus failure result.

[0058] In one embodiment, the consensus result determining subunit is further configured to determine the factor consensus result corresponding to the primary key value, the foreign key value, and the data type as the consensus passing result if the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result are all factor consensus passing results;

[0059] The consensus result determination subunit is further specifically configured to determine the factor consensus result corresponding to the primary key value, foreign key value, and data type as a consensus failure result if at least one of the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result is a factor consensus failure result.

[0060] In one embodiment, the on-chain request carries a digital signature; the digital signature is obtained by the second node signing the block based on the second node's private key;

[0061] The block-based data processing apparatus further comprises:

[0062] A signature verification module, configured to obtain the public key of the second node and verify the digital signature based on the public key;

[0063] A step execution module is configured to, if the signature verification passes, execute a first pre-execution result of obtaining transaction data in the block based on the on-chain request, and reach consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result for the block;

[0064] The communication suspension module is used to mark the second node as an abnormal node if the signature verification fails, and suspend data communication with the abnormal node within a target time period.

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

[0066] The memory stores a computer program, and when the computer program is executed by the processor, the processor executes the method in the embodiment of the present application.

[0067] On one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program includes program instructions. When the program instructions are executed by a processor, the method in the embodiment of the present application is executed.

[0068] In one aspect of the present application, a computer program product is provided, comprising a computer program stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, causing the computer device to perform the method provided in one aspect of the embodiments of the present application.

[0069] In an embodiment of the present application, when a first node receives a request for a block to be uploaded to the blockchain from a certain node (such as a second node), it will pre-execute the transaction-related operations in the transaction data based on the structured query language instructions of the transaction data in the block to obtain an execution result (which can be referred to as a first pre-execution result). Then, based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model, consensus is reached on the block. When the consensus result of the block is a consensus-passed result, the block is stored in the relational database corresponding to the blockchain (a database established based on the relational data model). It should be understood that the present application uses a relational database to store the on-chain data of the blockchain, and the relational database is mainly accessed through structured language query instructions. Therefore, the present application can perform relational operations on the transaction data through structured query language instructions. Since the relational data model can intuitively and flexibly store and access structured instructions, the intricate relationships between business data can be intuitively and accurately presented through simple instructions. Then, through structured query language instructions, the transaction data in this application can be flexibly and accurately subjected to relational operations. Without spending too much manpower and time, the flexibility and accuracy of the relational operations of the transaction data can be greatly improved, thereby improving the efficiency and accuracy of data processing. At the same time, this application can also add data integrity constraints to the relational data model in the blockchain consensus process, that is, the consensus process of this application can not only reach a consensus based on the execution results of the transaction data, but also reach a consensus based on the data integrity constraint rules, thereby ensuring that the data written into the relational database complies with the data integrity constraint rules, and further improving the accuracy of the written data. In summary, this application can improve the flexibility of the relational operations of business data in the blockchain business, thereby improving data processing efficiency and accuracy, and at the same time reducing data processing costs. BRIEF DESCRIPTION OF THE DRAWINGS

[0070] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0071] Figure 1 This is a schematic diagram of a system architecture provided by an embodiment of the present application;

[0072] Figure 2 This is a flowchart of a blockchain-based data processing method provided in an embodiment of the present application;

[0073] Figure 3This is a flowchart of a block consensus process based on data integrity constraint rules provided by an embodiment of the present application;

[0074] Figure 4 This is a system logic architecture diagram provided by an embodiment of the present application;

[0075] Figure 5 This is a system flow chart provided by an embodiment of the present application;

[0076] Figure 6 is a structural diagram of a data processing device provided in an embodiment of the present application;

[0077] Figure 7 It is a structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0078] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0079] The blockchain-based data processing method provided in this application can be applied to a blockchain network. A blockchain network comprises a network of nodes that record and query data blocks on a blockchain. Each node in a blockchain network is a blockchain node, a computer device capable of querying or recording data blocks. Because the solutions provided in the embodiments of this application involve blockchain and other related technologies, for ease of understanding, the following will prioritize blockchain and related concepts.

[0080] 1. Blockchain: In a narrow sense, blockchain is a chained data structure based on blocks. Blocks use digital summaries to verify previously acquired transaction histories, making them suitable for the tamper-proof and scalability requirements of distributed ledgers. Broadly speaking, blockchain also refers to the distributed ledger technologies implemented by blockchain structures, including distributed consensus, privacy and security protections, peer-to-peer communication technologies, network protocols, and smart contracts. The goal of blockchain is to create a distributed data record book that only allows additions, not deletions. The underlying structure of this ledger is a linear linked list. This linked list consists of a series of "blocks," with successive blocks recording the hash values ​​of previous blocks. The legitimacy of each block (and the transactions within it) can be quickly verified by calculating the hash value. If a node in the network proposes to add a new block, the block must be confirmed through a consensus mechanism.

[0081] It should be understood that blockchain is a novel application model of computer technologies, including distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. It is primarily used to organize data in chronological order and encrypt it into a ledger, rendering it tamper-proof and forgery-proof. It also enables data verification, storage, and updates. A blockchain is essentially a decentralized database, in which each node stores an identical blockchain. The blockchain network categorizes nodes into core nodes, data nodes, and light nodes. Core nodes are responsible for consensus across the entire blockchain network, effectively acting as the consensus nodes within the blockchain network. The process by which transaction data is written to the ledger in a blockchain network can be as follows: a client sends transaction data to a data node or light node. This transaction data is then passed between data nodes or light nodes in the blockchain network in a relay-like fashion until a consensus node receives the transaction data. The consensus node then packages the transaction data into a block, reaches consensus with other consensus nodes, and, upon reaching consensus, writes the block containing the transaction data into the ledger.

[0082] It is understood that a blockchain system may include smart contracts, which can be understood as a code that can be understood and executed by each node (including consensus nodes) of the blockchain system, and can execute arbitrary logic and obtain results. A user can call a smart contract deployed on the blockchain by initiating a transaction service request through a client. Subsequently, the data node or light node on the blockchain can send the transaction service request to the consensus node, and each consensus node on the blockchain can respectively run the smart contract. It should be understood that a blockchain may include one or more smart contracts, which can be distinguished by an identity document (ID) or name. The transaction service request initiated by the client can also carry the identification number or name of the smart contract to specify the smart contract that the blockchain needs to run. If the smart contract specified by the client is a contract that needs to read data, each consensus node will access the local ledger to read the data. Finally, each consensus node will verify whether the execution results are consistent with each other (that is, reach consensus). If they are consistent, the execution results can be stored in their respective local ledgers and returned to the client.

[0083] 2. Blockchain Nodes: Blockchain networks categorize nodes into consensus nodes (also called core nodes) and synchronization nodes (which can include data nodes and light nodes). Consensus nodes are responsible for consensus across the entire blockchain network; synchronization nodes are responsible for synchronizing the consensus nodes' ledger information, specifically the latest block data. Both consensus and synchronization nodes have internal network communication components. Because blockchain networks are essentially peer-to-peer (P2P) networks, they require P2P components to communicate with other nodes in the blockchain network. Resources and services within a blockchain network are distributed across nodes, and information transmission and service delivery occur directly between nodes, without the need for intermediaries or centralized servers (third parties).

[0084] 3. Public key and private key: A public key and a private key are a key pair (one public key and one private key) derived through an algorithm. The public key is the public portion of the key pair, while the private key is the private portion. Public keys are commonly used for encrypting data, verifying digital signatures, and other purposes. This algorithm ensures that the resulting key pair is unique. When using this key pair, if one key is used to encrypt a piece of data, the other key must be used to decrypt it. For example, data encrypted with the public key must be decrypted with the private key, and data encrypted with the private key must also be decrypted with the public key; otherwise, the decryption will fail.

[0085] 4. Hash value: Also known as an information characteristic value or eigenvalue, a hash value is generated by converting input data of any length into a cipher and producing a fixed output using a hash algorithm. The original input data cannot be retrieved by decrypting the hash value; it is a one-way encryption function. In a blockchain, each block (except the initial block) contains the hash value of the previous block, which is called the parent block of the current block. The hash value is the core foundation and most important aspect of the potential of blockchain technology. It preserves the authenticity of recorded and viewed data, as well as the integrity of the blockchain as a whole.

[0086] 5. Smart Contract: A computer protocol designed to communicate, verify, or execute contracts in an information-based manner. In a blockchain system, a smart contract (or simply a contract) is a code that can be understood and executed by all blockchain nodes, executing arbitrary logic and producing results. In practice, smart contracts are managed and tested through transactions on the blockchain. Each transaction is equivalent to a Remote Procedure Call (RPC) request to the blockchain system. If a smart contract is equivalent to an executable program, the blockchain is equivalent to the operating system that provides the runtime environment. A blockchain can contain multiple contracts, distinguished by contract identities (IDs), identification numbers, or names. For example, a smart contract can include a governance consensus committee contract, which is primarily used to manage consensus nodes. This contract can include recording the node status of consensus nodes, dynamically adding consensus nodes, and removing abnormal consensus nodes.

[0087] 6. Wallet: This is used to provide the function of conducting digital asset transactions, including initiating transactions (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system. After successful verification by other nodes, as a response to acknowledge the validity of the transaction, the transaction record data is stored in a temporary block of the blockchain); of course, the wallet also supports querying the remaining digital assets (or digital resources) in the digital asset address (also known as the digital resource address).

[0088] See Figure 1 , Figure 1 This is a schematic diagram of a system architecture provided by an embodiment of the present application. Figure 1 As shown, the system may include a blockchain network 100a, an application server 100b, and a terminal device cluster. Among them, the blockchain network 100a may include: blockchain node 10a, blockchain node 10b, blockchain node 10c, and blockchain node 10d. It is understandable that the blockchain network 100a may include one or more blockchain nodes, and the embodiment of the present application does not limit the number of blockchain nodes. It is understandable that in the blockchain network 100a, the blockchain node 10a, the blockchain node 10b, and the blockchain node 10d can all interact with data through the network connection with the blockchain node 10c. It should be understood that each blockchain node in the blockchain network 100a (for example, blockchain node 10a, blockchain node 10b, blockchain node 10c, blockchain node 10d) can be used to maintain the same blockchain (for example, Figure 1In the blockchain network 10e shown, any two blockchain nodes in the blockchain network 100a can form a peer-to-peer (P2P) network. This peer-to-peer network can use the P2P protocol, which is an application layer protocol running on top of the Transmission Control Protocol (TCP). In a distributed system, any device, such as a server or terminal device, can join and become a blockchain node.

[0089] It is understandable that, Figure 1 The blockchain nodes 10a, 10b, 10c, and 10d shown may each have a one-to-one correspondence with the corresponding roles (i.e., entity objects in the corresponding business scenarios) that need to be connected to the blockchain network 100a. The business scenarios herein may specifically include electronic billing scenarios, social scenarios, resource issuance scenarios, payment scenarios, etc. In this case, the business data information in the corresponding business scenarios may specifically include electronic bill information in the electronic billing scenario, data interaction information in the social scenario, resource issuance information in the resource issuance scenario, asset transfer records in the payment scenario, etc. The specific content of the business data information in the corresponding business scenarios will not be listed here one by one.

[0090] It is understandable that the above system may include one or more application servers, and the number of application servers is not limited here; Figure 1 The application server 100b shown can establish a network connection with the blockchain network 100a to facilitate data exchange via the network connection with the blockchain network 100a. The application server 100b can be a backend server corresponding to an application that has business functions associated with processing data in the blockchain network 100a.

[0091] The terminal device cluster may include terminal device 100c, terminal device 100d, terminal device 100e, ..., terminal device 100f. It is understood that the terminal device cluster may include one or more terminal devices, and the embodiments of the present application do not limit the number of terminal devices. A network connection may exist between the terminal clusters, for example, a network connection exists between terminal device 100c and terminal device 100d. At the same time, any terminal device in the terminal cluster may have a network connection with application server 100b, for example, a network connection exists between terminal device 100f and application server 100b. At the same time, any terminal device in the terminal cluster may have a network connection with blockchain network 100a, for example, a network connection exists between terminal device 100d and blockchain network 100a. At the same time, any terminal device in the terminal cluster may have a network connection with storage device 200a, for example, a network connection exists between terminal device 100f and storage device 200a. The above-mentioned network connection does not limit the connection method and may be directly or indirectly connected via a wired network, directly or indirectly connected via a wireless network, or through other methods, which are not limited by the present application.

[0092] It should be understood that Figure 1 Each terminal device in the terminal cluster shown can be installed with an application client (also called a target application), and the application server 100b can be the background server corresponding to the application client. When the application client runs in each terminal device, it can be respectively connected to the above-mentioned Figure 1 The application server 100b shown in the figure performs data interaction, that is, the above-mentioned network connection. Among them, the application client (target application) can be an application client with data processing functions such as video application, live broadcast application, social application, instant messaging application, game application, music application, shopping application, novel application, browser, digital asset application, digital resource application, etc., and the application client can also have the function of processing digital assets. Among them, the application client can be an independent client or an embedded sub-client integrated in a client (for example, a social client, an educational client, and a multimedia client, etc.), which is not limited here. Taking the target application as a social application as an example, the application server 100b can be a collection of multiple servers such as a background server and a data processing server corresponding to the social application. Therefore, each terminal device can transmit data with the application server 100b through the application client corresponding to the social application. For example, each terminal device can upload the service data delivery request to the application server 100b through the application client of the social application, and then the application server 100b can send the service data delivery request to other terminal devices or transmit it to the blockchain network 100a.

[0093] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards of relevant countries and regions.

[0094] To facilitate subsequent understanding and explanation, the embodiments of the present application can be Figure 1 In the terminal cluster shown, a terminal device is selected as the target terminal device, for example, terminal device 100c. The target terminal device can send transaction data to a data node or light node. The transaction data is then passed between data nodes or light nodes in the blockchain network in a relay manner until the consensus node receives the transaction data. The consensus node then packages the transaction data into a block and reaches consensus with other consensus nodes. After consensus is reached, the block containing the transaction data is written to the ledger.

[0095] To improve the applicability of blockchain for business scenarios and enable blockchain to better describe the relationships between different business data in different business scenarios, this application provides a data processing method based on a relational database (a database established based on a relational data model) to store on-chain data. Because the relational data model has more flexible data operations and more rigorous data integrity constraints, the use of a relational database corresponding to the relational data model allows users to customize relational data structures, relational operations, data constraints, etc. in smart contracts, thereby greatly improving contract development efficiency. At the same time, because the relational data model supports structured information, the flexible data operations of the relational data model also allow users to perform more flexible relational operations on data through Structured Query Language (SQL) statements in smart contracts, which can simplify the operation process and improve data processing efficiency. To improve the rigor of data processing and improve accuracy, this application can also introduce the data integrity constraints of the relational data model into the consensus process of the blockchain. That is, when the consensus nodes in this application reach consensus on blocks, they also need to use the data integrity constraints of the relational data model to reach consensus on the blocks.

[0096] For ease of understanding, take the example of a consensus node (such as the first node) receiving a request from another consensus node (such as the second node) for a block to go on the chain. The second node expects to reach a consensus on the block with the first node, and after the consensus is passed, store the block in the blockchain jointly maintained by the first node and the second node. Since this application uses a relational database to store the on-chain data of the blockchain, storing the block in the blockchain can refer to storing the data in the block in the relational database corresponding to the blockchain. In this application, the first node can call the smart contract corresponding to the transaction data based on the on-chain request, and pre-execute each transaction data in the block through the smart contract to obtain a pre-execution result. It should be understood that since the relational operations in this application can all be performed using SQL statements, pre-execution of transaction data can be performed by executing the structured query language commands (SQL commands, also referred to as structured query language instructions) generated by all transaction data in the block. It should be understood that each structured query language instruction can correspond to a logical step. Therefore, when all structured query language commands involved in a transaction data are executed, that is, the execution logic corresponding to the transaction data is executed, the resulting command execution result can be the execution result of the transaction data. In other words, executing a structured query language instruction is to execute the corresponding logical operation involved in the transaction data (this application may refer to the transaction-related operation). When all structured query language instructions indicated by the logical operation are executed, an instruction execution result can be obtained, which can be the pre-execution result of the corresponding transaction data (herein, the pre-execution result obtained by the first node can be referred to as the first pre-execution result).

[0097] Similarly, the second node can also obtain a pre-execution result (here the pre-execution result obtained by the second node can be referred to as the second pre-execution result). The first node can reach a consensus on the block based on the first pre-execution result, the second pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result of the block. When the consensus result of the block is a consensus passing result, the block can be stored in a relational database. Among them, for the specific implementation method of the first node reaching a consensus on the block based on the first pre-execution result, the second pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain the consensus result of the block, please refer to the subsequent Figure 2 Description in the corresponding embodiment.

[0098] As can be seen from the above, the method provided in the embodiment of the present application can be executed by a computer device, including but not limited to a terminal device, an application server or a blockchain node. The above-mentioned application server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The above-mentioned terminal devices may include: smart phones, tablet computers, laptops, desktop computers, smart TVs, smart speakers, desktop computers, smart watches, car-mounted devices, etc., which carry multimedia data processing functions (for example, video data playback functions, music data playback functions), but are not limited to these.

[0099] It is understood that the aforementioned application server 100b, terminal device 100c, terminal device 100d, terminal device 100e, ..., and terminal device 100f may all be blockchain nodes in blockchain network 100a, and the data described herein (e.g., transaction data) may be stored. This storage may be performed by a blockchain node generating blocks based on the data and adding the blocks to the blockchain for storage. In a distributed system such as a blockchain, any computer device, such as an application server, terminal device, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.

[0100] Further, see Figure 2 , Figure 2 This is a flowchart of a data processing method based on blockchain provided by an embodiment of the present application. The embodiment of the present application can be applied to various scenarios, including but not limited to cloud technology, artificial intelligence, smart transportation, assisted driving, etc. Among them, the data processing method based on blockchain can be executed by a computer device, where the computer device can refer to an application server (such as the above Figure 1 The application server in the corresponding embodiment) can also refer to a terminal device (such as the above Figure 1 Any terminal device in the terminal device cluster in the corresponding embodiment) can also refer to a device that integrates an application server and a terminal device. Figure 2 As shown, the process of the blockchain-based data processing method may include at least the following steps S101 to S103:

[0101] In step S101, the first node receives a request for uploading a block from the second node. The request for uploading a block is used to request that the block be stored in a relational database corresponding to the blockchain. A relational database refers to a database established based on a relational data model.

[0102] In this application, the first node and the second node can both be nodes in the blockchain. For example, both the first node and the second node can be core nodes (also known as consensus nodes) in the blockchain. The core node can receive transaction data sent from data nodes or light nodes in the blockchain. The transaction data can be sent by the terminal device to the data node or light node. The transaction data can be data generated by the terminal device based on the transaction business initiated by the user. After obtaining user authorization, the terminal device can send the transaction data to the data node or light node. When the core node receives transaction data sent by different data nodes, it can temporarily cache the received transaction data in the transaction pool. After receiving transaction data sent by the data nodes within a period of time, the core node can obtain one or more transaction data from the transaction pool and generate a block based on this transaction data. If the node generating the block wishes to store the block in the blockchain, the node needs to initiate a consensus request for the block to the consensus node in the blockchain. The consensus nodes of the blockchain can reach a consensus on the block based on the consensus request. After the block passes the consensus, the block can be stored in the blockchain. Among them, since the node initiates a consensus request in the hope of storing the block in the blockchain, the consensus request can also be called a chain request.

[0103] It should be understood that this application can establish a relational database based on the relational data model and use this relational database to store blockchain data. In other words, if you wish to store blocks in a blockchain, you can store them in the relational database corresponding to the blockchain. To facilitate understanding of the relational data model and relational database, the following will explain them in detail. The relational data model refers to a data model that represents entities and the relationships between them in the form of a two-dimensional table. It is a model that represents entities and the relationships between entities in a relational database using a two-dimensional table. In other words, the relational data model primarily uses tables to represent data and relationships between data. For example, to represent a many-to-many relationship between entity A and entity B, three tables can be created: two tables representing entities A and B, respectively, and a third table representing the relationship between entity A and entity B. In the relational data model, real-world entities and the various relationships between them are represented by relationships.

[0104] A relational database system is a database system that supports the relational data model. It's built on this model and has a relational structure, also known as a relational database. Relational databases primarily use the relational data model to organize data, storing data in rows and columns for easier understanding. These rows and columns are called tables, and a group of tables makes up a database. Relational databases are primarily used for transaction processing and include databases such as Oracle, DB2, MySQL, Microsoft SQL Server, and Microsoft Access.

[0105] It is understandable that the corresponding relational database and relational database mainly support structured information, that is, it can be accessed through a structured language to implement operations such as adding, deleting, modifying, and querying the relational database, and the structured language can include Structured Query Language (SQL). In this application, users can customize the structured data storage method in the smart contract of the blockchain, thereby accessing the relational database based on structured query language statements (such as SQL statements) to store blockchain data based on the relational data model. For example, based on SQL syntax, the table structure of the relational database can be defined when installing the smart contract. It can mainly be implemented in the following way: in the initialization method of the smart contract, the application programming interface (API) provided by the smart contract is called to execute the table creation SQL. Of course, the specific implementation method for defining the table structure of a relational database when installing a smart contract is not limited to the above implementation method. It can also be any other method that can define the table structure of a relational database in a smart contract. For example, its specific implementation method can also be: in the smart contract installation package, the SQL command for creating a table is written into a specific file or a specific file directory, thereby defining the table structure of the relational database in the smart contract. After the table structure of the relational database is defined in the corresponding smart contract, the transaction data in the block can be processed using the corresponding smart contract. When the transaction data is processed based on the corresponding smart contract, the SQL commands related to the transaction data can be executed in the smart contract. By executing the SQL commands, the relational database can be accessed, and the addition, deletion, modification and query of the relational database can be realized. Among them, the SQL commands involved in the transaction data can be written by the user (the instruction writing object); the user can also deploy the corresponding program in the smart contract (such as a program template or program function. For example, the user can customize the structured data storage in the smart contract, so that the smart contract can support the user to perform relational operations on the data through structured query language commands, such as adding, deleting, modifying, and querying data). When the smart contract is called, the smart contract can determine the corresponding SQL command based on the logical operations involved in the transaction data and the program deployed in the contract.

[0106] Step S102: Obtain a first pre-execution result of the transaction data in the block based on the on-chain request, and reach consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result of the block; the first pre-execution result refers to the execution result obtained after the first node pre-executes the transaction-related operations involved in the transaction data based on the structured query language instructions corresponding to the transaction data; the structured query language instructions refer to instructions for operating a relational database to perform transaction-related operations.

[0107] In this application, the first pre-execution result may refer to the execution result obtained after the first node pre-executes the transaction data in the block. It should be understood that since this application uses a relational database to store the on-chain data of the blockchain, and the relational database is also mainly accessed using structured information (such as structured query language), the process of pre-executing the transaction data in the block by the first node can also be pre-executed using structured query language commands. For example, after receiving the on-chain request, the first node can call the corresponding smart contract based on the content of the transaction data. The table structure of the relational database is defined in the smart contract. Through this smart contract, all structured query language commands (also known as structured query language instructions, such as SQL commands) involved in the transaction data can be executed. The process of executing the structured query language instructions is the process of executing the transaction data, and the execution result of the structured query language instructions can also be used as the execution result of the transaction data (that is, the pre-execution result).

[0108] It should be understood that a transaction business (transaction data) can be divided into different transaction logic operation steps, and one transaction logic operation step can correspond to one structured query language instruction (such as an SQL command). Of course, one transaction logic operation step can also correspond to multiple different structured query language instructions (that is, executing one transaction logic operation step requires executing multiple structured query language instructions). When executing structured query language instructions, the corresponding structured query language instructions may be executed sequentially according to the execution order of the transaction logic operation steps. Each structured query language instruction may correspond to an instruction execution result (whether the execution is successful or not). When all structured query language instructions involved in a transaction can be successfully executed and the instruction execution results of all structured query language instructions are successful execution results, the final instruction execution result of the structured query language instructions involved in the transaction can be considered a successful execution result (also referred to as a normal execution result). Correspondingly, if one or more structured query language instructions among all structured query language instructions involved in a transaction cannot be successfully executed, the instruction execution results of these structured query language instructions are execution failure results. In this case, the final instruction execution result of the structured query language instructions involved in the transaction can be considered an execution failure result (also referred to as an abnormal execution result).

[0109] It should be understood that all transaction logic operation steps involved in a transaction data have certain correlations. For example, all transaction logic operation steps involved in a transaction data include transaction logic operation step 1, transaction logic operation step 2, and transaction logic operation step 3. Transaction logic operation step 2 must rely on the execution result of transaction logic operation step 1 to execute, and transaction logic operation step 3 must rely on the execution result of transaction logic operation step 2 to execute. Therefore, a dependent execution relationship exists between transaction logic operation step 1, transaction logic operation step 2, and transaction logic operation step 3. Accordingly, based on this correlation of transaction logic operation steps, this application refers to transaction logic operation steps as transaction-related operations. In other words, a transaction data can involve multiple transaction-related operations. For ease of understanding, let's assume that user A initiates a transfer transaction through user terminal 100c (user A transfers 5,000 yuan to user B, where the transfer transaction can refer to a piece of transaction data). User A can select a smart contract on the blockchain through user terminal 100c (for example, smart contract A that has transfer business logic and contains a relational data structure). In other words, user A can select the smart contract on the blockchain to execute the transfer transaction. It should be understood that the execution logic of the smart contract for this transfer transaction can be the following five steps:

[0110] 1. Read the balance of user A in the blockchain.

[0111] 2. Read the balance of user b in the blockchain.

[0112] 3. Make logical judgments on the transfer and modify the balances of user a and user b.

[0113] 4. Write user A’s latest balance to the blockchain.

[0114] 5. Write the latest balance of user b to the blockchain.

[0115] Each of the above steps can be understood as a transaction-related operation. The transaction-related operations designed for the transfer transaction business (transfer transaction data) include five. Each transaction-related operation can correspond to a structured query language instruction. The structured query language instruction corresponding to each transaction-related operation can be the structured query language instruction involved in the transaction data. Executing the structured query language instruction indicated by a transaction-related operation can obtain an instruction execution result (here, to distinguish it from the final instruction execution result of all instructions, the instruction execution result of a structured query language instruction can be referred to as an instruction execution sub-result). For example, taking the above transaction-related operation 1 as an example, the transaction-related operation of reading user a's balance in the blockchain can correspond to a structured query language instruction (such as structured query language instruction P). This structured query language instruction can be used to operate a relational database to query the balance corresponding to user a's account address in the relational database (represented as a numerical value in the relational database). Based on the relational database, a numerical value can be returned, which is user a's balance. Of course, if the relational database successfully returns the balance of user a, then the instruction execution sub-result of the structured query language instruction P can be a successful execution result; if the instruction cannot be executed, resulting in an inability to access the database (for example, due to incorrect instruction format or other abnormal reasons), then the instruction execution sub-result of the structured query language instruction P can be an abnormal execution result. It should be understood that when all instruction execution sub-results of all structured query language instructions involved in a transaction data are successful execution results, the final instruction execution results corresponding to all structured query language instructions can be considered to be successful execution results, and the execution result of the transaction data (such as the first pre-execution result) is a successful execution result. However, if the instruction execution sub-result of any structured query language instruction involved in the transaction data is an abnormal execution result, then the final instruction execution results corresponding to all structured query language instructions can be considered to be abnormal execution results, and the execution result of the transaction data (such as the first pre-execution result) is an abnormal execution result.

[0116] It can be understood that since relational databases are mainly used for transaction processing, in order to respond to relational databases, the first node in this application can start a database transaction after receiving a chain request for a block. All structured query language instructions (such as SQL commands) involved in all transaction data in the current block can be executed in the database transaction to obtain the first pre-execution result of the transaction data. In other words, the specific implementation method for obtaining the first pre-execution result of the transaction data in the block based on the chain request can be: an initial database transaction for the block can be created based on the chain request; in the initial database transaction, the structured query language instruction indicated by the transaction-related operation can be executed to obtain the instruction execution result; then, the instruction execution result can be determined as the first pre-execution result of the transaction data. Among them, the instruction execution result here can refer to the final instruction execution result of all structured query language instructions of a transaction data, that is, the final instruction execution result of all structured query language instructions involved in a transaction data can be used as the pre-execution result of the transaction data (such as the first pre-execution result).

[0117] As can be seen from the above, for each consensus node in the blockchain (including the first node and the second node), the transaction-related operations involved in the transaction data can be executed based on the structured query language instructions corresponding to the transaction data, thereby obtaining the pre-execution result corresponding to the transaction data. For a certain consensus node, it can reach a consensus on the block to which the transaction data belongs based on its own pre-execution results and the pre-execution results of other consensus nodes. After the consensus is passed, the block can be stored in the blockchain. Taking the first node and the second node as an example, the application can refer to the execution result obtained by the first node after pre-executing the transaction-related operations involved in the transaction data based on the structured query language instructions corresponding to the transaction data as the first pre-execution result, and the execution result obtained by the second node after pre-executing the transaction-related operations involved in the transaction data based on the structured query language instructions corresponding to the transaction data as the second pre-execution result. The second pre-execution result can be carried in the chain request sent by the second node to the first node. Then, the first node can reach a consensus on the block based on the first pre-execution result, the second pre-execution result, and the data integrity constraint rules indicated by the relational data model.

[0118] From the above, it can be seen that it should be understood that a specific implementation method for reaching consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain the consensus result of the block can be: the first pre-execution result can be compared with the second pre-execution result to obtain a comparison result; if the comparison result between the first pre-execution result and the second pre-execution result is a match result, the primary key value contained in the structured query language instruction, the foreign key value contained in the structured query language instruction, and the data type corresponding to the structured query language instruction can be obtained based on the data integrity constraint rules indicated by the relational data model, and then consensus can be reached on the primary key value, foreign key value, and data type to obtain a factor consensus result corresponding to the primary key value, foreign key value, and data type. Subsequently, the factor consensus result can be determined as the consensus result of the block; and if the comparison result between the first pre-execution result and the second pre-execution result is a mismatch result, the consensus result of the block can be set as a consensus failure result.

[0119] It should be understood that each consensus node can compare and verify the pre-execution result obtained by itself with the pre-execution results of other consensus nodes. In actual scenarios, there will be at least two consensus nodes (generally more than two). The cluster composed of each consensus node can be called a consensus node cluster. When a certain proportion of consensus nodes in the consensus node cluster have the same pre-execution results, the comparison and verification of the pre-execution result can be considered to be a passed verification result (the pre-execution result can be matched). At this time, the next step can be taken to reach consensus on the block again based on the data integrity constraint rules; if the comparison and verification of the pre-execution result is a failed verification result (the pre-execution result cannot match), then the consensus result of the block can be directly determined as a consensus failure result.

[0120] For ease of understanding, taking the example of at least two second nodes, since one second node can obtain a pre-execution result (a second pre-execution result), each of the at least two second nodes can pre-execute the transaction-related operation involved in the transaction data based on the structured query language instruction corresponding to the transaction data to obtain a second pre-execution result. In other words, the number of second pre-execution results is also at least two. Taking the example of at least two second nodes and at least two second pre-execution results, a specific implementation method for comparing the first pre-execution result with the second pre-execution result to obtain a comparison result can be as follows: a pre-execution result set can be formed based on the at least two second pre-execution results and the first pre-execution result; then, pre-execution results with the same result in the pre-execution result set can be determined as pre-execution results to be counted; then, the number of pre-execution results to be counted can be counted, and the number of pre-execution results to be counted can be used as the counted number; at the same time, the total number of results corresponding to the first pre-execution result and the at least two second pre-execution results can also be counted; then, a ratio between the number of operations and the total number of results can be determined, and the comparison result between the first pre-execution result and the second pre-execution result can be determined based on the ratio.

[0121] Among them, the specific implementation method for determining the comparison result between the first pre-execution result and the second pre-execution result based on the quantity ratio can be: the quantity ratio can be compared with the ratio threshold; if the quantity ratio is greater than the ratio threshold, the comparison result between the first pre-execution result and the second pre-execution result can be determined as a matching result; and if the quantity ratio is less than the ratio threshold, the comparison result between the first pre-execution result and the second pre-execution result can be determined as a mismatching result.

[0122] It can be understood that the first node can compare its own first pre-execution result with at least two other second pre-execution results, and can form a pre-execution result set with the first pre-execution result and at least two second pre-execution results. Each first pre-execution result and each second pre-execution result contained in the pre-execution result set can be referred to as a pre-execution result; the pre-execution results with the same result in the set can be determined as pre-execution results to be counted, and the number of pre-execution results to be counted can be counted, and this number can be referred to as the statistical number. That is to say, the number of identical pre-execution results in the first pre-execution result and the other at least two second pre-execution results can be counted. If the ratio between the number of identical pre-execution results and the total number of results (such as the above-mentioned number ratio) exceeds the ratio threshold (the threshold can be a manually preset value), it can be indicated that more than a proportion of consensus nodes in the consensus node cluster have the same execution results. At this time, the pre-execution result verification can be considered successful. In order to ensure that all honest nodes in the consensus node cluster of the two blocks can obtain consistent results and improve the robustness of the blockchain, further consensus can be made on the data integrity constraint rules based on the relational data model. For example, consensus can be made based on the above-mentioned primary key value, the above-mentioned foreign key value and the above-mentioned data type to obtain the factor consensus result corresponding to the primary key value, the above-mentioned foreign key value and the above-mentioned data type, and then the factor consensus result can be determined as the consensus result of the block. For the specific implementation method of reaching a consensus based on the above-mentioned primary key value, the above-mentioned foreign key value and the above-mentioned data type to obtain the factor consensus result corresponding to the primary key value, the above-mentioned foreign key value and the above-mentioned data type, please refer to the subsequent Figure 3 Description in the corresponding embodiment.

[0123] It should be noted that in blockchain, to ensure the reliability and authenticity of data transmission, consensus nodes can authenticate each other using their own private keys and the other party's public key. Once verification is successful, subsequent processing can be performed. For example, if the second node sends a request to upload a block to the chain to the first node, the second node can sign the block using its private key to obtain a digital signature, and then send the upload request carrying the digital signature to the first node. The first node can then verify the digital signature using the second node's public key. Once verification is successful, subsequent processing can be performed. Taking the uplink request carrying a digital signature, and the digital signature being obtained by the second node signing the block based on the second node's private key as an example, its specific implementation method can be: the first node can obtain the public key of the second node, and verify the digital signature based on the public key; if the verification is successful, subsequent processing can be performed, for example, a first pre-execution result of obtaining the transaction data in the block based on the uplink request can be executed, and a consensus is reached on the block according to the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result of the block; and if the verification fails, the second node can be marked as an abnormal node, and data communication with the abnormal node can be suspended within the target time period.

[0124] It should be understood that if the signature verification fails, the second node can be considered as an unreliable node (called an abnormal node, such as a malicious node). At this time, in order to ensure the security of data transmission, data communication with the abnormal node can be suspended within a certain time (such as the target time period).

[0125] Step S103: When the consensus result of the block is a consensus-passed result, the block is stored in a relational database.

[0126] In this application, when the consensus result of the block is a consensus-passed result, the block can be stored in the blockchain. This application mainly uses a relational database to store on-chain data, so the data of the block can be stored in a relational database. Specifically, it can be seen from the above that when executing the structured language query instruction corresponding to the transaction data, a database transaction (such as the initial database transaction mentioned above) can be created, and then the structured language query instruction is executed in the initial database transaction to obtain the instruction execution result (as the first pre-execution result of the transaction data). Then, when the consensus result of the block is a consensus-passed result, this application can submit the database transaction of the entire block (including the structured query language instruction and the first pre-execution result, which can be called the target database transaction), that is, the database transaction of the block can be stored in a relational database.

[0127] In other words, a specific implementation method for storing a block in a relational database may include: obtaining a target database transaction associated with the block; wherein the target database transaction includes a structured query language instruction in the transaction data and a first pre-execution result; and storing the target database transaction in the relational database. The target database transaction may be understood as the initial database transaction including the structured query language instruction and the first pre-execution result.

[0128] Further, see Figure 3 , Figure 3 This is a flow chart of a block consensus process based on data integrity constraint rules provided by the embodiment of the present application. Figure 2 In the corresponding embodiment, consensus is reached on the primary key value, foreign key value and data type, a consensus result of factors corresponding to the primary key value, foreign key value and data type is obtained, and then the consensus result of factors is determined as the consensus result of the block. This process can also be executed by a computer device, and the computer device here can refer to an application server (such as the above-mentioned Figure 1 The application server in the corresponding embodiment) can also refer to a terminal device (such as the above Figure 1 Any terminal device in the terminal device cluster in the corresponding embodiment) can also refer to a device that integrates an application server and a terminal device. Figure 3 As shown, the process may include at least the following steps S301 to S304:

[0129] Step S301: Consensus is performed on the primary key value to obtain a first factor consensus sub-result corresponding to the primary key value.

[0130] Specifically, to enhance data security, the relational data model specifies data integrity. This data integrity constraint is used to constrain the conditions that data in a relational database must meet, and is therefore also referred to as a data integrity constraint. Data integrity refers to the accuracy and reliability of data. It is designed to prevent the presence of data in a database that does not conform to semantic requirements and to prevent invalid operations or erroneous information from being generated by incorrect input or output. Data integrity can include entity integrity, domain integrity, referential integrity, and user-defined integrity.

[0131] Entity integrity refers to the integrity of rows in a table. It primarily ensures that data (records) being manipulated are non-null, unique, and non-duplicate. Specifically, entity integrity requires that each relation (table) have one and only one primary key, and each primary key value must be unique, with no null or duplicate values ​​allowed. For example, if attribute a is the primary attribute of a base relation R, then attribute a cannot have a null value; that is, the primary attribute cannot have a null value. A null value is not 0, an empty space, or an empty string; rather, it is the absence of a value. In practice, a null value refers to a value that is temporarily "unstored," "unknown," or "meaningless." Since the primary key uniquely identifies entity data (records), if the primary attribute takes a null value, unidentifiable (undistinguished) entity data (records) in the relation will exist, contradicting the definition of an entity. However, non-primary attributes can take a null value (NULL), hence the name entity integrity rule. For example, the primary attribute "student number" (column) in the student status relation (table) cannot have a null value; otherwise, operations on the data (records) in the student status table will fail.

[0132] Domain integrity means that columns in database tables must conform to specific data types or constraints. Constraints can include value ranges and precision. Table CHECK and FOREIGN KEY constraints, as well as DEFAULT and NOT NULL definitions, all fall under the umbrella of domain integrity.

[0133] Referential integrity is a rule between tables. For related tables in a persistent relationship, updating, inserting, or deleting records will affect data integrity if only one of them is modified. For example, if a record in a parent table is deleted but the corresponding record in the child table is not deleted, these records are called orphaned records. The integrity of data between tables when updating, inserting, or deleting is collectively referred to as referential integrity. Generally, there are certain connections between entities in objective reality. In the relational data model, entities and the connections between entities are described as relationships. Therefore, during operations, there may be associations and references between relationships.

[0134] In a relational database, the connection between relations is realized through common attributes. This common attribute is often the primary key of a table and the foreign key of another table. Referential integrity is reflected in two aspects: the connection between tables is realized, and the value of the foreign key must be a valid value of the primary key of the other table, or a "null" value. For example, attribute group F is the primary key of relational schema R1, and F is also the foreign key of relational schema R2. In the relation of R2, the value of F is only allowed to have two possibilities: null value or equal to a primary key value in the relation of R1. R1 is called the "referenced relation" schema, and R2 is called the "reference relation" schema.

[0135] User-defined integrity is a constraint on the properties of fields in a data table. User-defined integrity rules, also known as domain integrity rules, include constraints such as the field's range, field type, and field validity rules (such as the number of decimal places). These constraints are determined by the field's properties defined when the relational structure is established. For example, the range of values ​​for a grade on a 100-point scale is between 0 and 100.

[0136] Based on the data requirements specified by the above-mentioned entity integrity, domain integrity, referential integrity and user-defined integrity, this application can reach a consensus on the block. This application can call the data requirements specified by entity integrity, domain integrity, referential integrity and user-defined integrity data integrity constraint rules. Then, based on the data integrity constraint rules, this application can reach a consensus on the block.

[0137] It should be understood that since the entity integrity constraint rule is used to stipulate that the primary key value must be unique, the entity integrity constraint rule can also be called a uniqueness constraint rule. Based on the uniqueness constraint rule, the present application can reach a consensus on the structured query language instructions corresponding to the transaction data in the block. Since the uniqueness constraint rule stipulates that each row of the table is a unique entity in the table, the primary key value contained in the structured query language instruction can be obtained when verifying the consensus on the structured query language instruction. If the structured query language instruction contains a primary key value and the target entity object indicated by the primary key value is a unique entity, then the structured query language instruction can be considered to satisfy the uniqueness constraint rule. If the structured query language instruction contains a primary key value, but the target entity object indicated by the primary key value is not a unique entity, then it can be determined that the structured query language instruction does not satisfy the uniqueness constraint rule.

[0138] It should be understood that the result of whether the structured query language instruction satisfies the uniqueness constraint rule can be used as the first factor consensus sub-result. For example, if the structured query language instruction satisfies the uniqueness constraint rule, the first factor consensus sub-result can be determined as a factor consensus pass result; and if the structured query language instruction does not satisfy the uniqueness constraint rule, the first factor consensus sub-result can be determined as a factor consensus failure result (i.e., a factor consensus failure result).

[0139] That is to say, when the data integrity constraint rules include a uniqueness constraint rule configured for the primary key value, the specific implementation method for reaching consensus on the primary key value and obtaining the first factor consensus sub-result corresponding to the primary key value can be: obtaining the target entity object indicated by the primary key value; based on the uniqueness constraint rule, the set of existing entity objects contained in the relational database can be traversed; if there is no existing entity object identical to the target entity object in the set of existing entity objects, the target entity object can be determined as a unique entity object, and the first factor consensus sub-result corresponding to the primary key value can be determined as the factor consensus passed result; and if there is an existing entity object identical to the target entity object in the set of existing entity objects, the target entity object can be determined as a duplicate entity object, and the first factor consensus sub-result corresponding to the primary key value can be determined as the factor consensus failed result. Among them, traversing the set of existing entity objects contained in the relational database can specifically refer to obtaining the table (which can be called the target table) to which the primary key value in the structured query language instruction belongs in the relational database, and then traversing the row parameters indicated by the primary key value in the target table, and querying whether there is an existing entity object that is the same as the target entity object in the row parameters. If so, the target entity object can be determined as a duplicate entity object. At this time, it can be indicated that the primary key value does not meet the uniqueness constraint rule, then the first factor consensus sub-result corresponding to the primary key value can be determined to be the factor consensus failure result; if it does not exist, the target entity object can be determined to be a unique entity object. At this time, it can be determined that the primary key value meets the uniqueness constraint rule, then the first factor consensus sub-result corresponding to the primary key value can be determined to be the factor consensus pass result.

[0140] Of course, in a feasible case, traversing the set of existing entity objects contained in a relational database may also refer to traversing the existing entity objects contained in all tables in the relational database. The traversal method of traversing the existing entity objects contained in all tables in the relational database is more rigorous. This traversal method requires that each entity object in the relational database is a unique entity object, rather than requiring that an entity object in a certain table is a unique entity object in the table.

[0141] Step S302: Consensus is performed on the foreign key value to obtain a second factor consensus sub-result corresponding to the foreign key value.

[0142] Specifically, as can be seen from the above, referential integrity realizes the connection between tables, and the value of the foreign key must be a valid value of the primary key of another table, that is, the reference object indicated by the foreign key value must be a valid object (valid reference object) in the other table. Referential integrity can also be called a reference validity constraint rule. When the data integrity constraint rule includes a reference validity constraint rule configured for the foreign key value, based on the reference validity constraint rule, the present application can reach a consensus on the structured query language instructions corresponding to the transaction data in the block. Since the reference validity constraint rule stipulates that the foreign key value must be a valid primary key value of another table, when verifying the consensus on the structured query language instruction, the foreign key value contained in the structured query language instruction can be obtained. If the structured query language instruction contains a foreign key value, and the reference object indicated by the foreign key value is a valid reference object in the referenced table, then the structured query language instruction can be considered to meet the reference validity constraint rule. If the structured query language instruction includes a foreign key value, but the reference object indicated by the foreign key value is not a valid reference object, it can be determined that the structured query language instruction does not meet the reference validity constraint rule.

[0143] That is to say, when the data integrity constraint rules include reference validity constraint rules configured for foreign key values, the specific implementation method for reaching consensus on the foreign key value and obtaining the second factor consensus sub-result corresponding to the foreign key value can be: based on the reference validity constraint rules, the reference object indicated by the foreign key value and the object file to which the reference object belongs can be determined in the structured query language instruction; then, the object file can be obtained and the object file can be traversed; if the object file contains the reference object, the reference object can be determined as a valid reference object, and the second factor consensus sub-result corresponding to the foreign key value can be determined as the factor consensus passed result; if the object file does not contain the reference object, the reference object can be determined as an invalid reference object, and the second factor consensus sub-result corresponding to the foreign key value can be determined as the factor consensus failed result.

[0144] It can be understood that the object file in this application can refer to the table referenced by the foreign key value (which can be called the referenced table or referenced file). In a relational database, the entity objects written into each table need to meet certain constraints. Therefore, when an entity object is written into a table, it can be considered that the entity object is valid in the table. Then, when the reference object indicated by the foreign key value and the object file to which the reference object belongs are obtained, the object file can be traversed. If the object file does contain the reference object (for example, the reference object is indeed an entity object in the object file), the reference object can be considered to be a valid reference object. At this time, it can be determined that the foreign key value meets the reference validity constraint rule, and the second factor consensus sub-result corresponding to the foreign key value can be determined as the factor consensus pass result; if the object file does not contain the reference object (for example, the reference object is not any entity object in the object file), it can be considered that the reference object is not a valid reference object (in other words, it is an invalid reference object). At this time, it can be determined that the foreign key value does not meet the reference validity constraint rule, and the second factor consensus sub-result corresponding to the foreign key value can be determined as the factor consensus failure result.

[0145] Step S303: Consensus is performed on the data type to obtain a third factor consensus sub-result corresponding to the data type.

[0146] Specifically, as can be seen from the above, domain integrity means that the columns in the database table must satisfy a certain data type or constraint. The domain integrity constraint rule can also be called a type constraint rule. If the data type constrained by the relational data model is called a standard data type, then the type constraint rule can include a set of standard data types that the relational database can support (which can be composed of one or more standard data types). Based on the type constraint rule, the present application can reach a consensus on the structured query language instruction corresponding to the transaction data in the block. For the structured query language instruction, the type description field for indicating the data type contained in the structured query language instruction can be obtained. If the data type described by the type description field is one of the standard data types specified by the relational data model, then the structured query language instruction can be considered to meet the type integrity. At this time, the third factor consensus sub-result corresponding to the data type can be determined as the factor consensus pass result; and if the data type described by the type description field is any of the standard data types specified by the non-relational data model, then the structured query language instruction can be considered to not meet the type integrity. At this time, the third factor consensus sub-result corresponding to the data type can be determined as the factor consensus failure result.

[0147] Step S304 : determining a factor consensus result corresponding to the primary key value, the foreign key value, and the data type based on the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result.

[0148] Specifically, after determining the factor consensus sub-results corresponding to the primary key value, foreign key value, and data type, respectively, the factor consensus result corresponding to the primary key value, foreign key value, and data type can be determined based on the factor consensus sub-results corresponding to the primary key value, foreign key value, and data type. The specific method can be: if the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result are all factor consensus passing results, then the factor consensus result corresponding to the primary key value, foreign key value, and data type can be determined as the consensus passing result; and if at least one of the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result is a factor consensus failure result, then the factor consensus result corresponding to the primary key value, foreign key value, and data type can be determined as the consensus failure result.

[0149] It should be noted that the above method of achieving consensus on blocks based on data integrity constraints is only a feasible example. This is not the only method. For example, user-defined integrity can also be incorporated into the consensus process, meaning that consensus on blocks can be achieved based on entity integrity constraints, domain integrity constraints, referential integrity constraints, and user-defined integrity constraints. Other methods of achieving consensus on blocks based on data integrity constraints can be used to improve data reliability and security, and will not be further illustrated here.

[0150] It should be noted that the above consensus on primary key values, foreign key values, and data types is mainly based on a certain node (such as the first node). That is, a single consensus node determines whether the primary key value, foreign key value, and data type comply with the corresponding data integrity constraint rules. Where feasible, when a node obtains the factor consensus sub-results corresponding to the primary key value, foreign key value, and data type, it can also communicate with other consensus nodes. When the factor consensus sub-results of more than a proportion of consensus nodes are consistent, the consistent factor consensus sub-results are used as the factor consensus sub-results corresponding to the primary key value, foreign key value, or data type. In other words, the factor consensus sub-results corresponding to the primary key value, foreign key value, and data type are not determined by a single consensus node, but can also be determined by all consensus nodes, thereby enhancing the rigor and reliability of the data, and further improving the robustness of the blockchain and ensuring the reliability of the data.

[0151] It is understandable that when consensus is reached on a block based on the first pre-execution result and the data integrity constraint rules, consensus can be reached on the block based on the data integrity constraint rules first, and then the consensus result obtained by consensus on the block based on the data integrity constraint rules is the consensus result, and then consensus is reached on the block based on the first pre-execution result to obtain the final consensus result; of course, consensus can also be reached on the block based on the first pre-execution result, and after the consensus is passed, consensus can be reached on the block based on the data integrity constraint rules to obtain the final consensus result. This application does not limit the execution order of the two.

[0152] This application uses a relational database to store the on-chain data of the blockchain, and the relational database is mainly accessed through structured language query instructions. Therefore, this application can perform relational operations on transaction data through structured query language instructions. Since the relational data model can store and access structured instructions intuitively and flexibly, the complex relationship between business data can be intuitively and accurately presented through simple instructions. Then, through structured query language instructions, the transaction data in this application can be flexibly and accurately operated on, without spending too much manpower and time, and the flexibility and accuracy of the relational operations of transaction data can be greatly improved, thereby improving data processing efficiency and accuracy. At the same time, this application can also add data integrity constraints to the relational data model in the blockchain consensus process, that is, the consensus process of this application can not only be based on the execution results of the transaction data, but also based on the data integrity constraint rules. Consensus, thereby ensuring that the data written into the relational database complies with the data integrity constraint rules, can further improve the robustness of the blockchain, thereby improving the accuracy of the written data. In summary, this application can improve the flexibility of the relational operations of business data in the blockchain business, thereby improving data processing efficiency and accuracy, and reducing data processing costs.

[0153] Further, see Figure 4 , Figure 4 This is a system logic architecture diagram provided by the embodiment of this application. Figure 4 As shown, the system's logical architecture can include a client and a blockchain node cluster. The blockchain node cluster can refer to a consensus node cluster, and the blockchain nodes within the blockchain node cluster can refer to consensus nodes. Each consensus node can include a Remote Procedure Call (RPC) service component, a transaction pool, a consensus engine, a scheduler, a virtual machine, and storage components. For ease of understanding, the following describes each component of the system architecture.

[0154] Client: The client can refer to the application client mentioned above. The client can also refer to the initiator of blockchain transactions or query requests. In other words, users can initiate transaction data (or transaction requests, such as query requests) through the client.

[0155] RPC service component: The RPC service component can provide the blockchain service API to the client. When the client initiates transaction data, if the blockchain node receives the transaction data, the RPC service component in the blockchain node can send the transaction data to the transaction pool; and when the client initiates a transaction request (such as a query request), the RPC service component can call the virtual machine to execute the query request. Among them, queries for existing data in the blockchain can directly access the storage component.

[0156] Transaction pool: The transaction pool is used to temporarily cache newly received transaction data. For newly received transaction data, the virtual machine can be called to check whether the transaction data is valid. When a new block needs to be generated, a batch of transaction data is taken from the transaction pool and packaged into a block. When the block is submitted, this batch of transaction data can be cleared from the transaction pool.

[0157] Consensus engine: The consensus engine can be used to be responsible for the consensus work in the blockchain. The consensus engine can communicate with other blockchain nodes (such as consensus nodes) to ensure that the honest nodes in the blockchain can reach a consensus on the new block through consensus. If a consensus is reached (such as the results of more than a proportion of consensus nodes are consistent), the new block can be submitted; if no consensus is reached, the proposal for the new block can be rolled back. It should be noted that in this application, when the consensus engine reaches a consensus with other blockchain nodes, in addition to reaching a consensus on the execution results of the smart contract, it also needs to reach a consensus on the data integrity constraint rules of the relational data model, and unanimously reject transactions that do not meet the data integrity constraint rules. Among them, for the specific implementation method of consensus on blocks based on execution results (such as pre-execution results) and data integrity constraint rules, please refer to the above Figure 2-Figure 3 The description in the corresponding embodiment will not be repeated here.

[0158] Scheduler: The scheduler is mainly responsible for the scheduling of block processing. It can be used to respond to the block requests of the consensus engine (such as chain requests or consensus requests), call the virtual machine to execute the smart contract corresponding to the transaction data in the block, and pre-execute the transaction data in the block; at the same time, the scheduler can also call the storage component to store the content in the block. It should be noted that the scheduler in this application will also schedule the storage component to start a database transaction during the block verification phase. The database transaction is used to execute the structured query language commands (such as SQL commands) generated by all the transaction data in the block. This can refer to the content of the final block consensus verification and can include the execution results of the SQL command, thereby improving the robustness of the blockchain.

[0159] Virtual Machine: The virtual machine primarily serves as the execution environment for smart contracts. When the scheduler invokes a smart contract, the smart contract can be executed within the virtual machine. It should be noted that the blockchain used in this application is based on a relational data model. Therefore, the virtual machine must provide an API that supports relational operations for smart contracts, allowing smart contract developers to operate relational databases using SQL. When the virtual machine executes a smart contract and parses an SQL command, it can pass the SQL command to the storage component, allowing the storage component to execute the corresponding relational operations on the relational database.

[0160] Storage component: The storage component is mainly responsible for storing data on the blockchain. In this application, in a blockchain with a relational data model, it is necessary to ensure the atomicity of data operations. The storage component can organize all SQL commands involved in all transaction data in the block and submit them as a single transaction (called a database transaction, such as the initial database transaction and the target database transaction mentioned above). Before submitting the transaction, it is necessary to verify whether the SQL command can be executed successfully during the transaction simulation execution (pre-execution) to ensure that the transaction data after consensus can successfully modify the relational database.

[0161] For the specific implementation of how each component in a blockchain node reaches consensus on blocks and stores blocks in the blockchain, please refer to the above Figure 2-Figure 3 In the corresponding embodiment, the description of the first node reaching consensus on the block and storing the block in the blockchain will not be repeated here.

[0162] In the embodiment of the present application, a relational database is used to store the on-chain data of the blockchain, and the relational database is mainly accessed through structured language query instructions. Therefore, the present application can perform relational operations on the transaction data through structured query language instructions. Since the relational data model can intuitively and flexibly store and access structured instructions, the complex relationship between business data can be intuitively and accurately presented through simple instructions. Therefore, through structured query language instructions, the transaction data in the present application can be flexibly and accurately operated on. Without spending too much manpower and time, the flexibility and accuracy of the relational operations of the transaction data can be greatly improved, thereby improving the efficiency and accuracy of data processing. At the same time, the present application can also add data integrity constraints to the relational data model in the blockchain consensus process. That is, the consensus process of the present application can not only reach consensus based on the execution results of the transaction data, but also reach consensus based on the data integrity constraint rules. This can ensure that the data written into the relational database complies with the data integrity constraint rules, further improving the robustness of the blockchain, and thus improving the accuracy of the written data. In summary, this application can improve the flexibility of relational operations of business data in blockchain business, thereby improving data processing efficiency and accuracy, while reducing data processing costs.

[0163] For easier understanding, see Figure 5 , Figure 5 This is a system flow chart provided by the embodiment of the present application. The system flow is mainly the execution process of each component in a blockchain node for a new block, wherein the components contained in the blockchain node are mainly based on the above Figure 4 As shown. Figure 5 As shown, the process may include at least the following steps S41 to S49:

[0164] In step S41, the consensus engine sends a request to the scheduler to verify the block.

[0165] Specifically, a request to verify a block can refer to a consensus request (or on-chain request) for a block. When the consensus engine proposes a new block or receives a new block broadcast by other consensus nodes, it can initiate a block verification request (consensus request) to the scheduler.

[0166] In step S42 , the scheduler initiates a request to the storage component to start block pre-execution.

[0167] Specifically, after receiving the block verification request, the scheduler can call the storage component to start the block pre-execution command.

[0168] Step S43: The storage component starts a database transaction.

[0169] Specifically, the database transaction can correspond to the initial database transaction described above. The storage component can initiate a database transaction, obtain, and maintain a transaction handle. It should be understood that all SQL commands required for all transaction data in the current block can be executed within this database transaction.

[0170] Step S44: The scheduler sends a request for simulating the execution of transaction data to the virtual machine.

[0171] Specifically, the scheduler may send execution requests for transaction data in the block to the virtual machine in sequence.

[0172] Step S45: The virtual machine accesses the transaction data.

[0173] Specifically, the virtual machine can call and execute the corresponding smart contract based on the content of each transaction data. During the execution of the smart contract, if a request to access a relational database is parsed (such as a structured query language instruction such as SQL), the virtual machine can send the structured query language instruction to access the relational database to the storage component.

[0174] Step S46: The storage component executes the structured query language instruction.

[0175] Specifically, the structured query language instructions here can refer to SQL commands, and the storage component can execute all SQL commands in a transaction data in sequence to simulate the execution of the corresponding transaction data. It should be noted that when all SQL commands in a transaction are successfully executed, the corresponding field in the SQL standard (which can be called a save field, such as SAVEPOINT) can be called to set a save point. If an exception is encountered during the execution of the current transaction data, it can be rolled back to the save point set for the previous normal transaction data. Through the save point method, the write operation of a certain abnormal transaction data in the block to the relational database can be rolled back without affecting the write operation of the normal transaction data in the block.

[0176] In step S47, the consensus engine initiates a command to submit or revoke the block.

[0177] Specifically, if the block verification is successful (such as the consensus result of the block is a consensus pass result), the consensus engine can initiate a command to the scheduler to submit the block; on the contrary, if the block verification fails (such as the consensus result of the block is a consensus fail result), the consensus engine can initiate a command to the scheduler to revoke the block.

[0178] In step S48, the scheduler sends a command to the storage component to submit or withdraw the block.

[0179] Specifically, after receiving a block commit or revocation command, the scheduler may send the command to the storage component.

[0180] Step S49: The storage component commits or rolls back the database transaction.

[0181] Specifically, if the storage component receives a block commit command, it can commit the database transaction of the entire block to ensure the atomicity of the write operation in the block; if the storage component receives a block undo command, the storage component can roll back the database transaction of the entire block, so that the database rolls back to the state before the block was pre-executed.

[0182] Specifically, for the specific implementation of steps S41 to S49, please refer to the above Figure 2-Figure 3 The description in the corresponding embodiment will not be repeated here.

[0183] In the embodiment of the present application, a relational database is used to store the on-chain data of the blockchain, and the relational database is mainly accessed through structured language query instructions. Therefore, the present application can perform relational operations on the transaction data through structured query language instructions. Since the relational data model can intuitively and flexibly store and access structured instructions, the complex relationship between business data can be intuitively and accurately presented through simple instructions. Therefore, through structured query language instructions, the transaction data in the present application can be flexibly and accurately operated on. Without spending too much manpower and time, the flexibility and accuracy of the relational operations of the transaction data can be greatly improved, thereby improving the efficiency and accuracy of data processing. At the same time, the present application can also add data integrity constraints to the relational data model in the blockchain consensus process. That is, the consensus process of the present application can not only reach consensus based on the execution results of the transaction data, but also reach consensus based on the data integrity constraint rules. This can ensure that the data written into the relational database complies with the data integrity constraint rules, further improving the robustness of the blockchain, and thus improving the accuracy of the written data.

[0184] Further, see Figure 6 , Figure 6 This is a structural diagram of a data processing device provided in an embodiment of the present application. The data processing device may be a computer program (including program code) running on a computer device, for example, the data processing device is an application software; the data processing device may be used to execute Figure 3 As shown in the method. Figure 6 As shown, the data processing device 1 may include: a request receiving module 11, an execution result obtaining module 12, a block consensus module 13 and a block storage module 14.

[0185] A request receiving module 11 is configured to receive a request for uploading a block from a second node. The uploading request is configured to request that the block be stored in a relational database corresponding to the blockchain. A relational database is a database established based on a relational data model.

[0186] An execution result acquisition module 12 is configured to acquire a first pre-execution result of transaction data in a block based on an on-chain request;

[0187] The block consensus module 13 is configured to perform consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result for the block; the first pre-execution result refers to the execution result obtained after the first node pre-executes the transaction-related operation involved in the transaction data based on the structured query language instruction corresponding to the transaction data; the structured query language instruction refers to an instruction for operating a relational database to perform the transaction-related operation;

[0188] The block storage module 14 is configured to store the block in a relational database when the consensus result of the block is a consensus passing result.

[0189] The specific implementation of the request receiving module 11, the execution result acquisition module 12, the block consensus module 13 and the block storage module 14 can be found in the above Figure 2 The description of steps S101 to S103 in the corresponding embodiment will not be repeated here.

[0190] In one embodiment, the execution result acquisition module 12 may include: a transaction creation unit 121 , an instruction execution unit 122 , and a result determination unit 123 .

[0191] A transaction creation unit 121, configured to create an initial database transaction for a block based on an on-chain request;

[0192] The instruction execution unit 122 is used to execute the structured query language instruction indicated by the transaction-related operation in the initial database transaction and obtain the instruction execution result;

[0193] The result determination unit 123 is configured to determine the instruction execution result as the first pre-execution result of the transaction data.

[0194] The specific implementation of the transaction creation unit 121, the instruction execution unit 122 and the result determination unit 123 can be found in the above Figure 2 The description of step S102 in the corresponding embodiment will not be repeated here.

[0195] In one embodiment, the block storage module 14 may include: a target transaction acquisition unit 141 and a transaction storage unit 142 .

[0196] The target transaction acquisition unit 141 is configured to acquire a target database transaction associated with the block; the target database transaction includes a structured query language instruction in the transaction data and a first pre-execution result;

[0197] The transaction storage unit 142 is configured to store target database transactions in a relational database.

[0198] The specific implementation of the target transaction acquisition unit 141 and the transaction storage unit 142 can be found in the above Figure 2 The description of step S103 in the corresponding embodiment will not be repeated here.

[0199] In one embodiment, the on-chain request carries a second pre-execution result, which refers to the execution result obtained after the second node pre-executes the transaction relationship operation in the transaction data based on the structured query language instruction in the transaction data;

[0200] The block consensus module 13 may include: a result comparison unit 131 , a factor consensus unit 132 , a first result determination unit 133 , and a second result determination unit 134 .

[0201] A result comparison unit 131 is used to compare the first pre-execution result with the second pre-execution result to obtain a comparison result;

[0202] The factor consensus unit 132 is configured to obtain, if the comparison result between the first pre-execution result and the second pre-execution result is a match result, a primary key value included in the structured query language instruction, a foreign key value included in the structured query language instruction, and a data type corresponding to the structured query language instruction based on the data integrity constraint rule indicated by the relational data model;

[0203] The factor consensus unit 132 is further used to reach a consensus on the primary key value, the foreign key value, and the data type, and obtain a factor consensus result corresponding to the primary key value, the foreign key value, and the data type;

[0204] A first result determination unit 133, configured to determine the factor consensus result as the consensus result of the block;

[0205] The second result determination unit 134 is configured to set the consensus result of the block as a consensus failure result if the comparison result between the first pre-execution result and the second pre-execution result is a mismatch result.

[0206] The specific implementation of the result comparison unit 131, the factor consensus unit 132, the first result determination unit 133 and the second result determination unit 134 can be found in the above Figure 2 The description of step S102 in the corresponding embodiment will not be repeated here.

[0207] In one embodiment, the number of the second nodes is at least two, and the number of the second pre-execution results is at least two;

[0208] The result comparison unit 131 may include: an identical result acquisition subunit 1311 , an operation subunit 1312 , a quantity counting subunit 1313 , a ratio determination subunit 1314 , and a comparison result determination subunit 1315 .

[0209] The same result obtaining subunit 1311 is configured to form a pre-execution result set based on at least two second pre-execution results and the first pre-execution result, and determine the pre-execution results with the same result in the pre-execution result set as the pre-execution results to be counted;

[0210] An operation subunit 1312 is configured to count the number of pre-execution results to be counted, and use the number of pre-execution results to be counted as a statistical number;

[0211] The quantity counting subunit 1313 is configured to count the total quantity of the first pre-execution result and the at least two second pre-execution results.

[0212] a ratio determination subunit 1314 for determining a quantity ratio between the number of operations and the total number of results;

[0213] The comparison result determining subunit 1315 is configured to determine a comparison result between the first pre-execution result and the second pre-execution result according to the quantity ratio.

[0214] The specific implementation of the same result obtaining subunit 1311, the operation subunit 1312, the quantity counting subunit 1313, the ratio determination subunit 1314 and the comparison result determination subunit 1315 can be found in the above Figure 2 The description of step S102 in the corresponding embodiment will not be repeated here.

[0215] In one embodiment, the comparison result determination subunit 1315 is further specifically configured to compare the quantity ratio with a ratio threshold;

[0216] The comparison result determination subunit 1315 is further specifically configured to determine the comparison result between the first pre-execution result and the second pre-execution result as a matching result if the quantity ratio is greater than a ratio threshold;

[0217] The comparison result determination subunit 1315 is further specifically configured to determine the comparison result between the first pre-execution result and the second pre-execution result as a mismatch result if the quantity ratio is less than a ratio threshold.

[0218] In one embodiment, the factor consensus unit 132 may include: a first factor consensus sub-unit 1321 , a second factor consensus sub-unit 1322 , a third factor consensus sub-unit 1323 , and a consensus result determination sub-unit 1324 .

[0219] The first factor consensus sub-unit 1321 is used to reach a consensus on the primary key value and obtain a first factor consensus sub-result corresponding to the primary key value;

[0220] The second factor consensus sub-unit 1322 is used to reach a consensus on the foreign key value and obtain a second factor consensus sub-result corresponding to the foreign key value;

[0221] The third factor consensus sub-unit 1323 is used to reach a consensus on the data type and obtain a third factor consensus sub-result corresponding to the data type;

[0222] The consensus result determining subunit 1324 is configured to determine a factor consensus result corresponding to the primary key value, the foreign key value, and the data type based on the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result.

[0223] The specific implementation of the first factor consensus subunit 1321, the second factor consensus subunit 1322, the third factor consensus subunit 1323 and the consensus result determination subunit 1324 can be found in the above Figure 3 The description of steps S301 to S304 in the corresponding embodiment will not be repeated here.

[0224] In one embodiment, the data integrity constraint rule includes a uniqueness constraint rule configured for the primary key value;

[0225] The first factor consensus sub-unit 1321 is further specifically used to obtain the target entity object indicated by the primary key value;

[0226] The first factor consensus sub-unit 1321 is further specifically configured to traverse the set of existing entity objects contained in the relational database based on the uniqueness constraint rule;

[0227] The first factor consensus sub-unit 1321 is further specifically configured to, if there is no existing entity object identical to the target entity object in the set of existing entity objects, determine the target entity object as a unique entity object, and determine the first factor consensus sub-result corresponding to the primary key value as the factor consensus pass result;

[0228] The first factor consensus sub-unit 1321 is further specifically configured to determine the target entity object as a duplicate entity object if there is an existing entity object identical to the target entity object in the existing entity object set, and determine the first factor consensus sub-result corresponding to the primary key value as a factor consensus failure result.

[0229] In one embodiment, the data integrity constraint rules include referential validity constraint rules configured for foreign key values;

[0230] The second factor consensus sub-unit 1322 is further specifically configured to determine, based on the reference validity constraint rule, the reference object indicated by the foreign key value in the structured query language instruction and the object file to which the reference object belongs;

[0231] The second factor consensus subunit 1322 is further specifically used to obtain the object file and traverse the object file;

[0232] The second factor consensus sub-unit 1322 is further specifically configured to, if the object file contains a reference object, determine the reference object as a valid reference object, and determine the second factor consensus sub-result corresponding to the foreign key value as a factor consensus pass result;

[0233] The second factor consensus sub-unit 1322 is further specifically configured to determine the reference object as an invalid reference object if the object file does not contain the reference object, and determine the second factor consensus sub-result corresponding to the foreign key value as a factor consensus failure result.

[0234] In one embodiment, the data integrity constraint rules include a set of standard data types supported by the relational database;

[0235] The third factor consensus subunit 1323 is further specifically used to traverse the standard data type set;

[0236] The third factor consensus sub-unit 1323 is further specifically configured to determine the data type as a valid data type if a standard data type identical to the data type exists in the standard data type set, and determine the third factor consensus sub-result corresponding to the data type as a factor consensus pass result;

[0237] The third factor consensus sub-unit 1323 is further specifically configured to determine the data type as an invalid data type if there is no standard data type identical to the data type in the standard data type set, and determine the third factor consensus sub-result corresponding to the data type as a factor consensus failure result.

[0238] In one embodiment, the consensus result determining subunit 1324 is further configured to determine the factor consensus result corresponding to the primary key value, foreign key value, and data type as the consensus pass result if the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result are all factor consensus pass results;

[0239] The consensus result determination subunit 1324 is further specifically configured to determine the factor consensus result corresponding to the primary key value, foreign key value, and data type as a consensus failure result if at least one of the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result is a factor consensus failure result.

[0240] In one embodiment, the on-chain request carries a digital signature; the digital signature is obtained by the second node signing the block based on the second node's private key;

[0241] The block-based data processing device 1 may further include: a signature verification module 15 , a step execution module 16 and a communication suspension module 17 .

[0242] The signature verification module 15 is used to obtain the public key of the second node and verify the digital signature based on the public key;

[0243] Step execution module 16 is configured to, if the signature verification passes, execute a first pre-execution result of obtaining the transaction data in the block based on the on-chain request, and reach consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result for the block;

[0244] The communication suspension module 17 is configured to mark the second node as an abnormal node if the signature verification fails, and to suspend data communication with the abnormal node within a target time period.

[0245] The specific implementation of the signature verification module 15, the step execution module 16 and the communication suspension module 17 can be found in the above Figure 2 The description of step S102 in the corresponding embodiment will not be repeated here.

[0246] In the embodiment of the present application, a relational database is used to store the on-chain data of the blockchain, and the relational database is mainly accessed through structured language query instructions. Therefore, the present application can perform relational operations on the transaction data through structured query language instructions. Since the relational data model can intuitively and flexibly store and access structured instructions, the complex relationship between business data can be intuitively and accurately presented through simple instructions. Therefore, through structured query language instructions, the transaction data in the present application can be flexibly and accurately operated on. Without spending too much manpower and time, the flexibility and accuracy of the relational operations of the transaction data can be greatly improved, thereby improving the efficiency and accuracy of data processing. At the same time, the present application can also add data integrity constraints to the relational data model in the blockchain consensus process. That is, the consensus process of the present application can not only reach consensus based on the execution results of the transaction data, but also reach consensus based on the data integrity constraint rules. This can ensure that the data written into the relational database complies with the data integrity constraint rules, further improving the robustness of the blockchain, and thus improving the accuracy of the written data. In summary, this application can improve the flexibility of relational operations of business data in blockchain business, thereby improving data processing efficiency and accuracy, while reducing data processing costs.

[0247] Further, see Figure 7 , Figure 7 This is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. Figure 7 As shown above Figure 6 The blockchain-based data processing device 1 in the corresponding embodiment can be applied to the above-mentioned computer device 8000, which may include: a processor 8001, a network interface 8004 and a memory 8005. In addition, the above-mentioned computer device 8000 also includes: a user interface 8003, and at least one communication bus 8002. The communication bus 8002 is used to realize the connection and communication between these components. The user interface 8003 may include a display screen (Display), a keyboard (Keyboard), and the optional user interface 8003 may also include a standard wired interface and a wireless interface. The network interface 8004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 8005 may be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 8005 may optionally be at least one storage device located away from the aforementioned processor 8001. As Figure 7 As shown, the memory 8005 as a computer-readable storage medium may include an operating system, a network communication module, a user interface module, and a device control application.

[0248] exist Figure 7 In the computer device 8000 shown, the network interface 8004 can provide network communication functions; the user interface 8003 is mainly used to provide an interface for user input; and the processor 8001 can be used to call the device control application stored in the memory 8005 to achieve:

[0249] Receive a request for uploading the block from the second node; the uploading request is used to request that the block be stored in a relational database corresponding to the blockchain. A relational database refers to a database established based on a relational data model;

[0250] Obtaining a first pre-execution result of the transaction data in the block based on the on-chain request, and reaching consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result of the block; the first pre-execution result refers to the execution result obtained by the first node after pre-executing the transaction-related operations involved in the transaction data based on the structured query language instructions corresponding to the transaction data; the structured query language instructions refer to instructions for operating a relational database to execute the transaction-related operations;

[0251] When the consensus result of the block is a consensus-passed result, the block is stored in a relational database.

[0252] It should be understood that the computer device 8000 described in the embodiment of the present application can execute the above Figures 2 to 3 The description of the data processing method based on blockchain in the corresponding embodiment can also be performed as described above. Figure 6 The description of the blockchain-based data processing device 1 in the corresponding embodiment will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated here.

[0253] In addition, it should be noted that: the embodiment of the present application also provides a computer-readable storage medium, and the computer-readable storage medium stores a computer program executed by the computer device 8000 for data processing mentioned above, and the computer program includes program instructions. When the processor executes the program instructions, the computer program can execute the above-mentioned data processing. Figures 2 to 3 The description of the blockchain-based data processing method described in the corresponding embodiment will not be repeated here. Furthermore, the description of the beneficial effects of the same method will not be repeated here. For technical details not disclosed in the computer-readable storage medium embodiments involved in this application, please refer to the description of the method embodiments of this application.

[0254] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0255] In one aspect of the present application, a computer program product or computer program is provided. The computer program product or computer program includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the method provided in one aspect of the embodiments of the present application.

[0256] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.

[0257] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0258] The methods and related devices provided by the embodiments of the present application are described with reference to the method flow charts and / or structural diagrams provided by the embodiments of the present application. Specifically, each process and / or block in the method flow charts and / or structural diagrams, as well as the combination of processes and / or blocks in the flow charts and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the steps in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific way, so that the instructions stored in the computer-readable memory produce a product including the instruction device, which implements the function specified in the process. Figure 1 Schematic diagram of one or more processes and / or structures Figure 1 These computer program instructions can also be loaded onto a computer or other programmable data processing device, so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the process. Figure 1 The flow or flows and / or structures illustrate the steps of the functions specified in one block or multiple blocks.

[0259] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A data processing method based on blockchain, characterized in that: include: The first node receives a request for uploading a block to a blockchain from the second node; the uploading request is used to request that the block be stored in a relational database corresponding to the blockchain, where the relational database is a database established based on a relational data model; the uploading request carries a second pre-execution result of the transaction data in the block, where the second pre-execution result is an execution result obtained by the second node after pre-executing a transaction relationship operation in the transaction data based on a structured query language instruction in the transaction data; Obtaining a first pre-execution result of the transaction data in the block based on the on-chain request, and reaching a consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result of the block; the first pre-execution result refers to an execution result obtained after the first node pre-executes the transaction-related operation involved in the transaction data based on the structured query language instruction corresponding to the transaction data; the structured query language instruction refers to an instruction for operating the relational database to execute the transaction-related operation; the first pre-execution result and the second pre-execution result both refer to the final instruction execution results of all structured query language instructions involved in the transaction data, and the instruction execution result is an execution success result or an execution failure result; When the consensus result of the block is a consensus-passed result, storing the block in the relational database; The step of performing consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result of the block includes: comparing the first pre-execution result with the second pre-execution result to obtain a comparison result; if the comparison result between the first pre-execution result and the second pre-execution result is a match result, then based on the data integrity constraint rules indicated by the relational data model, performing consensus on the primary key value contained in the structured query language instruction, the foreign key value contained in the structured query language instruction, and the data type corresponding to the structured query language instruction, obtaining a factor consensus result corresponding to the primary key value, the foreign key value, and the data type, and determining the factor consensus result as the consensus result of the block; if the comparison result between the first pre-execution result and the second pre-execution result is a mismatch result, setting the consensus result of the block as a consensus failure result.

2. The method according to claim 1, characterized in that The first pre-execution result of obtaining the transaction data in the block based on the on-chain request includes: Creating an initial database transaction for the block based on the on-chain request; In the initial database transaction, executing the structured query language instruction indicated by the transaction-related operation to obtain an instruction execution result; The instruction execution result is determined as the first pre-execution result of the transaction data.

3. The method according to claim 1, characterized in that Storing the block in the relational database includes: Obtaining a target database transaction associated with the block; the target database transaction includes the structured query language instruction in the transaction data and the first pre-execution result; The target database transaction is stored in the relational database.

4. The method according to claim 1, wherein The number of the second nodes is at least two, and the number of the second pre-execution results is at least two; The comparing the first pre-execution result with the second pre-execution result to obtain a comparison result includes: According to at least two second pre-execution results and the first pre-execution result, a pre-execution result set is formed, and pre-execution results with the same result in the pre-execution result set are determined as pre-execution results to be counted; Counting the number of the to-be-counted pre-execution results, and using the number of the to-be-counted pre-execution results as the statistical number; Counting the total number of results corresponding to the first pre-execution result and the at least two second pre-execution results; A quantity ratio between the statistical quantity and the total quantity of the results is determined, and the comparison result between the first pre-execution result and the second pre-execution result is determined according to the quantity ratio.

5. The method according to claim 4, characterized in that The determining, according to the quantity ratio, the comparison result between the first pre-execution result and the second pre-execution result includes: comparing the quantity ratio to a ratio threshold; If the quantity ratio is greater than the ratio threshold, determining the comparison result between the first pre-execution result and the second pre-execution result as a matching result; If the quantity ratio is less than the ratio threshold, the comparison result between the first pre-execution result and the second pre-execution result is determined as a mismatch result.

6. The method according to claim 1, characterized in that The consensus on the primary key value, the foreign key value, and the data type is obtained to obtain a consensus result of factors corresponding to the primary key value, the foreign key value, and the data type, including: A consensus is performed on the primary key value to obtain a first factor consensus sub-result corresponding to the primary key value; A consensus is performed on the foreign key value to obtain a second factor consensus sub-result corresponding to the foreign key value; A consensus is generated on the data type to obtain a third factor consensus sub-result corresponding to the data type; A factor consensus result corresponding to the primary key value, the foreign key value, and the data type is determined according to the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result.

7. The method according to claim 6, characterized in that The data integrity constraint rule includes a uniqueness constraint rule configured for the primary key value; The step of performing consensus on the primary key value to obtain a first factor consensus sub-result corresponding to the primary key value includes: Obtain the target entity object indicated by the primary key value; Based on the uniqueness constraint rule, traverse the set of existing entity objects contained in the relational database; If there is no existing entity object identical to the target entity object in the set of existing entity objects, determining the target entity object as a unique entity object, and determining the first factor consensus sub-result corresponding to the primary key value as a factor consensus pass result; If there is an existing entity object identical to the target entity object in the existing entity object set, the target entity object is determined to be a duplicate entity object, and the first factor consensus sub-result corresponding to the primary key value is determined to be a factor consensus failure result.

8. The method according to claim 6, characterized in that The data integrity constraint rules include reference validity constraint rules configured for the foreign key values; The step of performing consensus on the foreign key value to obtain a second factor consensus sub-result corresponding to the foreign key value includes: Based on the reference validity constraint rule, determining the reference object indicated by the foreign key value and the object file to which the reference object belongs in the structured query language instruction; Obtain the object file, and traverse the object file; If the object file contains the reference object, determining the reference object as a valid reference object, and determining the second factor consensus sub-result corresponding to the foreign key value as a factor consensus passing result; If the object file does not include the reference object, the reference object is determined to be an invalid reference object, and the second factor consensus sub-result corresponding to the foreign key value is determined to be a factor consensus failure result.

9. The method according to claim 6, characterized in that The data integrity constraint rules include a set of standard data types supported by the relational database; The consensus on the data type to obtain a third factor consensus sub-result corresponding to the data type includes: Traversing the set of standard data types; If there is a standard data type identical to the data type in the standard data type set, the data type is determined as a valid data type, and the third factor consensus sub-result corresponding to the data type is determined as a factor consensus pass result; If the standard data type set does not contain a standard data type identical to the data type, the data type is determined to be an invalid data type, and the third factor consensus sub-result corresponding to the data type is determined to be a factor consensus failure result.

10. The method according to claim 6, characterized in that The determining, based on the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result, a factor consensus result corresponding to the primary key value, the foreign key value, and the data type includes: If the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result are all factor consensus passed results, then determining the factor consensus result corresponding to the primary key value, the foreign key value, and the data type as the consensus passed result; If at least one of the first factor consensus sub-result, the second factor consensus sub-result, and the third factor consensus sub-result is a factor consensus failure result, the factor consensus result corresponding to the primary key value, the foreign key value, and the data type is determined as a consensus failure result.

11. The method according to claim 1, wherein The on-chain request carries a digital signature; the digital signature is obtained by the second node signing the block based on the second node's private key; The method further comprises: Obtaining a public key of the second node, and verifying the digital signature based on the public key; If the signature verification passes, the steps of obtaining the first pre-execution result of the transaction data in the block based on the on-chain request, and performing consensus on the block according to the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result of the block are executed; If the signature verification fails, the second node is marked as an abnormal node, and data communication with the abnormal node is suspended within a target time period.

12. A data processing device based on blockchain, characterized in that: include: a request receiving module, configured to receive a request for uploading a block from a second node; the uploading request is configured to request that the block be stored in a relational database corresponding to the blockchain, wherein the relational database is a database established based on a relational data model; the uploading request carries a second pre-execution result of the transaction data in the block, wherein the second pre-execution result is an execution result obtained by the second node after pre-executing a transaction relationship operation in the transaction data based on a structured query language instruction in the transaction data; An execution result acquisition module, configured to acquire a first pre-execution result of the transaction data in the block based on the on-chain request; a block consensus module, configured to reach consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model, thereby obtaining a consensus result for the block; the first pre-execution result refers to an execution result obtained after the first node pre-executes the transaction-related operation involved in the transaction data based on the structured query language instruction corresponding to the transaction data; the structured query language instruction refers to an instruction for operating the relational database to execute the transaction-related operation; the first pre-execution result and the second pre-execution result both refer to the final instruction execution results of all structured query language instructions involved in the transaction data, and the instruction execution result is an execution success result or an execution failure result; A block storage module, configured to store the block in the relational database when the consensus result of the block is a consensus-passed result; The step of performing consensus on the block based on the first pre-execution result and the data integrity constraint rules indicated by the relational data model to obtain a consensus result of the block includes: comparing the first pre-execution result with the second pre-execution result to obtain a comparison result; if the comparison result between the first pre-execution result and the second pre-execution result is a match result, then based on the data integrity constraint rules indicated by the relational data model, performing consensus on the primary key value contained in the structured query language instruction, the foreign key value contained in the structured query language instruction, and the data type corresponding to the structured query language instruction, obtaining a factor consensus result corresponding to the primary key value, the foreign key value, and the data type, and determining the factor consensus result as the consensus result of the block; if the comparison result between the first pre-execution result and the second pre-execution result is a mismatch result, setting the consensus result of the block as a consensus failure result.

13. A computer device, characterized in that: include: processor, memory, and network interface; The processor is connected to the memory and the network interface, wherein the network interface is used to provide a network communication function, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method according to any one of claims 1 to 11.

14. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded by a processor and executing the method according to any one of claims 1 to 11.

15. A computer program product, characterized in that The computer program product comprises a computer program stored in a computer-readable storage medium. The computer program is suitable for being read and executed by a processor, so as to enable a computer device having the processor to perform the method according to any one of claims 1 to 11.

Citation Information

Patent Citations

  • Secure and transparent database transactions in untrusted environments using permissioned, minimally invasive blockchain technology

    WO2020225224A1