CN116112501A - Business processing method, device, equipment and storage medium based on block chain network - Google Patents
Business processing method, device, equipment and storage medium based on block chain network Download PDFInfo
- Publication number
- CN116112501A CN116112501A CN202111332181.4A CN202111332181A CN116112501A CN 116112501 A CN116112501 A CN 116112501A CN 202111332181 A CN202111332181 A CN 202111332181A CN 116112501 A CN116112501 A CN 116112501A
- Authority
- CN
- China
- Prior art keywords
- consensus
- target
- cluster
- block
- node
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
- H04L67/104—Peer-to-peer [P2P] networks
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/06—Management of faults, events, alarms or notifications
- H04L41/0654—Management of faults, events, alarms or notifications using network fault recovery
- H04L41/0668—Management of faults, events, alarms or notifications using network fault recovery by dynamic selection of recovery network elements, e.g. replacement by the most appropriate element after failure
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/30—Decision processes by autonomous network management units using voting and bidding
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
- Complex Calculations (AREA)
Abstract
The embodiment of the application discloses a business processing method, a business processing device, business processing equipment and a business processing device based on a blockchain network. The blockchain network is composed of a plurality of consensus clusters, each consensus cluster comprises a master node and a slave node, and a consensus process based on the consensus clusters can comprise: the master node acquires a first proposal block, forwards the first proposal block to a slave node in a target consensus cluster, determines a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster for the first proposal block, acquires voting results of other consensus clusters except the target consensus cluster in the block chain network for the first proposal block, and acquires the consensus result of the first proposal block based on the voting results of the first proposal block. It can be seen that consensus clusters are more stable than a single consensus node, and that the availability of a blockchain network can be improved by composing the blockchain network from multiple consensus clusters.
Description
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method for processing a service based on a blockchain network, a device for processing a service based on a blockchain network, and a computer readable storage medium.
Background
With the continuous development of computer technology, blockchains are widely applied to aspects such as resource transfer, business data storage and the like by virtue of traceability characteristics. The consensus mechanism is one of the cores of the blockchain, by which the data stored in the blockchain can be ensured to be trusted. In practice, the consensus mechanism is implemented based on consensus nodes in the blockchain network. Practice has found that when a common node in a blockchain network fails, it results in reduced availability of the blockchain network.
Disclosure of Invention
The embodiment of the invention provides a business processing method, a business processing device, business processing equipment and a computer readable storage medium based on a blockchain network, which can improve the usability of the blockchain network.
In one aspect, an embodiment of the present application provides a method for processing a service based on a blockchain network, where the blockchain network includes a plurality of consensus clusters, each of the consensus clusters includes a master node and a slave node; the method is executed by a target master node in a target consensus cluster, wherein the target consensus cluster is any consensus cluster in a blockchain network, and the service processing method comprises the following steps:
acquiring a first proposal block, and forwarding the first proposal block to a slave node in a target consensus cluster;
Determining a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster aiming at the first proposal block;
the method comprises the steps of obtaining voting results of other consensus clusters except a target consensus cluster in a block chain network for a first proposal block, wherein the voting result of each consensus cluster for the first proposal block is determined by the consensus cluster according to consensus sub-results in the consensus cluster;
and obtaining a consensus result of the first proposal block based on the voting result of the first proposal block.
In one aspect, an embodiment of the present application provides a method for processing a service based on a blockchain network, where the blockchain network includes a plurality of consensus clusters, each of the consensus clusters includes a master node and a slave node; the method is executed by a target slave node in a target consensus cluster, the target consensus cluster is any consensus cluster in a blockchain network, the target slave node is any slave node in the target consensus cluster, and the service processing method comprises the following steps:
receiving a first proposal block sent by a target master node in a target consensus cluster;
checking the first proposal block, and returning a checking result of the first proposal block to the target main node;
receiving a consensus result of a first proposal block sent by a target master node;
If the consensus result of the first proposal block indicates that the first proposal block passes through the consensus of the blockchain network, the first proposal block is subjected to the certification storage processing.
In one aspect, an embodiment of the present application provides a service processing apparatus based on a blockchain network, where the blockchain network includes a plurality of consensus clusters, each consensus cluster including a master node and a slave node; the method is executed by a target master node in a target consensus cluster, wherein the target consensus cluster is any consensus cluster in a blockchain network, and the service processing device comprises:
the acquisition unit is used for acquiring a first proposal block and forwarding the first proposal block to a slave node in the target consensus cluster;
the processing unit is used for determining a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster aiming at the first proposal block;
the system comprises an acquisition unit, a first judgment unit and a second judgment unit, wherein the acquisition unit is also used for acquiring voting results of other consensus clusters in the blockchain network, except for a target consensus cluster, aiming at a first proposal block, wherein the voting result of each consensus cluster aiming at the first proposal block is determined by the consensus cluster according to consensus sub-results in the consensus cluster;
the processing unit is further configured to obtain a consensus result of the first proposed block based on the voting result of the first proposed block.
In one embodiment, the number of consensus clusters in the blockchain network is 3N+1, each consensus cluster includes M consensus nodes, wherein the M consensus nodes include 1 master node and M-1 slave nodes, N is a positive integer, and M is an integer greater than 1.
In one embodiment, the processing unit is configured to determine a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster for the first proposal block, specifically configured to:
obtaining the verification results of P slave nodes aiming at the first proposal block, wherein P is a positive integer;
if the number of the first type of verification results in the P verification results is larger than a first number threshold, judging that the first proposal block passes the consensus of the target consensus cluster, and taking the judgment result as a consensus sub-result of the target consensus cluster;
the first type of verification result is used for indicating that the first proposal block passes verification.
In one embodiment, the processing unit is further configured to:
if the number of the second type of verification results in the P verification results is larger than a second number threshold, judging that the first proposal block fails to pass the consensus of the target consensus cluster, and taking the judgment result as a consensus sub-result of the target consensus cluster;
The second type of check result is used for indicating that the first proposal block fails to pass the check.
In one embodiment, the processing unit is configured to obtain a consensus result of the first proposal block based on the voting result of the first proposal block, and specifically is configured to:
if the number of voting results of the first proposal block, which indicates approval of the first proposal block to pass through the consensus, is greater than a third number threshold, judging the consensus of the first proposal block through the blockchain network;
if the number of voting results indicating that the first proposed block passes through the consensus is greater than a fourth number threshold in the voting results of the first proposed block, determining that the first proposed block does not pass through the consensus of the blockchain network.
In one embodiment, the processing unit is further configured to:
if the first proposal block passes through the consensus of the blockchain network, forwarding the consensus result of the first proposal block to the slave nodes in the target consensus cluster so as to ensure that the slave nodes in the target consensus cluster store the first proposal block.
In one embodiment, the processing unit is further configured to:
obtaining to-be-stored data, and generating a second proposal block based on the to-be-stored data;
transmitting a second proposal block to a consensus cluster except a target consensus cluster in the blockchain network;
And obtaining the voting result of the second proposal block, and determining the consensus result of the second proposal block according to the voting result of the second proposal block.
In one aspect, an embodiment of the present application provides a service processing apparatus based on a blockchain network, where the blockchain network includes a plurality of consensus clusters, each consensus cluster including a master node and a slave node; the method is executed by a target slave node in a target consensus cluster, the target consensus cluster is any consensus cluster in a blockchain network, the target slave node is any slave node in the target consensus cluster, and the service processing device comprises:
the acquisition unit is used for receiving a first proposal block sent by a target master node in the target consensus cluster;
the processing unit is used for checking the first proposal block and returning a checking result of the first proposal block to the target main node;
the acquisition unit is also used for receiving the consensus result of the first proposal block sent by the target master node;
the processing unit is further configured to perform a certification storing process on the first proposed block if the consensus result of the first proposed block indicates that the first proposed block passes through the consensus of the blockchain network.
In one embodiment, the processing unit is further configured to:
When the target consensus cluster meets the replacement condition of the master node, voting the slave nodes in the target consensus cluster, wherein the replacement condition of the master node comprises the following steps: the target main node is in fault, the current moment is matched with the replacement period of the target main node, and the target main node is determined to be a malicious node;
and determining the slave node with the highest ticket in the target consensus cluster as the master node of the target consensus cluster.
In one embodiment, the target slave node is the highest-scoring slave node in the target consensus cluster; the processing unit is further configured to:
sending a node replacement notification to the consensus clusters except the target consensus cluster;
the node replacement notification is used for indicating that the master node of the target consensus cluster is replaced by the target slave node.
In one embodiment, each consensus cluster communicates with other consensus clusters in the blockchain network through a corresponding gateway, and the gateway corresponding to each consensus cluster stores master node information of the consensus cluster;
the processing unit is used for sending a node replacement notification to the consensus clusters except the target consensus cluster, and is specifically used for:
and sending a node replacement notification to a gateway corresponding to the target consensus cluster, so that the gateway updates the master node information of the target consensus cluster according to the node replacement notification, and broadcasts the updated master node information to other consensus clusters except the target consensus cluster in the blockchain network.
Accordingly, the present application provides a computer device comprising:
a processor for loading and executing the computer program;
a computer readable storage medium having a computer program stored therein, which when executed by a processor, implements the above-described blockchain network-based service processing method.
Accordingly, the present application provides a computer readable storage medium storing a computer program adapted to be loaded by a processor and to perform the above-described blockchain network based service processing method.
Accordingly, the present application provides a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium and executes the computer instructions to cause the computer device to perform the above-described blockchain network-based business processing method.
In the embodiment of the present application, the blockchain network is composed of a plurality of consensus clusters, each consensus cluster includes a master node and a slave node, and a consensus process based on the consensus clusters may include: the master node acquires a first proposal block, forwards the first proposal block to a slave node in a target consensus cluster, determines a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster for the first proposal block, acquires voting results of other consensus clusters except the target consensus cluster in the block chain network for the first proposal block, and acquires the consensus result of the first proposal block based on the voting results of the first proposal block. It can be seen that consensus clusters are more stable than a single consensus node, and that the availability of a blockchain network can be improved by composing the blockchain network from multiple consensus clusters.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1a is a schematic diagram of a data sharing system according to an embodiment of the present disclosure;
FIG. 1b is a block chain architecture diagram according to one embodiment of the present disclosure;
fig. 1c is a schematic flow chart of a block generation method according to an embodiment of the present application;
fig. 1d is a schematic diagram of a dual-layer network according to an embodiment of the present application;
fig. 2 is a schematic flow chart of a block chain-based service processing method according to an embodiment of the present application;
FIG. 3 is a flowchart of another block chain based service processing method according to an embodiment of the present disclosure;
fig. 4 is a flowchart of another service processing method based on a blockchain according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a service processing device based on a blockchain network according to an embodiment of the present application;
Fig. 6 is a schematic structural diagram of another service processing device based on a blockchain network according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present application.
Detailed Description
The following description of the embodiments of the present application will be made clearly and fully with reference to the accompanying drawings, in which it is evident that the embodiments described are only some, but not all, of the embodiments of the present application. All other embodiments, which can be made by one of ordinary skill in the art based on the embodiments herein without making any inventive effort, are intended to be within the scope of the present application.
The following sets forth the terms involved in the embodiments of the present application:
embodiments of the present application relate to blockchain technology and related terms and concepts of blockchain technology are briefly described below:
blockchain (Blockchain) is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like. The method is characterized in that the method is a decentralised database, which is a series of data blocks generated by correlation of a cryptography method, and each data block contains information of a batch of network transactions and is used for checking the validity (anti-counterfeiting) of the information and generating a next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
A blockchain network may be understood as a data sharing system 100, the data sharing system 100 may refer to a system for sharing data between nodes, and an exemplary architecture of the data sharing system 100 may be seen in fig. 1a; as shown in fig. 1a, a data sharing system 100 refers to a system for performing data sharing between nodes, where a plurality of nodes 101 may be included in the data sharing system, and the plurality of nodes 101 may be respective clients in the data sharing system. Each node 101 may receive input information while operating normally and maintain shared data within the data sharing system based on the received input information. In order to ensure the information intercommunication in the data sharing system, information connection can exist between each node in the data sharing system, and the nodes can transmit information through the information connection. For example, when any node in the data sharing system receives input information, other nodes in the data sharing system acquire the input information according to a 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 are consistent.
Each node in the data sharing system has a node identifier corresponding to the node identifier, and each node in the data sharing system can store the node identifiers 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 identifiers of the other nodes. Each node can maintain a node identification list shown in the following table, and the node names and the node identifications are correspondingly stored in the node identification list. Wherein the node identity may be an IP (Internet Protocol, protocol for interconnection between networks) address and any other information that can be used to identify the node; for example, the node identifier may also be a binary sequence code (e.g., 110001110), and table 1 is only illustrated by taking an IP address as an example:
TABLE 1
Node name | Node identification |
Node 1 | 117.114.151.174 |
Node 2 | 117.116.189.145 |
… | … |
Node X (X is a positive integer) | xx.xxx.xxx.xxx |
Each node in the data sharing system stores one and the same blockchain. The blockchain is composed of a plurality of blocks, see fig. 1b, the blockchain is composed of a plurality of blocks, the starting block comprises a block head and a block main body, the block head stores an input information characteristic value, a version number, a time stamp and a difficulty value, and the block main body stores input information; the next block of the starting block takes the starting block as a father block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the father block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain are associated with the block data stored in the father block, and the safety of the input information in the block is ensured.
When each block in the blockchain is generated, referring to fig. 1c, when the node where the blockchain is located receives input information, checking the input information, after the checking is completed, storing the input information into a memory pool, and updating a hash tree used for recording the input information; then, updating the update time stamp to the time of receiving the input information, trying different random numbers, and calculating the characteristic value for a plurality of times, so that the calculated characteristic value can meet the following formula:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
wherein SHA256 is a eigenvalue algorithm used to calculate eigenvalues; version (version number) is version information of the related block protocol in the block chain; the prev_hash is the block header characteristic value of the parent block of the current block; the merkle_root is a characteristic value of input information; ntime is the update time of the update timestamp; the nbits is the current difficulty, is a fixed value in a period of time, and is determined again after exceeding a fixed period of time; x is a random number; TARGET is a eigenvalue threshold that can be determined from nbits.
Thus, when the random number meeting the formula is calculated, the information can be correspondingly stored to generate the block head and the block main body, and the current block is obtained. And then, broadcasting the newly generated block to other nodes in the data sharing system according to the node identification of other nodes in the data sharing system by the node in which the block chain is positioned, performing common check on the newly generated block by the other nodes, and adding the newly generated block into the stored block chain after the common check is finished.
To improve the availability of the blockchain network, embodiments of the present application provide a dual layer network architecture based on a P2P network. Wherein the P2P network is a network of point-to-point connections, each node of which is called a peer node. The P2P network is based on a specific network protocol, so that a central node is not required between peer nodes to maintain network state, and each node maintains node state of the whole network and connection state of the node with adjacent nodes through broadcasting interaction with the adjacent nodes.
Fig. 1d is a schematic diagram of a dual-layer network according to an embodiment of the present application; as shown in fig. 1D, the first layer network architecture is a consensus cluster layer, and a blockchain network is formed by a plurality of consensus clusters (such as a consensus cluster a-consensus cluster D); the second layer network architecture is a consensus node layer, and a consensus cluster is formed by a plurality of consensus nodes; for example, consensus node A1-consensus node A3 are included in consensus cluster A; for another example, the consensus cluster D includes a consensus node D1 and a consensus node D2. Each consensus cluster comprises a master node and a slave node; for example, in consensus cluster a, A1 is a master node and A2 and A3 are slaves. The master node of the target consensus cluster may be configured to communicate with other consensus clusters in the blockchain network than the target consensus cluster and forward relevant information (e.g., proposal blocks, consensus results, etc.) in the blockchain network to the slave nodes within the target consensus cluster, and the slave nodes of the target consensus cluster may be configured to verify the proposal blocks, to document the consensus results, and to replace the master node as a new master node when the target master node fails, or to vote for a new master node. The target consensus cluster may be any consensus cluster in a blockchain network. In one embodiment, each consensus cluster corresponds to a gateway; for example, consensus cluster a corresponds to gateway a and consensus cluster B corresponds to gateway B. Each consensus cluster in the blockchain network can communicate with other consensus clusters in the blockchain network except for the consensus cluster. Further, data transmission is performed between the gateways based on a secure transport layer protocol. It will be appreciated that the common clusters in fig. 1d and the number of common nodes in each common cluster are for example only and do not constitute a practical limitation of the present application.
Based on the above description about the dual-layer network architecture according to the embodiments of the present application, the following description briefly describes a blockchain-based service processing scheme proposed by the embodiments of the present application based on the dual-layer network architecture, which can improve the availability of a blockchain network. This scheme may be performed by a master node in the consensus cluster shown in fig. 1 d. The master node may in particular be a terminal device or a server. The terminal device may include, but is not limited to: smart phones (e.g., android phones, IOS phones, etc.), tablet computers, portable personal computers, mobile internet devices (MIDs for short), etc., which are not limited in this embodiment of the present application. The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN (Content Delivery Network ), basic cloud computing services such as big data and an artificial intelligent platform, which is not limited in the embodiment of the present application.
In a specific implementation, the blockchain network includes a plurality of consensus clusters, each comprising a master node and a slave node; the business processing method based on the block chain network is executed by a target main node in a target consensus cluster, wherein the target consensus cluster is any consensus cluster in the block chain network; the general principle of a blockchain-based traffic handling scheme is as follows:
(1) The target master node acquires the first proposal block and forwards the first proposal block to the slave nodes in the target consensus cluster. The first proposal block is a block to be recognized; the target master node in the target consensus cluster may be selected by a slave node in the target consensus cluster, or may be preconfigured before the consensus service is provided. Within the target consensus cluster, the master node and each slave node, and each slave node may communicate with each other. When the target master node forwards the first proposal block to the slave nodes in the target consensus cluster, the target master node can also carry a verification result after the target master node verifies the first proposal block.
(2) After receiving the first proposal block forwarded by the target master node, the slave nodes in the target consensus cluster check the first proposal block, and return a check result aiming at the first proposal block to the target master node. The target master node determines a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster aiming at the first proposal block; for example, the target master node counts and determines the number of the slave nodes passing the check in the first proposed area, if it is determined that the number of the slave nodes passing the check in the first proposed area is greater than a first number threshold, it is determined that the first proposed area passes the consensus of the target consensus cluster, and the first number threshold may be a preset fixed value or may be calculated according to a preset proportion and the number of the consensus nodes in the target consensus cluster. Correspondingly, if the number of the slave nodes which do not pass the verification of the first proposal block exceeds a second number threshold, the first proposal block is judged not to pass the consensus of the target consensus cluster, and the second number threshold can be a preset fixed value or can be calculated according to a preset proportion and the number of the consensus nodes in the target consensus cluster; the first number threshold and the second number threshold may be the same or different, and this application is not limited thereto.
(3) The target master node obtains a voting result of the target consensus cluster aiming at the first proposal block based on the consensus sub-result of the first proposal block; specifically, if the consensus sub-result of the first proposal block indicates that the first proposal block passes the consensus of the target consensus cluster, the voting result is in favor of the first proposal block passing the consensus; if the consensus result of the first proposed block indicates that the first proposed block fails to pass the consensus of the target consensus cluster, the voting result is opposite to the first proposed block passing the consensus. The target master node sends voting results of target consensus clusters for the first proposed block to other consensus clusters except the target consensus clusters in the blockchain network, and acquires voting results of other consensus clusters except the target consensus clusters in the blockchain network for the first proposed block, wherein the voting results of each consensus cluster for the first proposed block are determined by the consensus clusters according to consensus sub-results in the consensus clusters.
(4) After the target master node obtains the voting results of each consensus cluster aiming at the first proposal block in the blockchain network, the consensus results of the first proposal block are obtained based on the voting results of the first proposal block. Specifically, if the voting result of each consensus cluster for the first proposal block through consensus is greater than a third quantity threshold value, judging that the first proposal block passes consensus; the third number threshold may be a preset fixed value, or may be calculated according to a preset ratio and the number of target consensus clusters in the blockchain network. Correspondingly, if the voting result of each consensus cluster aiming at the first proposal block, which is opposite to the first proposal block passing the consensus, is larger than a fourth quantity threshold value, judging that the first proposal block does not pass the consensus; the fourth number threshold may be a preset fixed value, or may be calculated according to a preset proportion and the number of target consensus clusters in the blockchain network; the third number threshold and the fourth number threshold may be the same or different, and are not limited in this application.
In the embodiment of the present application, the blockchain network is composed of a plurality of consensus clusters, each consensus cluster includes a master node and a slave node, and a consensus process based on the consensus clusters may include: the master node acquires a first proposal block, forwards the first proposal block to a slave node in a target consensus cluster, determines a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster for the first proposal block, acquires voting results of other consensus clusters except the target consensus cluster in the block chain network for the first proposal block, and acquires the consensus result of the first proposal block based on the voting results of the first proposal block. It can be seen that consensus clusters are more stable than a single consensus node, and that the availability of a blockchain network can be improved by composing the blockchain network from multiple consensus clusters.
Based on the above-described blockchain-based service processing scheme, the embodiments of the present application provide a more detailed blockchain-based service processing method, and the blockchain-based service processing method provided by the embodiments of the present application will be described in detail below with reference to the accompanying drawings.
Fig. 2 is a schematic flow chart of a block chain-based service processing method according to an embodiment of the present application; the block chain network comprises a plurality of consensus clusters, wherein each consensus cluster comprises a master node and a slave node; the business method is executed by a target master node in a target consensus cluster, which can be any consensus cluster in a blockchain network; the blockchain-based service processing method may include, but is not limited to, steps S201-S204:
S201, acquiring a first proposal block, and forwarding the first proposal block to a slave node in the target consensus cluster.
The first proposed block is a block to be consensus. After the target master node acquires the first proposal block, the target master node can directly forward the first proposal block to the slave nodes in the target consensus cluster, or can write the first proposal block into a log file; for example, the target master node may write the first proposal block into a binary log file. The slave nodes in the target consensus cluster can acquire the forwarded content of the target master node in real time by monitoring the log file.
S202, determining a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster for the first proposal block.
The verification result of the slave node on the first proposal block is obtained by processing the first proposal block by the slave node alone, and the consensus result of the first proposal block is obtained after the target consensus cluster performs consensus on the first proposal block.
In one embodiment, the target master node counts the check results of each slave node in the target consensus cluster for the first proposed block, and when the counted number of check results for the first proposed block exceeds a statistical threshold, the target master node determines a consensus sub-result for the first proposed block based on the counted check results for the first proposed block. That is, the target master node may obtain the consensus sub-result of the first proposal block after counting the verification result of a part of slave nodes in the target consensus cluster for the first proposal block; for example, the target consensus cluster includes 10 slave nodes, and the statistical threshold is 6, that is, after the target master node counts the check results of the 6 slave nodes for the first proposed block, the consensus sub-result of the first proposed block can be determined according to the check results of the 6 slave nodes for the first proposed block.
It can be seen that the slave nodes in the target consensus cluster have less overall impact on the target consensus cluster when they fail. The stability of the consensus cluster is higher than that of a single consensus node in the blockchain network, and the availability of the blockchain network is better ensured.
In one embodiment, the specific implementation manner of determining the consensus sub-result of the first proposal block by the target master node according to the verification result of the slave node in the target consensus cluster for the first proposal block is as follows: the target master node counts and judges the number of the slave nodes passing the verification of the first proposal area according to the verification result of the slave nodes in the target consensus cluster aiming at the first proposal area, if the number of the slave nodes passing the verification of the first proposal area is judged to be larger than a first number threshold, the first number threshold is judged to pass the consensus of the target consensus cluster, and the first number threshold can be a preset fixed value or can be calculated according to a preset proportion and the number of the consensus nodes in the target consensus cluster. Correspondingly, if the number of the slave nodes which do not pass the verification of the first proposal block exceeds a second number threshold, the first proposal block is judged not to pass the consensus of the target consensus cluster, and the second number threshold can be a preset fixed value or can be calculated according to a preset proportion and the number of the consensus nodes in the target consensus cluster; the first number threshold and the second number threshold may be the same or different, and this application is not limited thereto.
S203, voting results of other consensus clusters except the target consensus cluster in the blockchain network for the first proposal block are obtained.
The voting result of each consensus cluster aiming at the first proposal block is determined by the consensus cluster according to the consensus sub-result in the consensus cluster; for example, if the first proposed block passes the consensus of the consensus cluster a and fails the consensus of the consensus cluster B, the voting result of the consensus cluster a is in favor of the first proposed block passing the consensus, and the voting result of the consensus cluster B is opposite to the first proposed block passing the consensus.
In one embodiment, the target master node sends the voting result of the target consensus cluster for the first proposed block to other consensus clusters except the target consensus cluster in the blockchain network, and obtains the voting result of the other consensus clusters except the target consensus cluster in the blockchain network for the first proposed block.
S204, based on the voting result of the first proposal block, obtaining the consensus result of the first proposal block.
When the number of the voting results acquired by the target master node exceeds a voting number threshold, the target master node determines a consensus result of the first proposal block based on the acquired voting results. That is, the target master node may obtain the consensus result of the first proposed block after counting the voting result of a part of consensus clusters in the blockchain network for the first proposed block; for example, if the blockchain network includes 10 consensus clusters, the threshold of the number of votes is 6, that is, after the target master node obtains the voting results of the 6 consensus clusters for the first proposed block, the target master node can determine the consensus result of the first proposed block according to the voting results of the 6 consensus clusters for the first proposed block.
Specifically, if the obtained voting results of the consensus clusters for the first proposal block agree that the voting result of the first proposal block passing the consensus is greater than a third quantity threshold, judging that the first proposal block passes the consensus; the third number threshold may be a preset fixed value, or may be calculated according to a preset ratio and the number of target consensus clusters in the blockchain network. Correspondingly, if the voting result of each consensus cluster aiming at the first proposal block, which is opposite to the first proposal block passing the consensus, is larger than a fourth quantity threshold value, judging that the first proposal block does not pass the consensus; the fourth number threshold may be a preset fixed value, or may be calculated according to a preset proportion and the number of target consensus clusters in the blockchain network; the third number threshold and the fourth number threshold may be the same or different, and are not limited in this application.
In the embodiment of the present application, the blockchain network is composed of a plurality of consensus clusters, each consensus cluster includes a master node and a slave node, and a consensus process based on the consensus clusters may include: the master node acquires a first proposal block, forwards the first proposal block to a slave node in a target consensus cluster, determines a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster for the first proposal block, acquires voting results of other consensus clusters except the target consensus cluster in the block chain network for the first proposal block, and acquires the consensus result of the first proposal block based on the voting results of the first proposal block. It can be seen that consensus clusters are more stable than a single consensus node, and that the availability of a blockchain network can be improved by composing the blockchain network from multiple consensus clusters.
FIG. 3 is a flowchart of another block chain based service processing method according to an embodiment of the present disclosure; the block chain network comprises a plurality of consensus clusters, wherein each consensus cluster comprises a master node and a slave node; the business method is executed by a target master node in a target consensus cluster, which can be any consensus cluster in a blockchain network; the blockchain-based service processing method may include, but is not limited to, steps S301-S308:
s301, acquiring a first proposal block, and forwarding the first proposal block to a slave node in the target consensus cluster.
In one embodiment, the number of consensus clusters in the blockchain network is 3N+1, N being a positive integer; a blockchain network of 3N+1 consensus clusters that can tolerate N consensus cluster errors; that is, when the number of consensus clusters in which errors occur in the blockchain network is equal to or less than N, the blockchain network may operate normally. Specifically, the target consensus cluster broadcasts the information to be confirmed to other consensus clusters in the blockchain network, and the other consensus clusters send a preparation message if the voting result is accepted, and do not send if the voting result is not accepted. When 2N consensus cluster nodes accept the preparation message, the target consensus cluster sends a confirmation message. If there are 2n+1 consensus clusters accepting the acknowledgement message, the broadcasted information to be acknowledged representing the target consensus cluster is determined.
Further, each consensus cluster may comprise M consensus nodes, including 1 master node and M-1 slave nodes. The master node may be configured to communicate with other consensus clusters in the blockchain network than the target consensus cluster and forward relevant information in the blockchain network (e.g., proposal blocks, consensus results, etc.) to the slave nodes within the target consensus cluster, and the slave nodes of the target consensus cluster may be configured to verify the proposal blocks, to document the consensus results, and to replace the master node as a new master node or vote for a new master node when the target master node fails.
In one embodiment, each consensus cluster corresponds to a gateway; for example, consensus cluster a corresponds to gateway a and consensus cluster B corresponds to gateway B. Each consensus cluster in the blockchain network can communicate with other consensus clusters in the blockchain network except for the consensus cluster. That is to say, the target master node obtains the first proposal block through the gateway corresponding to the target consensus cluster.
S302, determining a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster for the first proposal block.
In one embodiment, the target master node obtains the verification results of P slave nodes for the first proposal block, wherein P is a positive integer, and P is less than or equal to M; if the number of the first type of verification results in the P verification results is larger than a first number threshold, judging that the first proposal block passes the consensus of the target consensus cluster, and taking the judgment result as a consensus sub-result of the target consensus cluster; the first type of verification result is used for indicating that the first proposal block passes verification. Correspondingly, if the number of the second type of verification results in the P verification results is larger than a second number threshold, judging that the first proposal block fails to pass the consensus of the target consensus cluster, and taking the judgment result as a consensus sub-result of the target consensus cluster; the second type of check result is used for indicating that the first proposal block fails to pass the check. For example, let the target master node obtain the verification results of 10 slave nodes for the first proposal block, where the first number threshold is 6 and the second number threshold is 5; if the number of the first type of check results in the 10 check results is 8, judging that the first proposal block passes the consensus of the target consensus cluster; if the number of the second type of check results in the 10 check results is 6, it is determined that the first proposed block fails to pass the consensus of the target consensus cluster.
S303, obtaining voting results of other consensus clusters except the target consensus cluster in the blockchain network for the first proposal block.
The specific embodiment of step S303 can refer to the embodiment of step S203 in fig. 2, and will not be described herein.
In one embodiment, the target master node obtains voting results of other consensus clusters in the blockchain network, except the target consensus cluster, for the first proposed block through the gateway corresponding to the target consensus cluster, and broadcasts the voting results of the target consensus cluster, except the target consensus cluster, for the first proposed block to the other consensus clusters in the blockchain network through the gateway corresponding to the target consensus cluster.
S304, based on the voting result of the first proposal block, obtaining the consensus result of the first proposal block.
In one embodiment, if the number of voting results of the first proposed block indicating that the first proposed block passes through the consensus of the consensus cluster (i.e., the first proposed block is approved to pass through the consensus) is greater than a third number threshold, determining that the first proposed block passes through the consensus of the blockchain network; the third number threshold may be a preset fixed value, or may be calculated according to a preset ratio and the number of target consensus clusters in the blockchain network. If the number of voting results of the first proposal block, which indicates that the first proposal block does not pass the consensus of the consensus cluster (namely, the first proposal block is opposite to pass the consensus), is greater than a fourth number threshold, judging that the first proposal block does not pass the consensus of the block chain network; the fourth number threshold may be a preset fixed value, or may be calculated according to a preset proportion and the number of target consensus clusters in the blockchain network; the third number threshold and the fourth number threshold may be the same or different, and are not limited in this application. For example, let the target master node obtain voting results of 10 first proposal blocks, the third number threshold value be 5, and the fourth number threshold value be 5; if the voting result of the first proposal block passing through the consensus among the 10 voting results is 6, judging that the first proposal block passes through the consensus of the block chain network; if the voting result of the 10 voting results, which is opposite to the first proposal block passing through the consensus, is 8, the first proposal block is judged not to pass through the consensus of the blockchain network.
S305, forwarding the consensus result of the first proposal block to a slave node in the target consensus cluster.
After the consensus result of the first proposal block is obtained, the target master node forwards the consensus result of the first proposal block to the slave nodes in the target consensus cluster. The specific forwarding manner may refer to the forwarding manner of forwarding the first proposal block to the slave node in the target consensus cluster in step 301, which is not described herein. If the first proposal block passes through the consensus of the blockchain network, the slave node in the target consensus cluster stores the first proposal block; if the first proposal block does not pass the consensus of the block chain network, the slave node in the target consensus cluster discards the first proposal block and ends the operation.
S306, obtaining the data to be stored, and generating a second proposal block based on the data to be stored.
In one embodiment, the target master node obtains the data to be stored from the target consensus cluster, and packages the data to be stored to obtain the second proposal block. The data to be stored can be provided by part or all of the consensus nodes in the target consensus cluster, and the consensus nodes can be master nodes or slave nodes. Alternatively, the data to be authenticated may be provided by consensus nodes in other consensus clusters than the target consensus cluster.
S307, the second proposal block is sent to the consensus clusters except the target consensus cluster in the blockchain network.
In one embodiment, after generating the second proposed block, the target master node broadcasts the second proposed block to other consensus clusters in the blockchain network through a gateway corresponding to the target consensus cluster, so that each consensus cluster in the blockchain network performs consensus processing on the second proposed block, and votes based on a result of the consensus processing.
S308, obtaining the voting result of the second proposal block, and determining the consensus result of the second proposal block according to the voting result of the second proposal block.
The specific embodiment of step S308 refers to step S303 and step S304, which are not described herein. In one embodiment, the target master node is selected from the target consensus cluster, the target master node transmits a message (such as a proposal block, a consensus result, etc.) to the gateway, the gateway routes the consensus message to the gateways corresponding to other consensus clusters except the gateway corresponding to the target consensus cluster in the blockchain network, and the gateways corresponding to the other consensus clusters forward the message to the master node in the consensus cluster after receiving the message. And after receiving the message, the master node of each consensus cluster processes the message in real time and forwards the message to other slave nodes in the consensus cluster, and when the number of the slave nodes in the consensus cluster, which process the message, exceeds a threshold value, the master node determines the consensus result of the consensus cluster based on the processing result of the slave nodes, which process the message, and broadcasts the consensus result of the consensus cluster to other consensus clusters in the blockchain network through a gateway.
The following is a complete description with reference to fig. 1 d:
the master node A1 provided with the consensus cluster A generates a proposal block and broadcasts the proposal block to other consensus clusters B/C/D in the block chain network; and the gateway corresponding to the consensus cluster B/C/D receives the proposal block and forwards the proposal block to the cluster master node. Taking the consensus cluster B as an example, B1 is currently the master node in the consensus cluster B, the gateway B corresponding to the consensus cluster B forwards the proposal block to the master node B1 after receiving the proposal block, and the master node B1 forwards the proposal block to the slave node B2/B3 in the consensus cluster B. After receiving the proposal blocks from the node B2/B3, the proposal blocks are processed through a consensus module respectively, the result of processing the proposal blocks is returned to the master node B1, and when the majority of results are received by the node B1, the proposal blocks are voted, and voting information is broadcasted to other participators A/C/D through a B gateway. Similarly, when consensus is achieved for the proposed blocks by the consensus clusters a/B/C/D, the proposed blocks are written into the ledger, and the proposed blocks are written into the ledger not only the master node of each consensus cluster, but also the slave nodes in each consensus cluster.
Further, after a master node in a certain consensus cluster fails, a slave node in the consensus cluster can replace the master node to provide a consensus accounting service, and assume that the master node A1 of the consensus cluster a fails, the remaining slave nodes A2/A3 reselect a new master node, and assume that the elected A2 is a new master node, A2 informs the gateway corresponding to the consensus cluster a that the master node of the consensus cluster a has been changed to A2, and the gateway corresponding to the consensus cluster a updates the master node information corresponding to the consensus cluster a so that the following consensus message is correctly routed to the master node A2. After the failed node A1 recovers and rejoins the consensus cluster, it will act as a slave node to A2.
For other consensus clusters in the blockchain network, the consensus nodes in the consensus cluster A work normally, so that the proceeding of the consensus process can be ensured. In addition, each consensus cluster adopts a master-slave mode architecture, so that the data and the consensus state of each consensus node in the consensus cluster can keep consistent, and even if the consensus cluster A is switched by the master node, the slave node can correctly process the consensus messages sent by other participants.
In the embodiment of the present application, the blockchain network is composed of a plurality of consensus clusters, each consensus cluster includes a master node and a slave node, and a consensus process based on the consensus clusters may include: the master node acquires a first proposal block, forwards the first proposal block to a slave node in a target consensus cluster, determines a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster for the first proposal block, acquires voting results of other consensus clusters except the target consensus cluster in the block chain network for the first proposal block, and acquires the consensus result of the first proposal block based on the voting results of the first proposal block. It can be seen that consensus clusters are more stable than a single consensus node, and that the availability of a blockchain network can be improved by composing the blockchain network from multiple consensus clusters.
Fig. 4 is a flowchart of another service processing method based on a blockchain according to an embodiment of the present application; the block chain network comprises a plurality of consensus clusters, wherein each consensus cluster comprises a master node and a slave node; the business method is executed by a target slave node in a target consensus cluster, wherein the target consensus cluster can be any one of the consensus clusters in the blockchain network, and the target slave node can be any one of the target consensus clusters; the blockchain-based service processing method may include, but is not limited to, steps S401-S406:
s401, receiving a first proposal block sent by a target master node in a target consensus cluster.
The first proposed block is a block to be consensus. The slave node can directly acquire the first proposal block from the target master node, and can monitor the log file in the target consensus cluster to acquire the forwarded content of the target master node in real time.
S402, checking the first proposal block, and returning a checking result of the first proposal block to the target master node.
After the slave node acquires the first proposal block, checking the first proposal block; for example, verifying the validity of the data in the first proposal block, verifying the identity of the provider of the data in the first proposal block, etc. And after the verification is completed, the slave node returns a verification result of the first proposal block to the target master node. In addition to returning the verification result of the first proposed block to the target master node, the slave nodes in the target consensus cluster may also mutually transmit the verification result for the first proposed block.
S403, receiving a consensus result of the first proposal block sent by the target master node.
The consensus result of the first proposed block is used to indicate whether the first proposed block passes through the consensus of the blockchain network. The specific embodiment of the slave node receiving the consensus result of the first proposal block sent by the target master node may refer to step S401, which is not described herein again.
S404, if the consensus result of the first proposal block indicates that the first proposal block passes the consensus of the blockchain network, the first proposal block is subjected to the certification processing.
Accordingly, if the consensus result of the first proposed block indicates that the first proposed block does not pass the consensus of the blockchain network, the first proposed block is discarded, and the operation is ended.
And S405, voting slave nodes in the target consensus cluster when the target consensus cluster meets the replacement condition of the master node.
The master node replacement condition includes: the target master node is in fault, the current moment is matched with the replacement period of the target master node (for example, the target consensus cluster is replaced once every 24 hours), and the target master node is determined to be a malicious node (for example, the target master node has fake data, and the target consensus cluster is misreported to the illegal operations such as consensus sub-result of the proposed block).
In one embodiment, voting a slave node in the target consensus cluster refers to: each slave node in the target consensus cluster votes for the slave nodes in the target consensus cluster that meet the master node election conditions (e.g., computing power, throughput, network delay, etc. of the slave nodes) to select a new master node.
S406, determining the slave node with the highest ticket in the target consensus cluster as the master node of the target consensus cluster.
In one embodiment, the target slave node is the highest-priced slave node in the target consensus cluster, i.e., the target slave node is elected as the new master node in the target consensus cluster. After being selected as a new master node in the target consensus cluster, the target slave node sends a node replacement notification to the consensus clusters except the target consensus cluster; the node replacement notification is used to indicate that the master node of the target consensus cluster is replaced with the target slave node. Specifically, the target slave node sends a node replacement notification to a gateway corresponding to the target consensus cluster, so that the gateway updates master node information of the target consensus cluster according to the node replacement notification, and broadcasts the updated master node information to other consensus clusters except the target consensus cluster in the blockchain network.
In the embodiment of the present application, the blockchain network is composed of a plurality of consensus clusters, each consensus cluster includes a master node and a slave node, and a consensus process based on the consensus clusters may include: the slave node receives a first proposal block sent by a target master node in a target consensus cluster; checking the first proposal block, and returning a checking result of the first proposal block to the target main node; receiving a consensus result of a first proposal block sent by a target master node; if the consensus result of the first proposal block indicates that the first proposal block passes through the consensus of the blockchain network, the first proposal block is subjected to the certification storage processing. It can be seen that consensus clusters are more stable than a single consensus node, and that the availability of a blockchain network can be improved by composing the blockchain network from multiple consensus clusters.
The foregoing details of the method of embodiments of the present application are set forth in order to provide a better understanding of the foregoing aspects of embodiments of the present application, and accordingly, the following provides a device of embodiments of the present application.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a service processing apparatus based on a blockchain network according to an embodiment of the present application, where the apparatus may be mounted on a computer device; the block chain network comprises a plurality of consensus clusters, wherein each consensus cluster comprises a master node and a slave node; the method is performed by a target master node in a target consensus cluster, the target consensus cluster being any one of the consensus clusters in the blockchain network. The blockchain network-based service processing device shown in fig. 5 may be used to perform some or all of the functions of the method embodiments described above with respect to fig. 2 and 3. Referring to fig. 5, the detailed descriptions of the respective units are as follows:
An obtaining unit 501, configured to obtain a first proposal block, and forward the first proposal block to a slave node in the target consensus cluster;
a processing unit 502, configured to determine a consensus sub-result of the first proposed block according to a verification result of the slave node in the target consensus cluster for the first proposed block;
the obtaining unit 501 is further configured to obtain voting results of other consensus clusters in the blockchain network, except for the target consensus cluster, for the first proposed block, where the voting result of each consensus cluster for the first proposed block is determined by the consensus cluster according to the consensus sub-result in the consensus cluster;
the processing unit 502 is further configured to obtain a consensus result of the first proposed block based on the voting result of the first proposed block.
In one embodiment, the number of consensus clusters in the blockchain network is 3N+1, each consensus cluster includes M consensus nodes, wherein the M consensus nodes include 1 master node and M-1 slave nodes, N is a positive integer, and M is an integer greater than 1.
In one embodiment, the processing unit 502 is configured to determine a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster for the first proposal block, specifically configured to:
Obtaining the verification results of P slave nodes aiming at the first proposal block, wherein P is a positive integer;
if the number of the first type of verification results in the P verification results is larger than a first number threshold, judging that the first proposal block passes the consensus of the target consensus cluster, and taking the judgment result as a consensus sub-result of the target consensus cluster;
the first type of verification result is used for indicating that the first proposal block passes verification.
In one embodiment, the processing unit 502 is further configured to:
if the number of the second type of verification results in the P verification results is larger than a second number threshold, judging that the first proposal block fails to pass the consensus of the target consensus cluster, and taking the judgment result as a consensus sub-result of the target consensus cluster;
the second type of check result is used for indicating that the first proposal block fails to pass the check.
In one embodiment, the processing unit 502 is configured to obtain a consensus result of the first proposal block based on the voting result of the first proposal block, specifically configured to:
if the number of voting results of the first proposal block, which indicates approval of the first proposal block to pass through the consensus, is greater than a third number threshold, judging the consensus of the first proposal block through the blockchain network;
If the number of voting results indicating that the first proposed block passes through the consensus is greater than a fourth number threshold in the voting results of the first proposed block, determining that the first proposed block does not pass through the consensus of the blockchain network.
In one embodiment, the processing unit 502 is further configured to:
if the first proposal block passes through the consensus of the blockchain network, forwarding the consensus result of the first proposal block to the slave nodes in the target consensus cluster so as to ensure that the slave nodes in the target consensus cluster store the first proposal block.
In one embodiment, the processing unit 502 is further configured to:
obtaining to-be-stored data, and generating a second proposal block based on the to-be-stored data;
transmitting a second proposal block to a consensus cluster except a target consensus cluster in the blockchain network;
and obtaining the voting result of the second proposal block, and determining the consensus result of the second proposal block according to the voting result of the second proposal block.
According to one embodiment of the present application, some of the steps involved in the blockchain network-based service processing methods shown in fig. 2 and 3 may be performed by various units in the blockchain network-based service processing device shown in fig. 5. For example, step S201 and step S203 shown in fig. 2 may be performed by the acquisition unit 501 shown in fig. 5, and step S202 and step S204 may be performed by the processing unit 502 shown in fig. 5; step S301, step S303, and step S306 shown in fig. 3 may be performed by the acquisition unit 501 shown in fig. 5, step S302, step S304, step S305, and step S307 may be performed by the processing unit 502 shown in fig. 5, and step S308 may be performed cooperatively by the acquisition unit 501 and the processing unit 502 shown in fig. 5. The various units in the blockchain network-based service processing device shown in fig. 5 may be combined into one or several other units separately or all, or some (some) of the units may be further split into a plurality of units with smaller functions to form the same operation, which may not affect the implementation of the technical effects of the embodiments of the present application. The above units are divided based on logic functions, and in practical applications, the functions of one unit may be implemented by a plurality of units, or the functions of a plurality of units may be implemented by one unit. In other embodiments of the present application, the blockchain network-based service processing device may also include other units, and in practical applications, these functions may also be implemented with assistance from other units, and may be implemented by cooperation of multiple units.
According to another embodiment of the present application, a blockchain network-based traffic processing apparatus as shown in fig. 5 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods as shown in fig. 2 and 3 on a general-purpose computing device such as a computer including a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), etc., processing elements and storage elements, and implementing the blockchain network-based traffic processing method of the embodiments of the present application. The computer program may be recorded on, for example, a computer-readable recording medium, and loaded into and run in the above-described computing device through the computer-readable recording medium.
Based on the same inventive concept, the principle and beneficial effects of solving the problem of the service processing device based on the blockchain network provided in the embodiments of the present application are similar to those of the service processing method based on the blockchain network in the embodiments of the present application, and can be referred to the principle and beneficial effects of implementation of the method, and are not described herein for brevity.
Referring to fig. 6, fig. 6 is a schematic structural diagram of another service processing apparatus based on a blockchain network according to an embodiment of the present application, where the apparatus may be mounted on a computer device; the block chain network comprises a plurality of consensus clusters, wherein each consensus cluster comprises a master node and a slave node; the method is performed by a target slave node in a target consensus cluster, the target consensus cluster being any one of the consensus clusters in the blockchain network, the target slave node being any one of the target consensus clusters. The blockchain network-based service processing device shown in fig. 6 may be used to perform some or all of the functions described above in the method embodiment depicted in fig. 4. Referring to fig. 6, the detailed descriptions of the respective units are as follows:
An obtaining unit 601, configured to receive a first proposal block sent by a target master node in a target consensus cluster;
the processing unit 602 is configured to verify the first proposed block, and return a verification result of the first proposed block to the target master node;
the obtaining unit 601 is further configured to receive a consensus result of the first proposal block sent by the target master node;
the processing unit 602 is further configured to perform a certification process on the first proposed block if the consensus result of the first proposed block indicates that the first proposed block passes through the consensus of the blockchain network.
In one embodiment, the processing unit 602 is further configured to:
when the target consensus cluster meets the replacement condition of the master node, voting the slave nodes in the target consensus cluster, wherein the replacement condition of the master node comprises the following steps: the target main node is in fault, the current moment is matched with the replacement period of the target main node, and the target main node is determined to be a malicious node;
and determining the slave node with the highest ticket in the target consensus cluster as the master node of the target consensus cluster.
In one embodiment, the target slave node is the highest-scoring slave node in the target consensus cluster; the processing unit 602 is further configured to:
sending a node replacement notification to the consensus clusters except the target consensus cluster;
The node replacement notification is used for indicating that the master node of the target consensus cluster is replaced by the target slave node.
In one embodiment, each consensus cluster communicates with other consensus clusters in the blockchain network through a corresponding gateway, and the gateway corresponding to each consensus cluster stores master node information of the consensus cluster;
the processing unit 602 is configured to send a node replacement notification to a consensus cluster other than the target consensus cluster, specifically configured to:
and sending a node replacement notification to a gateway corresponding to the target consensus cluster, so that the gateway updates the master node information of the target consensus cluster according to the node replacement notification, and broadcasts the updated master node information to other consensus clusters except the target consensus cluster in the blockchain network.
According to one embodiment of the present application, some of the steps involved in the blockchain network-based service processing method shown in fig. 4 may be performed by various units in the blockchain network-based service processing device shown in fig. 6. For example, step S401 and step S403 shown in fig. 4 may be performed by the acquisition unit 601 shown in fig. 6, and step S402 and step S404 to step S406 may be performed by the processing unit 602 shown in fig. 6. The various units in the blockchain network-based service processing device shown in fig. 6 may be combined into one or several other units separately or all, or some (some) of the units may be further split into a plurality of units with smaller functions to form the same operation, which may not affect the implementation of the technical effects of the embodiments of the present application. The above units are divided based on logic functions, and in practical applications, the functions of one unit may be implemented by a plurality of units, or the functions of a plurality of units may be implemented by one unit. In other embodiments of the present application, the blockchain network-based service processing device may also include other units, and in practical applications, these functions may also be implemented with assistance from other units, and may be implemented by cooperation of multiple units.
According to another embodiment of the present application, a blockchain network-based service processing device as shown in fig. 6 may be constructed by running a computer program (including program code) capable of executing the steps involved in the respective methods as shown in fig. 4 on a general-purpose computing device such as a computer including a Central Processing Unit (CPU), a random access storage medium (RAM), a read only storage medium (ROM), etc., processing elements and storage elements, and implementing the blockchain network-based service processing method of the embodiments of the present application. The computer program may be recorded on, for example, a computer-readable recording medium, and loaded into and run in the above-described computing device through the computer-readable recording medium.
Based on the same inventive concept, the principle and beneficial effects of solving the problem of the service processing device based on the blockchain network provided in the embodiments of the present application are similar to those of the service processing method based on the blockchain network in the embodiments of the present application, and can be referred to the principle and beneficial effects of implementation of the method, and are not described herein for brevity.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a computer device according to an embodiment of the present application, and as shown in fig. 7, the computer device at least includes a processor 701, a communication interface 702, and a memory 703. Wherein the processor 701, the communication interface 702, and the memory 703 may be connected by a bus or other means. The processor 701 (or called central processing unit (Central Processing Unit, CPU)) is a computing core and a control core of the terminal, and may parse various instructions in the terminal and process various data of the terminal, for example: the CPU can be used for analyzing a startup and shutdown instruction sent by a user to the terminal and controlling the terminal to perform startup and shutdown operation; and the following steps: the CPU can transmit various kinds of interactive data between the internal structures of the terminal, and so on. Communication interface 702 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI, mobile communication interface, etc.), and may be controlled by processor 701 to receive and transmit data; the communication interface 702 may also be used for transmission and interaction of data inside the terminal. The Memory 703 (Memory) is a Memory device in the terminal for storing programs and data. It will be appreciated that the memory 703 here may include both the internal memory of the terminal and the expansion memory supported by the terminal. The memory 703 provides a storage space that stores the operating system of the terminal, which may include, but is not limited to: android systems, iOS systems, windows Phone systems, etc., which are not limiting in this application.
The embodiment of the application also provides a computer readable storage medium (Memory), which is a Memory device in the terminal and is used for storing programs and data. It will be appreciated that the computer readable storage medium herein may include both a built-in storage medium in the terminal and an extended storage medium supported by the terminal. The computer readable storage medium provides a storage space that stores a processing system of the terminal. Also stored in this memory space are one or more instructions, which may be one or more computer programs (including program code), adapted to be loaded and executed by the processor 701. Note that the computer readable storage medium can be either a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory; alternatively, it may be at least one computer-readable storage medium located remotely from the aforementioned processor.
In one embodiment, a blockchain network includes a plurality of consensus clusters, each consensus cluster including a master node and a slave node; the computer device may be a target master node device in a target consensus cluster, the target consensus cluster being any consensus cluster in the blockchain network. In this case, the processor 701 performs the following operations by executing the executable program code in the memory 703:
Acquiring a first proposal block, and forwarding the first proposal block to a slave node in a target consensus cluster;
determining a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster aiming at the first proposal block;
the method comprises the steps of obtaining voting results of other consensus clusters except a target consensus cluster in a block chain network for a first proposal block, wherein the voting result of each consensus cluster for the first proposal block is determined by the consensus cluster according to consensus sub-results in the consensus cluster;
and obtaining a consensus result of the first proposal block based on the voting result of the first proposal block.
As an alternative embodiment, the number of consensus clusters in the blockchain network is 3N+1, each consensus cluster comprises M consensus nodes, wherein the M consensus nodes comprise 1 master node and M-1 slave nodes, N is a positive integer, and M is an integer greater than 1.
As an alternative embodiment, the processor 701 determines, according to the verification result of the slave node in the target consensus cluster for the first proposal block, a specific embodiment of the consensus sub-result of the first proposal block is as follows:
obtaining the verification results of P slave nodes aiming at the first proposal block, wherein P is a positive integer;
If the number of the first type of verification results in the P verification results is larger than a first number threshold, judging that the first proposal block passes the consensus of the target consensus cluster, and taking the judgment result as a consensus sub-result of the target consensus cluster;
the first type of verification result is used for indicating that the first proposal block passes verification.
As an alternative embodiment, the processor 701 further performs the following operations by running executable program code in the memory 703:
if the number of the second type of verification results in the P verification results is larger than a second number threshold, judging that the first proposal block fails to pass the consensus of the target consensus cluster, and taking the judgment result as a consensus sub-result of the target consensus cluster;
the second type of check result is used for indicating that the first proposal block fails to pass the check.
As an alternative embodiment, the processor 701 obtains the consensus result of the first proposal block based on the voting result of the first proposal block, which is specifically shown as follows:
if the number of voting results of the first proposal block, which indicates approval of the first proposal block to pass through the consensus, is greater than a third number threshold, judging the consensus of the first proposal block through the blockchain network;
If the number of voting results indicating that the first proposed block passes through the consensus is greater than a fourth number threshold in the voting results of the first proposed block, determining that the first proposed block does not pass through the consensus of the blockchain network.
As an alternative embodiment, the processor 701 further performs the following operations by running executable program code in the memory 703:
if the first proposal block passes through the consensus of the blockchain network, forwarding the consensus result of the first proposal block to the slave nodes in the target consensus cluster so as to ensure that the slave nodes in the target consensus cluster store the first proposal block.
As an alternative embodiment, the processor 701 further performs the following operations by running executable program code in the memory 703:
obtaining to-be-stored data, and generating a second proposal block based on the to-be-stored data;
transmitting a second proposal block to a consensus cluster except a target consensus cluster in the blockchain network;
and obtaining the voting result of the second proposal block, and determining the consensus result of the second proposal block according to the voting result of the second proposal block.
In another embodiment, a blockchain network includes a plurality of consensus clusters, each consensus cluster including a master node and a slave node; the computer device may be a target slave node device in a target consensus cluster, the target consensus cluster being any one of the consensus clusters in the blockchain network, the target slave node being any one of the slave nodes in the target consensus cluster. The processor 801 performs the following operations by executing executable program code in the memory 803:
Receiving a first proposal block sent by a target master node in a target consensus cluster;
checking the first proposal block, and returning a checking result of the first proposal block to the target main node;
receiving a consensus result of a first proposal block sent by a target master node;
if the consensus result of the first proposal block indicates that the first proposal block passes through the consensus of the blockchain network, the first proposal block is subjected to the certification storage processing.
As an alternative embodiment, the processor 801, by executing executable program code in the memory 803, also performs the following operations:
when the target consensus cluster meets the replacement condition of the master node, voting the slave nodes in the target consensus cluster, wherein the replacement condition of the master node comprises the following steps: the target main node is in fault, the current moment is matched with the replacement period of the target main node, and the target main node is determined to be a malicious node;
and determining the slave node with the highest ticket in the target consensus cluster as the master node of the target consensus cluster.
As an alternative embodiment, the target slave node is the highest-priced slave node in the target consensus cluster; the processor 801, by executing executable program code in the memory 803, also performs the following operations:
Sending a node replacement notification to the consensus clusters except the target consensus cluster;
the node replacement notification is used for indicating that the master node of the target consensus cluster is replaced by the target slave node.
As an optional embodiment, each consensus cluster communicates with other consensus clusters in the blockchain network through a corresponding gateway, and the main node information of the consensus cluster is stored in the gateway corresponding to each consensus cluster; the specific embodiment of the processor 801 sending a node replacement notification to a consensus cluster other than the target consensus cluster is:
and sending a node replacement notification to a gateway corresponding to the target consensus cluster, so that the gateway updates the master node information of the target consensus cluster according to the node replacement notification, and broadcasts the updated master node information to other consensus clusters except the target consensus cluster in the blockchain network.
Based on the same inventive concept, the principle and beneficial effects of solving the problem of the computer device provided in the embodiments of the present application are similar to those of solving the problem of the service processing method based on the blockchain network in the embodiments of the method of the present application, and may refer to the principle and beneficial effects of implementation of the method, and for brevity description, no further description is given here.
Embodiments of the present application also provide a computer readable storage medium having one or more instructions stored therein, the one or more instructions adapted to be loaded by a processor and to perform the blockchain network-based service processing method of the method embodiments described above.
Embodiments of the present application also provide a computer program product comprising instructions that, when executed on a computer, cause the computer to perform the blockchain network-based business processing method of the method embodiments described above.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer readable storage medium, and the processor executes the computer instructions, so that the computer device performs the block chain network-based service processing method.
The steps in the method of the embodiment of the application can be sequentially adjusted, combined and deleted according to actual needs.
The modules in the device of the embodiment of the application can be combined, divided and deleted according to actual needs.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program to instruct related hardware, the program may be stored in a computer readable storage medium, and the readable storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The foregoing disclosure is only a preferred embodiment of the present application, and it is not intended to limit the scope of the claims, and one of ordinary skill in the art will understand that all or part of the processes for implementing the embodiments described above may be performed with equivalent changes in the claims of the present application and still fall within the scope of the claims.
Claims (16)
1. A business processing method based on a blockchain network, which is characterized in that the blockchain network comprises a plurality of consensus clusters, wherein each consensus cluster comprises a master node and a slave node; the method is performed by a target master node in a target consensus cluster, the target consensus cluster being any consensus cluster in the blockchain network; the method comprises the following steps:
acquiring a first proposal block, and forwarding the first proposal block to a slave node in the target consensus cluster;
Determining a consensus sub-result of the first proposal block according to a verification result of a slave node in the target consensus cluster aiming at the first proposal block;
the voting result of other consensus clusters except the target consensus cluster in the blockchain network for the first proposal block is obtained, and the voting result of each consensus cluster for the first proposal block is determined by the consensus cluster according to the consensus sub-result in the consensus cluster;
and obtaining a consensus result of the first proposal block based on the voting result of the first proposal block.
2. The method of claim 1, wherein the number of consensus clusters in the blockchain network is 3n+1, each consensus cluster comprising M consensus nodes, the M consensus nodes comprising 1 master node and M-1 slave nodes, N being a positive integer, M being an integer greater than 1.
3. The method according to claim 1 or 2, wherein the determining the consensus sub-result of the first proposal block from the check result of the slave node within the target consensus cluster for the first proposal block comprises:
obtaining the verification results of P slave nodes aiming at the first proposal block, wherein P is a positive integer;
If the number of the first type of verification results in the P verification results is larger than a first number threshold, judging that the first proposal block passes the consensus of the target consensus cluster, and taking the judgment result as a consensus sub-result of the target consensus cluster;
the first type of verification result is used for indicating that the first proposal block passes verification.
4. A method as claimed in claim 3, wherein the method further comprises:
if the number of the second type of verification results in the P verification results is larger than a second number threshold, judging that the first proposal block fails to pass the consensus of the target consensus cluster, and taking the judgment result as a consensus sub-result of the target consensus cluster;
the second type of verification result is used for indicating that the first proposal block fails verification.
5. The method according to claim 1 or 2, wherein the obtaining the consensus result of the first proposal block based on the voting result of the first proposal block comprises:
if the number of voting results of the first proposal block, which indicates approval of the first proposal block to pass through consensus, is greater than a third number threshold, determining that the first proposal block passes through consensus of the blockchain network;
If the number of voting results indicated to be against the consensus of the first proposed block is greater than a fourth number threshold, determining that the first proposed block does not pass the consensus of the blockchain network.
6. The method of claim 1, wherein the method further comprises:
and if the first proposal block passes through the consensus of the blockchain network, forwarding the consensus result of the first proposal block to a slave node in the target consensus cluster so as to enable the slave node in the target consensus cluster to store the first proposal block.
7. The method of claim 1, wherein the method further comprises:
obtaining to-be-stored data, and generating a second proposal block based on the to-be-stored data;
transmitting the second proposal block to a consensus cluster in the blockchain network except the target consensus cluster;
and obtaining the voting result of the second proposal block, and determining the consensus result of the second proposal block according to the voting result of the second proposal block.
8. A business processing method based on a blockchain network, which is characterized in that the blockchain network comprises a plurality of consensus clusters, wherein each consensus cluster comprises a master node and a slave node; the method is performed by a target slave node in a target consensus cluster, the target consensus cluster being any one of the target consensus clusters in the blockchain network, the target slave node being any one of the target consensus clusters; the method comprises the following steps:
Receiving a first proposal block sent by a target master node in the target consensus cluster;
checking the first proposal block, and returning a checking result of the first proposal block to the target main node;
receiving a consensus result of the first proposal block sent by the target master node;
and if the consensus result of the first proposal block indicates that the first proposal block passes the consensus of the blockchain network, carrying out the certification processing on the first proposal block.
9. The method of claim 8, wherein the method further comprises:
when the target consensus cluster meets a master node replacement condition, voting slave nodes in the target consensus cluster, wherein the master node replacement condition comprises the following steps: the target master node fails, the current moment is matched with the replacement period of the target master node, and the target master node is determined to be a malicious node;
and determining the slave node with the highest ticket in the target consensus cluster as the master node of the target consensus cluster.
10. The method of claim 9, wherein the target slave node is a highest-ticketed slave node in the target consensus cluster; the method further comprises the steps of:
Sending a node replacement notification to a consensus cluster other than the target consensus cluster;
the node replacement notification is used for indicating that the master node of the target consensus cluster is replaced by the target slave node.
11. The method of claim 10, wherein each consensus cluster communicates with other consensus clusters in the blockchain network through a corresponding gateway, and wherein master node information of the consensus cluster is stored in the gateway corresponding to each consensus cluster; the sending a node replacement notification to a consensus cluster other than the target consensus cluster includes:
and sending a node replacement notification to a gateway corresponding to the target consensus cluster, so that the gateway updates the master node information of the target consensus cluster according to the node replacement notification, and broadcasts the updated master node information to other consensus clusters except the target consensus cluster in a blockchain network.
12. A block chain network-based service processing apparatus, wherein the block chain network comprises a plurality of consensus clusters, each comprising a master node and a slave node; the method is performed by a target master node in a target consensus cluster, the target consensus cluster being any consensus cluster in the blockchain network; the service processing device comprises:
The acquisition unit is used for acquiring a first proposal block and forwarding the first proposal block to a slave node in the target consensus cluster;
the processing unit is used for determining a consensus sub-result of the first proposal block according to a verification result of the slave node in the target consensus cluster aiming at the first proposal block;
the obtaining unit is further configured to obtain voting results of other consensus clusters in the blockchain network, except the target consensus cluster, for the first proposed block, where the voting result of each consensus cluster for the first proposed block is determined by the consensus cluster according to consensus sub-results in the consensus cluster;
the processing unit is further configured to obtain a consensus result of the first proposal block based on the voting result of the first proposal block.
13. A block chain network-based service processing apparatus, wherein the block chain network comprises a plurality of consensus clusters, each comprising a master node and a slave node; the method is performed by a target slave node in a target consensus cluster, the target consensus cluster being any one of the target consensus clusters in the blockchain network, the target slave node being any one of the target consensus clusters; comprising the following steps:
The acquisition unit is used for receiving a first proposal block sent by a target master node in the target consensus cluster;
the processing unit is used for checking the first proposal block and returning a checking result of the first proposal block to the target main node;
the obtaining unit is further configured to receive a consensus result of the first proposal block sent by the target master node;
the processing unit is further configured to perform a certification processing on the first proposed block if the consensus result of the first proposed block indicates that the first proposed block passes through the consensus of the blockchain network.
14. A computer device, comprising: a memory device and a processor;
a memory in which a computer program is stored;
a processor for loading the computer program to implement the blockchain network-based traffic processing method of any of claims 1-7 or to implement the blockchain network-based traffic processing method of any of claims 8-11.
15. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program adapted to be loaded by a processor and to perform the blockchain network based traffic processing method according to any of claims 1-7 or to perform the blockchain network based traffic processing method according to any of claims 8-11.
16. A computer program product, characterized in that the computer program product comprises a computer program adapted to be loaded by a processor and to perform the blockchain network based traffic processing method according to any of claims 1-7 or to perform the blockchain network based traffic processing method according to any of claims 8-11.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111332181.4A CN116112501A (en) | 2021-11-10 | 2021-11-10 | Business processing method, device, equipment and storage medium based on block chain network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111332181.4A CN116112501A (en) | 2021-11-10 | 2021-11-10 | Business processing method, device, equipment and storage medium based on block chain network |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116112501A true CN116112501A (en) | 2023-05-12 |
Family
ID=86262591
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111332181.4A Pending CN116112501A (en) | 2021-11-10 | 2021-11-10 | Business processing method, device, equipment and storage medium based on block chain network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116112501A (en) |
-
2021
- 2021-11-10 CN CN202111332181.4A patent/CN116112501A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113395363B (en) | Data processing method, device and equipment based on block chain and storage medium | |
US20230316273A1 (en) | Data processing method and apparatus, computer device, and storage medium | |
CN111741114A (en) | System, method and equipment capable of monitoring cross-chain interaction based on block chain | |
US20230315891A1 (en) | Transaction data processing method and apparatus, computer device and storage medium | |
WO2018234987A1 (en) | Fast propagation of recent transactions over a blockchain network | |
CN111698315B (en) | Data processing method and device for block and computer equipment | |
CN111698094B (en) | Common identification method based on block chain system and block chain system | |
US20230037932A1 (en) | Data processing method and apparatus based on blockchain network, and computer device | |
EP3477561A1 (en) | System for goods delivery | |
KR20200081533A (en) | Blockchain Consensus Method based Improved Dynamic Blind Voting for Internet of Things Environment | |
US20230370285A1 (en) | Block-chain-based data processing method, computer device, computer-readable storage medium | |
CN110930254A (en) | Data processing method, device, terminal and medium based on block chain | |
US20230360046A1 (en) | Blockchain-based block processing method and apparatus, device, storage medium, and program product | |
CN117407437A (en) | Block chain-based data processing method, equipment and readable storage medium | |
WO2023082883A1 (en) | Cross-blockchain transaction processing method and apparatus, and computer device, computer storage medium and computer program product | |
WO2023168993A1 (en) | Blockchain-based data processing method, apparatus, and device, medium, and product | |
CN117061538A (en) | Consensus processing method and related device based on block chain network | |
CN116112501A (en) | Business processing method, device, equipment and storage medium based on block chain network | |
CN110855492B (en) | Data processing method, device and storage medium | |
CN116226827A (en) | Data processing method, device, equipment and storage medium based on block chain network | |
CN117056131B (en) | Data processing method based on block chain network and related equipment | |
CN115455460A (en) | Data storage method, device, equipment and medium based on block chain | |
CN117811739A (en) | Block chain-based data processing method, equipment and readable storage medium | |
CN115577039A (en) | Block processing method, block processing device, verification node and storage medium | |
CN116112496A (en) | Cross-chain interaction method based on blockchain network and related equipment |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
REG | Reference to a national code |
Ref country code: HK Ref legal event code: DE Ref document number: 40086697 Country of ref document: HK |