A blockchain-based data storage method, device, equipment and medium
By introducing witness subnetworks and consensus subnetworks into the blockchain network, and utilizing supervisory nodes to review and sign consensus candidate blocks, the problems of data tampering and centralized management in blockchain data storage are solved, achieving secure and efficient data storage and consensus verification.
Patent Information
- Application Number
- CN202110640018.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-08
- Publication Date
- 2025-12-19
- Estimated Expiration
- 2041-06-08
AI Technical Summary
In blockchain technology, how can we achieve secure and effective consensus verification to prevent data tampering and realize centralized supervision and management of business data?
A data storage method based on blockchain is designed. By introducing a witness subnetwork and a consensus subnetwork into the blockchain network, and using regulatory nodes to review and sign consensus candidate blocks, it is ensured that only blocks that have been reviewed by regulatory nodes can be processed by consensus and are uploaded to the blockchain after successful consensus verification.
It enables centralized supervision and management of business data in the blockchain network, protects data privacy, improves security and consensus efficiency, and enhances the operational efficiency of the blockchain network.
Smart Images

Figure CN115455460B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computers, in particular to the field of artificial intelligence, and especially to a data storage method based on a blockchain, a data storage device based on a blockchain, a data storage equipment based on a blockchain, and a computer readable storage medium. BACKGROUND
[0002] With the rapid development of computer technology, the blockchain technology has gradually attracted the attention of users, and more and more users or enterprises choose to store data in the blockchain to prevent data tampering. Consensus is the basis of the blockchain technology. The so-called consensus refers to that the nodes in the blockchain network perform consensus verification on the newly generated block through a consensus algorithm. If the consensus verification is successful, the block is chained to the blockchain to achieve the storage of the block data in the blockchain. If the consensus verification fails, the new block cannot be chained to the blockchain. Therefore, in the process of data storage through the blockchain, how to achieve safe and effective consensus is an important research topic. SUMMARY
[0003] The embodiments of the present application provide a data storage method, device, equipment and medium based on a blockchain. In the process of data storage through the blockchain, a safe and effective consensus scheme is designed to achieve the purpose of centralized supervision and management of business data on the basis of ensuring the tamper-proof nature of the blockchain.
[0004] In one aspect, the embodiments of the present application provide a data storage method based on a blockchain. The blockchain is located in a blockchain network, the blockchain network includes a witness subnetwork and a consensus subnetwork, the witness subnetwork includes at least one business node, and the consensus subnetwork includes N consensus clusters and a supervision node, N is an integer greater than 1, each consensus cluster is composed of multiple accounting nodes, and each consensus cluster elects one accounting node as a representative node in the respective consensus cluster. N representative nodes form a consensus committee of the blockchain. The data storage method is executed by a target representative node in the consensus committee, and the target representative node is any representative node in the consensus committee. The data storage method includes:
[0005] Obtaining a target consensus chain waiting for consensus in the blockchain network, the blockchain network including at least one consensus chain to be verified, each consensus chain being sequentially linked by one or more consensus candidate blocks, each consensus candidate block being a block verified by the supervision node, and the target consensus chain being the longest chain in the at least one consensus chain;
[0006] Selecting a target consensus candidate block from the target consensus chain, the target consensus candidate block being a consensus candidate block at a target position on the target consensus chain;
[0007] Performing consensus verification on the target consensus candidate block;
[0008] If the target consensus candidate block passes the consensus verification of the consensus committee, the target consensus candidate block is determined as a final block, and the final block is stored in the blockchain.
[0009] In the embodiments of the present application, the target consensus chain can be obtained from at least one consensus chain waiting for consensus in the blockchain network, the target consensus chain being the longest chain in the at least one consensus chain; and the consensus candidate blocks on the at least one consensus chain are all blocks that have passed the review of the supervision node; this design ensures that only blocks that have passed the review of the supervision node can be subjected to consensus processing, so as to ensure that the business data in the blocks can be centrally supervised and managed, and the privacy of the business data in the blocks can be protected, effectively improving the security. In addition, the target consensus candidate block at the target position in the target consensus chain is selected for consensus, and after the consensus verification succeeds, the target consensus candidate block is determined as a final block and is chained to the blockchain; this process can orderly store the blocks proposed by the multiple consensus clusters in the blockchain network to the blockchain, effectively maintaining the data chaining process in the multi-consensus cluster scenario, and thus improving the operation efficiency of the blockchain network.
[0010] In one aspect, the embodiments of the present application provide a data storage method based on a blockchain, the blockchain being located in a blockchain network, the blockchain network including a witness subnetwork and a consensus subnetwork, the witness subnetwork including at least one business node; the consensus subnetwork including N consensus clusters and a supervision node, N being an integer greater than 1; each consensus cluster being composed of multiple accounting nodes, and each consensus cluster electing one accounting node as a representative node in the respective consensus cluster; the N representative nodes forming a consensus committee of the blockchain; any representative node in the consensus committee being denoted as a target representative node, the data storage method being executed by the supervision node; the data storage method including:
[0011] determining a target business block to be processed submitted by the target representative node from a consensus tree of the blockchain;
[0012] reviewing the target business block to be processed;
[0013] if the review passes, extracting business data from the target business block to be processed;
[0014] performing signature processing on the extracted target business block to be processed to generate a target consensus candidate block;
[0015] updating the target business block to be processed as a target consensus candidate block on a consensus tree of the blockchain, so that the consensus committee performs consensus verification on the target consensus candidate block, wherein if the target consensus candidate block is a block in a target position on a target consensus chain in the blockchain network, when the target consensus candidate block successfully passes the consensus verification of the consensus committee, the target consensus candidate block is stored as a final block in the blockchain by the consensus committee.
[0016] In the embodiments of the present application, the target business block to be processed can be obtained, and after the target business block to be processed is reviewed and passed, the business data is extracted from the target business block to be processed for storage, so that the centralized storage and management of the business data in the blockchain network can be realized, the privacy of the business data is improved, and the storage resources of the consensus nodes are also saved. After the business data of the target business block to be processed is extracted, the target business block to be processed is also signed, so that the signed target business block to be processed is updated as a target consensus candidate block. In this way, the validity of the target consensus candidate block can be quickly verified by the representative node through the signature of the supervision node, and the consensus efficiency of the blockchain network is improved.
[0017] On the other hand, the embodiments of the present application provide a data storage device based on a blockchain, the blockchain is located in a blockchain network, the blockchain network includes a witness subnetwork and a consensus subnetwork, the witness subnetwork includes at least one business node; the consensus subnetwork includes N consensus clusters and a supervision node, N is an integer greater than 1; each consensus cluster is composed of a plurality of accounting nodes, and each consensus cluster elects one accounting node as a representative node in the respective consensus cluster; the N representative nodes form a consensus committee of the blockchain; the data storage device is mounted on a target representative node, and the target representative node is any one of the representative nodes in the consensus committee; the data storage device includes:
[0018] The obtaining unit is configured to obtain a target consensus chain to be consensus in the blockchain network, the blockchain network includes at least one consensus chain to be consensus, each consensus chain is sequentially linked by one or more consensus candidate blocks, and each consensus candidate block is a block reviewed by the supervision node; the target consensus chain is the longest chain in the at least one consensus chain;
[0019] The processing unit is configured to select a target consensus candidate block from the target consensus chain, the target consensus candidate block being a consensus candidate block in a target position on the target consensus chain;
[0020] The processing unit is further configured to perform consensus verification on the target consensus candidate block;
[0021] The processing unit is further configured to determine the target consensus candidate block as a final block if the target consensus candidate block passes the consensus verification of the consensus committee, and store the final block in the block chain.
[0022] In an implementation manner, the target consensus candidate block is converted from a target service block to be processed; and the processing unit is further configured to:
[0023] submit the target service block to be processed to a consensus tree of the block chain, trigger a regulatory node to review the target service block to be processed on the consensus tree, and process the target service block to be processed into the target consensus candidate block by the regulatory node after the review is passed.
[0024] In an implementation manner, the processing unit is further configured to:
[0025] generate a service block according to service data carried in the data storage request when the target representative node belongs to a target consensus cluster receiving the data storage request of the service node;
[0026] perform consensus verification on the service block in the target consensus cluster;
[0027] determine the service block as a target service block to be processed if the service block passes the consensus verification of the target consensus cluster.
[0028] In an implementation manner, the processing unit is further configured to:
[0029] select a consensus chain that forks based on the target consensus candidate block from at least one consensus chain if the target consensus candidate block passes the consensus verification of the consensus committee;
[0030] prune all consensus chains except the selected forked consensus chain in the at least one consensus chain.
[0031] In an implementation manner, the pruning processing includes: deleting a consensus candidate block on the consensus chain that is pruned from a consensus tree of the block chain; and
[0032] return the deleted consensus candidate block to the corresponding representative node.
[0033] In an implementation manner, the target consensus candidate block includes a transaction hash value, a Merkle tree root, and a signature of the regulatory node; and the processing unit, when performing the consensus verification on the target consensus candidate block, is specifically configured to:
[0034] perform consensus verification on contents included in the target consensus candidate block to obtain a consensus verification result;
[0035] broadcast the consensus verification result to other representative nodes in the consensus committee.
[0036] If the number of the representative nodes in the consensus committee that reach consensus on the content contained in the target consensus candidate block is greater than the number threshold, it is determined that the consensus committee reaches consensus verification on the target consensus candidate block.
[0037] In an implementation manner, the processing unit is further configured to:
[0038] obtain bidding information of a target consensus cluster to which the target representative node belongs, the bidding information being used to indicate that the target consensus cluster requests proposal right of the blockchain;
[0039] In the process of consensus verification on the target consensus candidate block by the consensus committee, the consensus verification result of the target consensus candidate block by the target representative node is broadcast to other representative nodes of the consensus committee, and the consensus verification result carries the bidding information, so that the consensus committee determines the winner of the proposal right of the blockchain based on the bidding information.
[0040] In an implementation manner, the processing unit is further configured to:
[0041] If the target business block to be processed on the consensus tree fails to pass the review of the supervision node, the target business block to be processed is deleted from the consensus tree of the blockchain;
[0042] If the consensus tree further contains other business blocks to be processed linked to the target business block to be processed, the other business blocks to be processed are deleted from the consensus tree of the blockchain, and the deleted other business blocks to be processed are returned to the corresponding representative nodes.
[0043] In the embodiments of the present application, the obtaining unit can obtain a target consensus chain from at least one consensus chain waiting for consensus in the blockchain network, the target consensus chain being the longest chain in the at least one consensus chain; and the consensus candidate blocks on the at least one consensus chain are all blocks that pass the review of the supervision node; this design is to ensure that only blocks that pass the review of the supervision node can be subjected to consensus processing, so as to ensure that the business data in the blocks can be centrally supervised and managed, and the privacy of the business data in the blocks can be protected, thereby effectively improving the security. In addition, the processing unit can select a target consensus candidate block at a target position in the target consensus chain to perform consensus, and determine the target consensus candidate block as a final block and chain it to the blockchain after successful consensus verification; this process can orderly store the blocks proposed by the multiple consensus clusters in the blockchain network to the blockchain, effectively maintain the data chaining process in the multi-consensus cluster scenario, and further improve the operation efficiency of the blockchain network.
[0044] In another aspect, an embodiment of the present application provides a data storage device based on a blockchain, the blockchain being located in a blockchain network, the blockchain network comprising a witness subnetwork and a consensus subnetwork, the witness subnetwork comprising at least one service node; the consensus subnetwork comprising N consensus clusters and a supervision node, N being an integer greater than 1; each consensus cluster being composed of a plurality of accounting nodes, and each consensus cluster electing one accounting node as a representative node in the respective consensus cluster; the N representative nodes forming a consensus committee of the blockchain; any representative node in the consensus committee being denoted as a target representative node, the data storage device being mounted on the supervision node; the data storage device comprising:
[0045] a processing unit configured to determine a target service block to be processed submitted by the target representative node from a consensus tree of the blockchain;
[0046] reviewing the target service block to be processed;
[0047] if the review is passed, extracting service data from the target service block to be processed;
[0048] performing signature processing on the extracted target service block to be processed to generate a target consensus candidate block;
[0049] updating the target service block to be processed as the target consensus candidate block on the consensus tree of the blockchain, so that the consensus committee performs consensus verification on the target consensus candidate block, wherein if the target consensus candidate block is a block in a target position on a target consensus chain in the blockchain network, when the target consensus candidate block successfully passes the consensus verification of the consensus committee, the target consensus candidate block is stored in the blockchain as a final block by the consensus committee.
[0050] In an implementation manner, the processing unit is further configured to:
[0051] if the service data contained in the target service block to be processed is successfully backed up in one or more data storage devices, triggering the step of performing signature processing on the extracted target service block to be processed to generate the target consensus candidate block.
[0052] In an implementation manner, the data storage device comprises one or more of the N representative nodes; or the data storage device comprises a storage device in a database;
[0053] The database comprises a public database of the blockchain, or a special database matching a service type of the target service block to be processed.
[0054] In an implementation manner, the processing unit is further configured to:
[0055] When receiving the data acquisition request sent by the service node, an address of a data storage device where the requested service data is located is acquired;
[0056] The address is returned to the service node, so that the service node acquires the service data from the data storage device according to the address.
[0057] In the embodiment of the application, the processing unit can acquire a target service block to be processed, and extract service data from the target service block to be processed and store the service data after the target service block to be processed is reviewed, so that the centralized storage and management of the service data in the blockchain network can be realized, and the storage resources of the consensus node are saved; and after the service data of the target service block to be processed is extracted, the target service block to be processed is signed, so that the target service block to be processed after signing is updated to a target consensus candidate block, so that the validity of the target consensus candidate block can be verified by the representative node through the signature of the supervision node, and the consensus efficiency of the blockchain network is improved.
[0058] In one aspect, the application provides a data storage device based on a blockchain, which comprises:
[0059] a processor configured to load and execute a computer program;
[0060] a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is executed by the processor to implement the data storage method based on the blockchain.
[0061] In one aspect, the application provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program, and the computer program is adapted to be loaded and executed by the processor to implement the data storage method based on the blockchain.
[0062] In one aspect, the application provides a computer program product or a computer program, which comprises computer instructions stored in a computer readable storage medium. The processor of the data storage device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions to make the computer device execute the data storage method based on the blockchain.
[0063] In the embodiments of the present application, the target consensus chain can be obtained from at least one consensus chain waiting for consensus in the blockchain network, the target consensus chain being the longest chain in the at least one consensus chain; and the consensus candidate blocks on the at least one consensus chain are all blocks that have been reviewed by the regulatory nodes; this design ensures that only blocks that have been reviewed by the regulatory nodes can be subjected to consensus processing, so that the business data in the blocks can be centrally regulated and managed, and the privacy of the business data in the blocks can be protected, effectively improving the security. In addition, the target consensus candidate block at the target position in the target consensus chain is selected for consensus, and after the consensus verification succeeds, the target consensus candidate block is determined as a final block and is chained to the blockchain; this process can orderly store the blocks proposed by the multiple consensus clusters in the blockchain network to the blockchain, effectively maintaining the data chaining process in the multi-consensus cluster scenario, and thus improving the operation efficiency of the blockchain network. BRIEF DESCRIPTION OF DRAWINGS
[0064] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0065] Figure 1a An architecture schematic diagram of a data sharing system provided by an exemplary embodiment of the present application is shown;
[0066] Figure 1b A structure schematic diagram of a blockchain provided by an exemplary embodiment of the present application is shown;
[0067] Figure 1c A flow schematic diagram of generating a block provided by an exemplary embodiment of the present application is shown;
[0068] Figure 1d An architecture schematic diagram of a double-layer network provided by an exemplary embodiment of the present application is shown;
[0069] Figure 1e An architecture schematic diagram of a double-layer network provided by an exemplary embodiment of the present application is shown;
[0070] Figure 1f A scenario schematic diagram of a consensus sub-network including N consensus clusters provided by an exemplary embodiment of the present application is shown;
[0071] Figure 1g A scenario architecture diagram of an electronic invoice business based on a double-layer network provided by an exemplary embodiment of the present application is shown;
[0072] Figure 1h A scene diagram of a data storage scheme provided by an example embodiment of the present application is shown;
[0073] Figure 1i A diagram showing the block type of a block in different time periods provided by an example embodiment of the present application is shown;
[0074] Figure 2 A flow diagram of a blockchain-based data storage method provided by an example embodiment of the present application is shown;
[0075] Figure 3 A flow diagram of another blockchain-based data storage method provided by an example embodiment of the present application is shown;
[0076] Figure 4 A flow diagram of another blockchain-based data storage method provided by an example embodiment of the present application is shown;
[0077] Figure 5 A structural diagram of a blockchain-based data storage device provided by an example embodiment of the present application is shown;
[0078] Figure 6 A structural diagram of another blockchain-based data storage device provided by an example embodiment of the present application is shown;
[0079] Figure 7 A structural diagram of another blockchain-based data storage device provided by an example embodiment of the present application is shown. DETAILED DESCRIPTION
[0080] The technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative labor fall within the scope of protection of the present application.
[0081] The present application embodiments relate to blockchain technology, and the related terms and concepts of the blockchain technology will be briefly introduced below:
[0082] Blockchain, a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. Its essence is a decentralized database, which is a series of data blocks associated using cryptographic methods, each data block contains information of a batch of network transactions, used to verify the validity of the information (anti-fake) and generate the next block. Blockchain can include blockchain underlying platform, platform product service layer and application service layer.
[0083] The blockchain network can be understood as a data sharing system 100, which can refer to a system for sharing data between nodes. An exemplary structure of the data sharing system 100 can be seen in Figure 1a ; as shown in Figure 1a , the data sharing system 100 refers to a system for sharing data between nodes. The data sharing system can include multiple nodes 101, which can refer to each client in the data sharing system. Each node 101 can receive input information during normal operation and maintain shared data within the data sharing system based on the received input information. To ensure information exchange within the data sharing system, each node in the data sharing system can have an information connection between nodes, and information can be transmitted between nodes through the above information connection. For example, when any node in the data sharing system receives input information, other nodes in the data sharing system obtain the input information according to the consensus algorithm, and store the input information as data in the shared data, so that the data stored on all nodes in the data sharing system is consistent.
[0084] Each node in the data sharing system has a corresponding node identifier, and each node in the data sharing system can store the node identifier of other nodes in the data sharing system, so that the generated block can be broadcast to other nodes in the data sharing system according to the node identifier of other nodes. Each node can maintain a node identifier list as shown in the following table, and store the node name and node identifier in the node identifier list. The node identifier can be an IP (Internet Protocol) address and any other information that can be used to identify the node; for example, the node identifier can also be a binary sequence code (such as 110001110). Table 1 only takes the IP address as an example for explanation:
[0085] Table 1
[0086]
[0087] Each node in the data sharing system stores a same blockchain. The blockchain is composed of multiple blocks, as shown inFigure 1b The blockchain is composed of a plurality of blocks, the initial block includes a block header and a block body, the block header stores input information characteristic values, a version number, a timestamp and a difficulty value, and the block body stores input information; the next block of the initial block takes the initial block as a parent block, the next block also includes a block header and a block body, the block header stores input information characteristic values of the current block, a block header characteristic value of the parent block, a version number, a timestamp and a difficulty value, and the like, so that the block data stored in each block in the blockchain is associated with the block data stored in the parent block, thereby ensuring the security of the input information in the block.
[0088] When generating each block in the blockchain, referring to Figure 1c When the node where the blockchain is located receives input information, the input information is checked, after the checking is completed, the input information is stored in the memory pool, and the hash tree used to record the input information is updated; then, the update timestamp is updated to the time when the input information is received, and different random numbers are tried, and the characteristic value calculation is performed multiple times, so that the calculated characteristic value can satisfy the following formula:
[0089] SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x)) < TARGET
[0090] Wherein, SHA256 is a characteristic value algorithm used for calculating the characteristic value; version (version number) is the version information of the relevant block protocol in the blockchain; prev_hash is the block header characteristic value of the parent block of the current block; merkle_root is the characteristic value of the input information; ntime is the update time of the updated timestamp; nbits is the current difficulty, which is a constant value within a certain period of time, and is determined again after a certain period of time; x is a random number; TARGET is a characteristic value threshold, which can be determined according to nbits.
[0091] In this way, when the random number satisfying the above formula is calculated, the information is stored correspondingly, the block header and the block body are generated, and the current block is obtained. Subsequently, the node where the blockchain is located broadcasts the newly generated block to other nodes in the data sharing system according to the node identifiers of the other nodes in the data sharing system, and the other nodes perform consensus verification on the newly generated block, and add the newly generated block to the stored blockchain after completing the consensus verification. Wherein, the node can perform consensus verification on the newly generated block through a consensus algorithm, and the consensus algorithm can include but is not limited to:
[0092] 1) Pow (Proof-of-Work, Proof of Work):
[0093] Proof of Work is a measure set by a system (such as the aforementioned data sharing system) to achieve a certain goal. Simply put, it is a proof that confirms the amount of work. In essence, the more work someone does, the more likely they are to receive additional rewards. Proof of Work, commonly known as "mining", is a random number that meets the rules through an XOR operation, which obtains the right to record this time, issues the data that needs to be recorded in this round, and is stored together after verification by other nodes in the blockchain network. This makes Proof of Work have the following advantages: complete decentralization, nodes can freely enter and exit.
[0094] 2) Pos (proof-of-stake, proof of stake):
[0095] Pos proof of stake is an upgraded consensus mechanism of Pow proof of work; specifically, the longer someone holds electronic resources (length of time holding electronic resources = amount of electronic resources held * time holding electronic resources), the more likely they are to obtain the right to record blocks, where electronic resources can refer to resources stored in electronic accounts in electronic form and can be circulated through the Internet; According to the proportion and time of electronic resources occupied by each node; Reduce the mining difficulty in proportion to speed up the speed of finding random numbers. Pos proof of stake shortens the time to reach consensus to some extent, but still requires mining.
[0096] 3) DPos (Delegated Proof of Stake, delegated proof of stake) share authorization proof mechanism:
[0097] The DPos share authorization proof mechanism is similar to a board of directors voting, where people holding electronic resources vote for a certain number of nodes to act as their agents for verification and record-keeping. To encourage more people to participate in the election, the system will generate a small amount of electronic resources as a reward. DPos share authorization proof mechanism is to let everyone holding bitcoins vote, and from this 101 representatives are produced, which can be understood as 101 supernodes or mining pools, and the rights of these 101 supernodes are completely equal. In a sense, if the elected representatives fail to perform their duties (when it's their turn, they fail to generate blocks), they will be removed from the network, and new supernodes will be selected to replace them. This allows the DPos share authorization proof mechanism to significantly reduce the number of nodes participating in verification and record-keeping, achieving second-level consensus verification, but the entire consensus mechanism still relies on electronic resources.
[0098] 4) pbft (Practical Byzantine Fault Tolerance, Byzantine Fault Tolerance Algorithm):
[0099] PBFT is a message-passing consensus algorithm that reaches agreement in three phases, which can be repeated in the event of a failure. Specifically, assuming a total of 3f+1 nodes, f being Byzantine faulty nodes, first, when a node discovers that a leader (e.g., a representative node, a ledger node, or a supernode) is misbehaving, it elects other replicas (nodes) as leaders through an algorithm. Second, the leader broadcasts its chosen value to other replica nodes through a pre-prepare message. If accepted, the other replica nodes send a prepare message, and if not, they do not send. Third, once 2f nodes accept the prepare message, the node sends a commit message. Finally, when 2f+1 nodes accept the commit message, the representative value is determined. The above process enables the PBFT Byzantine fault-tolerant algorithm to reach consensus among nodes composed of business participants or regulators, with security and stability guaranteed by business-related parties. Moreover, the consensus delay is approximately 2-5 seconds, basically meeting the requirements of commercial real-time processing, improving consensus efficiency, and meeting the demand for high-frequency transactions.
[0100] 5) Paxos (a distributed algorithm) algorithm:
[0101] Paxos algorithm is a two-phase algorithm with three main roles: proposer, acceptor, and learner. The proposer proposes a proposal, the acceptor agrees or rejects, and the learner obtains the final value after consensus is reached. Paxos algorithm includes two phases: ① Preparation phase: the proposer selects a proposal number n and sends a prepare request to a majority of acceptors; the acceptor receives the prepare request, and if the proposal number is greater than all the prepare requests it has already replied to, the acceptor replies to the proposer with the last accepted proposal and promises not to reply to proposals less than n. ② Approval phase: when a proposer receives a majority of acceptors' replies to the prepare request, it enters the approval phase; it sends an accept request to the acceptors that replied to the prepare request, including the number n and the value (if there is no accepted value, it can freely decide the value); under the premise of not violating its promise to other proposers, the acceptor receives the accept request and accepts it.
[0102] Paxos algorithm is suitable for a simple fault-tolerant model, that is, only failure or faulty nodes exist in the system, and no malicious nodes exist, if the number of failure nodes is x (x is a positive integer), then only x+1 non-failure nodes are needed to maintain the normal operation of the system.
[0103] 6) Raft (a distributed consensus algorithm) algorithm:
[0104] The Raft algorithm includes three roles, namely, follower, candidate and leader. A node can only be one of the three states at a certain time, and the three roles can be converted to each other with the change of time and conditions. All nodes are initially in the follower state, and the follower that does not receive a heartbeat packet within a timeout will become a candidate and broadcast a vote request, and the node that obtains the majority of votes will become a leader. The process of this round of voting is who first sends who is advantageous, and each node will only give one vote. The leader node periodically sends heartbeat packets to other nodes, and the failure of the leader node will trigger a new round of voting process.
[0105] In actual application, when the blockchain is applied to some scenes, such as a ticket business scene, a data storage scene of a commercial institution and the like; in these scenes, not all nodes in the blockchain network have sufficient resources and necessity to become a node participating in the blockchain consensus. And due to the consideration of data security, when the related data involving personal privacy or national security in the blockchain system, the universal data peer-to-peer deployment mode of the blockchain is not applicable. In order to adapt to the business demand (such as internal and external networks, business networks, office networks, etc.) and further improve the security and confidentiality of data, an embodiment of the present application provides a double-layer chain, which forms a double-layer network architecture of “witness sub-network-consensus sub-network” through a P2P (Peer to Peer, point-to-point) network, wherein the P2P network is a point-to-point connection network, and each node in the point-to-point connection is called a peer node. The P2P network is based on a specific network protocol, so that the peer nodes do not need a central node to maintain the network state, and each node maintains the node state of the whole network and the connection state with adjacent nodes through broadcast interaction with adjacent nodes.
[0106] Figure 1d An architecture diagram of a double-layer network provided by an example embodiment of the present application is shown; as Figure 1dAs shown, the blockchain network includes a witness subnetwork and a consensus subnetwork. Business nodes are deployed in the witness subnetwork, which is on the public network, while the consensus subnetwork contains ledger nodes running the blockchain consensus protocol. The witness subnetwork and the consensus subnetwork interact through a routing boundary. The business nodes in the witness subnetwork primarily execute business logic and do not participate in the ledger consensus. They obtain block header data and partially authorized block data from the consensus subnetwork through identity authentication. The consensus subnetwork is the core network of the blockchain network, used for ledger consensus. Typically, the witness subnetwork and the consensus subnetwork operate in different network environments: the witness subnetwork is on a public network, while the consensus subnetwork is on a private network. Because the consensus subnetwork is in a relatively secure private network, their mutual access is inherently secure due to the consensus mechanism, requiring no additional identity management or network control. However, business nodes are on 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 subnetwork needs to be strictly controlled.
[0107] In one feasible implementation, the ledger nodes in the consensus subnetwork can be further divided into multiple consensus clusters. That is, multiple consensus clusters can be deployed in the consensus subnetwork, and each consensus cluster can include at least one ledger node. Consensus clusters can be divided according to different rules, which may include: division based on business type, such as grouping ledger nodes processing business data of the same type into the same consensus cluster; or division based on the distance between ledger nodes, such as grouping two or more ledger nodes whose distance is less than a certain threshold into the same consensus cluster, and so on. Under this implementation, the architecture of the two-layer blockchain network can be changed to... Figure 1e ,like Figure 1e As shown, the blockchain network includes a witness subnetwork and a consensus subnetwork. Multiple consensus clusters are deployed in the consensus subnetwork, and each consensus cluster contains at least one ledger node. Any business node in the witness subnetwork can establish an information connection with the ledger node deployed in a consensus cluster within the consensus subnetwork. Assume... Figure 1e The consensus clusters shown are divided according to business type, meaning each consensus cluster can be used to provide consensus services for business data of one or more business types. For example: Figure 1e Consensus cluster 1 can be a cluster that provides consensus services for business data of the invoice business type, that is, each accounting node in consensus cluster 1 only performs consensus processing on invoice data; consensus cluster 2 can be a cluster that provides consensus services for business data of the credit reporting business type, that is, each accounting node in consensus cluster 2 only performs consensus processing on business data related to credit reporting; and so on.
[0108] exist Figure 1eIn the illustrated architecture, each consensus cluster jointly maintains a blockchain in the blockchain network, which is referred to as a main chain, and contains all information of all business ecologies in the blockchain network. Each consensus cluster can organize a business subchain of its own business. Each business subchain in each consensus cluster contains only information of the business of the respective consensus cluster. Each consensus cluster can elect a ledger node as a representative node in the respective consensus cluster; the representative node participates in consensus processing of the business subchain in the consensus cluster to which the representative node belongs, and also participates in consensus processing of the main chain. The non-representative nodes in the consensus cluster, i.e., the ledger nodes other than the representative node in the consensus cluster, only participate in consensus processing of the business subchain in the consensus cluster. In the consensus subnetwork, the representative nodes elected by each consensus cluster jointly form a consensus committee of the main chain, and jointly perform consensus processing on the main chain.
[0109] To describe in more detail the implementation of the consensus clusters in the consensus subnetwork for maintaining business data, the following describes the implementation of the consensus clusters in the consensus subnetwork for maintaining business data in combination with Figure 1f The following briefly describes a process of maintaining business data by N consensus clusters included in the consensus subnetwork, where N is an integer greater than 1. As shown in Figure 1f Each consensus cluster included in the consensus subnetwork can elect a ledger node as a representative node, and the N representative nodes form a consensus committee, which maintains a blockchain 102 of the consensus subnetwork, which is the main chain in the blockchain network. The N consensus clusters can bid for the proposal right of the blockchain network. When a consensus cluster obtains the proposal right, the consensus cluster with the proposal right is responsible for generating a new block, and the representative node of the consensus cluster with the proposal right is responsible for uploading the new block to the main chain (i.e., the blockchain 102) in the blockchain network for consensus processing by the consensus committee. For example, block A1 in the blockchain 102 is submitted by the representative node in consensus cluster 3, and for another example, block C1 in the blockchain 102 is submitted by the representative node in consensus cluster 1. In this way, the blockchain maintained by the consensus committee can record the business data of the entire consensus subnetwork, facilitating management and review of the business data provided by different consensus clusters in the entire consensus subnetwork.
[0110] Of course, each consensus cluster can also organize its own business subchain, which contains only blocks of its own business, facilitating management of the business data of the consensus cluster. In a specific implementation, when a new block is generated in a consensus cluster, the new block can anchor the last block generated in the consensus cluster, realizing organization of the business subchain of the consensus cluster. For example, Figure 1fThe consensus cluster 1 can organize its own business subchain 103, which includes the block C1 and the block C2 generated in the consensus cluster 1; wherein when the block C2 is generated in the consensus cluster 1, the block C2 can anchor the last block C1 of the business subchain 102 in the consensus cluster 1, that is, the block C2 records the hash value (subprehash) of the last block C1 of the business subchain 103 in the consensus cluster 1, that is, the hash value of the block C1. When the block C2 is submitted to the blockchain 102 of the consensus subnetwork by the representative node for consensus processing, the block C2 can also anchor the last block in the blockchain 102, and at this time the block 2 records the hash value (prehash) of the block D1 in the blockchain 102, that is, the hash value of the block D1. Based on the above description, each consensus cluster can organize its own business subchain through the subprehash in the block, so as to facilitate the management of the business data in the cluster, and the consensus committee can maintain the blockchain of the entire consensus subnetwork, so as to facilitate the unified management and review of the business data of the entire consensus subnetwork.
[0111] Taking the blockchain network as an example, the scene architecture of the double-layer network provided by the embodiments of the application is shown in the following Figure 1g As shown in Figure 1g , the blockchain network includes a business layer, a routing agent layer, and a core consensus network layer, which form the entire complete blockchain business system; wherein ① the business layer is in the witness subnetwork, and the business layer includes at least one business node, which can be an SPV node. The SPV node maintains a normal unstructured P2P network, and the business node can process tax (local tax bureau), bills (enterprise billing), payment (enterprise fund flow), and other businesses. ② The core consensus network layer is in the consensus subnetwork, and the core consensus network layer includes various consensus clusters, such as the consensus cluster 104, the consensus cluster 105, and the like. Each consensus cluster maintains a business subchain in the cluster, for example, the consensus cluster 104 maintains the core chain 1 in the cluster, and the consensus cluster 105 maintains the core chain 2 in the cluster. ③ The routing agent layer includes at least one agent node, which can provide routing services, authentication services, certificate caching services, peer-to-peer (P2P) services, and the like. The business layer and the core consensus network layer exchange information through the routing agent layer, that is, the business layer submits business operation interactions to the core consensus network layer through the routing agent layer, so that the routing agent layer plays a role of isolation between the business layer and the core consensus network layer.
[0112] Based on the above introduction of the basic structure of the double-layer network involved in the embodiments of the present application, the data storage scheme based on the blockchain based on the above double-layer network structure is briefly introduced below. The data storage scheme increases a supervision node in the consensus sub-network to review and extract the business data contained in the block, so that the business data in the block can be centrally supervised and managed, and the privacy of the business data in the block can be protected, effectively improving the security. In addition, the consensus committee obtains a target consensus chain from the blockchain network, and the consensus candidate blocks on the target consensus chain are all blocks reviewed by the supervision node; the consensus committee can select a target consensus candidate block at a target position from the target consensus chain for consensus, and determine the target consensus candidate block as a final block (Finallize Block) after successful consensus, and chain the final block to the blockchain. This process can orderly store the blocks proposed by the multiple consensus clusters in the blockchain network to the blockchain, effectively maintain the data chaining process in the multi-consensus cluster scenario, and further improve the operation efficiency of the blockchain network.
[0113] The scene architecture diagram of the data storage scheme can be seen from Figure 1h As shown in Figure 1h The consensus sub-network includes a consensus tree of the blockchain, which can be called a merkle tree. The consensus tree includes one or more chains formed by sequentially linking blocks. According to the characteristics of the blocks on the consensus tree, the consensus tree can be divided into three areas, including a supervision data extraction area, a main chain consensus candidate area, and a main chain final block area. Based on the area division of the consensus tree, the types of blocks involved in the consensus sub-network are as follows:
[0114] (1) A to-be-processed business block.
[0115] The to-be-processed business block is located in the supervision data extraction area. The to-be-processed business block is a block submitted to the consensus tree by a representative node. The to-be-processed business block has not been reviewed by the supervision node, and the to-be-processed business block includes complete business data.
[0116] (2) A consensus candidate block.
[0117] The to-be-processed business block becomes a consensus candidate block after being reviewed by the supervision node. The consensus candidate block is located in the main chain consensus candidate area, which refers to a block that has passed the review of the supervision node but has not yet passed the consensus of the consensus committee. In the process of being reviewed by the supervision node, the business data in the to-be-processed business block is extracted by the supervision node, so after the to-be-processed business block becomes a consensus candidate block, the consensus candidate block only contains transaction Hash and Merkle tree root, and does not contain business data. Moreover, after the to-be-processed business block passes the review, the supervision node will add the signature of the supervision node to the to-be-processed business block, so after the to-be-processed business block becomes a consensus candidate block, the consensus candidate block also contains the signature of the supervision node.
[0118] (3) Final block (Finallize Block).
[0119] The consensus candidate block becomes a final block after successfully passing the consensus verification of the consensus committee. The final block is located in the main chain final block area, which refers to a block that has passed the consensus verification of the consensus committee, and the final block is determined to be chained to the main chain (such as the blockchain 102), which has tamper resistance. The final block only contains transaction Hash and Merkle tree root.
[0120] The consensus sub-network includes a consensus cluster and a supervision node, and the supervision node can include but is not limited to an audit node and a management node. The supervision node is used for reviewing the to-be-processed business block, extracting the business data in the to-be-processed business block, and signing the to-be-processed business block that passes the review, etc. Further, the supervision node can also be responsible for providing content distribution services to other devices outside the consensus sub-network, such as receiving a data acquisition request sent by a business node in the witness sub-network, and responding to the data acquisition request to provide business data to the business node, etc. It should be noted that the number of supervision nodes in the embodiments of the present application can be one or more, and the number of supervision nodes is not limited in the embodiments of the present application.
[0121] The implementation of submitting a block to a blockchain by a target representative node will be described below. Figure 1h and Figure 1i The target representative node refers to a representative node in a target consensus cluster, and the target consensus cluster is any consensus cluster in the consensus sub-network.
[0122] Firstly, when the target consensus cluster has a new block transaction packaged, the target representative node of the target consensus cluster can conduct an exclusive block auction to the blockchain network, i.e., the target representative node competes for the proposal right of the next block in the blockchain. When the target representative node succeeds in the auction, it means that the target consensus cluster obtains the proposal right of the next block in the blockchain, and the representative node with the proposal right can submit the new block generated by the consensus cluster to which it belongs to the consensus tree. At this time, the new block is called a target business block to be processed, as shown in Figure 1i
[0123] Secondly, the supervisory node obtains the target business block to be processed from the consensus tree, extracts and reviews the business data of the target business block to be processed, and signs the target business block to be processed after the review is passed, and processes the target business block to be processed into a target consensus candidate block.
[0124] Finally, the consensus committee can verify the target consensus candidate block, and after the consensus verification is successful, the target consensus candidate block becomes a final block, which can be stored in the blockchain.
[0125] Based on the above description of the blockchain-based data storage scheme, the embodiments of the present application propose a more detailed blockchain-based data storage method. The blockchain-based data storage method proposed by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
[0126] Figure 2 A flowchart of a blockchain-based data storage method provided by an example embodiment of the present application is shown; the data storage method can be executed by a target representative node, which is any representative node in the consensus committee; the data storage method can include but is not limited to steps S201-S204:
[0127] S201: Obtain a target consensus chain waiting for consensus in the blockchain network.
[0128] Based on the foregoing description of the consensus tree, it can be known that the consensus tree of the blockchain includes a plurality of chains, and the plurality of chains include at least one consensus chain to be consensus. Each consensus chain is sequentially linked by one or more consensus candidate blocks, and each consensus candidate block is a block reviewed by a supervisory node. The target consensus chain is the longest chain in at least one consensus chain. The length of the consensus chain can be represented by calculating the number of blocks contained in the consensus chain.
[0129] In a specific implementation, the consensus committee can vote for the longest chain in at least one consensus chain, and determine the consensus chain with the largest number of votes as the target consensus chain. Since the voting is based on the longest chain, the length of the target consensus chain obtained by voting is the longest consensus chain among all consensus chains. For example, as shown in the schematic diagram, the three consensus chains in the main chain consensus candidate area are used to illustrate the above content. The number of consensus candidate blocks contained in the consensus chain 106 is 3, the number of consensus candidate blocks contained in the consensus chain 107 is 2, and the number of consensus candidate blocks contained in the consensus chain 108 is 2. It is determined that the number of consensus candidate blocks contained in the consensus chain 106 is the largest, and the consensus chain 106 is determined as the target consensus chain. Figure 1h
[0130] S202: Select a target consensus candidate block from the target consensus chain.
[0131] The target consensus candidate block is a block in the target position of the target consensus chain, which can be specifically a block in the first position of the target consensus chain. In combination with the above description, the target consensus candidate block can be determined as follows. Figure 1h For example, as shown in the schematic diagram, the target consensus chain is the consensus chain 106, and according to the sequence of the blocks in the target consensus chain, it can be determined that the consensus candidate block in the first position of the target consensus chain is the block X, and the block X is determined as the target consensus candidate block. Figure 1h
[0132] S203: Perform consensus verification on the target consensus candidate block.
[0133] S204: If the target consensus candidate block passes the consensus verification of the consensus committee, the target consensus candidate block is determined as the final block, and the final block is stored in the block chain.
[0134] In steps S203-S204, after the target consensus candidate block is determined from the target consensus chain, the consensus committee can perform consensus verification on the target consensus candidate block, and after the consensus verification is successful, the target consensus candidate block is determined as the final block. The final block can be added to the block chain for storage and become a block contained in the consensus subnetwork.
[0135] The consensus verification on the target consensus candidate block mainly includes the consensus verification on the content contained in the target consensus candidate block, and the consensus verification result is obtained. The content can include: transaction hash value, Merkle tree root, and signature of the regulatory node. After the target consensus node obtains the consensus verification result of the target consensus candidate block, the consensus verification result can be broadcast to other representative nodes in the consensus committee; if the number of representative nodes in the consensus committee that successfully consensus on the content contained in the target consensus candidate block is greater than the number threshold, that is, more than the number threshold of representative nodes in the consensus committee successfully consensus verify the target consensus candidate block, it can be determined that the consensus committee successfully consensus verifies the target consensus candidate block. The transaction hash value contained in the target consensus candidate block is determined when the target consensus cluster receives the business data corresponding to the target consensus candidate block. Verifying the transaction hash value can be used to determine that the business data contained in the target consensus candidate block has not been tampered with. Verifying the Merkle tree root is to verify the root hash of the Merkle tree. Verifying the Merkle tree root can be used to verify whether the block (or business data) on the consensus tree has been tampered with, determine the security of the consensus tree, and further determine whether the target consensus candidate block has been tampered with. Verifying the signature of the regulatory node can be used to verify whether the target consensus candidate block has passed the review of the regulatory node. Only blocks that have passed the review of the regulatory node and have been signed by the regulatory node have successfully verified business data, and the business data that can be chained is determined to meet the requirements of the blockchain network.
[0136] In the embodiments of the present application, the target consensus chain can be obtained from at least one consensus chain waiting for consensus in the blockchain network, and the target consensus chain is the longest chain in the at least one consensus chain. The consensus candidate blocks on the at least one consensus chain are all blocks that have passed the review of the regulatory node. This design ensures that only blocks that have passed the review of the regulatory node can be subjected to consensus processing, thereby ensuring that the business data in the blocks can be centrally regulated and managed, and the privacy of the business data in the blocks can be protected, thereby effectively improving the security. In addition, the target consensus candidate block at the target position in the target consensus chain is selected for consensus, and after the consensus verification is successful, the target consensus candidate block is determined as the final block and is chained to the blockchain. This process can orderly store the blocks proposed by the multiple consensus clusters in the blockchain network to the blockchain, effectively maintain the data chaining process in the multiple consensus cluster scenario, and further improve the operation efficiency of the blockchain network.
[0137] Figure 3 A flowchart of another blockchain-based data storage method provided by an exemplary embodiment of the present application is shown. The data storage method can be executed by a target representative node, which is any representative node in the consensus committee. The data storage method can include, but is not limited to, steps S301-S308:
[0138] S301: When the target consensus cluster to which the target representative node belongs receives a data storage request of a service node, a service block is generated according to service data carried in the data storage request.
[0139] For example, as shown in the data storage scenario, any service node in the witness subnetwork, such as the service node 109, can send a data storage request to any accounting node or representative node in the target consensus cluster, such as the service node 109 sending a data storage request to the accounting node 110 in the consensus cluster 1, and the data storage request carries service data to be stored; at this time, the target representative node can obtain the service data from the accounting node 110, and generate a service block based on the service data. Figure 1e
[0140] S302: The service block is consensus-verified in the target consensus cluster.
[0141] The service block is consensus-verified by each accounting node and representative node in the target consensus cluster, and step S303 is executed after the consensus verification is successful. Specifically, the consensus algorithm (or consensus mechanism) for consensus of the service block is stored in the accounting node and the representative node, and the accounting node and the representative node can call the consensus algorithm to consensus-verify the service block. The above-mentioned consensus verification is consensus verification of the service data contained in the service block; for example, verifying whether the service data is legal or conforms to ethics and morals, and when the verification result indicates that the service data conforms to legal regulations or moral standards, it is determined that the verification of the service data is successful; for another example, verifying whether the data format of the service data is a data format supported by the blockchain network; for another example, verifying whether the source of the service data conforms to the rules, such as setting the target consensus cluster to receive the service data sent by company A, and when the service data is from company B, it is determined that the verification of the service data fails; and the like.
[0142] S303: If the service block successfully passes the consensus verification of the target consensus cluster, the service block is determined as a target service block to be processed.
[0143] The target service block to be processed is successfully consensus-verified by the target consensus cluster, and at this time the target service block to be processed can be stored in the service subchain organized by the target consensus cluster; when it is the turn to submit the target service block to be processed to the consensus tree, the target representative node in the target consensus cluster submits the target service block to be processed to the consensus tree.
[0144] S304: The target service block to be processed is submitted to the consensus tree of the blockchain, triggering the regulatory node to review the target service block to be processed on the consensus tree, and after the review is passed, the regulatory node processes the target service block to be processed into a consensus candidate block.
[0145] The supervisory node can pull a to-be-processed business block from the consensus tree, such as a to-be-processed target business block submitted by a target representative node, and review the to-be-processed target business block. After the to-be-processed target business block passes the review, the to-be-processed target business block is processed into a consensus candidate block. However, if the to-be-processed target business block on the consensus tree fails to pass the review by the supervisory node, indicating that the to-be-processed target business block submitted by the target representative node is an invalid block, the to-be-processed target business block is deleted from the consensus tree of the blockchain, and the target representative node is punished and warned. Meanwhile, if the consensus tree further includes other to-be-processed business blocks linked to the to-be-processed target business block, which can be submitted by representative nodes of other consensus clusters in the consensus subnetwork, the other to-be-processed business blocks are deleted from the consensus tree of the blockchain, and the deleted other to-be-processed business blocks are returned to the corresponding representative nodes, so that the corresponding representative nodes can submit the returned to-be-processed business blocks to the consensus tree again in the future. It should be noted that since the to-be-processed business block returned to the corresponding representative node has already passed the consensus in the corresponding consensus cluster, it does not need to be repeated in the corresponding consensus cluster, and can be directly submitted to the consensus tree by the representative node.
[0146] For example, the to-be-processed target business block submitted by the target representative node is linked to a to-be-processed business block 1 submitted by a representative node 1 of a first consensus cluster, and the to-be-processed business block 1 is linked to a to-be-processed business block 2 submitted by a representative node 2 of a second consensus cluster. If the to-be-processed target business block fails to pass the review by the supervisory node, the to-be-processed target business block is deleted from the consensus tree of the blockchain, and the to-be-processed business block 1 is returned to the representative node 1 of the first consensus cluster, and the to-be-processed business block 2 is returned to the representative node 2 of the second consensus cluster. It can be understood that since the representative node stores the to-be-processed business block, the returned to-be-processed business block here can also be a notification message sent to the representative node, which can prompt that the to-be-processed target business block linked before the to-be-processed business block fails to pass the review, and the representative node can continue to bid for the proposal right so as to submit the to-be-processed business block to the consensus tree again after obtaining the proposal right. For example, a notification message is sent to the representative node 1 of the first consensus cluster to continue to participate in the bidding for the proposal right, so as to submit the to-be-processed business block 1 to the consensus tree again in the future.
[0147] S305: Obtain a target consensus chain waiting for consensus in the blockchain network.
[0148] S306: Select a target consensus candidate block from the target consensus chain.
[0149] S307: consensus verification is performed on the target consensus candidate block.
[0150] S308: if the target consensus candidate block passes the consensus verification of the consensus committee, the target consensus candidate block is determined as a final block, and the final block is stored in the block chain.
[0151] It should be noted that the specific implementation mode shown in steps S305-S308 can refer to the related description of the specific implementation mode of the embodiment shown in steps S201-S204 described above, which will not be repeated here. Figure 2 The specific implementation mode of the embodiment shown in steps S201-S204 in the embodiment shown in steps S201-S204 is not repeated here.
[0152] In addition, if the target consensus candidate block passes the consensus verification of the consensus committee, the embodiment of the application also supports filtering out the consensus chain that forks based on the target consensus candidate block from at least one consensus chain; and pruning all consensus chains in the at least one consensus chain except the filtered out consensus chain that forks, obtaining a consensus tree after pruning, and then repeating steps S305-S308 to constantly determine the consensus candidate block as a final block. The so-called pruning process can include deleting the consensus candidate block on the consensus chain that is pruned from the consensus tree of the block chain, and returning the deleted consensus candidate block to the corresponding representative node, so that the corresponding representative node re-submits the returned consensus candidate block to the consensus tree after obtaining the bidding qualification of the block in the subsequent process. Taking the three consensus chains in the consensus tree shown in Figure 1h As shown in Figure 1h The block X, the block X1 and the block X2 are included in the consensus chain 106, the block Y and the block Y1 are included in the consensus chain 107, and the block Y and the block Y2 are included in the consensus chain 108; based on the foregoing analysis, the target consensus chain is the consensus chain 106, and the target consensus candidate block is the block X in the consensus chain 106; wherein the chain that forks based on the block X (i.e. the target consensus candidate block) is the consensus chain 106, and the chain that does not fork based on the target consensus candidate block is the consensus chain 107 and the consensus chain 108. Then, after the target consensus candidate block passes the consensus verification of the consensus committee, the consensus chain 107 and the consensus chain 108 can be pruned, i.e. the block Y, the block Y1 and the block Y2 are deleted from the consensus tree of the block chain, and the block Y, the block Y1 and the block Y2 are returned to the corresponding representative node; the corresponding representative node described here can refer to the foregoing description, which will not be repeated here.
[0153] It can be understood that if the plurality of consensus clusters included in the consensus sub-network randomly submit the respective to-be-processed business blocks to the consensus tree, it is likely to cause the respective to-be-processed business blocks sequentially linked in the consensus tree to be in disorder, and the operation order of the blockchain network to be poor. Based on this, the embodiments of the present application support that, in the process of the consensus committee performing consensus verification on the target consensus candidate block, the consensus committee simultaneously determines the winner of the proposal right of the next block in the consensus tree, and the winner of the proposal right can submit his own to-be-processed business block to the position of the next block in the consensus tree. In this way, the order of the plurality of consensus clusters submitting the to-be-processed business blocks can be ensured in order, and the operation order and the operation efficiency of the blockchain network can be maintained and ensured.
[0154] In the following, the consensus cluster is taken as a target consensus cluster, and the representative node is taken as a target representative node as an example, and the implementation manner of the representative node bidding for the proposal right of the block is briefly described; specifically, the target representative node can obtain the bidding information of the target consensus cluster to which the target representative node belongs, and the bidding information is used to indicate that the target consensus cluster requests to bid for the proposal right of the next block of the blockchain; in the process of the consensus committee performing consensus verification on the target consensus candidate block, the target representative node broadcasts the consensus verification result of the target consensus candidate block to the other representative nodes of the consensus committee, and at this time, the consensus verification result can carry the bidding information, so that the consensus committee determines the winner of the proposal right of the blockchain based on the bidding information. Of course, if no representative node bids for the proposal right of the next block in the process of the consensus committee performing consensus verification on the target consensus candidate block, that is, in the pre-submission stage of the target consensus candidate block, the next block can be set as a blank block (such as not containing any data) or a specially configured block. Among them, the pre-submission stage refers to the stage of pre-submission processing of the target consensus candidate block by the representative nodes in the consensus committee. The so-called pre-submission processing refers to the process of whether to agree to pre-submit the target consensus candidate block, and if it is agreed to pre-submit the target consensus candidate block, it means to agree to determine the target consensus candidate block as a final block and add it to the blockchain.
[0155] In the embodiments of the present application, the target consensus chain can be obtained from at least one consensus chain waiting for consensus in the blockchain network, the target consensus chain being the longest chain in the at least one consensus chain; and the consensus candidate blocks on the at least one consensus chain are all blocks that have been reviewed by the supervision node; this design ensures that only blocks that have been reviewed by the supervision node can be subjected to consensus processing, so as to ensure that the business data in the blocks can be centrally supervised and managed, and the privacy of the business data in the blocks can be protected, thereby effectively improving the security. In addition, the target consensus candidate block at the target position in the target consensus chain is selected for consensus, and after the consensus verification succeeds, the target consensus candidate block is determined as a final block and is chained to the blockchain; this process can orderly store the blocks proposed by the multiple consensus clusters in the blockchain network to the blockchain, effectively maintain the data chaining process in the multi-consensus cluster scenario, and further improve the operation efficiency of the blockchain network.
[0156] Figure 4 A flowchart of another blockchain-based data storage method provided by an example embodiment of the present application is shown; the data storage method can be executed by a supervision node; the data storage method can include but is not limited to steps S401-S405:
[0157] S401: determining a target business block to be processed submitted by a target representative node from a consensus tree of a blockchain.
[0158] S402: reviewing the target business block to be processed.
[0159] In steps S401-S402, the supervision node can obtain a business block to be processed that has not been reviewed from the consensus tree of the blockchain, including a target business block to be processed submitted by a target representative node, and review the target business block to be processed; if the supervision node reviews the target business block to be processed and passes, i.e., determines that the target business block to be processed is valid, step S403 is executed; if the supervision node reviews the target business block to be processed and fails, i.e., determines that the target business block to be processed is invalid, step S404 can be executed. Figure 3 The operation of deleting the target business block to be processed and returning other business blocks to be processed linked after the target business block to be processed described in step S304 can be implemented in the manner described above with reference to the description of the implementation manner of step S304, and thus is not described herein.
[0160] The review manner of the target business block to be processed by the supervision node can include but is not limited to the following: ①review whether the business type of the business data of the target business block to be processed matches the data type of the data of the target consensus cluster to which the target representative node belongs; if the target representative node is a cluster for consensus of electronic invoices, the business type of the business data of the target business block to be processed should be an electronic invoice type; ②review whether the data format of the business data of the target business block to be processed meets the requirement of the blockchain network on the data format of the business data; if the blockchain network requires the data format of the business data to be a file format, when the data format of the business data of the target business block to be processed is a table format, it is determined that the review of the target business block to be processed fails; ③review whether the business data of the target business block to be processed is legal or conforms to ethics and morals; for example, check whether the business data of the target business block to be processed contains violent data, false information, etc., when it is detected that the business data of the target business block to be processed contains illegal data or information violating ethics, it is determined that the review of the multimedia data target business block to be processed fails; and the like. The above is only an exemplary enumeration of several review implementation manners, and the review manner of the target business block to be processed by the supervision node is not limited in the present application.
[0161] S403: If the review passes, extracting the business data from the target business block to be processed.
[0162] S404: Signing the extracted target business block to be processed to generate a target consensus candidate block.
[0163] After the review of the target business block to be processed in step S402 succeeds, the supervision node performs the operation of extracting the business data from the target business block to be processed, so that the supervision node can realize the unified storage of the business data of the block, facilitate the management of the business data, and save the storage resources of the representative node without affecting the storage performance and block output performance of the representative node.
[0164] After the regulatory node extracts the business data from the target business block to be processed, the regulatory node can perform signature processing on the target business block to be processed to indicate that the target business block to be processed has passed the regulatory node review. In one implementation, before the regulatory node signs the target business block to be processed after extracting the business data, the regulatory node can also verify whether the business data (or the target business block to be processed) is stored in one or more data storage devices. If the business data contained in the target business block to be processed is successfully backed up in one or more data storage devices, the step of signing the extracted target business block to be processed to generate a target consensus candidate block is triggered. In other words, after extracting the target business block to be processed, the regulatory node also needs to ensure that the business data is successfully backed up to one or more data storage devices before signing the extracted target business block to be processed. This is conducive to indexing the business data and organizing the storage of the business data. In this implementation, the type of data storage device for storing business data can not be limited, such as the data storage device can be one or more representative nodes in N representative nodes, and the one or more representative nodes can be used to process data of different business types; or the data storage device can include a storage device in a database, and the database can include a public database of a block chain, which can be used to store business data of multiple business types.
[0165] In other implementations, before performing signature processing on the target business block to be processed, the regulatory node not only verifies whether the business data of the target business block to be processed is stored in one or more data storage devices, but also verifies whether the one or more data storage devices storing the business data are devices allowed to store the business data of the target business block to be processed, i.e., whether the business data is stored in a matching data storage device. For example, certain business data can only be stored in a data storage device specially used to store data of a business type corresponding to the business data. In this case, the data storage device can include a storage device in a database, and the database can include a special database matching the business type of the target business block to be processed.
[0166] S405: Update the target business block to be processed as a target consensus candidate block on the consensus tree of the block chain.
[0167] Specifically, when the regulatory node performs signature processing on the target business block to be processed after extracting the business data, it indicates that the target business block to be processed is successfully audited, and the target business block to be processed can be updated to a target consensus candidate block on the consensus tree of the blockchain, so that the consensus committee performs consensus verification on the target consensus candidate block. Wherein, if the target consensus candidate block is a block on the target consensus chain in the blockchain network, when the target consensus candidate block successfully passes the consensus verification of the consensus committee, the target consensus candidate block is stored as a final block by the consensus committee. Through the above process, the business blocks of the multiple consensus clusters can be stored in order on the blockchain, which is conducive to maintaining the stability of the entire blockchain network.
[0168] The embodiments of the present application also support the regulatory node to organize the cache of business data (such as providing content distribution services to the outside), data archiving, data tracing, etc. according to the reading requirements of the business data. Taking the case that the regulatory node provides content distribution services to the outside as an example, when the regulatory node receives a data acquisition request sent by any business node in the witness sub-network, the address of the data storage device where the business data requested by the data acquisition request is located can be acquired, and when the number of data storage devices storing business data is multiple, a data storage device address can be selected from the multiple data storage devices according to a preset selection rule; and the address is returned to the business node, so that the business node acquires the business data from the data storage device according to the address. Taking the case that the regulatory node provides data tracing services as an example, when the regulatory node receives a request for checking and tracing a certain block in the blockchain, the business data in the data storage device according to the address of the data storage device where the business data of the block is located can be acquired from the data storage device to recover the block and realize the checking and tracing of the block. Similar to the foregoing, when the number of data storage devices storing business data is multiple, a data storage device address can be selected from the multiple data storage devices according to a preset selection rule to acquire the business data according to the selected address to recover the block. Wherein, the preset selection rule can include but is not limited to: randomly selecting an address of a data storage device; or, judging the distance between each data storage device storing business data and the business node sending the data acquisition request (or judging the distance between each data storage device storing business data and the regulatory node), and acquiring the address of the data storage device with the shortest distance; or, detecting the network state of each data storage device storing business data, and acquiring the address of the data storage device with the best network state; and the like. It can be understood that the above only gives several exemplary preset selection rules, and the embodiments of the present application do not limit the preset selection rule of the regulatory node for selecting the address of the data storage device.
[0169] In the embodiments of the present application, the target business block to be processed can be acquired, and after the target business block to be processed is reviewed and passed, the business data of the target business block to be processed is extracted and stored, so that the centralized storage and management of the business data in the blockchain network can be realized, the privacy of the business data is improved, and the storage resources of the consensus nodes are saved; and after the business data of the target business block to be processed is extracted, the target business block to be processed is also signed, so that the target business block to be processed after signing is updated to a target consensus candidate block, so that the validity of the target consensus candidate block can be verified quickly by the subsequent representative node through the signature of the supervision node, and the consensus efficiency of the blockchain network is improved. In addition, before the signature processing of the target business block to be processed is performed, it can also be detected whether the business data of the target business block to be processed is stored in one or more data devices, and only after it is determined that the business data is stored in one or more data storage devices, the signature operation is performed, so that the business data can be backed up multiple times to ensure that the business data is not missed, or before the signature processing of the target business block to be processed is performed, it can also be detected whether the business data of the target business block to be processed is stored in a data storage device matched with the business data, and only after the business data is stored in the data storage device matched with the business data, the signature operation of the target business block to be processed is performed, so that the data index of the business data can be realized, and the storage of the business data can be effectively organized.
[0170] The above describes the method of the embodiments of the present application in detail. In order to better implement the above method of the embodiments of the present application, the device of the embodiments of the present application is provided accordingly.
[0171] Figure 5 A structure diagram of a blockchain-based data storage device provided by an example embodiment of the present application is shown, which can be a computer program (including program code) running in a target representative node (such as any representative node); the blockchain-based data storage device can be used to execute part or all of the steps in the method embodiments shown in Figure 2 and Figure 3 . Wherein, the blockchain is located in a blockchain network, the blockchain network includes a witness subnetwork and a consensus subnetwork, the witness subnetwork contains at least one business node; the consensus subnetwork contains N consensus clusters and a supervision node, N is an integer greater than 1; each consensus cluster is composed of multiple accounting nodes, and each consensus cluster elects an accounting node as a representative node in the respective consensus cluster; the N representative nodes form a consensus committee of the blockchain; the data storage device can be carried on the target representative node in the consensus committee, and the target representative node is any representative node in the consensus committee; please refer to Figure 5 , the blockchain-based data storage device includes the following units:
[0172] The acquisition unit 501 is configured to acquire a target consensus chain waiting for consensus in a blockchain network, the blockchain network comprising at least one consensus chain to be consensus, each consensus chain being sequentially linked by one or more consensus candidate blocks, each consensus candidate block being a block examined by a supervision node; the target consensus chain being the longest chain in the at least one consensus chain;
[0173] The processing unit 502 is configured to select a target consensus candidate block from the target consensus chain, the target consensus candidate block being a consensus candidate block at a target position on the target consensus chain;
[0174] The processing unit 502 is further configured to perform consensus verification on the target consensus candidate block.
[0175] The processing unit 502 is further configured to determine the target consensus candidate block as a final block if the target consensus candidate block passes the consensus verification of a consensus committee, and store the final block into the blockchain.
[0176] In an implementation manner, the target consensus candidate block is converted from a target business block to be processed; the processing unit 502 is further configured to:
[0177] submit the target business block to be processed to a consensus tree of the blockchain, trigger the supervision node to examine the target business block to be processed on the consensus tree, and process the target business block to be processed into the target consensus candidate block by the supervision node after the examination.
[0178] In an implementation manner, the processing unit 502 is further configured to:
[0179] generate a business block according to business data carried in a data storage request when the target representative node belonging to a target consensus cluster receives the data storage request of the business node;
[0180] perform consensus verification on the business block in the target consensus cluster;
[0181] determine the business block as a target business block to be processed if the business block passes the consensus verification of the target consensus cluster.
[0182] In an implementation manner, the processing unit 502 is further configured to:
[0183] select a consensus chain based on the target consensus candidate block from the at least one consensus chain if the target consensus candidate block passes the consensus verification of the consensus committee;
[0184] prune all consensus chains in the at least one consensus chain except the selected consensus chain based on the target consensus candidate block.
[0185] In an implementation manner, the pruning processing comprises: deleting, from the consensus tree of the blockchain, a consensus candidate block on the consensus chain that is subjected to the pruning processing; and
[0186] returning the deleted consensus candidate block to the corresponding representative node.
[0187] In an implementation manner, the target consensus candidate block comprises: a transaction hash value, a Merkle tree root, and a signature of the supervisory node; and the processing unit 502 is specifically configured to, when performing the consensus verification on the target consensus candidate block:
[0188] performing the consensus verification on the content contained in the target consensus candidate block to obtain a consensus verification result;
[0189] broadcasting the consensus verification result to other representative nodes in the consensus committee;
[0190] determining the consensus verification of the target consensus candidate block by the consensus committee, if the number of the representative nodes in the consensus committee that successfully perform the consensus on the content contained in the target consensus candidate block is greater than the number threshold.
[0191] In an implementation manner, the processing unit 502 is further configured to:
[0192] obtain bidding information of a target consensus cluster to which the target representative node belongs, the bidding information being used to indicate that the target consensus cluster requests to bid for the proposal right of the blockchain;
[0193] during the consensus verification of the target consensus candidate block by the consensus committee, broadcast a consensus verification result of the target consensus candidate block by the target representative node to other representative nodes in the consensus committee, the consensus verification result carrying the bidding information, so that the consensus committee determines the winner of the proposal right of the blockchain based on the bidding information.
[0194] In an implementation manner, the processing unit 502 is further configured to:
[0195] if the target business block to be processed on the consensus tree fails to pass the review by the supervisory node, delete the target business block to be processed from the consensus tree of the blockchain;
[0196] if the consensus tree further comprises other business blocks to be processed that are linked to the target business block to be processed, delete the other business blocks to be processed from the consensus tree of the blockchain, and return the deleted other business blocks to be processed to the corresponding representative nodes.
[0197] According to an embodiment of the present application, Figure 5The units in the illustrated blockchain-based data storage device can be combined into one or several other units respectively or all together, or some of the units can be further split into multiple units that are functionally smaller, which can achieve the same operation without affecting the implementation of the technical effects of the embodiments of the present application. The above units are logically divided, and in actual application, the functions of one unit can be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the blockchain-based data storage device can also include other units, which can also be assisted by other units in actual application, and can be implemented by multiple units in cooperation. According to another embodiment of the present application, the blockchain-based data storage device can be constructed by running a computer program (including program codes) capable of performing the corresponding method illustrated in Figure 2 and Figure 3 The computer program (including program codes) related to the steps of the corresponding method illustrated above can be used to construct the blockchain-based data storage device illustrated in Figure 5 and implement the blockchain-based data storage method of the embodiments of the present application. The computer program can be recorded on a computer readable recording medium, loaded into the above-mentioned computing device through the computer readable recording medium, and run therein.
[0198] In the embodiments of the present application, the obtaining unit 501 can obtain a target consensus chain from at least one consensus chain waiting for consensus in the blockchain network, the target consensus chain being the longest chain in the at least one consensus chain; and the consensus candidate blocks on the at least one consensus chain are all blocks that have been reviewed by the supervision node; this design ensures that only blocks that have been reviewed by the supervision node can be subjected to consensus processing, which can ensure that the business data in the blocks can be centrally supervised and managed, and the privacy of the business data in the blocks can be protected, effectively improving the security. In addition, the processing unit 502 can select a target consensus candidate block at a target position in the target consensus chain to perform consensus, and after successful consensus verification, determine the target consensus candidate block as a final block and chain it to the blockchain; this process can orderly store the blocks proposed by the multiple consensus clusters in the blockchain network to the blockchain, effectively maintaining the data chaining process in the multi-consensus cluster scenario, and further improving the operation efficiency of the blockchain network.
[0199] Figure 6 A structure diagram of a blockchain-based data storage device provided by an exemplary embodiment of the present application is shown, which can be a computer program (including program codes) running in a target representative node (such as any representative node); the blockchain-based data storage device can be used to executeFigure 4 Part or all of the steps in the method embodiments are shown. Among them, the blockchain is located in a blockchain network, the blockchain network includes a witness subnetwork and a consensus subnetwork, the witness subnetwork contains at least one business node; the consensus subnetwork contains N consensus clusters and a supervision node, N is an integer greater than 1; each consensus cluster is composed of multiple accounting nodes, and each consensus cluster elects one accounting node as a representative node in the respective consensus cluster; the N representative nodes form a consensus committee of the blockchain; any representative node in the consensus committee is denoted as a target representative node, and the data storage device can be carried on the supervision node; see Figure 6 The blockchain-based data storage device includes the following units:
[0200] The processing unit 601 is configured to determine a target business block to be processed submitted by the target representative node from the consensus tree of the blockchain;
[0201] The target business block to be processed is reviewed;
[0202] If the review is passed, the business data is extracted from the target business block to be processed;
[0203] The target business block to be processed after extraction is signed to generate a target consensus candidate block;
[0204] The target business block to be processed is updated as the target consensus candidate block on the consensus tree of the blockchain, so that the consensus committee verifies the target consensus candidate block. If the target consensus candidate block is a block in the target position on the target consensus chain in the blockchain network, when the target consensus candidate block successfully passes the consensus verification of the consensus committee, the target consensus candidate block is stored in the blockchain as a final block by the consensus committee.
[0205] In an implementation manner, the processing unit 601 is further configured to:
[0206] If the business data contained in the target business block to be processed is successfully backed up in one or more data storage devices, the step of signing the target business block to be processed after extraction to generate a target consensus candidate block is triggered.
[0207] In an implementation manner, the data storage device includes one or more of the N representative nodes; or the data storage device includes a storage device in a database;
[0208] The database includes a public database of the blockchain, or a special database matching the business type of the target business block to be processed.
[0209] In an implementation manner, the processing unit 601 is further configured to:
[0210] When receiving the data acquisition request sent by the service node, an address of a data storage device where the requested service data is located is acquired;
[0211] The address is returned to the service node, so that the service node acquires the service data from the data storage device according to the address.
[0212] According to one embodiment of the present application, Figure 6 The units in the blockchain-based data storage device shown can be combined into one or several other units respectively or all, or some of the units can be further split into a plurality of units with smaller functions to constitute, which can achieve the same operation without affecting the implementation of the technical effects of the embodiments of the present application. The above units are logically divided, and in actual application, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present application, the blockchain-based data storage device can also include other units, which can also be assisted by other units in actual application, and can be implemented by multiple units. According to another embodiment of the present application, the blockchain-based data storage device can be constructed by running a computer program capable of executing the steps of the corresponding method shown in the Figure 4 The computer program (including program code) of the steps involved in the corresponding method shown can be used to construct the blockchain-based data storage device shown in Figure 6 and to implement the blockchain-based data storage method of the embodiments of the present application. The computer program can be recorded on a computer readable recording medium, loaded into the above-mentioned computing device through the computer readable recording medium, and run therein.
[0213] In the embodiments of the present application, the processing unit 601 can acquire a target service block to be processed, and after the target service block to be processed is reviewed and passed, extract service data from the target service block to be processed for storage, which can realize centralized storage and management of service data in the blockchain network, thereby saving storage resources of the consensus node; and after extracting the service data of the target service block to be processed, the target service block to be processed is signed, so that the signed target service block to be processed is updated to a target consensus candidate block, so that the subsequent representative node can quickly verify the validity of the target consensus candidate block by verifying the signature of the supervision node, thereby improving the consensus efficiency of the blockchain network.
[0214] Figure 7 Fig. 1 shows a structural schematic diagram of a blockchain-based data processing device according to an exemplary embodiment of the present application; please refer to Figure 7The blockchain-based data processing device at least includes a processor 701, a communication interface 702, and a computer readable storage medium 703. The terminal includes a processor 701, a communication interface 702, and a computer readable storage medium 1203. The processor 701, the communication interface 702, and the computer readable storage medium 703 can be connected through a bus or other means. The communication interface 702 is used to receive and send data. The computer readable storage medium 703 can be stored in the memory of the terminal, and the computer readable storage medium 703 is used to store a computer program, the computer program includes program instructions, and the processor 701 is used to execute the program instructions stored in the computer readable storage medium 703. The processor 701 (or CPU (Central Processing Unit, Central Processing Unit)) is the computing core and control core of the terminal, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement a corresponding method flow or a corresponding function.
[0215] The embodiment of the present application also provides a computer readable storage medium (Memory). The computer readable storage medium is a memory device in the terminal, and is used to store programs and data. It can be understood that the computer readable storage medium herein can include an internal storage medium in the terminal, and of course can include an expansion storage medium supported by the terminal. The computer readable storage medium provides a storage space, and the storage space stores a processing system of the terminal. In addition, one or more instructions suitable for being loaded and executed by the processor 701 are also stored in the storage space, and the instructions can be one or more computer programs (including program codes). It should be noted that the computer readable storage medium herein can be a high-speed RAM memory, or a non-volatile memory such as at least one disk memory; optionally, it can also be at least one computer readable storage medium located away from the aforementioned processor.
[0216] In one embodiment, the computer readable storage medium stores one or more instructions; the one or more instructions stored in the computer readable storage medium are loaded and executed by the processor 701 to implement the corresponding steps in the above-mentioned social conversation method embodiments; in a specific implementation, the blockchain is located in a blockchain network, the blockchain network includes a witness subnetwork and a consensus subnetwork, the witness subnetwork includes at least one business node; the consensus subnetwork includes N consensus clusters and a supervision node, N is an integer greater than 1; each consensus cluster is composed of multiple accounting nodes, and each consensus cluster elects an accounting node as a representative node in the respective consensus cluster; the N representative nodes form a consensus committee of the blockchain; the data storage device is mounted on a target representative node, and the target representative node is any representative node in the consensus committee; the one or more instructions in the computer readable storage medium are loaded and executed by the processor 701 to implement the following steps:
[0217] Obtain a target consensus chain waiting for consensus in the blockchain network, the blockchain network includes at least one consensus chain to be consensus, each consensus chain is sequentially linked by one or more consensus candidate blocks, and each consensus candidate block is a block reviewed by the supervision node; the target consensus chain is the longest chain in the at least one consensus chain;
[0218] Select a target consensus candidate block from the target consensus chain, the target consensus candidate block is a consensus candidate block at a target position on the target consensus chain;
[0219] Perform consensus verification on the target consensus candidate block;
[0220] If the target consensus candidate block successfully passes the consensus verification of the consensus committee, the target consensus candidate block is determined as a final block, and the final block is stored in the blockchain.
[0221] In one implementation, the target consensus candidate block is converted from a target business block to be processed; the one or more instructions in the computer readable storage medium are loaded and executed by the processor 701 to implement the following steps:
[0222] Submit the target business block to be processed to the consensus tree of the blockchain, trigger the supervision node to review the target business block to be processed on the consensus tree, and process the target business block to be processed into the target consensus candidate block by the supervision node after the review is passed.
[0223] In one implementation, the one or more instructions in the computer readable storage medium are loaded and executed by the processor 701 to implement the following steps:
[0224] When the target consensus cluster to which the target representative node belongs receives a data storage request of the business node, generate a business block according to the business data carried in the data storage request;
[0225] consensus verification on the business block in the target consensus cluster;
[0226] If the business block successfully passes the consensus verification of the target consensus cluster, the business block is determined as a target business block to be processed.
[0227] In an implementation manner, the one or more instructions in the computer readable storage medium are loaded by the processor 701 and further perform the following steps:
[0228] If the target consensus candidate block successfully passes the consensus verification of the consensus committee, a consensus chain based on the target consensus candidate block is screened out from at least one consensus chain;
[0229] Pruning processing is performed on all consensus chains in the at least one consensus chain except the screened out consensus chain.
[0230] In an implementation manner, the pruning processing includes: deleting, from the consensus tree of the blockchain, the consensus candidate block on the consensus chain that is subjected to the pruning processing; and,
[0231] The deleted consensus candidate block is returned to the corresponding representative node.
[0232] In an implementation manner, the target consensus candidate block includes: a transaction hash value, a Merkle tree root, and a signature of a regulatory node; the one or more instructions in the computer readable storage medium are loaded by the processor 701 and, when performing the consensus verification on the target consensus candidate block, are specifically used for performing the following steps:
[0233] The consensus verification is performed on the content contained in the target consensus candidate block to obtain a consensus verification result;
[0234] The consensus verification result is broadcasted to other representative nodes in the consensus committee;
[0235] If the number of representative nodes in the consensus committee that successfully pass the consensus on the content contained in the target consensus candidate block is greater than a number threshold, it is determined that the consensus committee passes the consensus verification on the target consensus candidate block.
[0236] In an implementation manner, the one or more instructions in the computer readable storage medium are loaded by the processor 701 and further perform the following steps:
[0237] Obtain auction information of a target consensus cluster to which the target representative node belongs, the auction information being used to indicate that the target consensus cluster requests the proposal right of the blockchain;
[0238] In the consensus verification process of the target consensus candidate block by the consensus committee, the consensus verification result of the target representative node on the target consensus candidate block is broadcast to other representative nodes of the consensus committee, and the consensus verification result carries the bidding information, so that the consensus committee determines the winner of the proposal right of the blockchain based on the bidding information.
[0239] In an implementation manner, the one or more instructions in the computer readable storage medium are loaded by the processor 701 and further perform the following steps:
[0240] If the target business block to be processed on the consensus tree fails to pass the review of the supervision node, the target business block to be processed is deleted from the consensus tree of the blockchain;
[0241] If the consensus tree still contains other business blocks to be processed linked to the target business block to be processed, the other business blocks to be processed are deleted from the consensus tree of the blockchain, and the deleted other business blocks to be processed are returned to the corresponding representative nodes.
[0242] In the embodiment of the application, the processor 701 can obtain a target consensus chain from at least one consensus chain waiting for consensus in the blockchain network, the target consensus chain being the longest chain in the at least one consensus chain; and the consensus candidate blocks on the at least one consensus chain are all blocks reviewed by the supervision node; this design is to ensure that only blocks reviewed by the supervision node can be subjected to consensus processing, so as to ensure that the business data in the blocks can be centrally supervised and managed, and the privacy of the business data in the blocks can be protected, effectively improving the security. In addition, a target consensus candidate block at a target position in the target consensus chain can be selected for consensus, and after the consensus verification succeeds, the target consensus candidate block is determined as a final block and is chained to the blockchain; this process can orderly store the blocks proposed by the multiple consensus clusters in the blockchain network to the blockchain, effectively maintaining the data chaining process in the multiple consensus cluster scenario, and further improving the operation efficiency of the blockchain network.
[0243] In another embodiment, the computer readable storage medium stores one or more instructions; the one or more instructions stored in the computer readable storage medium are loaded and executed by the processor 701 to implement the corresponding steps in the above-mentioned social conversation method embodiments; in a specific implementation, the blockchain is located in a blockchain network, the blockchain network includes a witness subnetwork and a consensus subnetwork, the witness subnetwork includes at least one business node; the consensus subnetwork includes N consensus clusters and a supervision node, N is an integer greater than 1; each consensus cluster is composed of a plurality of accounting nodes, and each consensus cluster elects one accounting node as a representative node in the respective consensus cluster; the N representative nodes form a consensus committee of the blockchain; any representative node in the consensus committee is denoted as a target representative node, and the data storage device is mounted on the supervision node; the one or more instructions in the computer readable storage medium are loaded and executed by the processor 701 to implement the following steps:
[0244] determining a target business block to be processed submitted by the target representative node from the consensus tree of the blockchain;
[0245] reviewing the target business block to be processed;
[0246] if the review is passed, extracting business data from the target business block to be processed;
[0247] performing signature processing on the extracted target business block to be processed to generate a target consensus candidate block;
[0248] updating the target business block to be processed to the target consensus candidate block on the consensus tree of the blockchain, so that the consensus committee performs consensus verification on the target consensus candidate block, wherein if the target consensus candidate block is a block in a target position on a target consensus chain in the blockchain network, when the target consensus candidate block successfully passes the consensus verification of the consensus committee, the target consensus candidate block is stored in the blockchain as a final block by the consensus committee.
[0249] In an implementation manner, the one or more instructions in the computer readable storage medium are loaded and further executed by the processor 701 to implement the following steps:
[0250] if the business data contained in the target business block to be processed is successfully backed up in one or more data storage devices, triggering the step of performing signature processing on the extracted target business block to be processed to generate a target consensus candidate block.
[0251] In an implementation manner, the data storage device includes one or more of the N representative nodes; or, the data storage device includes a storage device in a database;
[0252] The database includes a public database of the blockchain or a special database matching the business type of the target business block to be processed.
[0253] In an implementation manner, one or more instructions in the computer readable storage medium are loaded by the processor 701 and further perform the following steps:
[0254] When receiving the data acquisition request sent by the business node, an address of a data storage device where the requested business data is located is acquired;
[0255] The address is returned to the business node, so that the business node acquires the business data from the data storage device according to the address.
[0256] In the embodiment of the application, the processor 701 can acquire the target business block to be processed, and after the target business block to be processed is reviewed, the business data in the target business block to be processed is extracted and stored, so that the centralized storage and management of the business data in the blockchain network can be realized, and the storage resources of the consensus node are saved; and after the business data of the target business block to be processed is extracted, the target business block to be processed is also signed, so that the target business block to be processed after signing is updated to a target consensus candidate block, so that the subsequent representative node can verify the validity of the target consensus candidate block by verifying the signature of the supervision node, and the consensus efficiency of the blockchain network is improved.
[0257] The embodiment of the application also provides a computer program product or a computer program, which includes computer instructions stored in a computer readable storage medium. The processor of the data storage device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the data storage device performs the above-mentioned blockchain-based data storage method.
[0258] Those skilled in the art can realize that the units and algorithm steps of the examples described in combination with the embodiments disclosed in the application can be realized by electronic hardware or a combination of computer software and electronic hardware. Whether the functions are realized in hardware or software mode depends on the specific application and design constraints of the technical solution. Professional technicians can use different methods to realize the described functions for each specific application, but such implementation should not be considered beyond the scope of the application.
[0259] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware or any combination thereof. When implemented by software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present application are generated. The computer can be a general purpose computer, a special purpose computer, a computer network, or other programmable devices. The computer instructions can be stored in or transmitted by a computer readable storage medium. The computer instructions can be transmitted from one website, computer, server or data center to another website, computer, server or data center through a wired (for example, coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (for example, infrared, wireless, microwave, etc.) manner. The computer readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server, data center, etc. integrated with one or more available media. The available media can be magnetic media (for example, floppy disk, hard disk, magnetic tape), optical media (for example, DVD), or semiconductor media (for example, solid state disk (SSD)) and the like.
[0260] The above description is merely a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art can easily think of changes or replacements within the technical range disclosed in the present application, which should be covered within the protection scope of the present application. Therefore, the protection scope of the present application should be subject to the protection scope of the claims.
Claims
1. A blockchain-based data storage method, characterized by, The blockchain is located in a blockchain network, the blockchain network comprises a witness subnetwork and a consensus subnetwork, the witness subnetwork comprises at least one business node; the consensus subnetwork comprises N consensus clusters and a supervision node, N is an integer greater than 1; each consensus cluster is composed of a plurality of accounting nodes, and each consensus cluster elects an accounting node as a representative node in the respective consensus cluster; N representative nodes form a consensus committee of the blockchain; The method is executed by a target representative node in the consensus committee, and the target representative node is any representative node in the consensus committee; the method comprises: Obtaining a target consensus chain waiting for consensus in the blockchain network, the blockchain network comprises at least one consensus chain waiting for consensus, each consensus chain is sequentially linked by one or more consensus candidate blocks, each consensus candidate block is a block reviewed by the supervision node; the target consensus chain is the longest chain in the at least one consensus chain; Selecting a target consensus candidate block from the target consensus chain, the target consensus candidate block is a consensus candidate block at a target position on the target consensus chain; Performing consensus verification on the target consensus candidate block; If the target consensus candidate block successfully passes the consensus verification of the consensus committee, the target consensus candidate block is determined as a final block, and the final block is stored in the blockchain; Wherein, the target consensus candidate block is converted from a target business block to be processed; the method further comprises: submitting the target business block to be processed to a consensus tree of the blockchain, triggering the supervision node to review the target business block to be processed on the consensus tree, and processing the target business block to be processed into the target consensus candidate block by the supervision node after the review is passed; the target consensus candidate block comprises a transaction hash value, a merkle tree root and a signature of the supervision node.
2. The method of claim 1, wherein, The method further comprises: When a target consensus cluster to which the target representative node belongs receives a data storage request of the business node, generating a business block according to business data carried in the data storage request; Performing consensus verification on the business block in the target consensus cluster; If the business block successfully passes the consensus verification of the target consensus cluster, the business block is determined as the target business block to be processed.
3. The method of claim 1, wherein, The method further comprises: If the target consensus candidate block successfully passes the consensus verification of the consensus committee, filtering a consensus chain based on the target consensus candidate block from the at least one consensus chain; Pruning all consensus chains in the at least one consensus chain except the filtered consensus chain.
4. The method of claim 3, wherein, The pruning process comprises: deleting the consensus candidate blocks on the consensus chain subjected to the pruning process from the consensus tree of the blockchain; and, Returning the deleted consensus candidate blocks to the corresponding representative nodes.
5. The method of claim 1, wherein, The consensus verification on the target consensus candidate block comprises: perform consensus verification on content contained in the target consensus candidate block to obtain a consensus verification result; broadcast the consensus verification result to other representative nodes in the consensus committee; if the number of representative nodes in the consensus committee that successfully perform consensus on the content contained in the target consensus candidate block is greater than a number threshold, it is determined that the consensus committee successfully performs consensus verification on the target consensus candidate block.
6. The method of claim 1, wherein, The method further comprises: obtaining bidding information of a target consensus cluster to which the target representative node belongs, the bidding information being used to indicate that the target consensus cluster requests to bid for proposal authority of the blockchain; during consensus verification of the target consensus candidate block by the consensus committee, broadcasting a consensus verification result of the target consensus candidate block by the target representative node to other representative nodes of the consensus committee, the consensus verification result carrying the bidding information, so that the consensus committee determines an obtainer of the proposal authority of the blockchain based on the bidding information.
7. The method of claim 1, wherein, The method further comprises: if the target business block to be processed on the consensus tree fails to pass the review by the supervision node, deleting the target business block to be processed from the consensus tree of the blockchain; if the consensus tree further contains other business blocks to be processed linked to the target business block to be processed, deleting the other business blocks to be processed from the consensus tree of the blockchain, and returning the deleted other business blocks to be processed to corresponding representative nodes. 8.A blockchain-based data storage method, characterized in that, The blockchain is located in a blockchain network, the blockchain network comprising a witness subnetwork and a consensus subnetwork, the witness subnetwork containing at least one business node; the consensus subnetwork containing N consensus clusters and a supervision node, N being an integer greater than 1; each consensus cluster being composed of multiple accounting nodes, and each consensus cluster electing one accounting node as a representative node in the respective consensus cluster; N representative nodes constitute a consensus committee of the blockchain; any representative node in the consensus committee is denoted as a target representative node, and the method is performed by the supervision node; the method comprises: determining a target business block to be processed submitted by the target representative node from a consensus tree of the blockchain; performing review on the target business block to be processed; if the review passes, extracting business data from the target business block to be processed; performing signature processing on the extracted target business block to be processed to generate a target consensus candidate block; the target consensus candidate block comprising a transaction hash value, a Merkle tree root, and a signature of the supervision node; updating the target business block to be processed as a target consensus candidate block on a consensus tree of the blockchain, so that the consensus committee performs consensus verification on the target consensus candidate block, wherein the target consensus candidate block is a block in a target consensus chain on the blockchain network, the blockchain network comprises at least one consensus chain to be verified, each consensus chain is sequentially linked by one or more consensus candidate blocks, and each consensus candidate block is a block verified by the supervision node; the target consensus chain is the longest chain in the at least one consensus chain; and if the target consensus candidate block successfully passes the consensus verification of the consensus committee, the target consensus candidate block is stored as a final block in the blockchain by the consensus committee.
9. The method of claim 8, wherein, Before the target business block to be processed is signed to generate the target consensus candidate block, the method further comprises: If the business data contained in the target business block to be processed is successfully backed up in one or more data storage devices, triggering the step of signing the extracted target business block to be processed to generate a target consensus candidate block; The data storage device comprises one or more of the N representative nodes; or the data storage device comprises a storage device in a database; the database comprises a public database of the blockchain or a special database matching the business type of the target business block to be processed.
10. The method of claim 9, wherein, The method further comprises: When receiving a data acquisition request sent by a business node, acquiring an address of a data storage device where the requested business data is located; Returning the address to the business node, so that the business node acquires the business data from the data storage device according to the address. 11.A blockchain-based data storage device, characterized by, The blockchain is located in a blockchain network, the blockchain network comprises a witness subnetwork and a consensus subnetwork, the witness subnetwork comprises at least one business node; the consensus subnetwork comprises N consensus clusters and a supervision node, N is an integer greater than 1; each consensus cluster is composed of a plurality of accounting nodes, and each consensus cluster elects one accounting node as a representative node in the respective consensus cluster; The N representative nodes form a consensus committee of the blockchain; The data storage device is mounted on a target representative node, the target representative node being any representative node in the consensus committee; the data storage device comprises: An acquisition unit is configured to acquire a target consensus chain to be verified in the blockchain network, the blockchain network comprising at least one consensus chain to be verified, each consensus chain being sequentially linked by one or more consensus candidate blocks, and each consensus candidate block being a block verified by the supervision node; the target consensus chain being the longest chain in the at least one consensus chain; A processing unit is configured to select a target consensus candidate block from the target consensus chain, the target consensus candidate block being a consensus candidate block in a target position on the target consensus chain; The processing unit is further configured to perform consensus verification on the target consensus candidate block; The processing unit is further configured to determine the target consensus candidate block as a final block if the target consensus candidate block passes the consensus verification of the consensus committee, and store the final block into the blockchain. The target consensus candidate block is converted from a target business block to be processed; the processing unit is further configured to submit the target business block to be processed to a consensus tree of the blockchain, trigger the supervisory node to examine the target business block to be processed on the consensus tree, and process the target business block to be processed into the target consensus candidate block by the supervisory node after the examination passes; the target consensus candidate block includes a transaction hash value, a Merkle tree root, and a signature of the supervisory node. 12.A blockchain-based data storage device, characterized by, The blockchain is located in a blockchain network, the blockchain network includes a witness subnetwork and a consensus subnetwork, the witness subnetwork includes at least one business node; the consensus subnetwork includes N consensus clusters and a supervisory node, N is an integer greater than 1; each consensus cluster is composed of a plurality of accounting nodes, and each consensus cluster elects one accounting node as a representative node in the respective consensus cluster; The N representative nodes form a consensus committee of the blockchain; Any representative node in the consensus committee is denoted as a target representative node, and the data storage device is mounted on the supervisory node; The data storage device includes: A processing unit configured to determine a target business block to be processed submitted by the target representative node from a consensus tree of the blockchain; The processing unit is further configured to examine the target business block to be processed; The processing unit is further configured to extract business data from the target business block to be processed if the examination passes; The processing unit is further configured to generate a target consensus candidate block by signature processing on the target business block to be processed after the extraction; the target consensus candidate block includes a transaction hash value, a Merkle tree root, and a signature of the supervisory node; The processing unit is further configured to update the target business block to be processed as the target consensus candidate block on the consensus tree of the blockchain, so that the consensus committee performs consensus verification on the target consensus candidate block, wherein the target consensus candidate block is a block at a target position on a target consensus chain in the blockchain network, the blockchain network includes at least one consensus chain to be verified, each consensus chain is sequentially linked by one or more consensus candidate blocks, and each consensus candidate block is a block examined by the supervisory node; the target consensus chain is the longest chain in the at least one consensus chain; if the target consensus candidate block passes the consensus verification of the consensus committee, the consensus committee stores the target consensus candidate block as a final block into the blockchain.
13. A blockchain-based data storage device, characterized by, The processor is adapted to execute a computer program. A computer readable storage medium having stored therein a computer program which, when executed by the processor, implements the blockchain-based data storage method of any one of claims 1-7, or implements the blockchain-based data storage method of any one of claims 8-10.
14. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a computer program which is adapted to be loaded and executed by the processor to implement the blockchain-based data processing method of any one of claims 1-7, or implement the blockchain-based data storage method of any one of claims 8-10.
15. A computer program product, characterised in that, The computer program product comprises computer instructions stored in a computer readable storage medium, the processor of the data storage device reading and executing the computer instructions from the computer readable storage medium, causing the data storage device to execute the blockchain-based data processing method of any one of claims 1-7, or execute the blockchain-based data storage method of any one of claims 8-10.
Citation Information
Patent Citations
Method and device for processing data request in blockchain network
CN110535872A
Data processing method and device in blockchain network, storage medium and equipment
CN110602096A