Data processing methods, apparatus, computer equipment and storage media
By dividing the blockchain network into consensus clusters and introducing supervisory nodes, the problem of low data storage efficiency is solved, and efficient data storage and supervision are achieved.
Patent Information
- Application Number
- CN202110640268.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-08
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2041-06-08
AI Technical Summary
Existing technologies have low storage efficiency when storing data on blockchain networks, requiring data broadcasting and network-wide consensus verification, resulting in cumbersome processing procedures.
By dividing the blockchain network into consensus clusters, a target consensus cluster is determined for the target business for consensus processing, and a supervisory node is introduced to verify the validity. Blocks that pass the verification are directly stored in the blockchain network, avoiding network-wide consensus processing.
It improves the efficiency of data storage to the blockchain network and enables the supervision of storage blocks, thereby enhancing the oversight capabilities of the blockchain network.
Smart Images

Figure CN115454320B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data processing method, apparatus, computer equipment, and storage medium. Background Technology
[0002] With the continuous development of blockchain technology, and based on the security and reliability of data stored in blockchain networks, an increasing amount of transaction data (or business data) relies on blockchain networks for storage to ensure data security and immutability. Currently, storing data on a blockchain network requires broadcasting the data to be stored so that consensus nodes can reach a consensus and verify the data to produce blocks. Based on the voting of these consensus nodes, the final block is selected for storage on the blockchain. Therefore, the current method of processing data and storing it on the blockchain is cumbersome and inefficient. Summary of the Invention
[0003] This invention provides a data processing method, apparatus, computer equipment, and storage medium that can improve storage efficiency when storing data on a blockchain.
[0004] On one hand, embodiments of the present invention provide a data processing method, including:
[0005] In response to a storage trigger operation for business data under a target business, a target consensus cluster associated with the target business is determined from the blockchain network; the blockchain network includes at least one consensus cluster, each consensus cluster provides consensus services for one or more businesses, the target consensus cluster is used to provide consensus services for the target business, and the target consensus cluster includes one or more consensus nodes;
[0006] Consensus processing of the business data is performed in the target consensus cluster, and a block containing the business data is obtained based on the consensus result of the target consensus cluster on the business data.
[0007] The supervisory node is triggered to perform a validity check on the block to be stored, and after the block to be stored passes the validity check, the block containing the business data is stored in the blockchain network.
[0008] In another aspect, embodiments of the present invention provide a data processing apparatus, comprising:
[0009] A determining unit is configured to, in response to a storage trigger operation for business data under a target business, determine a target consensus cluster associated with the target business from the blockchain network; the blockchain network includes at least one consensus cluster, each consensus cluster provides consensus services for one or more businesses, the target consensus cluster is used to provide consensus services for the target business, and the target consensus cluster includes one or more consensus nodes;
[0010] The acquisition unit is used to perform consensus processing on the business data in the target consensus cluster, and to acquire a block containing the business data to be stored based on the consensus result of the target consensus cluster on the business data.
[0011] The storage unit is used to trigger the supervisory node to perform validity verification on the block to be stored, and after the block to be stored passes the validity verification, the block containing the business data is stored in the blockchain network.
[0012] In another aspect, embodiments of the present invention provide a computer device, including a processor, an input device, an output device, and a memory, wherein the processor, input device, output device, and memory are interconnected, wherein the memory is used to store a computer program supporting the computer device in executing the above-described method, the computer program including program instructions, and the processor is configured to invoke the program instructions to execute the following steps:
[0013] In response to a storage trigger operation for business data under a target business, a target consensus cluster associated with the target business is determined from the blockchain network; the blockchain network includes at least one consensus cluster, each consensus cluster provides consensus services for one or more businesses, the target consensus cluster is used to provide consensus services for the target business, and the target consensus cluster includes one or more consensus nodes;
[0014] Consensus processing of the business data is performed in the target consensus cluster, and a block containing the business data is obtained based on the consensus result of the target consensus cluster on the business data.
[0015] The supervisory node is triggered to perform a validity check on the block to be stored, and after the block to be stored passes the validity check, the block containing the business data is stored in the blockchain network.
[0016] In another aspect, embodiments of the present invention provide a computer-readable storage medium storing program instructions, which, when executed by a processor, are used to perform the data processing method as described in the first aspect.
[0017] In this embodiment of the invention, when a computer device receives a storage trigger operation for business data under a target business, it can first determine the target consensus cluster associated with the target business from the blockchain network. The blockchain network includes at least one consensus cluster, each consensus cluster provides consensus services for one or more businesses, and the target consensus cluster is used to provide consensus services for the target business. The target consensus cluster includes one or more consensus nodes. Further, the computer device can perform consensus processing on the business data in the target consensus cluster, and obtain a block to be stored containing the business data based on the consensus result of the target consensus cluster on the business data, thereby triggering a supervisory node to verify the validity of the block to be stored. After the block to be stored passes the validity verification, the block containing the business data is stored in the blockchain network. This allows computer devices to store business data under the target business in the blockchain network without having to send the business data under the target business to all consensus nodes in the blockchain for consensus processing. Instead, only a portion of the consensus nodes related to the target business need to process the business data for consensus. This can effectively improve the efficiency of storing business data under the target business in the blockchain network. Moreover, since a supervisory node is introduced to supervise the block to be stored after the block containing the business data is generated, the supervision of the blocks stored in the blockchain network can be realized. Attached Figure Description
[0018] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the following description of the embodiments will be briefly introduced. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1a This is a schematic diagram of a blockchain network provided in an embodiment of the present invention;
[0020] Figure 1b This is a schematic diagram of a blockchain provided in an embodiment of the present invention;
[0021] Figure 1c This is a schematic diagram of a blockchain-based data processing system provided in an embodiment of the present invention;
[0022] Figure 2 This is a schematic flowchart of a data processing method provided in an embodiment of the present invention;
[0023] Figure 3a This is a schematic diagram of a blockchain network provided in an embodiment of the present invention;
[0024] Figure 3b This is a schematic diagram illustrating an embodiment of the present invention for processing electronic invoices.
[0025] Figure 3c This is a schematic diagram of a tree structure constructed based on different types of blocks provided in an embodiment of the present invention;
[0026] Figure 3d This is a schematic diagram of a storage service data provided in an embodiment of the present invention;
[0027] Figure 4 This is a schematic flowchart of a data processing method provided in an embodiment of the present invention;
[0028] Figure 5 This is a schematic diagram of a blockchain network provided in an embodiment of the present invention;
[0029] Figure 6 This is a schematic block diagram of a data processing device provided in an embodiment of the present invention;
[0030] Figure 7 This is a schematic block diagram of a computer device provided in an embodiment of the present invention. Detailed Implementation
[0031] This invention proposes a blockchain-based data processing method. The blockchain network mentioned in this invention includes multiple consensus nodes, which are divided into one or more consensus clusters. Each consensus cluster in the blockchain network is associated with a specific business function, enabling it to perform consensus processing on business data within that function. Therefore, when storing business data in the blockchain network, a target consensus cluster associated with the corresponding business function can be identified first. The business data can then be sent to that target consensus cluster, allowing each consensus node within the target cluster to perform consensus processing on the business data. This allows for the processing of the business data based on the consensus of each consensus node. The consensus result generates a block to be stored for the business data. Further, after obtaining this block, the computer device, in order to supervise the block storage process in the blockchain network, can first have a supervisory node verify the validity of the block. The block that passes the validity verification is then stored in the blockchain network. Based on the division of the blockchain network into different consensus nodes, different consensus clusters are associated with different businesses, enabling concurrent on-chain storage of business data under different businesses. Furthermore, based on the validity verification process of the corresponding block during business data storage, the validity of the blockchain stored in the network can be supervised, thereby improving the supervision capability of the blockchain. Blockchain is a novel application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. Essentially, it is a decentralized database, a chain of data blocks linked using cryptographic methods. Each data block contains information about a batch of network transactions, used to verify the validity of the information (anti-counterfeiting) and generate the next block. In the embodiments of this invention, the blockchain network (or blockchain system) can be a distributed system formed by clients and multiple nodes (any form of computing device connected to the network, such as servers and user terminals) through network communication. Its system structure can be as follows: Figure 1a As shown, this distributed system may include multiple nodes (i.e., any form of computing device in the network, such as servers and user terminals) and clients. The nodes form a peer-to-peer (P2P) network. The P2P protocol is an application layer protocol that runs on top of the Transmission Control Protocol (TCP). The P2P network is based on a specific type of network protocol. The network nodes do not need a central node to maintain the network state. Instead, each node maintains the state of the entire network or the connection state of its neighboring nodes through broadcast interaction with neighboring nodes.
[0032] As is understandable, a blockchain consists of a series of blocks sequentially arranged according to their creation time. Once a new block is added to the blockchain, it cannot be removed. The blocks record the data submitted by nodes in the blockchain system, such as... Figure 1b The diagram illustrates an optional block structure provided in this embodiment of the invention. Each block in the blockchain network includes: the hash value of the transaction records stored in this block (the hash value of this block), and the hash value of the previous block. Blocks are connected through their hash values to form a blockchain. Additionally, a block may include information such as a timestamp when it was generated. Therefore, based on the connection order between blocks in the blockchain, the blocks preceding and following a given block can be determined. Furthermore, the computer device mentioned in this embodiment refers to a node device corresponding to any consensus node in the target consensus cluster associated with the business data to be stored, determined from the blockchain network. This computer device can be a terminal device or a server; no limitation is made in this embodiment.
[0033] In one embodiment, this blockchain-based data processing method can be applied to, for example... Figure 1cThe data processing system shown includes a client 10, a computer device 11, and a supervisory node 12. The client 10 receives business data and distributes it to a consensus cluster associated with the corresponding business (or business type) for consensus processing based on the business type. The computer device 11 is a node device corresponding to any consensus node in the target consensus cluster associated with the target business. It is used to obtain the business data of the corresponding business from the client 10 and broadcast the obtained business data to the target consensus cluster, so that each node device in the target consensus cluster can perform consensus processing on the business data and obtain the consensus processing result for the business data. If the service data obtained by the client 10 is service data under the target service, then after receiving the service data under the target service, the client 10 can send the service data under the target service to the target consensus cluster associated with the target service for consensus processing. Assuming that the target consensus cluster is the consensus cluster where the computer device 11 is located, then when the client 10 sends the service data under the target service to the target consensus cluster for consensus processing, it can send the service data under the target service to any consensus node in the target consensus cluster (if it is the computer device 11). Then, after the computer device 11 obtains the service data under the target service from the client 10, it can broadcast the obtained service data under the target service in the target consensus cluster so that each consensus node in the target consensus cluster can perform consensus processing on the service data and obtain the consensus processing result of the service data.
[0034] After each node in the target consensus cluster performs consensus processing on the business data, each node in the target consensus cluster will generate a reference block containing the business data. Then, a reference block can be selected from the reference blocks generated by each node in the target consensus cluster as a block to be stored, and the supervisory node 12 will be triggered to perform a validity verification on the block to be stored. It can be understood that after the block to be stored passes the validity verification, the block to be stored can be stored in the blockchain network, thereby realizing the uploading of business data to the blockchain network for storage. The supervisory node 12 may join the blockchain network and perform the required regulatory verification operations only when there is a validity verification for the block. Alternatively, the supervisory node 12 may join the blockchain network in advance. In this embodiment of the invention, there are no limitations on the timing of the supervisory node 12 joining the blockchain network, the method of leaving the blockchain network, or the timing. It should be noted that the supervisory node 12 may be a node device with strong credibility or regulatory capabilities, or it may be a collection of multiple node devices with strong credibility or regulatory capabilities. The node devices with strong credibility or regulatory capabilities include any one or more of public security supervision node devices, customs supervision node devices, and central bank supervision node devices.
[0035] Please see Figure 2 This is a schematic flowchart illustrating a blockchain-based data processing method proposed in an embodiment of the present invention. This data processing method can be specifically executed by the aforementioned computer equipment, such as... Figure 2 As shown, the method may include:
[0036] S201, in response to the storage trigger operation of business data under the target business, determines the target consensus cluster associated with the target business from the blockchain network.
[0037] In one embodiment, the business data under the target business is submitted by a user-side business node, which is deployed in a witness network within a blockchain network. This blockchain network includes a witness network and a consensus network, such as... Figure 3aAs shown, business nodes in the witness network execute business transactions but do not participate in accounting consensus. Instead, they obtain block header data and partially authorized visible block data from the consensus network through identity authentication. Consensus nodes in this consensus network perform accounting consensus and are divided into different consensus clusters based on business type. In other words, the blockchain network includes at least one consensus cluster, each providing consensus services for one or more businesses. The target consensus cluster provides consensus services for the target business and includes one or more consensus nodes. In one embodiment, the witness network and consensus network in this blockchain network are generally located in different network environments. Typically, the witness network is in a public network, while the consensus network is in a private network. To enable data communication between the business nodes in the witness network and the consensus nodes in the consensus network, routing devices are configured between the witness network and the consensus network to ensure data communication between the node devices in the witness network and the node devices in the consensus network. The consensus network is also the core network, and the witness network can also be called the business network. The business nodes included in the witness network consist of business SPV witness nodes (a type of simple payment verification node).
[0038] Since the consensus nodes in the consensus network reside in a relatively secure private cloud, their mutual access is inherently secure thanks to the consensus mechanism, eliminating the need for additional identity management and network control. However, the business nodes in the witness network reside in a public network and may be accessed by other unidentified network terminals. Therefore, the access of business nodes and other potential nodes to the consensus network needs strict control. In one embodiment, the blockchain network can support the storage of business data from different business areas (or business types), specifically including government affairs, tax affairs, etc. When users submit data from different business areas, they can do so through the corresponding business node, such as... Figure 3b As shown, computer devices can submit business data under electronic invoice services through tax-related business nodes, based on the above. Figure 3a and Figure 3b As can be seen, the business layer is located in the witness network and also submits business operation interactions to the consensus layer (i.e., the layer where the consensus network is located). The business layer, the routing proxy layer, and the core consensus layer (i.e., the layer where the consensus network is located) constitute the entire complete blockchain business system. The routing proxy layer plays a role in isolating the business layer and facilitating data exchange between the business layer and the core consensus network layer.
[0039] In one embodiment, when a computer device obtains business data for a target business from a user-side business node, it determines that a storage trigger operation for the obtained business data for that target business has been initiated. This allows it to identify the target consensus cluster associated with the target business within the blockchain network. Specifically, when the user-side business node sends business data for the target business to the blockchain network for storage, it will send the data to the device corresponding to any consensus node used to process business data for that specific business type, based on the different business types. In other words, the consensus cluster where the computer device resides is the target consensus cluster used to process the business data for that target business. For example, if the target business is an electronic invoice business, then the target consensus cluster is an invoice-related consensus cluster; or if the target business is an export business, then the target consensus cluster is an export business-related consensus cluster. It is understood that the consensus nodes in the blockchain network are divided into one or more consensus clusters based on business, and each consensus cluster is only used for consensus processing of business data under one associated business, and will not process data under other businesses. For instance, the invoice-related consensus cluster will only process business data under the invoice business, and will not process business data under the export business. Therefore, it can be understood that after the computer device obtains the storage request for business data under the target business, it can take the consensus cluster where it is located as the target consensus cluster and perform consensus processing on the business data in the target consensus cluster, that is, proceed to step S202.
[0040] S202, perform consensus processing on business data in the target consensus cluster, and obtain the block to be stored containing business data based on the consensus result of the target consensus cluster on business data.
[0041] When a computer device performs consensus processing on service data under a target service in a target consensus cluster, the service data is first broadcast to each consensus node in the target consensus cluster. After receiving the service data, each consensus node in the target consensus cluster can generate a reference block containing the service data. Then, each consensus node in the target consensus cluster performs consensus processing on the service data, and after obtaining the corresponding reference block, the computer device obtains a reference block containing the service data from the generated reference block as a block to be stored. When a computer device determines a reference block as a block to be stored from the generated reference blocks, a representative node can first be determined from the target consensus cluster. If the node device corresponding to the selected representative node is the computer device, then the computer device can determine a reference block as a block to be stored from the generated reference blocks. Alternatively, if the node device corresponding to the selected representative node is not a computer device, then the computer device can trigger the representative node to determine a reference block as a block to be stored from the generated reference blocks. In this embodiment of the invention, the computer device is taken as a representative node in the target consensus cluster for detailed explanation. When the computer device is not a representative node, please refer to the embodiments of the present invention.
[0042] In one embodiment, when a computer device determines a block to be stored from reference blocks generated by each consensus node in the target consensus cluster, it can broadcast the reference block generated by any consensus node to the target consensus cluster. This allows each consensus node in the target consensus cluster to vote on each generated reference block, and further, based on the result of the consensus vote, select the block to be stored from the generated reference blocks. In this embodiment, the method and basis for consensus voting by each consensus node in the target consensus cluster after the computer device broadcasts the reference block generated by any consensus node to the target consensus cluster are not limited. After the computer device obtains the block to be stored containing business data, it can trigger a supervisory node to verify the validity of the block to be stored, thereby storing the block containing the business data in the blockchain network, and proceeding to step S203.
[0043] S203 triggers the supervisory node to perform validity verification on the block to be stored, and after the block to be stored passes the validity verification, the block containing business data is stored in the blockchain network.
[0044] In one embodiment, the blockchain network includes three types of blocks: final blocks, consensus optional blocks, and blocks awaiting regulatory verification. The blockchain comprised of final blocks is the main chain, while the blockchain comprised of one or more consensus optional blocks is the alternative chain. It is understood that final blocks are blocks already determined in the main chain, immutable, and all forked chains in the consensus process, chains that produce blocks in parallel, must be based on final blocks. Consensus optional blocks may fork, and new consensus optional blocks can be continuously added after all qualified consensus optional blocks. Consensus optional blocks are blocks that have passed the validity verification of the supervisory nodes. Blocks awaiting regulatory verification are always located after consensus optional blocks in the connection relationship and are blocks that have not passed the validity verification of the supervisory nodes. Based on the definitions of the three types of blocks, it can be understood that the reference block obtained after the consensus nodes in the target consensus cluster process the business data as mentioned above, and the selected block to be stored are blocks to be supervised and verified. After the block to be stored is verified by the supervisory node, it becomes a consensus optional block. It can be understood that after the block to be stored is stored in the blockchain network, the block becomes the final block.
[0045] In one embodiment, based on the three types of blocks included in the blockchain network and the connection relationships between the blocks, a structure such as... can be constructed. Figure 3c As shown in the tree structure, after constructing the tree structure, voting can be conducted based on the longest chain algorithm to select the first block of the longest chain (let's say block X) from the consensus candidate blocks and add it to the final block. All forks not based on block X will be pruned and cleaned up. In other words, the selected longest chain is the blockchain ultimately stored in the blockchain network. Specifically, after the computer device determines the block containing the business data to be stored and verifies its validity, if the block passes the validity check, it can add the block containing the business data as a consensus candidate block to the tree structure as a leaf node. This allows the blockchain network to confirm the final blockchain stored in the blockchain network based on the longest chain criterion. Therefore, it can be understood that, in order for the computer device to store the block containing the business data into the blockchain network as quickly as possible, when adding the valid block to the tree structure as a consensus candidate block, the computer device selects the longest candidate chain from the candidate chains formed by the current consensus candidate blocks and adds it, thereby realizing the storage of the block containing the business data into the blockchain network. Figure 3d As shown, if the block to be stored that has passed the validity check is determined by the computer device to be block a, and the main chain of the current blockchain network is composed of the final blocks as shown... Figure 3d The blockchain marked 10 is shown in the image, and the backup chains included in this blockchain network, each consisting of at least one consensus optional block, are respectively included in, as shown in, Figure 3d The blockchains are labeled as 20, 30, and 40. Since the backup chain 20 has the longest length, the computer device can add the block to be stored (i.e., block a) that has passed the validity check to the backup chain 20. Then, when selecting a blockchain using the longest chain criterion, the selected blockchain will be the blockchain consisting of the main chain 10 and the backup chain 20. Subsequently, the backup chains 30 and 40 can be deleted, thereby enabling the storage of block a in the blockchain network.
[0046] It is understood that the representative nodes in the consensus clusters of this blockchain network can take turns selecting the longest chain, and additionally select the blockchain to be finally stored in the blockchain network based on the longest chain criterion. Since the consensus clusters are used to process different businesses, it is possible to concurrently store data under different businesses on the chain. Before each representative node in the consensus cluster of this blockchain network selects the longest chain, a supervisory node (or regulatory node) will be triggered to supervise and verify the blocks to be stored submitted by the corresponding consensus node cluster. The supervisory node is registered and configured in the corresponding ecological business. If it is necessary to supervise tax business, the regulatory node may include one or more of public security regulatory nodes, customs regulatory nodes, and central bank regulatory nodes. The regulatory node can join and perform the required supervision and verification when needed, and can also leave when not needed. Its supervision program can also be upgraded and modified. In this embodiment of the invention, there are no restrictions on the timing and method of the regulatory node joining and leaving the blockchain network. Furthermore, if a supervisory node is conducting a random check, it can return a signature indicating that the block to be stored does not require verification when it determines that the block does not need to be verified. The block to be stored with this signature can be considered to have passed the validity check. It is understandable that after a supervisory node registers, an authoritative institution (such as the aforementioned customs agency) will issue a certificate. This certificate refers to a Public Key Infrastructure (PKI) system. In this system, a certificate is proof of identity for a public key holder, issued by an authoritative institution (Certificate Authority, CA). Based on the PKI, asymmetric encryption and digital signatures for information (or business data, or transaction data) can be achieved. PKI mainly includes public and private key cryptography, x.509 certificates (a type of digital certificate), and CA certificate issuance centers.
[0047] In this embodiment of the invention, when a computer device receives a storage trigger operation for business data under a target business, it can first determine the target consensus cluster associated with the target business from the blockchain network. The blockchain network includes at least one consensus cluster, each consensus cluster provides consensus services for one or more businesses, and the target consensus cluster is used to provide consensus services for the target business. The target consensus cluster includes one or more consensus nodes. Further, the computer device can perform consensus processing on the business data in the target consensus cluster, and obtain a block to be stored containing the business data based on the consensus result of the target consensus cluster on the business data, thereby triggering a supervisory node to verify the validity of the block to be stored. After the block to be stored passes the validity verification, the block containing the business data is stored in the blockchain network. This allows computer devices to store business data under the target business in the blockchain network without having to send the business data under the target business to all consensus nodes in the blockchain for consensus processing. Instead, only a portion of the consensus nodes related to the target business need to process the business data for consensus. This can effectively improve the efficiency of storing business data under the target business in the blockchain network. Moreover, since a supervisory node is introduced to supervise the block to be stored after the block containing the business data is generated, the supervision of the blocks stored in the blockchain network can be realized.
[0048] Please see Figure 4 This is a schematic flowchart of a blockchain-based data processing method proposed in an embodiment of the present invention, as shown below. Figure 4 As shown, the method may include:
[0049] S401, in response to a storage trigger operation for business data under the target business, a target consensus cluster associated with the target business is determined from the blockchain network; the blockchain network includes at least one consensus cluster, each consensus cluster provides consensus services for one or more businesses, the target consensus cluster is used to provide consensus services for the target business, and the target consensus cluster includes one or more consensus nodes.
[0050] In one embodiment, the specific implementation of step S401 can be found in the specific implementation of step S201 in the above embodiment, and will not be repeated in this embodiment.
[0051] S402 performs consensus processing on business data in the target consensus cluster and obtains the block to be stored containing business data based on the consensus result of the target consensus cluster on business data.
[0052] S403 triggers the supervisory node to perform validity verification on the block to be stored, and after the block to be stored passes the validity verification, the block containing business data is stored in the blockchain network.
[0053] In steps S402 and S403, since the consensus nodes included in the blockchain network are divided into multiple consensus clusters based on business differences, and since the blockchain network includes a main chain and at least one alternative chain, the blockchain network can be as follows: Figure 5 The diagram illustrates a blockchain network consisting of only a central main chain. Transactions processed by different consensus clusters within the network are ultimately submitted to the main chain for storage. In one embodiment, the block production and on-chain processing of a consensus cluster within the blockchain network is also anchored to a block specific to its business, and the information recorded in the block indicates the connection relationships between blocks, such as... Figure 5 The circles shown represent consensus nodes. Consensus nodes in different consensus clusters are used to process transactions under different business scenarios (i.e., business data under different business scenarios). Each consensus cluster selects a node as a representative node, and through the representative node, sends the block containing transaction data under a certain business scenario selected by the consensus cluster to the main chain and participates in the consensus process of the block on the main chain. In one embodiment, the process of storing business data under the corresponding business scenario on the chain by each consensus cluster in the blockchain network includes the following ①~③:
[0054] ① The consensus nodes in each consensus cluster complete a consensus on the business data under the corresponding business (i.e., generate a reference block that includes the business data under the corresponding business), and submit the block to the representative node of the consensus cluster after it is produced. The representative node is responsible for submitting it to the main chain.
[0055] ② The representative node of the consensus cluster submits a block from the obtained blocks to the main chain consensus tree (i.e., the tree structure composed of the three types of blocks in the blockchain network mentioned above). After one main chain consensus, it becomes a block to be supervised and is added to a leaf of a tree in the above figure, that is, it is added as a consensus optional block.
[0056] ③ The main chain consensus nodes continuously confirm the consensus candidate block as the final node based on the longest chain vote in the current consensus tree, and store the selected longest chain in the blockchain network. Both consensus protocols are part of the main chain consensus, but they operate independently.
[0057] In one embodiment, any candidate chain in the blockchain network includes one or more candidate blocks, and each candidate block has passed validity verification. Any candidate chain is connected to the main chain. When the computer device stores the block containing business data to be stored in the blockchain network, it can first select the longest candidate chain from at least one candidate chain as the target candidate chain, and connect the block containing business data to the candidate chain as a new target candidate chain. Then, if the computer device adds the block containing business data to be stored after the last block in the target candidate chain, a new blockchain consisting of the new target candidate chain and the main chain can be stored in the blockchain network. If the computer device adds the block to be stored as a leaf node of the target candidate chain instead of after the last block, it will use the longest chain criterion to determine the blockchain to be stored in the blockchain network. In this case, there is a possibility that the block to be stored may not be selected. The blockchain network will then return the block to the representative node (i.e., the computer device). After the computer device retrieves the returned block from the blockchain network, it will reselect a block based on the blocks generated by the consensus nodes of the target consensus cluster for validity verification and storage.
[0058] In one embodiment, the supervisory node includes a node device corresponding to a supervisory agency related to the target business, and the supervisory node has completed registration and configuration in the blockchain network. When the computer device triggers the supervisory node to perform validity verification on the block to be stored, it can first obtain the verification method for the block to be stored. Verification methods include sampling and full inspection. When the computer device determines that the verification method is sampling, and determines based on the sampling rules that the block to be stored does not need validity verification, it adds a skip verification identifier to the block to be stored. When the computer device determines that the verification method is full inspection, it performs validity verification on the block to be stored. The validity verification for the block to be stored includes one or more of the following: verifying the authenticity of the business data stored in the block to be stored; verifying the duplication of the business data stored in the block to be stored.
[0059] In one embodiment, if the computer device determines that the block to be stored has failed the validity check, it may proceed to step S404.
[0060] S404 If it is determined that the block to be stored has failed the validity check, the alarm information sent by the blockchain network is obtained, and a new block to be stored containing the business data is obtained again based on the consensus result of the target consensus cluster on the business data.
[0061] S405: After the new blockchain to be stored passes the validity verification, the new blockchain to be stored is stored in the blockchain network.
[0062] In steps S404 and S405, after the computer device triggers the supervisory node to perform validity verification on the block to be stored, if the computer device determines that the block to be stored has failed the validity verification (i.e., the block to be stored is invalid), the block to be stored will be abandoned, and the blocks to be supervised and verified after the block to be stored will be pruned. That is, the blockchain network will delete the corresponding blocks to be supervised and verified from the tree structure. In addition, the representative node in the consensus cluster (such as the node corresponding to the computer device) that submitted the block determined to be invalid by the supervisory node will receive an alarm message and perform alarm processing based on the alarm message. The pruned blocks to be supervised and verified will be returned to the submitting representative node so that the representative node can reselect a valid longest chain and submit it to the main chain for consensus after re-determining a new block. In other words, if the computer device determines that the block to be stored has failed the validity check, it will obtain the alarm information sent from the blockchain network, as well as the returned block to be stored. Based on the consensus results of the consensus nodes in the target consensus cluster regarding the business data, it can then obtain a new block to be stored for validity check and storage. In one embodiment, after determining that the block to be stored is invalid (i.e., has failed the validity check), the computer device will also obtain related blocks associated with the blockchain to be stored (i.e., blocks located after the block to be stored based on the aforementioned tree structure) and return the related blocks to the representative node that submitted them, so that the corresponding representative node can resubmit a new related block.
[0063] In one embodiment, if a block is pruned and eliminated due to consensus on the final block or because a preceding block fails validity verification, and is thus pruned as a subsequent block, since the business data in the block and the block itself are valid and have already been agreed upon in the corresponding consensus sub-cluster, the pruned block does not need to undergo the business verification process in the consensus sub-cluster again. It only needs to be added back to the tree structure as a block to be verified based on the longest chain rule. In one embodiment, based on the interaction between the main chain and the supervisory node, the blockchain network can perform rate limiting on consensus clusters with verification problems, suspending their ability to submit blocks to the main chain, deducting corresponding virtual electronic resources, or requiring the consensus cluster to replace its representative node, etc. That is, after the computer device determines that the block to be stored has failed validity verification and obtains alarm information from the blockchain network, it will execute corresponding alarm processing based on the alarm information. The alarm processing includes one or more of the following: limiting the number of blocks to be submitted for storage, deducting corresponding virtual electronic resources, replacing the representative node, etc.
[0064] In this embodiment of the invention, after receiving a storage trigger operation for business data under a target business, the computer device can determine the target consensus cluster associated with the target business from the blockchain network. Consensus processing of the business data can then be performed within this target consensus cluster. Based on the consensus result of the target consensus cluster, the computer device can obtain a block containing the business data to be stored and trigger a supervisory node to verify the validity of the block. If the block passes the validity verification, it can be stored in the blockchain network. If the block fails the validity verification, the computer device will obtain an alarm message from the blockchain network and execute corresponding alarm processing. Furthermore, the computer device will re-obtain a new block to be stored for validity verification and storage. This allows the main chain of the blockchain network to be monitored by supervisory nodes. Based on the business division of consensus nodes in the blockchain network and the classification of block types, concurrent on-chain storage of multiple businesses can be effectively performed, thereby improving the flexibility of data storage on the main chain under supervision and ensuring the secure storage of the corresponding business.
[0065] Based on the description of the above data processing method embodiments, this invention also proposes a data processing apparatus, which can be a computer program (including program code) running on the aforementioned computer device. This data processing apparatus can be used to perform tasks such as... Figure 2 and Figure 4 For the data processing method described above, please refer to [link / reference]. Figure 6 The data processing device includes: a determining unit 601, an acquiring unit 602, and a storage unit 603.
[0066] The determining unit 601 is used to determine, in response to a storage trigger operation for business data under a target business, a target consensus cluster associated with the target business from the blockchain network; the blockchain network includes at least one consensus cluster, each consensus cluster provides consensus services for one or more businesses, the target consensus cluster is used to provide consensus services for the target business, and the target consensus cluster includes one or more consensus nodes;
[0067] The acquisition unit 602 is used to perform consensus processing on the business data in the target consensus cluster, and to acquire a block containing the business data to be stored based on the consensus result of the target consensus cluster on the business data.
[0068] Storage unit 603 is used to trigger the supervisory node to perform validity verification on the block to be stored, and after the block to be stored passes the validity verification, to store the block containing the business data into the blockchain network.
[0069] In one embodiment, each consensus node in the target consensus cluster generates a reference block containing the business data after performing consensus processing on the business data; the acquisition unit 602 is specifically used for:
[0070] The reference block generated by any consensus node is broadcast to the target consensus cluster, so that each consensus node in the target consensus cluster can vote on each generated reference block.
[0071] Based on the consensus voting results, a block to be stored is selected from the generated reference block.
[0072] In one embodiment, the blockchain network includes a main chain and at least one alternative chain, each alternative chain including one or more alternative blocks, and each alternative block has passed validity verification. Each alternative chain is connected to the main chain; the storage unit 603 is specifically used for:
[0073] Select the longest candidate chain from the at least one candidate chain as the target candidate chain, and connect the block to be stored containing the business data to the candidate chain as a new target candidate chain;
[0074] If a block containing the business data to be stored is added after the last block in the target candidate chain, then a new blockchain consisting of the new target candidate chain and the main chain will be stored in the blockchain network.
[0075] In one embodiment, the supervisory node includes: a node device corresponding to a supervisory agency related to the target business, and the supervisory node has completed registration and configuration in the blockchain network; the storage unit 603 is specifically used for:
[0076] The verification method for the supervisory node to perform validity verification on the block to be stored includes sampling and full inspection.
[0077] When the verification method is determined to be a sampling method, and when it is determined based on the sampling rules that the block to be stored does not need to be validated, a skip verification identifier is added to the block to be stored.
[0078] When the verification method is determined to be a full check, the validity of the block to be stored is verified.
[0079] In one embodiment, the validity verification of the block to be stored includes one or more of the following: verifying the authenticity of the business data stored in the block to be stored; and verifying the duplication of the business data stored in the block to be stored.
[0080] In one embodiment, the acquisition unit 602 is further configured to, if it is determined that the block to be stored has failed the validity check, acquire the alarm information sent from the blockchain network, and re-acquire a new block to be stored containing the business data based on the consensus result of the target consensus cluster on the business data.
[0081] The storage unit 603 is further configured to store the new blockchain to be stored in the blockchain network after the new blockchain to be stored passes the validity verification.
[0082] In one embodiment, the acquisition unit 602 acquires the associated blocks related to the blockchain to be stored and returns the associated blocks to the representative node that submitted the associated blocks, so that the corresponding representative node resubmits new associated blocks.
[0083] In one embodiment, the apparatus further includes an execution unit 604.
[0084] The execution unit 604 is used to perform corresponding alarm processing based on the alarm information. The alarm processing includes one or more of the following: limiting the number of blocks to be submitted for storage, deducting the corresponding virtual electronic resources, and replacing the representative node.
[0085] In this embodiment of the invention, when a storage trigger operation for business data under a target business is obtained, the determining unit 601 can first determine the target consensus cluster associated with the target business from the blockchain network; the blockchain network includes at least one consensus cluster, each consensus cluster provides consensus services for one or more businesses, the target consensus cluster is used to provide consensus services for the target business, and the target consensus cluster includes one or more consensus nodes; furthermore, consensus processing can be performed on the business data in the target consensus cluster, so that the obtaining unit 602 can obtain the block to be stored containing the business data according to the consensus result of the target consensus cluster on the business data, thereby triggering the supervisory node to perform validity verification on the block to be stored. The storage unit 603 can store the block containing business data into the blockchain network after the block to be stored passes the validity verification. This means that when storing business data under the target business into the blockchain network, it is not necessary to send the business data under the target business to all consensus nodes in the blockchain for consensus processing. Instead, only a portion of the consensus nodes related to the target business need to perform consensus processing on the business data. This can effectively improve the efficiency of storing business data under the target business into the blockchain network. Moreover, since a supervisory node will be introduced to supervise the block to be stored after the block containing the business data is generated, supervision of the blocks stored in the blockchain network can be achieved.
[0086] Please see Figure 7This is a schematic block diagram of the structure of a computer device provided in an embodiment of the present invention. Figure 7 The computer device shown in this embodiment may include: one or more processors 701; one or more input devices 702; one or more output devices 703; and a memory 704. The processors 701, input devices 702, output devices 703, and memory 704 are connected via a bus 705. The memory 704 stores a computer program, which includes program instructions, and the processor 701 executes the program instructions stored in the memory 704.
[0087] The memory 704 may include volatile memory, such as random-access memory (RAM); the memory 704 may also include non-volatile memory, such as flash memory, solid-state drive (SSD), etc.; the memory 704 may also include a combination of the above types of memory.
[0088] The processor 701 may be a central processing unit (CPU). The processor 701 may further include hardware chips. These hardware chips may be application-specific integrated circuits (ASICs), programmable logic devices (PLDs), etc. The PLD may be a field-programmable gate array (FPGA), generic array logic (GAL), etc. The processor 701 may also be a combination of the above structures.
[0089] In this embodiment of the invention, the memory 704 is used to store a computer program, the computer program including program instructions, and the processor 701 is used to execute the program instructions stored in the memory 704 to implement the above-mentioned... Figure 2 and Figure 4 The steps of the corresponding method.
[0090] In one embodiment, the processor 701 is configured to invoke the program instructions to execute:
[0091] In response to a storage trigger operation for business data under a target business, a target consensus cluster associated with the target business is determined from the blockchain network; the blockchain network includes at least one consensus cluster, each consensus cluster provides consensus services for one or more businesses, the target consensus cluster is used to provide consensus services for the target business, and the target consensus cluster includes one or more consensus nodes;
[0092] Consensus processing of the business data is performed in the target consensus cluster, and a block containing the business data is obtained based on the consensus result of the target consensus cluster on the business data.
[0093] The supervisory node is triggered to perform a validity check on the block to be stored, and after the block to be stored passes the validity check, the block containing the business data is stored in the blockchain network.
[0094] In one embodiment, after each consensus node in the target consensus cluster performs consensus processing on the business data, it will generate a reference block containing the business data; the processor 701 is configured to call the program instructions to execute:
[0095] The reference block generated by any consensus node is broadcast to the target consensus cluster, so that each consensus node in the target consensus cluster can vote on each generated reference block.
[0096] Based on the consensus voting results, a block to be stored is selected from the generated reference block.
[0097] In one embodiment, the blockchain network includes a main chain and at least one alternative chain, each alternative chain including one or more alternative blocks, and each alternative block has passed validity verification. Each alternative chain is connected to the main chain. The processor 701 is configured to invoke the program instructions to execute:
[0098] Select the longest candidate chain from the at least one candidate chain as the target candidate chain, and connect the block to be stored containing the business data to the candidate chain as a new target candidate chain;
[0099] If a block containing the business data to be stored is added after the last block in the target candidate chain, then a new blockchain consisting of the new target candidate chain and the main chain will be stored in the blockchain network.
[0100] In one embodiment, the supervisory node includes: a node device corresponding to a supervisory agency related to the target business, and the supervisory node has completed registration and configuration in the blockchain network; the processor 701 is configured to call the program instructions to execute:
[0101] The verification method for the supervisory node to perform validity verification on the block to be stored includes sampling and full inspection.
[0102] When the verification method is determined to be a sampling method, and when it is determined based on the sampling rules that the block to be stored does not need to be validated, a skip verification identifier is added to the block to be stored.
[0103] When the verification method is determined to be a full check, the validity of the block to be stored is verified.
[0104] In one embodiment, the validity verification of the block to be stored includes one or more of the following: verifying the authenticity of the business data stored in the block to be stored; and verifying the duplication of the business data stored in the block to be stored.
[0105] In one embodiment, the processor 701 is configured to invoke the program instructions to execute:
[0106] If it is determined that the block to be stored has failed the validity check, then the alarm information sent by the blockchain network is obtained, and a new block to be stored containing the business data is obtained again based on the consensus result of the target consensus cluster on the business data.
[0107] After the new blockchain to be stored passes the validity verification, the new blockchain to be stored is stored in the blockchain network.
[0108] In one embodiment, the processor 701 is configured to invoke the program instructions to execute:
[0109] Obtain the associated blocks related to the blockchain to be stored, and return the associated blocks to the representative node that submitted the associated blocks, so that the corresponding representative node can resubmit new associated blocks.
[0110] In one embodiment, the processor 701 is configured to invoke the program instructions to execute:
[0111] Based on the alarm information, corresponding alarm processing is performed. The alarm processing includes one or more of the following: limiting the number of blocks to be submitted for storage, deducting the corresponding virtual electronic resources, and replacing the representative node.
[0112] This invention provides a computer program product or computer program that 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 aforementioned actions. Figure 2 or Figure 4 The method embodiment shown. The computer-readable storage medium may be a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM), etc.
[0113] The above-disclosed embodiments are merely partial examples of the present invention and should not be construed as limiting the scope of the invention. Those skilled in the art will understand that all or part of the processes for implementing the above embodiments, and equivalent variations made in accordance with the claims of the present invention, still fall within the scope of the invention.
Claims
1. A blockchain-based data processing method, characterized in that, include: In response to a storage-triggered operation for business data under a target business, a target consensus cluster associated with the target business is determined from the blockchain network; The blockchain network includes a main chain and at least one alternative chain. Each alternative chain is connected to the final block of the main chain. Each alternative chain includes one or more alternative blocks, and each alternative block has passed the validity verification of a supervisory node. The blockchain network includes at least one consensus cluster. Each consensus cluster provides consensus services for one or more services. The blockchain network supports the at least one consensus cluster to concurrently provide consensus services for their respective services. The target consensus cluster is used to provide consensus services for the target service. The target consensus cluster includes one or more consensus nodes. Consensus processing of the business data is performed in the target consensus cluster, and a block containing the business data is obtained based on the consensus result of the target consensus cluster on the business data. The supervisory node is triggered to perform a validity check on the block to be stored, and after the block to be stored passes the validity check, the longest candidate chain is selected from the at least one candidate chain as the target candidate chain. The block to be stored containing the business data is connected to the target candidate chain to form a new target candidate chain; If the block containing the business data to be stored is added to the last block in the target candidate chain, then a new blockchain consisting of the new target candidate chain and the main chain will be stored in the blockchain network.
2. The method of claim 1, wherein, After processing the business data, each consensus node in the target consensus cluster will generate a reference block containing the business data. The step of obtaining the block to be stored containing the business data based on the consensus result of the target consensus cluster on the business data includes: The reference block generated by any consensus node is broadcast to the target consensus cluster, so that each consensus node in the target consensus cluster can vote on each generated reference block. Based on the consensus voting results, a block to be stored is selected from the generated reference block.
3. The method of claim 1, wherein, The supervisory node includes: a node device corresponding to a supervisory agency related to the target business, and the supervisory node has completed registration and configuration in the blockchain network; triggering the supervisory node to perform validity verification on the block to be stored includes: The verification method used by the supervisory node to verify the validity of the block to be stored includes a sampling method and a full check method. When the verification method is determined to be a sampling method, and when it is determined based on the sampling rules that the block to be stored does not need to be validated, a skip verification identifier is added to the block to be stored. When the verification method is determined to be a full check, the validity of the block to be stored is verified.
4. The method of claim 1, wherein, The validity verification of the block to be stored includes one or more of the following: verifying the authenticity of the business data stored in the block to be stored; verifying the duplication of the business data stored in the block to be stored.
5. The method as described in claim 1, characterized in that, The method further includes: If it is determined that the block to be stored has failed the validity check, then the alarm information sent by the blockchain network is obtained, and a new block to be stored containing the business data is obtained again based on the consensus result of the target consensus cluster on the business data. After the new block to be stored passes the validity verification, the new block to be stored is stored in the blockchain network.
6. The method as described in claim 5, characterized in that, The method further includes: Obtain the associated block related to the block to be stored, and return the associated block to the representative node that submitted the associated block, so that the corresponding representative node can resubmit a new associated block.
7. The method as described in claim 5, characterized in that, The method further includes: Based on the alarm information, corresponding alarm processing is performed. The alarm processing includes one or more of the following: limiting the number of blocks to be submitted for storage, deducting the corresponding virtual electronic resources, and replacing the representative node.
8. A data processing device based on blockchain, characterized in that, include: A determining unit is configured to, in response to a storage trigger operation for business data under a target business, determine a target consensus cluster associated with the target business from the blockchain network; the blockchain network includes a main chain and at least one alternative chain, each alternative chain being connected to the final block of the main chain, each alternative chain including one or more alternative blocks, and each alternative block having passed the validity verification of a supervisory node; the blockchain network includes at least one consensus cluster, each consensus cluster providing consensus services for one or more businesses, the blockchain network supporting the at least one consensus cluster concurrently providing consensus services for their respective businesses, the target consensus cluster being used to provide consensus services for the target business, and the target consensus cluster including one or more consensus nodes; The acquisition unit is used to perform consensus processing on the business data in the target consensus cluster, and to acquire a block containing the business data to be stored based on the consensus result of the target consensus cluster on the business data. The storage unit is used to trigger the supervisory node to perform validity verification on the block to be stored, and after the block to be stored passes the validity verification, select the longest candidate chain from the at least one candidate chain as the target candidate chain; connect the block to be stored containing the business data to the target candidate chain as a new target candidate chain; if the block to be stored containing the business data is added after the last block in the target candidate chain, then the new blockchain composed of the new target candidate chain and the main chain is stored in the blockchain network.
9. A computer device, characterized in that, The device includes a processor, an input device, an output device, and a memory, wherein the processor, the input device, the output device, and the memory are interconnected, wherein the memory is used to store a computer program, the computer program including program instructions, and the processor is configured to invoke the program instructions to execute the method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, the computer program including program instructions that, when executed by a processor, cause the processor to perform the method as described in any one of claims 1 to 7.
11. A computer program product comprising computer instructions, characterized in that, The computer instructions are stored in a computer-readable storage medium and, when read and executed by the processor of a computer device, cause the computer device to perform the method as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Method and device for processing blockchain data, system, equipment and storage medium
CN108615153A
Data processing method, related node and system
CN110647559A
Block chain main chain determination method, device and equipment, and storage medium
CN111737358A
