CN111461887B - Block chain consensus processing method and device and electronic equipment - Google Patents

Block chain consensus processing method and device and electronic equipment Download PDF

Info

Publication number
CN111461887B
CN111461887B CN202010248779.4A CN202010248779A CN111461887B CN 111461887 B CN111461887 B CN 111461887B CN 202010248779 A CN202010248779 A CN 202010248779A CN 111461887 B CN111461887 B CN 111461887B
Authority
CN
China
Prior art keywords
consensus
module
proposal
control module
interface
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.)
Active
Application number
CN202010248779.4A
Other languages
Chinese (zh)
Other versions
CN111461887A (en
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.)
Hangzhou Rivtower Technology Co Ltd
Original Assignee
Hangzhou Rivtower Technology Co Ltd
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 Hangzhou Rivtower Technology Co Ltd filed Critical Hangzhou Rivtower Technology Co Ltd
Priority to CN202010248779.4A priority Critical patent/CN111461887B/en
Publication of CN111461887A publication Critical patent/CN111461887A/en
Application granted granted Critical
Publication of CN111461887B publication Critical patent/CN111461887B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer And Data Communications (AREA)

Abstract

One or more embodiments of the present specification disclose a block chain consensus processing method, apparatus, and electronic device, where the method includes: the consensus module calls a consensus interface matched with the identification based on the identification of the selected consensus algorithm; and the consensus module adopts a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal. Therefore, the consensus algorithm is decoupled from other parts of the block chain, and the corresponding consensus interface is called according to requirements to perform consensus processing, so that the method is flexible and convenient to realize, and can support the switching of multiple classes of consensus algorithms in the block chain system.

Description

Block chain consensus processing method and device and electronic equipment
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a method and an apparatus for processing consensus of blockchains, and an electronic device.
Background
The blockchain is a decentralized and innovative solution for solving the multi-party trust problem by using a distributed book technology, and is a leading-edge technology of the current society.
The consensus algorithm is the core of the blockchain, and the consensus algorithm is strongly coupled with other parts of the blockchain, and usually, only a certain initially selected consensus algorithm can be supported by one blockchain system. If the subsequent application scene changes, the consensus algorithm needs to be changed, and the whole body is dragged and moved, which is almost equal to the redesign of the whole block chain system. Therefore, the consensus algorithm cannot be simply and conveniently replaced based on application scene change in the existing block chain network.
Disclosure of Invention
One or more embodiments of the present disclosure provide a method, an apparatus, and an electronic device for processing consensus of a blockchain, so as to call a corresponding consensus interface according to a requirement to perform consensus processing in a manner of decoupling a consensus algorithm from other parts of the blockchain, thereby achieving flexibility and convenience, and supporting switching of multiple classes of consensus algorithms in a blockchain system.
To solve the above technical problem, one or more embodiments of the present specification are implemented as follows:
in a first aspect, a block chain consensus processing method is provided, which is applied to a block chain node of a block chain network, wherein the block chain network is encapsulated with a plurality of consensus interfaces, and each consensus interface is encapsulated with a class of consensus algorithm; the method comprises the following steps:
the consensus module calls a consensus interface matched with the identification based on the identification of the selected consensus algorithm;
and the consensus module adopts a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal, wherein the consensus module is functionally decoupled from other modules.
In a second aspect, a block chain consensus processing apparatus is provided, which is applied to a block chain node of a block chain network, where the block chain network is encapsulated with multiple consensus interfaces, and each of the consensus interfaces is encapsulated with a class of consensus algorithm; the device comprises: a consensus module and other modules; wherein, the first and the second end of the pipe are connected with each other,
the consensus module calls a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm;
and the consensus module performs consensus processing on a proposal by adopting a consensus algorithm corresponding to the consensus interface, wherein the consensus module is functionally decoupled from other modules.
In a third aspect, an electronic device is provided, including:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to perform:
calling a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm;
and carrying out consensus processing on the proposal by adopting a consensus algorithm corresponding to the consensus interface, wherein the consensus module in the block chain link point of the block chain network is decoupled from other module functions.
In a fourth aspect, a computer-readable storage medium is presented, storing one or more programs which, when executed by an electronic device comprising a plurality of application programs, cause the electronic device to perform:
calling a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm;
and carrying out consensus processing on the proposal by adopting a consensus algorithm corresponding to the consensus interface, wherein the consensus module in the block chain link point of the block chain network is decoupled from other module functions.
As can be seen from the technical solutions provided in one or more embodiments of the present specification, the consensus module calls a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm; and the consensus module adopts a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal. Therefore, the consensus algorithm is decoupled from other parts of the block chain, and the corresponding consensus interface is called according to requirements to perform consensus processing, so that the method is flexible and convenient to realize, and can support the switching of multiple classes of consensus algorithms in the block chain system.
Drawings
In order to more clearly illustrate one or more embodiments or prior art solutions of the present specification, reference will now be made briefly to the attached drawings, which are needed in the description of one or more embodiments or prior art, and it should be apparent that the drawings in the description below are only some of the embodiments described in the specification, and that other drawings may be obtained by those skilled in the art without inventive exercise.
Fig. 1 is a schematic step diagram of a block chain consensus processing method according to an embodiment of the present disclosure.
Fig. 2 is a schematic flowchart of a block chain consensus processing scheme provided in an embodiment of the present specification.
Fig. 3 is a schematic structural diagram of a block chain consensus processing apparatus according to an embodiment of the present disclosure.
Fig. 4 is a schematic structural diagram of an electronic device provided in an embodiment of the present specification.
Detailed Description
In order to make the technical solutions in the present specification better understood, the technical solutions in one or more embodiments of the present specification will be clearly and completely described below with reference to the accompanying drawings in one or more embodiments of the present specification, and it is obvious that the one or more embodiments described are only a part of the embodiments of the present specification, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from one or more of the embodiments in the present specification without inventive step, shall fall within the scope of protection of this document.
Example one
Referring to fig. 1, a schematic step diagram of a block chain consensus processing method provided in an embodiment of the present disclosure is shown, it should be understood that the method is applied in a block chain network, where the block chain network encapsulates multiple consensus interfaces, each of the consensus interfaces encapsulates a type of consensus algorithm, and an execution main body of the consensus processing method may be a block chain consensus processing device, and the block chain consensus processing device may specifically be a block chain link point.
The consensus processing method may include the steps of:
step 102: and calling a consensus interface matched with the identifier by the consensus module based on the identifier of the selected consensus algorithm.
It should be understood that in the block chain network, a plurality of consensus interfaces may be abstracted in advance, and each consensus interface is encapsulated with a class of consensus algorithms and corresponding functions thereof. Meanwhile, the number of delay blocks of the corresponding consensus algorithm is encapsulated in the consensus interface, so that the certainty of the consensus result is finally determined.
Different consensus algorithms have large differences in flow and attribute, and therefore, in a blockchain network, for consensus of a proposal, it should be ensured that the types of consensus interfaces called by all blockchain nodes are the same, that is, the consensus algorithms used by all blockchain nodes are the same.
Taking the practical Byzantine fault-tolerant algorithm PBFT and the workload proof POW as examples, the most important difference is certainty. As long as the PBFT agrees, the result is confirmed and will not be changed. However, the consensus such as POW is not very deterministic, and after a block is known, the probability of being knocked over is smaller and smaller.
The solution to this problem is that each consensus algorithm specifies a DELAY BLOCK NUMBER, which can be written as BLOCK _ DELAY _ NUMBER; for example, in the PBFT-like consensus algorithm, the number of delay blocks is 0, i.e., once the consensus result is obtained, the final result is obtained. In the POW-based consensus algorithm, the number of delay blocks may be 6, that is, after a result is known in a consensus, 6 blocks are delayed and then the result is considered as a final result. It should be understood that the value 6 is taken as an example, and the number of the delay blocks may also be set according to the actual delay situation, and the number of the delay blocks corresponding to other consensus algorithms is not short of other values, which is not described in detail herein.
Correspondingly, in order to accurately use the consensus algorithm packaged in the consensus interfaces, the number of delay blocks matched with the consensus algorithm is packaged in each consensus interface; after the consensus module calls the consensus interface matched with the identifier based on the identifier of the selected consensus algorithm, the control module obtains the NUMBER of DELAY BLOCKs from the consensus module in an initialization stage so as to finally determine the consensus result, and the control module maintains a latest BLOCK DELAY NUMBER chain.
In this embodiment of the present specification, assuming that the selection of the consensus algorithm can be implemented at the initialization of the consensus module, then, in the block-out phase, the control module can assemble the packaged transactions into a proposal; the proposal is then broadcast by the network module to other nodes within the blockchain.
In an implementation scheme, the network module may provide a registration interface, and the consensus module and other modules may all register interfaces during an initialization phase, and may provide necessary matching information, such as module identification, during registration, so that the consensus module or other modules may dynamically call the corresponding transmission interface to process when data needs to be transmitted through the network module. Therefore, the dependence coupling caused by static configuration can be avoided, especially the decoupling of the consensus module and the network module can be realized, and the consensus module can update the consensus algorithm conveniently.
Specifically, when the network module transmits data with other nodes in the block chain, the network module may perform parameter comparison based on transmission data of other modules having transmission requirements, and call a transmission interface registered by the other modules after matching, and transmit data using the transmission interface.
Step 104: and the consensus module adopts a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal, wherein the consensus module is functionally decoupled from other modules.
In the stage of consensus, the network module receives the proposal broadcast by the block-out party and forwards the proposal to the control module; the control module checks the proposal, and takes the proposal as a new block uplink after the check is passed, wherein the new block carries a mark representing that the proposal is not subjected to consensus processing; and the control module sends the information required by the consensus of the proposal to the consensus module so that the consensus module can conveniently adopt a consensus algorithm corresponding to the consensus interface to carry out consensus processing on the proposal. Therefore, the functions of proposal verification and transaction validity verification are transferred to the control module, and the dependence of the consensus module on the control module is relieved.
After the consensus module sends the consensus result to the control module, the control module adds the consensus result to a corresponding position of a branch chain for high maintenance based on the number of delay blocks.
It should be appreciated that after the consensus module agrees to vote, the control module is notified of the consensus result; if the consensus succeeds, the control module converts the new block into a formal block and informs the consensus module to agree on a block with the next height; otherwise, the consensus module is informed to perform consensus on other blocks with the same height as the new block.
In fact, some system configuration information, such as a consensus node address list, may be used in the consensus module consensus processing process on the proposal, and the update of the system configuration information without business logic may be implemented by being placed in a transaction without depending on an intelligent contract, thereby decoupling the dependency of the consensus module on the intelligent contract and the execution module.
The common processing scheme according to the embodiments of the present disclosure is described in detail below by way of a specific example.
Referring to fig. 2, the consensus processing scheme may include the following flows:
step 202: the blockchain system is initialized.
In the initialization process, a proper consensus interface can be called through a selected consensus algorithm; meanwhile, each module can register a transmission interface in the network module so as to facilitate subsequent dynamic calling.
It should be understood that not every consensus process requires initialization, but here only the case when a consensus algorithm needs to be reselected. If the consensus algorithm does not need to be changed, the consensus process may begin based on step 204.
Step 204: and the control module of the block output node directly assembles the packaged transaction into the proxy.
Step 206: the network module of the out-of-block node broadcasts the proseal to other consensus nodes.
When the network module broadcasts the proxy, the transmission interface can be dynamically called based on the transmission data of the control module to realize the transmission of the data.
Step 208: and the network modules of other consensus nodes forward the received proposal to the control module of the node.
Step 210: and the control modules of other consensus nodes complete the verification of the proposal and add the proposal to the current block chain, and mark that the block is not yet known in a consensus manner.
Step 212: and the control modules of other consensus nodes send the hash of the propofol and other necessary information to the consensus module of the node for subsequent consensus voting.
Step 214: and after the consensus is completed, informing the control module of the consensus result.
If the consensus is successful, step 216 is performed, otherwise, step 218 is performed.
Step 216: the control modules of all consensus nodes convert the proseal into a formal block and inform the consensus module to continue to agree on the next height.
After the consensus module sends the consensus result of a certain promosal to the control plane, the control plane will add the consensus result to the appropriate position with the branched chain. If the maximum height increases, the block before the delay block number block is confirmed, the processing flow after this block can be continued, and the bifurcation before the delay block number block is cut off.
Step 218: the control module may notify the consensus module to change to another proxy retry of the same altitude.
By the technical scheme, the consensus module calls a consensus interface matched with the identification based on the identification of the selected consensus algorithm; and the consensus module adopts a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal. Therefore, the consensus algorithm is decoupled from other parts of the block chain, and the corresponding consensus interface is called according to requirements to perform consensus processing, so that the method is flexible and convenient to realize, and can support the switching of multiple classes of consensus algorithms in the block chain system.
Example two
Referring to fig. 3, a consensus processing apparatus for a block chain provided in this specification is applied to a block chain node of a block chain network, where the block chain network is encapsulated with multiple consensus interfaces, and each of the consensus interfaces is encapsulated with a class of consensus algorithm; the apparatus 300 may include: a consensus module 302 and other modules, such as a control module 304, a network module 306, an execution module 308; wherein, the first and the second end of the pipe are connected with each other,
the consensus module 302 calls a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm;
the consensus module 302 performs consensus processing on the proposal by adopting a consensus algorithm corresponding to the consensus interface, wherein the consensus module is functionally decoupled from other modules.
Optionally, as an embodiment, the number of delay blocks adapted to the consensus algorithm is further encapsulated in each of the consensus interfaces;
after the consensus module calls a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm and before the consensus module performs consensus processing on a proposal by adopting the consensus algorithm corresponding to the consensus interface, the control module acquires the number of delay blocks from the consensus module in an initialization stage;
and after the consensus module sends the consensus result to the control module, the control module further adds the consensus result to a corresponding position of a highly maintained branch chain based on the number of delay blocks.
In a specific implementation manner of the embodiment of the present specification, in the block output stage, the control module assembles the packaged transactions into a proposal;
and the network module broadcasts the proposal to other nodes in the block chain.
In another specific implementation manner of the embodiment of the present specification, in the consensus phase, the network module receives a proposal broadcasted by a block-sending party, and forwards the proposal to the control module;
the control module checks the proposal, and takes the proposal as a new block uplink after the check is passed, wherein the new block carries a mark representing that the proposal is not subjected to consensus processing;
and the control module is used for sending the information required by the consensus of the proposal to the consensus module.
In a further specific implementation manner of the embodiment of the present specification, after the consensus module consensus votes, the control module is further notified of the consensus result,
if the consensus succeeds, the control module converts the new block into a formal block and informs the consensus module to agree on a block with the next height;
otherwise, the consensus module is informed to perform consensus on other blocks with the same height as the new block.
In another specific implementation manner of the embodiment of this specification, when the network module transmits data with other nodes in the block chain, the network module further performs parameter comparison based on transmission data of other modules with transmission requirements, and calls a dynamic transmission interface registered by the other modules after matching, and transmits data using the dynamic transmission interface.
In another specific implementation manner of the embodiment of the present specification, the system configuration information required by the consensus module in the consensus process does not depend on the intelligent contract of the block chain. That is, the system configuration information involved in the consensus process by the consensus module 302 does not require the execution module 308 to perform configuration updates by executing intelligent contracts. Specifically, the system configuration information can be put in the transaction by a transaction sending mode, so that the update management of the system configuration is realized. In this way, the management of system configuration information is decoupled from the intelligent contracts and execution modules 308, facilitating individual switching of consensus algorithms without affecting the maintenance of other modules.
By the technical scheme, the consensus module calls a consensus interface matched with the identification based on the identification of the selected consensus algorithm; and the consensus module adopts a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal. Therefore, by decoupling the consensus algorithm from other parts of the block chain, corresponding consensus interfaces are called according to requirements to perform consensus processing, so that the method is flexible and convenient to implement, and can support the switching of multiple types of consensus algorithms in the block chain system.
EXAMPLE III
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure. Referring to fig. 4, at a hardware level, the electronic device includes a processor, and optionally further includes an internal bus, a network interface, and a memory. The Memory may include a Memory, such as a Random-Access Memory (RAM), and may further include a non-volatile Memory, such as at least 1 disk Memory. Of course, the electronic device may also include hardware required for other services.
The processor, the network interface, and the memory may be connected to each other via an internal bus, which may be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one double-headed arrow is shown in FIG. 4, but this does not indicate only one bus or one type of bus.
And the memory is used for storing programs. In particular, the program may include program code comprising computer operating instructions. The memory may include both memory and non-volatile storage and provides instructions and data to the processor.
The processor reads the corresponding computer program from the nonvolatile memory into the memory and then runs the computer program to form the consensus processing device of the block chain on the logic level. The processor is used for executing the program stored in the memory and is specifically used for executing the following operations:
calling a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm;
and carrying out consensus processing on the proposal by adopting a consensus algorithm corresponding to the consensus interface, wherein the consensus module in the block chain link point of the block chain network is decoupled from other module functions.
The method performed by the apparatus according to the embodiment shown in fig. 1 of the present specification may be implemented in or by a processor. The processor may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the above method may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), Application Specific Integrated Circuits (ASICs), Field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components. The methods, steps, and logic blocks disclosed in one or more embodiments of the present specification may be implemented or performed. 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 one or more embodiments of the present disclosure may be embodied directly in hardware, in a software module executed by a hardware decoding processor, or in a combination of the hardware and software modules executed by a hardware decoding processor. The software modules may be located in ram, flash, rom, prom, or eprom, registers, etc. as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
The electronic device may also execute the method of fig. 1 and implement the functions of the corresponding apparatus in the embodiment shown in fig. 1, which are not described herein again in this specification.
Of course, besides the software implementation, the electronic device of the embodiment of the present disclosure does not exclude other implementations, such as a logic device or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may also be hardware or a logic device.
By the technical scheme, the consensus module calls a consensus interface matched with the identification based on the identification of the selected consensus algorithm; and the consensus module adopts a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal. Therefore, the consensus algorithm is decoupled from other parts of the block chain, and the corresponding consensus interface is called according to requirements to perform consensus processing, so that the method is flexible and convenient to realize, and can support the switching of multiple classes of consensus algorithms in the block chain system.
Example four
Embodiments of the present specification also propose a computer-readable storage medium storing one or more programs, the one or more programs comprising instructions, which when executed by a portable electronic device comprising a plurality of application programs, are capable of causing the portable electronic device to perform the method of the embodiment shown in fig. 1, and in particular for performing the method of:
calling a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm;
and carrying out consensus processing on the proposal by adopting a consensus algorithm corresponding to the consensus interface, wherein the consensus module in the block chain link point of the block chain network is decoupled from other module functions.
By the technical scheme, the consensus module calls a consensus interface matched with the identification based on the identification of the selected consensus algorithm; and the consensus module adopts a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal. Therefore, the consensus algorithm is decoupled from other parts of the block chain, and the corresponding consensus interface is called according to requirements to perform consensus processing, so that the method is flexible and convenient to realize, and can support the switching of multiple classes of consensus algorithms in the block chain system.
In short, the above description is only a preferred embodiment of the present disclosure, and is not intended to limit the scope of the present disclosure. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present specification shall be included in the protection scope of the present specification.
The system, apparatus, module or unit illustrated in one or more of the above embodiments may be implemented by a computer chip or an entity, or by an article of manufacture with a certain functionality. One typical implementation device is a computer. In particular, the computer may be, for example, a personal computer, a laptop computer, a cellular telephone, a camera phone, a smartphone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Disks (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The foregoing description has been directed to specific embodiments of this disclosure. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.

Claims (14)

1. A block chain consensus processing method is applied to a block chain node of a block chain network, the block chain network is packaged with a plurality of consensus interfaces, and each consensus interface is packaged with a class of consensus algorithm; the method comprises the following steps:
the consensus module calls a consensus interface matched with the identification based on the identification of the selected consensus algorithm;
the consensus module adopts a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal, wherein the consensus module is functionally decoupled from other modules;
the number of delay blocks adapted to the consensus algorithm is packaged in each consensus interface;
after the consensus module calls a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm and before the consensus module performs consensus processing on a proposal by adopting the consensus algorithm corresponding to the consensus interface, the method further comprises:
the control module acquires the number of the delay blocks from the consensus module in an initialization stage;
and after the consensus module sends the consensus result to the control module, the method further comprises:
the control module adds the consensus results to corresponding positions of the highly maintained fork chains based on the number of delay blocks.
2. The method of claim 1, further comprising:
in a block-out phase, the control module assembles the packaged transactions into a proposal;
the network module broadcasts the proposal to other nodes in the blockchain.
3. The method of claim 2, further comprising:
in the stage of consensus, the network module receives the proposal broadcast by the block-out party and forwards the proposal to the control module;
the control module checks the proposal, and takes the proposal as a new block uplink after the check is passed, wherein the new block carries a mark representing that the proposal is not subjected to consensus processing;
and the control module sends the information required by the consensus of the proposal to the consensus module.
4. The method of claim 3, further comprising:
after the consensus module agrees to vote, the control module is informed of the consensus result,
if the consensus succeeds, the control module converts the new block into a formal block and informs the consensus module to agree on a block with the next height;
otherwise, the consensus module is informed to perform consensus on other blocks with the same height as the new block.
5. The method according to any one of claims 2 to 4, wherein when the network module transmits data with other nodes in the block chain, the network module performs parameter comparison based on the transmission data of other modules with transmission requirements, and calls the transmission interfaces registered by the other modules after matching, and transmits data using the transmission interfaces.
6. The method of any of claims 1-4, the system configuration information required by the consensus module at the time of consensus processing is independent of an intelligent contract for the blockchain.
7. A block chain consensus processing device is applied to a block chain node of a block chain network, the block chain network is packaged with a plurality of consensus interfaces, and each consensus interface is packaged with a class of consensus algorithm; the device comprises: a consensus module and other modules; wherein the content of the first and second substances,
the consensus module calls a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm;
the consensus module performs consensus processing on a proposal by adopting a consensus algorithm corresponding to the consensus interface, wherein the consensus module is functionally decoupled from other modules;
the number of delay blocks adapted to the consensus algorithm is packaged in each consensus interface; the other modules include: a control module;
after the consensus module calls a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm and before the consensus module performs consensus processing on a proposal by adopting the consensus algorithm corresponding to the consensus interface, the control module acquires the number of delay blocks from the consensus module in an initialization stage;
and after the consensus module sends the consensus result to the control module, the control module further adds the consensus result to a corresponding position of a highly maintained branch chain based on the number of delay blocks.
8. The apparatus of claim 7, the other modules further comprising: a network module;
in the block-out stage, the control module assembles the packaged transactions into a proposal;
and the network module broadcasts the proposal to other nodes in the block chain.
9. The apparatus as set forth in claim 8,
in the stage of consensus, the network module receives the proposal broadcast by the block-out party and forwards the proposal to the control module;
the control module checks the proposal, and takes the proposal as a new block uplink after the check is passed, wherein the new block carries a mark representing that the proposal is not subjected to consensus processing;
and the control module is used for sending the information required by the consensus of the proposal to the consensus module.
10. The apparatus as set forth in claim 9, wherein,
after the consensus module agrees to vote, the control module is also informed of the consensus result,
if the consensus succeeds, the control module converts the new block into a formal block and informs the consensus module to agree on a block with the next height;
otherwise, the consensus module is informed to perform consensus on other blocks with the same height as the new block.
11. The device according to any of claims 8-10, wherein when the network module transmits data with other nodes in the block chain, the network module also performs parameter comparison based on the transmission data of other modules with transmission requirements, and calls the dynamic transmission interfaces registered by the other modules after matching, and transmits data using the dynamic transmission interfaces.
12. The apparatus of any of claims 7-10, the consensus module to require system configuration information at the time of consensus processing that is independent of an intelligent contract for the blockchain.
13. An electronic device, comprising:
a processor; and
a memory arranged to store computer executable instructions that, when executed, cause the processor to perform:
calling a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm;
adopting a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal, wherein the consensus module in the block chain link point of the block chain network is functionally decoupled from other modules;
the number of delay blocks adapted to the consensus algorithm is packaged in each consensus interface; the other modules include: a control module;
after the consensus module calls a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm and before the consensus module performs consensus processing on a proposal by adopting the consensus algorithm corresponding to the consensus interface, the control module acquires the number of delay blocks from the consensus module in an initialization stage;
and after the consensus module sends the consensus result to the control module, the control module further adds the consensus result to a corresponding position of a highly maintained branch chain based on the number of delay blocks.
14. A computer readable storage medium storing one or more programs that, when executed by an electronic device that includes a plurality of application programs, cause the electronic device to perform:
calling a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm;
adopting a consensus algorithm corresponding to the consensus interface to perform consensus processing on a proposal, wherein the consensus module in the block chain link point of the block chain network is functionally decoupled from other modules;
the number of delay blocks adapted to the consensus algorithm is packaged in each consensus interface; the other modules include: a control module;
after the consensus module calls a consensus interface matched with the identifier based on the identifier of the selected consensus algorithm and before the consensus module performs consensus processing on a proposal by adopting the consensus algorithm corresponding to the consensus interface, the control module acquires the number of delay blocks from the consensus module in an initialization stage;
and after the consensus module sends the consensus result to the control module, the control module further adds the consensus result to a corresponding position of a highly maintained branch chain based on the number of delay blocks.
CN202010248779.4A 2020-04-01 2020-04-01 Block chain consensus processing method and device and electronic equipment Active CN111461887B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010248779.4A CN111461887B (en) 2020-04-01 2020-04-01 Block chain consensus processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010248779.4A CN111461887B (en) 2020-04-01 2020-04-01 Block chain consensus processing method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111461887A CN111461887A (en) 2020-07-28
CN111461887B true CN111461887B (en) 2022-06-03

Family

ID=71681155

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010248779.4A Active CN111461887B (en) 2020-04-01 2020-04-01 Block chain consensus processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111461887B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111767347B (en) * 2020-07-27 2021-09-10 腾讯科技(深圳)有限公司 Switching method and device of consensus algorithm, node equipment and storage medium
CN112433885B (en) * 2020-11-19 2021-09-10 腾讯科技(深圳)有限公司 Block chain consensus processing method and device, electronic equipment and storage medium
CN112511312B (en) * 2020-11-23 2023-10-17 北京微芯区块链与边缘计算研究院 Assembled consensus method and system
CN112492016B (en) * 2020-11-23 2023-05-30 北京微芯区块链与边缘计算研究院 Cross-process extensible consensus method and system
CN112486518B (en) * 2020-12-01 2024-03-12 北京微芯区块链与边缘计算研究院 Consensus algorithm assembling method and device
CN114048264A (en) * 2021-09-28 2022-02-15 中诚区块链研究院(南京)有限公司 Consensus intelligent contract algorithm
CN117221337A (en) * 2022-06-02 2023-12-12 腾讯科技(深圳)有限公司 Block chain consensus method, device, medium and electronic equipment

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109698753B (en) * 2018-12-17 2022-05-03 成都四方伟业软件股份有限公司 Block chain-based uplink consensus algorithm matching method and device
CN109639406B (en) * 2018-12-24 2022-03-04 国泰君安证券股份有限公司 Efficient trust solution method based on block chain and IPFS
CN110365695A (en) * 2019-07-24 2019-10-22 中国工商银行股份有限公司 The block chain data interactive method and device of changeable common recognition algorithm

Also Published As

Publication number Publication date
CN111461887A (en) 2020-07-28

Similar Documents

Publication Publication Date Title
CN111461887B (en) Block chain consensus processing method and device and electronic equipment
CN108600326B (en) Communication method, device and equipment
CN108765159B (en) Block chain-based uplink and state processing method and device and interconnection system
CN110020859B (en) Parallel execution block chain consensus method and device and electronic equipment
CN109298926B (en) Method and device for entering resource transfer party into resource transfer platform and electronic equipment
CN113205416A (en) Service processing method and system based on block chain prediction machine
CN113421086A (en) Data evidence storing and obtaining method and device based on block chain
CN111369358A (en) Block chain consensus method and device and electronic equipment
CN110708163A (en) Block chain consensus method, device and system and electronic equipment
CN111225018A (en) Request message processing method and device and electronic equipment
CN110851207B (en) State transition management method and device, electronic equipment and storage medium
CN111651467A (en) Block chain link point interface issuing and calling method and device
CN110648125B (en) Packaging transaction method and device, electronic equipment and storage medium
CN112751935B (en) Request processing method and device, electronic equipment and storage medium
CN109345081B (en) Data acquisition method and device and electronic equipment
CN108596581B (en) Verification method and device for resource transfer and electronic payment verification method and device
CN111461886B (en) Management method and device for system configuration independent of intelligent contracts on block chains
CN107368293B (en) Page structure generation method, page screenshot reporting method, device and system
CN114138888B (en) Processing method, system, medium and equipment for distributed data routing
CN110750271B (en) Service aggregation, method and device for executing aggregated service and electronic equipment
CN110599139B (en) Block output method and device in block chain consensus algorithm
CN114327941A (en) Service providing method and device
CN113706146A (en) Processing method, device and system for executing batch transaction based on block chain
CN112907198A (en) Service state circulation maintenance method and device and electronic equipment
CN111884808A (en) Method and device for preventing cross-chain replay of transaction and electronic 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
GR01 Patent grant
GR01 Patent grant