CN114387109A - Data processing device and method and block chain-based service system - Google Patents

Data processing device and method and block chain-based service system Download PDF

Info

Publication number
CN114387109A
CN114387109A CN202210054018.4A CN202210054018A CN114387109A CN 114387109 A CN114387109 A CN 114387109A CN 202210054018 A CN202210054018 A CN 202210054018A CN 114387109 A CN114387109 A CN 114387109A
Authority
CN
China
Prior art keywords
consensus
transaction
consensus mechanism
updated
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
Application number
CN202210054018.4A
Other languages
Chinese (zh)
Inventor
张健
延安
董华
刘爽
吴殿丞
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202210054018.4A priority Critical patent/CN114387109A/en
Publication of CN114387109A publication Critical patent/CN114387109A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Abstract

The application provides a data processing device and method and a block chain-based service system.A consensus manager acquires a to-be-updated consensus mechanism in a consensus mechanism configuration instruction and sends the to-be-updated consensus mechanism to a consensus synchronizer. When the block height of the node reaches the target block height, the consensus synchronizer collects the consensus mechanism information of other nodes except the node, and when the consensus mechanism information of other nodes is consistent with the consensus mechanism information of the node and receives the collection request of other nodes, the consensus synchronizer sends a request for switching the consensus mechanism to the transaction receiver. The transaction receiver switches the current consensus mechanism to the to-be-updated consensus mechanism, and sends the to-be-updated consensus mechanism and the transaction consensus requests sent by other nodes to the consensus executor. After receiving the transaction consensus request, the consensus executor acquires transaction data in the transaction consensus request, performs transaction consensus on the transaction data through a to-be-updated consensus mechanism, and writes the transaction data achieving the transaction consensus into a block chain account book.

Description

Data processing device and method and block chain-based service system
Technical Field
The present application relates to the field of blockchain, and in particular, to a data processing apparatus and method, and a service system based on blockchain.
Background
The block chain technology is a specific data structure formed by data blocks in a chain mode according to the time sequence, the double payment problem of a decentralized system is solved through a distributed database, a digital encryption technology and a unique consensus algorithm on the premise that a third-party credit organization is not needed, and the decentralized trustable system without trusting a single node is realized.
In the blockchain technology, the consensus mechanism is a key element of a blockchain platform that can achieve decentralization. For any kind of blockchain, a high-performance, strong-security and stable consensus mechanism is used, which is a necessary basis for realizing the blockchain business requirements.
At present, in a financial service scenario based on a federation chain, when the federation chain needs to update a consensus mechanism, an update time needs to be agreed in advance by a offline mode and the consensus mechanism needs to be updated, and each participant of the federation chain synchronously turns off service application and block chain node service at the agreed time to implement an update operation. However, this updating method causes service interruption and has poor flexibility.
Disclosure of Invention
The application provides a data processing device, a data processing method and a block chain-based service system, which are used for solving the problem that the existing consensus mechanism updating mode is poor in flexibility.
In a first aspect, the present application provides a data processing apparatus comprising:
the system comprises a consensus manager, a consensus synchronizer connected with the consensus manager, a transaction receiver connected with the consensus synchronizer, and a consensus executor connected with the transaction receiver;
the consensus manager is used for acquiring a consensus mechanism to be updated in a consensus mechanism configuration instruction and sending the consensus mechanism to be updated to the consensus synchronizer;
the consensus synchronizer is used for acquiring consensus mechanism information of other nodes except the node when the block height of the node reaches a target block height, and sending a request for switching the consensus mechanism to the transaction receiver when the consensus mechanism information of the other nodes is consistent with the consensus mechanism information of the node and an acquisition request of the other nodes is received, wherein the target block height is the block height required to be reached for switching to the consensus mechanism to be updated;
after receiving a request for switching a consensus mechanism, the transaction receiver switches the current consensus mechanism to the to-be-updated consensus mechanism, and sends the to-be-updated consensus mechanism and the transaction consensus requests sent by the other nodes to the consensus executor;
the consensus actuator acquires the transaction data in the transaction consensus request, performs transaction consensus on the transaction data through the mechanism to be updated, and writes the transaction data achieving the transaction consensus into a block chain account book.
Optionally, the consensus manager includes a consensus mechanism configuration unit and a consensus information management unit;
the consensus mechanism configuration unit is used for acquiring a consensus mechanism to be updated in a consensus mechanism configuration instruction;
the consensus information management unit is used for sending the consensus mechanism to be updated to the consensus synchronizer.
Optionally, the consensus information management unit is specifically configured to send the consensus mechanism to be updated and the target block height to the consensus synchronizer when the node is a master node, or send the consensus mechanism to be updated to the consensus synchronizer when the node is a non-master node.
Optionally, the consensus mechanism configuring unit is further configured to manage a current consensus mechanism of the node according to the consensus mechanism configuration instruction, where the management includes at least one of modification, deletion, and query.
Optionally, the consensus synchronizer includes: the device comprises a data acquisition unit and a consensus judgment unit connected with the data acquisition unit;
the data acquisition unit is used for acquiring the block height of the node and the consensus mechanism information of other nodes;
the consensus judging unit is used for judging whether a request for switching the consensus mechanism can be sent to the transaction receiver or not according to the block height of the node and the consensus mechanism information of other nodes, and sending the request for switching the consensus mechanism to the transaction receiver when the request for switching the consensus mechanism can be sent to the transaction receiver.
Optionally, the transaction receiver comprises: the transaction processing device comprises a transaction receiving unit, a transaction packaging unit connected with the transaction receiving unit, and a consensus information unit connected with the transaction packaging unit;
the transaction receiving unit is used for receiving the transaction consensus requests sent by the other nodes;
the consensus information unit is used for receiving a request for switching a consensus mechanism and switching a current consensus mechanism to the consensus mechanism to be updated;
the transaction encapsulation unit is used for encapsulating the to-be-updated consensus mechanism and the transaction consensus request.
Optionally, the consensus actuator comprises: the device comprises a request analysis unit, a consensus execution unit connected with the request analysis unit, and a consensus feedback unit connected with the consensus execution unit;
the request analysis unit is used for acquiring the to-be-updated consensus mechanism and the transaction data and sending the transaction data and the to-be-updated consensus mechanism to the consensus execution unit;
the consensus execution unit is used for carrying out transaction consensus on the transaction data through the to-be-updated consensus mechanism;
the consensus feedback unit is used for collecting the execution condition of the consensus execution unit and writing the transaction data achieving the transaction consensus into a block chain account book.
Optionally, the consensus synchronizer is further configured to mark that the update of the consensus mechanism to be updated fails when the block height of the node reaches the target block height and any one of the other nodes does not reach the target block height.
In a second aspect, the present application provides a data processing method,
the method is used for the consensus synchronizer and comprises the following steps:
the consensus synchronizer receives a consensus mechanism to be updated sent by a consensus manager, wherein the consensus mechanism to be updated is obtained by the consensus manager from a consensus mechanism configuration instruction;
the consensus synchronizer collects consensus mechanism information of other nodes except the node when the block height of the node reaches the target block height, when the consensus mechanism information of the other nodes is consistent with the consensus mechanism information of the node and the acquisition request of the other nodes is received, sending a request for switching the consensus mechanism to the transaction receiver, so that the transaction receiver switches the current consensus mechanism to the to-be-updated consensus mechanism and sends the to-be-updated consensus mechanism and the transaction consensus requests sent by the other nodes to the consensus executor, so that the consensus executor acquires transaction data in the transaction consensus requests, transaction consensus is carried out on the transaction data through a mechanism to be updated and the transaction data achieving the transaction consensus is written into the block chain account book, the target block height is the block height required to be reached by switching to the to-be-updated consensus mechanism.
In a third aspect, the present application provides a service system based on a block chain, including a plurality of nodes, where each node includes the data processing apparatus in any one of the possible designs of the first aspect and the first aspect.
In a fourth aspect, the present application provides an electronic device comprising: a memory and a processor;
the memory is used for storing instructions; the processor is used for calling the instructions in the memory to execute the data processing method in the second aspect and any one of the possible designs of the second aspect.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon computer instructions, which, when executed by at least one processor of an electronic device, cause the electronic device to perform the data processing method of any one of the possible designs of the second aspect and the second aspect.
In a fifth aspect, the present application provides a computer program product comprising computer instructions which, when executed by at least one processor of an electronic device, cause the electronic device to perform the data processing method of the second aspect and any one of the possible designs of the second aspect.
The data processing device comprises a consensus manager, a consensus synchronizer connected with the consensus manager, a transaction receiver connected with the consensus synchronizer, and a consensus executor connected with the transaction receiver. The consensus manager acquires the consensus mechanism to be updated in the consensus mechanism configuration instruction and sends the consensus mechanism to be updated to the consensus synchronizer. When the block height of the node reaches the target block height, the consensus synchronizer collects the consensus mechanism information of other nodes except the node, and when the consensus mechanism information of other nodes is consistent with the consensus mechanism information of the node and a collection request of other nodes is received, a request for switching the consensus mechanism is sent to the transaction receiver. After receiving the request of switching the consensus mechanism, the transaction receiver switches the current consensus mechanism to the consensus mechanism to be updated, and sends the consensus mechanism to be updated and the transaction consensus requests sent by other nodes to the consensus executor. After receiving the transaction consensus request, the consensus executor acquires transaction data in the transaction consensus request, performs transaction consensus on the transaction data through a to-be-updated consensus mechanism, and writes the transaction data achieving the transaction consensus into a block chain account book. Thus, the consensus synchronizer collects the consensus mechanism information of other nodes except the node when the block height of the node reaches the target block height, when the consensus mechanism information of other nodes is consistent with the consensus mechanism information of the node and the acquisition request of other nodes is received, sending a request for switching the consensus mechanism to the transaction receiver, so that the transaction receiver switches the current consensus mechanism to the consensus mechanism to be updated, and the consensus executor utilizes the current consensus mechanism to carry out transaction consensus on the transaction data before the consensus mechanism is switched, after the consensus mechanism is switched, the to-be-updated consensus mechanism is used for carrying out transaction consensus on the transaction data, so that service application and block link point service do not need to be shut down in the process of updating the consensus mechanism, the node service restarting operation in the process of updating the consensus mechanism is avoided, and the flexibility of the updating mode is improved.
Drawings
In order to more clearly illustrate the technical solutions in the present application or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a schematic structural diagram of a data processing apparatus according to an embodiment of the present application;
fig. 2 is a schematic structural diagram of another data processing apparatus according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of another data processing apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of another data processing apparatus according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of another data processing apparatus according to an embodiment of the present application;
fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present application.
Detailed Description
To make the purpose, technical solutions and advantages of the present application clearer, the technical solutions in the present application will be clearly and completely described below with reference to the drawings in the present application, and it is obvious that the described embodiments are some, but not all embodiments of the present application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
To facilitate understanding of the present application, the terms referred to in the present application are explained first:
block chains: a blockchain in the narrow sense is a data structure that is linked up sequentially from back to front by blocks containing transaction information. All blocks are linked in this chain in order from back to front, each pointing to its parent block. The block chain in the broad sense refers to a decentralized distributed database, and has the characteristics of distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm and the like.
Federation chain: a federation chain is a permission block chain formed by limited nodes, and a plurality of organization deployment nodes form a federation chain network.
Block chain user: refers to an application, organization or individual that uses a blockchain network for information storage, consensus and transaction.
Block chain node: the entity is an entity for deploying block chain service and storing block chain data in a block chain network, and is a constituent unit of the block chain network.
Block chain service: refers to an application program deployed on a blockchain node that enables blockchain data storage and consensus.
Block chain transaction: refers to the actual transactions that occur in the blockchain network, which can be abstracted into change records of blockchain data.
A consensus mechanism: the method is a mechanism for block chain nodes to achieve the consistency of the block chain data in the whole network, and is essentially a program for distributed data consistency judgment, so that the accurate addition of the block chain data can be ensured, and the block chain can be prevented from being attacked by malicious nodes. If the result of the program execution meets the judgment standard of the consensus mechanism, the consensus is achieved; otherwise, no consensus is reached.
A consensus algorithm: common blockchain consensus algorithms designed to achieve transaction consensus among individual nodes within a blockchain network include workload proofs (pows), equity proofs (PoS), authorized equity proofs (DPoS), Practical Bypath Fault Tolerance (PBFT), authorized bypath fault tolerance (DBFT), federal bypath protocol (FBA), and the like.
A verification engine: the device responsible for the credible verification of the transaction between different consensus mechanisms verifies the consensus transaction by running the dynamically injected consensus verification rule.
And (3) block falling: and writing the transaction data after the consensus verification in the block link points into a block chain account book.
Target block height: the block height to be reached when the block chain node performs the switching of the consensus mechanism is determined by the consensus manager according to the block height when the consensus mechanism is started to be updated.
Transaction consensus: the method refers to a process that each node of the block chain verifies the block chain transaction through a consensus mechanism.
A master node: the main node initiates a transaction consensus process in a alliance chain, and the election mode of the main node is different in different alliance chain consensus algorithms
The present application mentions in the background art that in the blockchain technology, the consensus mechanism is a key element of a blockchain platform that can achieve decentralization. For any kind of blockchain, a high-performance, strong-security and stable consensus mechanism is used, which is a necessary basis for realizing the blockchain business requirements. However, in view of the difference in reliability, extensibility, and the like of the different types of consensus mechanisms, the applicability of the various consensus mechanisms in different financial service scenarios is also inconsistent. When a service scenario applied to a blockchain platform changes, the applicable consensus mechanism may also change. Therefore, for the blockchain platform, the consensus mechanism is sometimes updated according to the change of the service requirement. In addition, when the blockchain software is updated iteratively, the consensus mechanism on the blockchain is usually updated accordingly.
At present, in a financial service scenario based on a federation chain, when the federation chain needs to update a consensus mechanism, an update time needs to be agreed in advance by a offline mode and the consensus mechanism needs to be updated, and each participant of the federation chain synchronously turns off service application and block chain node service at the agreed time to implement an update operation. However, this updating method causes service interruption and has poor flexibility.
In view of the above problems, the present application provides a data processing apparatus, which includes a consensus manager, a consensus synchronizer connected to the consensus manager, a transaction receiver connected to the consensus synchronizer, and a consensus executor connected to the transaction receiver. The consensus manager acquires the consensus mechanism to be updated in the consensus mechanism configuration instruction and sends the consensus mechanism to be updated to the consensus synchronizer. When the block height of the node reaches the target block height, the consensus synchronizer collects the consensus mechanism information of other nodes except the node, and when the consensus mechanism information of other nodes is consistent with the consensus mechanism information of the node and a collection request of other nodes is received, a request for switching the consensus mechanism is sent to the transaction receiver. After receiving the request of switching the consensus mechanism, the transaction receiver switches the current consensus mechanism to the consensus mechanism to be updated, and sends the consensus mechanism to be updated and the transaction consensus requests sent by other nodes to the consensus executor. After receiving the transaction consensus request, the consensus executor acquires transaction data in the transaction consensus request, performs transaction consensus on the transaction data through a to-be-updated consensus mechanism, and writes the transaction data achieving the transaction consensus into a block chain account book. Thus, the consensus synchronizer collects the consensus mechanism information of other nodes except the node when the block height of the node reaches the target block height, when the consensus mechanism information of other nodes is consistent with the consensus mechanism information of the node and the acquisition request of other nodes is received, sending a request for switching the consensus mechanism to the transaction receiver, so that the transaction receiver switches the current consensus mechanism to the consensus mechanism to be updated, and the consensus executor utilizes the current consensus mechanism to carry out transaction consensus on the transaction data before the consensus mechanism is switched, after the consensus mechanism is switched, the to-be-updated consensus mechanism is used for carrying out transaction consensus on the transaction data, so that service application and block link point service do not need to be shut down in the process of updating the consensus mechanism, the node service restarting operation in the process of updating the consensus mechanism is avoided, and the flexibility of the updating mode is improved.
The technical solution of the present application will be described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 1 illustrates a data processing apparatus provided in an embodiment of the present application, where the data processing apparatus provided in this embodiment includes:
a consensus manager 101, a consensus synchronizer 102 connected to the consensus manager 101, a transaction receiver 103 connected to the consensus synchronizer 102, and a consensus executor 104 connected to the transaction receiver 103;
the consensus manager 101 obtains a consensus mechanism to be updated in the consensus mechanism configuration instruction, and sends the consensus mechanism to be updated to the consensus synchronizer 102;
when the height of the falling block of the node reaches the height of the target block, the consensus synchronizer 102 acquires consensus mechanism information of other nodes except the node, and when the consensus mechanism information of other nodes is consistent with the consensus mechanism information of the node and an acquisition request of other nodes is received, a request for switching the consensus mechanism is sent to the transaction receiver 103, and the height of the target block is the height of the target block required for switching to the consensus mechanism to be updated;
after receiving the request for switching the consensus mechanism, the transaction receiver 103 switches the current consensus mechanism to the consensus mechanism to be updated, and sends the consensus mechanism to be updated and the transaction consensus requests sent by other nodes to the consensus executor 104;
the consensus executor 104 obtains the transaction data in the transaction consensus request, performs transaction consensus on the transaction data through the to-be-updated consensus mechanism, and writes the transaction data achieving the transaction consensus into the blockchain ledger.
After receiving the consensus mechanism configuration instruction, the consensus manager 101 determines whether the consensus mechanism configuration instruction includes a to-be-updated consensus mechanism different from the current consensus mechanism, and if the to-be-updated consensus mechanism is included, obtains the to-be-updated consensus mechanism in the consensus mechanism configuration instruction, and sends the to-be-updated consensus mechanism to the consensus synchronizer 102.
Referring to fig. 2, the consensus manager 101 includes a consensus mechanism configuration unit 111 and a consensus information management unit 112, where the consensus mechanism configuration unit 111 is configured to maintain the total amount of the consensus mechanism information of the node, for example, when the consensus mechanism configuration instruction includes the to-be-updated consensus mechanism, the to-be-updated consensus mechanism is obtained, and the to-be-updated consensus mechanism is sent to the consensus information management unit 112. When the consensus mechanism configuration instruction includes a modification instruction, a deletion instruction, or a query instruction, the consensus mechanism configuration unit 111 may further manage the current consensus mechanism of the node according to the consensus mechanism configuration instruction, where the management includes at least one of modification, deletion, and query. For example, when the consensus mechanism configuration instruction includes a modification instruction, the current consensus mechanism of the node is queried and the current consensus mechanism is modified, when the consensus mechanism configuration instruction includes a deletion instruction, the current consensus mechanism of the node is queried and the current consensus mechanism is deleted, and when the consensus mechanism configuration instruction includes a query instruction, the current consensus mechanism of the node is queried.
The consensus information management unit 112 is used to maintain the usage of the node consensus mechanism. Specifically, when the consensus information management unit 112 receives the to-be-updated consensus mechanism sent by the consensus mechanism configuration unit 111, it stores the to-be-updated consensus mechanism and sends the to-be-updated consensus mechanism to the consensus synchronizer 102. It is understood that the consensus information managing unit 112 may store the consensus mechanism to be updated each time the consensus mechanism update is performed, and the consensus information managing unit 112 may store the current consensus mechanism, the consensus mechanism to be updated. When the node is a master node, the consensus information management unit 112 sends the consensus mechanism to be updated and the target block height to the consensus synchronizer 102, where the target block height is the block height required to be reached by switching to the consensus mechanism to be updated, and when the node is a non-master node, the consensus information management unit 112 sends the consensus mechanism to be updated to the consensus synchronizer 102 and receives the target block height sent by the master node.
The consensus synchronizer 102 collects consensus mechanism information of other nodes except the local node when the block height of the local node reaches a target block height, and sends a request for switching the consensus mechanism to the transaction receiver 103 when the consensus mechanism information of the other nodes is consistent with the consensus mechanism information of the local node and a collection request of the other nodes is received. When the block height of the node reaches the target block height, the consensus synchronizer 102 collects the consensus mechanism information of other nodes, and when the other nodes all receive the consensus mechanism to be updated and receive the collection requests sent by the other nodes, the consensus synchronizer sends a request for switching the consensus mechanism to the transaction receiver 103. When the block height of each node reaches the target block height, an acquisition request needs to be sent to other nodes to request to acquire the consensus mechanism information of other nodes, so that the acquisition request is sent to indicate that the block height of the node reaches the target block height, and when the block height of the node reaches the target block height, and other nodes all receive the consensus mechanism to be updated, and other nodes all send acquisition requests to the node, the consensus synchronizer 102 of the node can send a request for switching the consensus mechanism to the transaction receiver 103 of the node, wherein the request indicates that the block heights of all the nodes all reach the target block height and all receive the consensus mechanism to be updated.
The consensus synchronizer 102 may further mark that the to-be-updated consensus mechanism fails to be updated when the block height of the node reaches the target block height and any one of the other nodes does not reach the target block height, and send failure information to the consensus manager 101. That is, the block height of the node reaches the target block height, and the block heights of one or more nodes in other nodes do not reach the target block height, and the update failure of the to-be-updated consensus mechanism is recorded.
Referring to fig. 3, the consensus synchronizer 102 comprises: the data acquisition unit 121 and the consensus determination unit 122, wherein the data acquisition unit 121 acquires the block height of the node and the consensus mechanism information of the other nodes, and sends the block height of the node and the consensus mechanism information of the other nodes to the consensus determination unit 122. The consensus determining unit 122 determines whether the request for switching the consensus mechanism can be sent to the transaction receiver 103 after receiving the block height of the node and the consensus mechanism information of the other nodes, and the consensus determining unit 122 may further determine whether the node receives the acquisition request of the other nodes, and when the block height of the node reaches the target block height and the consensus mechanism information of the other nodes is consistent with the consensus mechanism information of the node and the acquisition request sent by the other nodes is received, determine that the request for switching the consensus mechanism can be sent to the transaction receiver 103 and send the request for switching the consensus mechanism to the transaction receiver 103. The consensus determining unit 122 is further configured to determine that the update of the consensus mechanism to be updated fails when the block height of the node reaches the target block height and the block heights of some nodes in other nodes do not reach the target block height.
After receiving the request for switching the consensus mechanism, the transaction receiver 103 switches the current consensus mechanism to the to-be-updated consensus mechanism, and sends the to-be-updated consensus mechanism and the transaction consensus requests sent by other nodes to the consensus executor 104. Specifically, the transaction receiver 103 may receive the consensus mechanism switching request sent by the consensus synchronizer 102, and switch the current consensus mechanism to the to-be-updated consensus mechanism in the consensus mechanism switching request, where the currently active consensus mechanism is the to-be-updated consensus mechanism. The transaction receiver 103 also monitors transaction consensus requests of other nodes, encapsulates the currently valid consensus mechanism of the node and the transaction consensus requests sent by other nodes after receiving the transaction consensus requests, and sends the encapsulated information to the consensus executor 104.
Referring to fig. 4, the transaction receiver 103 includes a transaction receiving unit 131, a transaction encapsulating unit 132 connected to the transaction receiving unit 131, and a consensus information unit 133 connected to the transaction encapsulating unit 132. The transaction receiving unit 131 receives the transaction consensus requests sent by other nodes and sends the transaction consensus requests to the transaction encapsulating unit 132. The consensus information unit 133 receives the request for switching the consensus mechanism sent by the consensus synchronizer 102, switches the current consensus mechanism of the node to the to-be-updated consensus mechanism in the request for switching the consensus mechanism, and sends the to-be-updated consensus mechanism to the transaction encapsulation unit 132. The transaction encapsulation unit 132 receives the transaction consensus request and the to-be-updated consensus mechanism, encapsulates the transaction consensus request and the to-be-updated consensus mechanism, and sends the encapsulated information to the consensus executor 104.
The consensus executor 104 obtains the encapsulated information sent by the transaction receiver 103, analyzes the encapsulated information, obtains transaction data in the transaction request and a to-be-updated consensus mechanism, performs transaction consensus on the transaction data through the to-be-updated consensus mechanism, and writes the transaction data achieving the transaction consensus into the block chain ledger.
Referring to fig. 5, the consensus executor 104 includes a request parsing unit 141, a consensus execution unit 142 connected to the request parsing unit 141, and a consensus feedback unit 143 connected to the consensus execution unit 142. The request parsing unit 141 receives the encapsulation information sent by the transaction receiver 103, parses the encapsulation information, obtains the to-be-updated consensus mechanism and the transaction data in the transaction consensus request, and sends the transaction data and the to-be-updated consensus mechanism to the consensus execution unit 142. The consensus performing unit 142 performs a transaction consensus on the transaction data through the consensus mechanism to be updated, the number of the consensus performing units 142 may be multiple, and each consensus performing unit performs the transaction consensus by using a specific consensus mechanism. The consensus feedback unit 143 obtains the execution status of the consensus execution unit 142, and writes the transaction data that achieves the transaction consensus into the blockchain account.
In the data processing device, the consensus synchronizer collects consensus mechanism information of other nodes except the node when the block height of the node reaches a target block height, sends a request for switching the consensus mechanism to the transaction receiver when the consensus mechanism information of the other nodes is consistent with the consensus mechanism information of the node and receives the collection request of the other nodes, so that the transaction receiver switches the current consensus mechanism to the consensus mechanism to be updated, and the consensus executor performs transaction consensus on transaction data by using the current consensus mechanism before the consensus mechanism is switched, performs transaction consensus on the transaction data by using the consensus mechanism to be updated after the consensus mechanism is switched, thereby avoiding the need of stopping service application and block chain link point service in the process of updating the consensus mechanism and restarting node service operation in the process of updating the consensus mechanism, the flexibility of the updating mode is improved.
An embodiment of the present application further provides a data processing method. With the consensus synchronizer as an execution subject, the method of the embodiment may include the following steps:
s101, the consensus synchronizer receives a consensus mechanism to be updated, which is sent by the consensus manager.
After receiving the consensus mechanism configuration instruction, the consensus manager acquires the consensus mechanism to be updated from the consensus mechanism configuration instruction and sends the consensus mechanism to be updated to the consensus synchronizer.
S102, when the consensus synchronizer receives that the block height of the node reaches the target block height, the consensus synchronizer collects consensus mechanism information of other nodes except the node, when the consensus mechanism information of the other nodes is consistent with the consensus mechanism information of the node and receives collection requests of the other nodes, a request for switching the consensus mechanism is sent to the transaction receiver, so that the transaction receiver switches the current consensus mechanism to the to-be-updated consensus mechanism and sends the to-be-updated consensus mechanism and the transaction consensus requests sent by the other nodes to the consensus executor, so that the consensus executor obtains transaction data in the transaction consensus request, performs transaction consensus on the transaction data through the to-be-updated consensus mechanism, writes the transaction data achieving the transaction consensus into a block chain account, and the target block height is the block height required to be reached by switching to the to-be-updated consensus mechanism.
An embodiment of the present application further provides a service system based on a block chain, which includes a plurality of nodes, and each node includes the above data processing apparatus.
And the block chain comprises a node A, a node B and a node C, and a consensus manager in the data processing device on the node A acquires the consensus mechanism to be updated in the consensus mechanism configuration instruction and sends the consensus mechanism to be updated to the consensus synchronizer on the node. If the node A is the master node, after the consensus manager on the node A acquires the consensus mechanism to be updated and the target block height, the node A directly broadcasts the target block height of the consensus mechanism to be updated. If the node A is not the master node, after the consensus manager on the node A obtains the consensus mechanism to be updated and the target block height, the master node broadcasts the target block height of the consensus mechanism to be updated.
When the block height of the node reaches the target block height, a consensus synchronizer on the node A acquires consensus mechanism information of the node B and the node C, when the node B and the node C both receive a consensus mechanism to be updated and the node A receives acquisition requests of the node B and the node C, the node A sends a request for switching the consensus mechanism to a transaction receiver of the node, after receiving the request of the consensus mechanism, the transaction receiver switches the current consensus mechanism to the consensus mechanism to be updated, and sends the consensus mechanism to be updated and transaction consensus sent by other nodes to a consensus actuator on the node. And the consensus executor on the node A acquires the transaction data in the transaction consensus request, performs transaction consensus on the transaction data through a mechanism to be updated, and writes the transaction data achieving the transaction consensus into the block chain account book.
Fig. 6 shows a hardware structure diagram of an electronic device according to an embodiment of the present application. As shown in fig. 6, the electronic device 20 is configured to implement the operations corresponding to the electronic device in any of the method embodiments described above, where the electronic device 20 of this embodiment may include: memory 21, processor 22 and communication interface 23.
A memory 21 for storing computer instructions. The Memory 21 may include a Random Access Memory (RAM), a Non-Volatile Memory (NVM), at least one disk Memory, a usb disk, a removable hard disk, a read-only Memory, a magnetic disk or an optical disk.
And a processor 22 for executing the computer instructions stored in the memory to implement the data processing method in the above-mentioned embodiments. Reference may be made in particular to the description relating to the method embodiments described above. The Processor 22 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present invention may be embodied directly in a hardware processor, or in a combination of the hardware and software modules within the processor.
Alternatively, the memory 21 may be separate or integrated with the processor 22.
A communication interface 23, which may be coupled to the processor 22. Processor 22 may control communication interface 23 to perform the functions of receiving and transmitting information.
The electronic device provided in this embodiment may be configured to execute the data processing method, and the implementation manner and the technical effect thereof are similar, and details are not described herein again.
The present application also provides a computer readable storage medium, in which computer instructions are stored, and the computer instructions are executed by a processor to implement the methods provided by the above-mentioned various embodiments.
The present application also provides a computer program product comprising computer instructions stored in a computer readable storage medium. The computer instructions may be read by at least one processor of the device from a computer-readable storage medium, and execution of the computer instructions by the at least one processor causes the device to perform the methods provided by the various embodiments described above.
The embodiment of the present application further provides a chip, which includes a memory and a processor, where the memory is used to store computer instructions, and the processor is used to call and execute the computer instructions from the memory, so that a device in which the chip is installed executes the method described in the above various possible embodiments.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: it is also possible to modify the solutions described in the previous embodiments or to substitute some or all of them with equivalents. And the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A data processing apparatus, comprising:
the system comprises a consensus manager, a consensus synchronizer connected with the consensus manager, a transaction receiver connected with the consensus synchronizer, and a consensus executor connected with the transaction receiver;
the consensus manager is used for acquiring a consensus mechanism to be updated in a consensus mechanism configuration instruction and sending the consensus mechanism to be updated to the consensus synchronizer;
the consensus synchronizer is used for acquiring consensus mechanism information of other nodes except the node when the block height of the node reaches a target block height, and sending a request for switching the consensus mechanism to the transaction receiver when the consensus mechanism information of the other nodes is consistent with the consensus mechanism information of the node and an acquisition request of the other nodes is received, wherein the target block height is the block height required to be reached for switching to the consensus mechanism to be updated;
after receiving a request for switching a consensus mechanism, the transaction receiver switches the current consensus mechanism to the to-be-updated consensus mechanism, and sends the to-be-updated consensus mechanism and the transaction consensus requests sent by the other nodes to the consensus executor;
the consensus actuator acquires the transaction data in the transaction consensus request, performs transaction consensus on the transaction data through the mechanism to be updated, and writes the transaction data achieving the transaction consensus into a block chain account book.
2. The apparatus according to claim 1, wherein the consensus manager comprises a consensus mechanism configuration unit and a consensus information management unit;
the consensus mechanism configuration unit is used for acquiring a consensus mechanism to be updated in a consensus mechanism configuration instruction;
the consensus information management unit is used for sending the consensus mechanism to be updated to the consensus synchronizer.
3. The apparatus of claim 2, wherein the consensus information management unit is specifically configured to send the to-be-updated consensus mechanism and the target block height to the consensus synchronizer when the node is a master node or send the to-be-updated consensus mechanism to the consensus synchronizer when the node is a non-master node.
4. The apparatus according to claim 2, wherein the consensus mechanism configuring unit is further configured to manage the current consensus mechanism of the node according to a consensus mechanism configuration instruction, the management including at least one of modification, deletion, and query.
5. The apparatus of any of claims 1-4, wherein the consensus synchronizer comprises: the device comprises a data acquisition unit and a consensus judgment unit connected with the data acquisition unit;
the data acquisition unit is used for acquiring the block height of the node and the consensus mechanism information of other nodes;
the consensus judging unit is used for judging whether a request for switching the consensus mechanism can be sent to the transaction receiver or not according to the block height of the node and the consensus mechanism information of other nodes, and sending the request for switching the consensus mechanism to the transaction receiver when the request for switching the consensus mechanism can be sent to the transaction receiver.
6. The apparatus of any of claims 1-4, wherein the transaction receiver comprises: the transaction processing device comprises a transaction receiving unit, a transaction packaging unit connected with the transaction receiving unit, and a consensus information unit connected with the transaction packaging unit;
the transaction receiving unit is used for receiving the transaction consensus requests sent by the other nodes;
the consensus information unit is used for receiving a request for switching a consensus mechanism and switching a current consensus mechanism to the consensus mechanism to be updated;
the transaction encapsulation unit is used for encapsulating the to-be-updated consensus mechanism and the transaction consensus request.
7. The apparatus of any one of claims 1-4, wherein the consensus actuator comprises: the device comprises a request analysis unit, a consensus execution unit connected with the request analysis unit, and a consensus feedback unit connected with the consensus execution unit;
the request analysis unit is used for acquiring the to-be-updated consensus mechanism and the transaction data and sending the transaction data and the to-be-updated consensus mechanism to the consensus execution unit;
the consensus execution unit is used for carrying out transaction consensus on the transaction data through the to-be-updated consensus mechanism;
the consensus feedback unit is used for collecting the execution condition of the consensus execution unit and writing the transaction data achieving the transaction consensus into a block chain account book.
8. The apparatus according to any of claims 1-4, wherein the consensus synchronizer is further configured to mark an update failure of the to-be-updated consensus mechanism when the block height of the node reaches a target block height, and any one of the other nodes does not reach the target block height.
9. A data processing method for a consensus synchronizer, comprising:
the consensus synchronizer receives a consensus mechanism to be updated sent by a consensus manager, wherein the consensus mechanism to be updated is obtained by the consensus manager from a consensus mechanism configuration instruction;
the consensus synchronizer collects consensus mechanism information of other nodes except the node when the block height of the node reaches the target block height, when the consensus mechanism information of the other nodes is consistent with the consensus mechanism information of the node and the acquisition request of the other nodes is received, sending a request for switching the consensus mechanism to the transaction receiver, so that the transaction receiver switches the current consensus mechanism to the to-be-updated consensus mechanism and sends the to-be-updated consensus mechanism and the transaction consensus requests sent by the other nodes to the consensus executor, so that the consensus executor acquires transaction data in the transaction consensus requests, transaction consensus is carried out on the transaction data through a mechanism to be updated and the transaction data achieving the transaction consensus is written into the block chain account book, the target block height is the block height required to be reached by switching to the to-be-updated consensus mechanism.
10. A blockchain based service system comprising a plurality of nodes, characterized in that each node comprises a data processing device according to any of claims 1-8.
CN202210054018.4A 2022-01-18 2022-01-18 Data processing device and method and block chain-based service system Pending CN114387109A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210054018.4A CN114387109A (en) 2022-01-18 2022-01-18 Data processing device and method and block chain-based service system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210054018.4A CN114387109A (en) 2022-01-18 2022-01-18 Data processing device and method and block chain-based service system

Publications (1)

Publication Number Publication Date
CN114387109A true CN114387109A (en) 2022-04-22

Family

ID=81202942

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210054018.4A Pending CN114387109A (en) 2022-01-18 2022-01-18 Data processing device and method and block chain-based service system

Country Status (1)

Country Link
CN (1) CN114387109A (en)

Similar Documents

Publication Publication Date Title
CN109493223B (en) Accounting method and device
JP6864330B2 (en) Room inventory management system based on blockchain
Enes et al. State-machine replication for planet-scale systems
US7912858B2 (en) Data synchronization method
CN111338773A (en) Distributed timed task scheduling method, scheduling system and server cluster
CN110413676A (en) The access method and its device of database, electronic equipment and medium
CN109308227A (en) Fault detection control method and relevant device
CN110597918A (en) Account management method and device and computer readable storage medium
CN113064744A (en) Task processing method and device, computer readable medium and electronic equipment
CN110222535A (en) Processing unit, method and the storage medium of block chain configuration file
CN114185558A (en) Native application master selection method and device based on K8s and storage medium
CN111311254A (en) Service processing method, device and system based on block chain
CN113347257A (en) Communication method, communication device, server and storage medium
CN106331081A (en) Information synchronization method and device
CN113112344B (en) Service processing method, device, storage medium and computer program product
CN113438275B (en) Data migration method and device, storage medium and data migration equipment
US11522966B2 (en) Methods, devices and systems for non-disruptive upgrades to a replicated state machine in a distributed computing environment
CN110297822A (en) Key management method, device, equipment and storage medium towards block chain
CN117170820A (en) Configuration sharing method, system, terminal and storage medium of cluster node
CN111737021A (en) Parallel task processing method and device, electronic equipment and storage medium
CN114387109A (en) Data processing device and method and block chain-based service system
CN113590643B (en) Data synchronization method, device, equipment and storage medium based on dual-track database
CN109901933B (en) Operation method and device of business system, storage medium and electronic device
CN110290215B (en) Signal transmission method and device
CN111752911A (en) Data transmission method, system, terminal and storage medium based on Flume

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