WO2023134159A1 - Consensus method and apparatus based on blockchain network, electronic device and storage medium - Google Patents

Consensus method and apparatus based on blockchain network, electronic device and storage medium Download PDF

Info

Publication number
WO2023134159A1
WO2023134159A1 PCT/CN2022/111013 CN2022111013W WO2023134159A1 WO 2023134159 A1 WO2023134159 A1 WO 2023134159A1 CN 2022111013 W CN2022111013 W CN 2022111013W WO 2023134159 A1 WO2023134159 A1 WO 2023134159A1
Authority
WO
WIPO (PCT)
Prior art keywords
instruction
system configuration
node
consensus
nodes
Prior art date
Application number
PCT/CN2022/111013
Other languages
French (fr)
Chinese (zh)
Inventor
段斯斯
张海滨
Original Assignee
清华大学
山东区块链研究院
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 清华大学, 山东区块链研究院 filed Critical 清华大学
Publication of WO2023134159A1 publication Critical patent/WO2023134159A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L12/00Data switching networks
    • H04L12/02Details
    • H04L12/16Arrangements for providing special services to substations
    • H04L12/18Arrangements for providing special services to substations for broadcast or conference, e.g. multicast
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present application provides a consensus method based on a blockchain network. Any consensus node in the blockchain network locally maintains system configuration information, the system configuration information comprising a member node set. The method comprises: an instruction initiating node broadcasting an instruction to the blockchain network, such that the blockchain network generates a consensus proposal comprising the instruction and performs consensus processing on the consensus proposal, wherein the instruction comprises a member configuration instruction; and after any member node in the blockchain network determines that a consensus is reached for the consensus proposal, if the consensus proposal comprises the member configuration instruction, updating the locally-maintained system configuration information according to the member configuration instruction. By means of adoption of the described method, the member node in the blockchain network takes the member configuration instruction and a conventional instruction as a consensus proposal for consensus, namely, the member configuration process can be executed without stopping the consensus process, so that the consensus efficiency of the blockchain network is greatly improved.

Description

一种基于区块链网络的共识方法、装置、电子设备及存储介质A consensus method, device, electronic equipment and storage medium based on blockchain network
相关申请的交叉引用Cross References to Related Applications
本申请基于申请号为202210046656.1、申请日为2022年01月17日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的全部内容在此引入本申请作为参考。This application is based on a Chinese patent application with application number 202210046656.1 and a filing date of January 17, 2022, and claims the priority of this Chinese patent application. The entire content of this Chinese patent application is hereby incorporated by reference into this application.
技术领域technical field
本申请涉及计算机技术领域,具体地,涉及一种基于区块链网络的共识方法、装置、电子设备及存储介质。The present application relates to the field of computer technology, in particular, to a blockchain network-based consensus method, device, electronic equipment, and storage medium.
背景技术Background technique
在区块链网络中各个共识节点为了保证数据的一致性,通常需要通过各种共识方法进行共识,当区块链网络中的共识节点想要退出区块链网络,或者区块链网络外的节点想要加入区块链网络,通常区块链网络的共识过程会被停止,开始执行节点加入或退出过程,等到相应的节点加入或退出后才继续进行共识过程,这大大降低了区块链网络的共识效率。In order to ensure data consistency, each consensus node in the blockchain network usually needs to achieve consensus through various consensus methods. When the consensus node in the blockchain network wants to withdraw from the blockchain network, or When a node wants to join the blockchain network, usually the consensus process of the blockchain network will be stopped, and the node joining or exiting process will be started, and the consensus process will not continue until the corresponding node joins or exits, which greatly reduces the blockchain The consensus efficiency of the network.
发明内容Contents of the invention
本申请实施例中提供了一种基于区块链网络的共识方法、装置、电子设备及存储介质,用于解决现有技术中共识效率低的问题。The embodiment of the present application provides a blockchain network-based consensus method, device, electronic equipment, and storage medium to solve the problem of low consensus efficiency in the prior art.
为了达到上述目的,本申请提供如下技术方案:In order to achieve the above object, the application provides the following technical solutions:
根据本申请实施例的第一个方面,提供了一种基于区块链网络的共识方法,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述方法包括:According to the first aspect of the embodiment of the present application, a consensus method based on a blockchain network is provided. Any consensus node in the blockchain network maintains system configuration information locally, and the system configuration information includes member A set of nodes and a system configuration number for identifying the system configuration; the method comprising:
指令发起节点向区块链网络中的至少部分成员节点广播携带系统配置编号的指令;其中,所述指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或移除所述区块链网络;The instruction initiating node broadcasts an instruction carrying a system configuration number to at least some member nodes in the blockchain network; wherein, the instruction includes a member configuration instruction or a general instruction, and the member configuration instruction is used to instruct the instruction initiating node to join or remove remove said blockchain network;
区块链网络中的任一从节点根据所述指令中携带的系统配置编号以及本地维护的系统配置编号对该指令进行转发处理;Any slave node in the blockchain network forwards the instruction according to the system configuration number carried in the instruction and the locally maintained system configuration number;
区块链网络中的主节点在接收到所述指令,且生成包括所述指令的共识提议后,协调其他节点根据本地的系统配置编号对所述共识提议进行共识处理;所述共识提议中包括成员配置指令和/或常规指令;After receiving the instruction and generating a consensus proposal including the instruction, the master node in the blockchain network coordinates other nodes to perform consensus processing on the consensus proposal according to the local system configuration number; the consensus proposal includes membership configuration directives and/or general directives;
区块链网络中任一成员节点在确定针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。After any member node in the blockchain network determines that a consensus has been reached on the consensus proposal, if the consensus proposal includes a member configuration instruction, then update the locally maintained system configuration information according to the member configuration instruction.
上述方案中,所述指令中携带的系统配置编号,用于标识所述指令所针对的系统配置;In the above solution, the system configuration number carried in the instruction is used to identify the system configuration targeted by the instruction;
所述区块链网络中的任一从节点根据所述指令中携带的系统配置编号以及本地维护的系统配置编号对该指令进行转发处理,包括:Any slave node in the blockchain network forwards the instruction according to the system configuration number carried in the instruction and the locally maintained system configuration number, including:
在本地未执行该指令的情况下,若确定该系统配置编号与本地存储的系统配置编号相同,则将所述成员配置指令转发至主节点;若确定该系统配置编号小于本地存储的系统配置编号,则将所述指令转发至本地维护的成员节点集合中的成员节点;If the instruction is not executed locally, if it is determined that the system configuration number is the same as the locally stored system configuration number, then forward the member configuration instruction to the master node; if it is determined that the system configuration number is smaller than the locally stored system configuration number , forward the instruction to the member nodes in the locally maintained member node set;
在本地执行了该指令的情况下,将执行结果以及系统配置历史信息返回给该指令发起节点。When the instruction is executed locally, the execution result and system configuration history information are returned to the instruction originating node.
上述方案中,所述方法还包括:In the above scheme, the method also includes:
主节点在接收到指令后,将指令在本地指令池中进行存储;After the master node receives the instruction, it stores the instruction in the local instruction pool;
所述生成包括所述指令的共识提议,包括:Said generating a consensus proposal comprising said instructions, comprising:
从本地指令池中获取预设数量的指令;Obtain a preset number of instructions from the local instruction pool;
针对所述预设数量的指令中的任一成员配置指令,若所述成员配置指令用于指示将发起所述指令的指令发起节点加入区块链网络,则为该指令发起节点分配成员节点序号,将所述成员节点序号以及所述成员配置指令组合为成员加入指令;若所述成员配置指令用于指示将发起所述指令的指令发起节点从区块链网络退出,则将该指令发起节点的成员节点序号以及所述成员配置指令组合为成员退出指令;For any member configuration instruction in the preset number of instructions, if the member configuration instruction is used to indicate that the instruction originating node that will initiate the instruction joins the blockchain network, assign a member node serial number to the instruction originating node , combining the member node serial number and the member configuration instruction into a member joining instruction; if the member configuration instruction is used to indicate that the instruction originating node that will initiate the instruction withdraws from the blockchain network, then the instruction originating node The combination of the member node serial number and the member configuration instruction is a member exit instruction;
针对所述预设数量的指令,将成员加入指令、成员退出指令和常规指令打包为共识提议。For the preset number of instructions, the member join instruction, member exit instruction and regular instructions are packaged into a consensus proposal.
上述方案中,所述方法还包括:In the above scheme, the method also includes:
在为该指令发起节点分配成员序号后,将该指令发起节点加入到临时成员集合中;所述临时成员集合中包括本地系统配置中的全部成员节点;After assigning a member sequence number to the instruction initiating node, adding the instruction initiating node to a temporary member set; the temporary member set includes all member nodes in the local system configuration;
所述协调其他节点对所述共识提议进行共识处理,包括:The coordinating other nodes to perform consensus processing on the consensus proposal, including:
基于所述共识提议向临时成员集合中的节点广播预准备消息;broadcasting a pre-preparation message to nodes in the temporary membership set based on the consensus proposal;
任一从节点,在接收到有效的预准备消息后,针对所述共识提议中的成员加入指令,将该成员加入指令中的成员节点序号加入到本地的临时成员集合中,并向本地临时成员集合中的节点广播针对所述共识提议的准备消息;所述准备消息中携带所述从节点的签名;Any slave node, after receiving a valid pre-preparation message, for the member joining instruction in the consensus proposal, adds the member node serial number in the member joining instruction to the local temporary member set, and sends the local temporary member The nodes in the set broadcast a preparation message for the consensus proposal; the preparation message carries the signature of the slave node;
任一成员节点,在接收到本地系统配置的成员节点集合中2/3成员节点广播的针对所述共识提议的准备消息后,将接收到的准备消息的签名作为该共识提议的证明进行存储,并广播针对所述共识提议的承诺消息,或,在接收到本地系统配置的成员节点集合中1/3成员节点广播的针对所述共识提议的承诺消息后,将接收到的承诺消息的签名作为该共识提议的证明进行存储,并广播针对所述共识提议的承诺消息;其中,所述承诺消息中携带所述节点的签名;Any member node, after receiving the preparation message for the consensus proposal broadcast by 2/3 member nodes in the member node set configured by the local system, stores the signature of the received preparation message as the proof of the consensus proposal, And broadcast the commitment message for the consensus proposal, or, after receiving the commitment message for the consensus proposal broadcast by 1/3 member nodes in the set of member nodes configured by the local system, use the signature of the received commitment message as Store the proof of the consensus proposal, and broadcast a commitment message for the consensus proposal; wherein, the commitment message carries the signature of the node;
在收到本地系统配置的成员节点集合中2/3成员节点广播的针对所述共识提议的承诺消息后,确定针对所述共识提议达成共识,执行所述共识提议。After receiving the commitment message for the consensus proposal broadcast by 2/3 member nodes in the set of member nodes configured by the local system, it is determined that a consensus is reached for the consensus proposal, and the consensus proposal is executed.
上述方案中,所述方法还包括:In the above scheme, the method also includes:
任一从节点,将成员加入指令中的成员节点序号加入到临时成员组后,在成员加入指令中携带的系统配置编号小于本地系统配置号的情况下,向该成员节点序号对应的指令发起节点发送本地系统配置信息以及系统配置历史信息;Any slave node, after adding the member node serial number in the member joining command to the temporary member group, in the case that the system configuration number carried in the member joining command is smaller than the local system configuration number, send the node to the command corresponding to the member node serial number Send local system configuration information and system configuration history information;
所述指令发起节点在接收到该系统配置信息以及系统配置历史信息后,根据该系统配置历史信息对接收到的系统配置信息进行验证,并在验证通过后,根据接收到的系统配置历史信息对本地系统配置信息进行更新;所述系统配置历史信息为目标共识提议组成的集合,其中,目标共识提议为包括成员加入指令或成员退出指令的共识提议。After the instruction initiating node receives the system configuration information and the system configuration history information, it verifies the received system configuration information according to the system configuration history information, and after the verification is passed, it verifies the system configuration information according to the received system configuration history information. The local system configuration information is updated; the system configuration history information is a set of target consensus proposals, wherein the target consensus proposals are consensus proposals including member joining instructions or member exit instructions.
上述方案中,所述系统配置历史信息中包括每个目标共识提议的证明;In the above scheme, the system configuration history information includes the proof of each target consensus proposal;
所述根据该系统配置历史信息对接收到的系统配置信息进行验证包括:The verification of the received system configuration information according to the system configuration history information includes:
基于所述系统配置历史信息中的证明对目标提议进行验证,在对全部目标提议验证通过的情况下,确定所述系统配置历史信息以及所述系统配置信息通过验证。The target proposal is verified based on the proof in the system configuration history information, and when all target proposals pass the verification, it is determined that the system configuration history information and the system configuration information pass the verification.
上述方案中,所述根据所述成员配置指令更新本地维护的系统配置信息包括:In the above solution, updating the locally maintained system configuration information according to the member configuration instruction includes:
区块链网络中任一节点在针对所述共识提议达成共识后,针对所述共识提议中的任一成员加入指令,将所述成员加入指令中的成员节点序号加入到本地维护的系统配置信息中的成员节点集合中;After reaching a consensus on the consensus proposal, any node in the blockchain network will add the member node serial number in the member joining instruction to the locally maintained system configuration information for any member joining instruction in the consensus proposal In the set of member nodes in ;
针对所述共识提议中的任一成员退出指令,将所述成员退出指令中的成员节点序号,从到本地维护的系统配置信息中的成员节点集合中移除;For any member exit instruction in the consensus proposal, remove the member node serial number in the member exit instruction from the member node set in the locally maintained system configuration information;
将系统配置编号进行更新。Update the system configuration number.
上述方案中,所述方法还包括:In the above scheme, the method also includes:
区块链网络中任一节点将所述共识提议添加到系统配置历史信息中;Any node in the blockchain network adds the consensus proposal to the system configuration history information;
向所述共识提议中包括的成员配置指令对应的发起节点返回成员配置处理结果;其中,所述成员配置指令用于指示将所述指令的指令发起节点加入到区块链网络中;Return the member configuration processing result to the initiating node corresponding to the member configuration instruction included in the consensus proposal; wherein, the member configuration instruction is used to indicate that the instruction initiating node of the instruction is added to the blockchain network;
任一成员配置指令的指令发起节点在接收到2/3成员节点发送的配置处理结果后,可以确定该指令执行完毕,确定本地加入所述区块链网络。After receiving the configuration processing results sent by 2/3 member nodes, the instruction originating node of any member configuration instruction can determine that the instruction has been executed, and determine to join the blockchain network locally.
上述方案中,所述方法还包括:In the above scheme, the method also includes:
任一成员配置指令的指令发起节点,在共识过程中将共识提议的证明进行存储后,若所述成员配置指令包含在所述共识提议中,其中,所述成员配置指令用于指示将所述指令发起节点从所述区块链网络退出,则确定本地从所述区块链网络退出。The instruction initiating node of any member configuration instruction, after storing the proof of the consensus proposal during the consensus process, if the member configuration instruction is included in the consensus proposal, wherein the member configuration instruction is used to indicate that the If the initiating node is instructed to withdraw from the blockchain network, it is determined to withdraw locally from the blockchain network.
上述方案中,所述方法还包括:In the above scheme, the method also includes:
任一成员配置指令的指令发起节点,在确定共识提议被执行,且所述成员配置指令包含在所述共识提议中,其中,所述成员配置指令用于指示将所述指令发起节点从所述区块链网络退出,则确定本地从所述区块链网络退出。The instruction initiating node of any member configuration instruction determines that the consensus proposal is executed, and the member configuration instruction is included in the consensus proposal, wherein the member configuration instruction is used to instruct the instruction initiating node from the If the block chain network exits, it is determined that the local exits from the block chain network.
上述方案中,所述方法还包括:In the above scheme, the method also includes:
区块链网络中任一节点针对所述共识提议中的任一常规指令,在本地执行完成后,若确定该指令中的系统配置编号与本地的系统配置编号相同,则向该指令的指令发起节点返回处理结果;Any node in the blockchain network for any conventional command in the consensus proposal, after the local execution is completed, if it is determined that the system configuration number in the command is the same as the local system configuration number, it will initiate a The node returns the processing result;
若确定该指令中的系统配置编号小于本地的系统配置编号,则向该指令的指令发起节点返回处理结 果以及系统配置历史信息。If it is determined that the system configuration number in the command is smaller than the local system configuration number, the processing result and system configuration history information will be returned to the command originating node of the command.
上述方案中,所述方法还包括:In the above scheme, the method also includes:
任一从节点,在检测到满足视图切换条件的情况下,获取系统配置信息;Any slave node obtains system configuration information when it detects that the view switching condition is met;
若获取的系统配置编号与本地维护的系统配置编号相同,则向本地维护的成员节点集合中的成员节点广播视图切换指令;If the obtained system configuration number is the same as the locally maintained system configuration number, broadcast the view switching command to the member nodes in the locally maintained member node set;
若获取的系统配置编号大于本地维护的系统配置编号,则向获取的系统配置编号对应的成员节点集合中的成员节点广播历史数据获取消息;其中,所述历史数据获取消息中携带本地维护的系统配置编号;If the obtained system configuration number is greater than the locally maintained system configuration number, broadcast a historical data acquisition message to the member nodes in the member node set corresponding to the acquired system configuration number; wherein, the historical data acquisition message carries the locally maintained system configuration number;
所述成员节点集合中的任一成员节点,在接收到历史数据获取消息后,若确定其中携带的系统配置编号小于本地系统配置编号,且发送该历史数据获取消息的节点为本地维护的成员节点集合中的节点,则向该节点返回针对该历史数据获取消息的响应消息;其中,响应消息中携带该成员节点执行的所有共识提议;Any member node in the member node set, after receiving the historical data acquisition message, if it is determined that the system configuration number carried in it is smaller than the local system configuration number, and the node sending the historical data acquisition message is a locally maintained member node A node in the set returns a response message to the node for the historical data acquisition message; wherein, the response message carries all the consensus proposals executed by the member node;
该从节点在接收到该成员节点集合中1/3个成员节点返回的响应消息,且响应消息中携带的信息相同时,则根据响应消息对本地数据进行更新。When the slave node receives the response message returned by 1/3 of the member nodes in the member node set, and the information carried in the response message is the same, it updates the local data according to the response message.
上述方案中,所述方法还包括:In the above scheme, the method also includes:
任一从节点,在检测到满足视图切换条件的情况下,向本地维护的成员节点集合中的成员节点广播视图切换指令;所述视图切换消息中携带目标系统配置编号;Any slave node, when it detects that the view switching condition is met, broadcasts a view switching instruction to the member nodes in the locally maintained member node set; the view switching message carries the target system configuration number;
任一从节点在接收到其他节点广播的视图切换消息后,根据所述目标系统配置编号对该视图切换消息进行转发;Any slave node forwards the view switching message according to the target system configuration number after receiving the view switching message broadcast by other nodes;
主节点在接收到本地维护的系统配置的成员节点集合中2/3的节点发送的视图切换消息的情况下,向本地维护的系统配置的全部成员节点广播新视图消息,以使所述系统配置的成员节点集合中的节点进入新视图。When the master node receives the view switching message sent by 2/3 nodes in the locally maintained system configuration member node set, it broadcasts a new view message to all member nodes of the locally maintained system configuration, so that the system configuration The nodes in the member node collection of the enter into the new view.
上述方案中,所述根据所述目标系统配置编号对该视图切换消息进行转发,包括:In the above solution, the forwarding of the view switching message according to the target system configuration number includes:
任一从节点在接收到其他节点广播的视图切换消息后,若确定该视图切换消息中的目标系统配置编号小于本地系统配置编号,且本地系统配置编号对应的成员节点多于该目标系统配置编号对应的成员节点,则向第一节点转发所述视图切换消息;其中所述第一节点包括在本地系统配置的成员节点集合中,但不在目标系统配置的成员节点集合中的节点;After any slave node receives the view switching message broadcast by other nodes, if it determines that the target system configuration number in the view switching message is smaller than the local system configuration number, and the member nodes corresponding to the local system configuration number are more than the target system configuration number The corresponding member node forwards the view switching message to the first node; wherein the first node includes nodes in the member node set configured by the local system but not in the member node set configured by the target system;
若确定该视图切换消息中的目标系统配置编号大于本地系统配置编号,则将本地系统配置更新至所述目标系统配置编号对应的系统配置,在本地本轮已发送过视图切换消息的情况下,将该视图切换消息转发至第二节点,所述第二节点为包括在目标系统配置的成员节点集合中,但不在本地系统配置的成员节点集合中的节点;在本地本轮未发送过视图切换消息的情况下,将所述视图切换消息转发至目标系统配置编号对应的全部节点。If it is determined that the target system configuration number in the view switching message is greater than the local system configuration number, then the local system configuration is updated to the system configuration corresponding to the target system configuration number. Forward the view switch message to a second node, which is a node included in the member node set configured by the target system but not in the member node set configured by the local system; no view switch has been sent locally in this round In the case of a message, the view switching message is forwarded to all nodes corresponding to the target system configuration number.
上述方案中,所述视图切换条件包括:In the above solution, the view switching conditions include:
在针对共识提议达成共识后,且所述共识提议中包括成员配置指令。After a consensus is reached on the consensus proposal, and the consensus proposal includes a member configuration instruction.
根据本申请实施例的第二个方面,提供了一种基于区块链网络的共识方法,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括所述区块链网络的成员节点集合以及用于标识系统配置的系统配置编号;所述方法包括:According to the second aspect of the embodiment of the present application, a consensus method based on a blockchain network is provided, any consensus node in the blockchain network maintains system configuration information locally, and the system configuration information includes the The set of member nodes of the block chain network and the system configuration number used to identify the system configuration; the method includes:
向区块链网络中的至少部分成员节点广播携带系统配置编号的指令,以使区块链网络生成包括所述指令的共识提议并根据系统配置编号对所述共识提议进行共识处理;其中,所述指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或移除所述区块链网络。Broadcast an instruction carrying a system configuration number to at least some member nodes in the blockchain network, so that the blockchain network generates a consensus proposal including the instruction and performs consensus processing on the consensus proposal according to the system configuration number; wherein, the The instructions include member configuration instructions or general instructions, and the member configuration instructions are used to instruct the instruction originating node to join or remove from the blockchain network.
根据本申请实施例的第三个方面,提供了一种基于区块链网络的共识方法,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述方法包括:According to the third aspect of the embodiment of the present application, a consensus method based on a blockchain network is provided, any consensus node in the blockchain network maintains system configuration information locally, and the system configuration information includes member A set of nodes and a system configuration number for identifying the system configuration; the method comprising:
在接收到指令发起节点发送的指令后,根据所述指令中携带的系统配置编号以及本地维护的系统配置编号对该指令进行转发处理;其中所述指令包括成员配置指令或常规指令;After receiving the instruction sent by the instruction originating node, the instruction is forwarded according to the system configuration number carried in the instruction and the locally maintained system configuration number; wherein the instruction includes a member configuration instruction or a regular instruction;
针对包括所述指令的共识提议进行共识处理;所述共识提议中包括成员配置指令和/或常规指令;Consensus processing is performed on the consensus proposal including the instructions; the consensus proposal includes member configuration instructions and/or general instructions;
在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。After a consensus is reached on the consensus proposal, if the consensus proposal includes a member configuration instruction, locally maintained system configuration information is updated according to the member configuration instruction.
根据本申请实施例的第四个方面,提供了一种基于区块链网络的共识方法,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述方法包括:According to the fourth aspect of the embodiment of the present application, a consensus method based on a block chain network is provided, any consensus node in the block chain network maintains system configuration information locally, and the system configuration information includes member A set of nodes and a system configuration number for identifying the system configuration; the method comprising:
在接收到指令发起节点发送的指令,且生成包括所述指令的共识提议后,协调其他节点根据本地的系统配置编号对所述共识提议进行共识处理;其中所述指令包括成员配置指令或常规指令;所述共识提 议中包括成员配置指令和/或常规指令;After receiving the instruction sent by the instruction initiating node and generating a consensus proposal including the instruction, coordinate other nodes to perform consensus processing on the consensus proposal according to the local system configuration number; wherein the instruction includes member configuration instructions or regular instructions ; The consensus proposal includes member configuration instructions and/or general instructions;
在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。After a consensus is reached on the consensus proposal, if the consensus proposal includes a member configuration instruction, locally maintained system configuration information is updated according to the member configuration instruction.
根据本申请实施例的第五个方面,提供了一种基于区块链网络的共识系统,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述系统包括:According to the fifth aspect of the embodiment of the present application, a blockchain network-based consensus system is provided, any consensus node in the blockchain network maintains system configuration information locally, and the system configuration information includes member A collection of nodes and a system configuration number identifying a system configuration; the system includes:
指令发起节点,用于向区块链网络中的至少部分成员节点广播携带系统配置编号的指令;其中,所述指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或移除所述区块链网络;The instruction originating node is used to broadcast the instruction carrying the system configuration number to at least some member nodes in the blockchain network; wherein, the instruction includes a member configuration instruction or a general instruction, and the member configuration instruction is used to instruct the instruction originating node to join or leave said blockchain network;
区块链网络中的任一从节点,用于根据所述指令中携带的系统配置编号以及本地维护的系统配置编号对该指令进行转发处理;Any slave node in the blockchain network is used to forward the instruction according to the system configuration number carried in the instruction and the system configuration number maintained locally;
区块链网络中的主节点,用于在接收到所述指令,且生成包括所述指令的共识提议后,协调其他节点根据本地的系统配置编号对所述共识提议进行共识处理;所述共识提议中包括成员配置指令和/或常规指令;The master node in the blockchain network is used to coordinate other nodes to perform consensus processing on the consensus proposal according to the local system configuration number after receiving the instruction and generating a consensus proposal including the instruction; the consensus Proposals include membership directives and/or general directives;
区块链网络中任一节点,用于在确定针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。Any node in the blockchain network is configured to update locally maintained system configuration information according to the member configuration instruction after determining that a consensus has been reached on the consensus proposal, if the consensus proposal includes a member configuration instruction.
根据本申请实施例的第六个方面,提供了一种基于区块链网络的共识装置,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述装置包括:According to the sixth aspect of the embodiment of the present application, a consensus device based on a block chain network is provided, any consensus node in the block chain network maintains system configuration information locally, and the system configuration information includes member A set of nodes and a system configuration number for identifying the system configuration; the means include:
获取模块,用于获取系统配置信息;The obtaining module is used to obtain system configuration information;
广播模块,根据获取的系统配置信息对本地系统配置信息进行更新,并根据更新后的系统配置信息向区块链网络中的至少部分成员节点广播携带系统配置编号的指令,以使区块链网络生成包括所述指令的共识提议并根据系统配置编号对所述共识提议进行共识处理;其中,指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或退出所述区块链网络。The broadcast module updates the local system configuration information according to the acquired system configuration information, and broadcasts instructions carrying system configuration numbers to at least some member nodes in the blockchain network according to the updated system configuration information, so that the blockchain network Generate a consensus proposal including the instruction and perform consensus processing on the consensus proposal according to the system configuration number; wherein, the instruction includes a member configuration instruction or a general instruction, and the member configuration instruction is used to indicate that the instruction originating node joins or withdraws from the blockchain network.
根据本申请实施例的第七个方面,提供了一种基于区块链网络的共识装置,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述装置包括:According to the seventh aspect of the embodiments of the present application, a consensus device based on a blockchain network is provided, any consensus node in the blockchain network maintains system configuration information locally, and the system configuration information includes member A set of nodes and a system configuration number for identifying the system configuration; the means include:
转发模块,用于在接收到指令发起节点的发送的指令后,根据所述指令中携带的系统配置编号以及本地维护的系统配置编号对该指令进行转发处理;其中所述指令包括成员配置指令或常规指令;The forwarding module is configured to forward the instruction according to the system configuration number carried in the instruction and the locally maintained system configuration number after receiving the instruction sent by the instruction initiating node; wherein the instruction includes a member configuration instruction or general order;
共识模块,用于针对包括所述指令的共识提议进行共识处理;所述共识提议中包括成员配置指令和/或常规指令;A consensus module, configured to perform consensus processing on the consensus proposal including the instructions; the consensus proposal includes member configuration instructions and/or regular instructions;
更新模块,用于在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。An update module, configured to update the locally maintained system configuration information according to the member configuration instruction after reaching a consensus on the consensus proposal, if the consensus proposal includes a member configuration instruction.
根据本申请实施例的第八个方面,提供了一种基于区块链网络的共识装置,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述装置包括:According to an eighth aspect of the embodiments of the present application, a consensus device based on a blockchain network is provided, any consensus node in the blockchain network maintains system configuration information locally, and the system configuration information includes member A set of nodes and a system configuration number for identifying the system configuration; the means include:
共识模块,用于在接收到指令发起节点的发送的指令,且生成包括所述指令的共识提议后,协调其他节点根据本地的系统配置编号对所述共识提议进行共识处理;其中所述指令包括成员配置指令或常规指令;所述共识提议中包括成员配置指令和/或常规指令;The consensus module is used to coordinate other nodes to perform consensus processing on the consensus proposal according to the local system configuration number after receiving the instruction sent by the instruction initiating node and generating a consensus proposal including the instruction; wherein the instruction includes Member configuration instructions or regular instructions; the consensus proposal includes member configuration instructions and/or regular instructions;
更新模块,用于在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。An update module, configured to update the locally maintained system configuration information according to the member configuration instruction after reaching a consensus on the consensus proposal, if the consensus proposal includes a member configuration instruction.
根据本申请实施例的第九个方面,提供了一种计算机设备,包括存储器、处理器、通信接口及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现如上述第二个至第四个方面中的任一方面所述的方法。According to a ninth aspect of the embodiments of the present application, there is provided a computer device, including a memory, a processor, a communication interface, and a computer program stored in the memory and operable on the processor, wherein the processor executes the When the program is described above, the method described in any one of the second to fourth aspects above is realized.
根据本申请实施例的第十个方面,提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如上述第二个至第四个方面中的任一方面所述的方法。According to a tenth aspect of the embodiments of the present application, there is provided a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, any one of the above-mentioned second to fourth aspects can be realized. method described in the aspect.
采用本申请实施例中提供的共识方法,需要加入或退出区块链网络的节点,在获取了当前区块链网络的系统配置信息后,即可以向区块链网络广播成员配置指令,该指令用于指示将该节点加入或移除区块链网络,区块链网络中的成员节点将该成员配置指令与常规指令一同作为共识提议进行共识,各个共识节点在基于共识提议达成共识后,即可以执行该成员配置指令,不需要将成员配置指令与常规指令分别处理,即不需要将共识过程停止就可以执行成员配置过程,因此大大提升了区块链网络的共识效率。Using the consensus method provided in the embodiment of this application, nodes that need to join or exit the blockchain network can broadcast member configuration instructions to the blockchain network after obtaining the system configuration information of the current blockchain network. It is used to indicate that the node is added or removed from the blockchain network. The member nodes in the blockchain network use the member configuration instructions together with regular instructions as a consensus proposal for consensus. After each consensus node reaches a consensus based on the consensus proposal, that is, The member configuration command can be executed without processing the member configuration command separately from the regular command, that is, the member configuration process can be executed without stopping the consensus process, thus greatly improving the consensus efficiency of the blockchain network.
附图说明Description of drawings
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described here are used to provide a further understanding of the application and constitute a part of the application. The schematic embodiments and descriptions of the application are used to explain the application and do not constitute an improper limitation to the application. In the attached picture:
图1为本说明书实施例的一种网络架构拓扑结构示意图;FIG. 1 is a schematic diagram of a network architecture topology according to an embodiment of the specification;
图2为本说明书实施例的一种基于区块链网络的共识方法的流程示意图;FIG. 2 is a schematic flow diagram of a consensus method based on a blockchain network according to an embodiment of this specification;
图3为本说明书实施例的一种将节点加入区块链网络的示意图;FIG. 3 is a schematic diagram of adding a node to a blockchain network according to an embodiment of this specification;
图4为本说明书实施例的一种基于区块链网络的共识方法的示意图;FIG. 4 is a schematic diagram of a consensus method based on a blockchain network according to an embodiment of this specification;
图5为本说明书实施例的一种系统配置历史信息的结构示意图;FIG. 5 is a schematic structural diagram of system configuration history information according to an embodiment of this specification;
图6为本说明书实施例的一种视图切换消息转发的示意图;FIG. 6 is a schematic diagram of view switching message forwarding according to an embodiment of this specification;
图7为本说明书实施例的另一种视图切换消息转发的示意图;FIG. 7 is a schematic diagram of another view switching message forwarding according to the embodiment of this specification;
图8为本说明书实施例的一种基于区块链网络的共识装置的结构示意图;FIG. 8 is a schematic structural diagram of a consensus device based on a blockchain network according to an embodiment of this specification;
图9为本说明书实施例的另一种基于区块链网络的共识装置的结构示意图;FIG. 9 is a schematic structural diagram of another consensus device based on a blockchain network according to an embodiment of this specification;
图10为本说明书实施例的又一种基于区块链网络的共识装置的结构示意图;FIG. 10 is a schematic structural diagram of another consensus device based on a blockchain network according to an embodiment of this specification;
图11是用于配置本说明书实施例装置的一种设备的结构示意图。Fig. 11 is a schematic structural diagram of a device for configuring the device of the embodiment of this specification.
具体实施方式Detailed ways
区块链网络作为分布式数据存储网络,区块链网络中的各个节点需要保证数据的一致性,各个节点需要通过各种共识方法进行共识,其中共识是指各个节点达成数据一致的过程。The blockchain network is a distributed data storage network. Each node in the blockchain network needs to ensure data consistency. Each node needs to achieve consensus through various consensus methods. Consensus refers to the process by which each node reaches data consistency.
当区块链网络中的共识节点想要退出区块链网络,或者区块链网络外的节点想要加入区块链网络时,通常情况下区块链网络的共识过程会被停止,开始执行节点加入或退出的过程,等到相应的节点加入或退出后才继续进行共识过程,这大大降低了区块链网络的共识效率。其中,共识过程通常是指对常规指令的共识。When a consensus node in the blockchain network wants to exit the blockchain network, or a node outside the blockchain network wants to join the blockchain network, usually the consensus process of the blockchain network will be stopped and execution will start In the process of node joining or exiting, the consensus process will not continue until the corresponding node joins or exits, which greatly reduces the consensus efficiency of the blockchain network. Among them, the consensus process usually refers to the consensus on regular instructions.
针对上述问题,本申请实施例中提供了一种基于区块链网络的共识方法,当节点需要加入或退出区块链网络时,可以向区块链网络广播成员配置指令,该指令用于指示将该节点加入或退出区块链网络,区块链网络中的共识节点将该成员配置指令与常规指令一同作为共识提议进行共识,各个共识节点在基于共识提议达成共识后,即可以执行该成员配置指令,不需要将成员配置指令与常规指令分别处理,即不需要将对于常规指令的共识过程停止就可以处理成员配置过程,因此大大提升了区块链网络的共识效率。In view of the above problems, the embodiment of this application provides a consensus method based on the blockchain network. When a node needs to join or withdraw from the blockchain network, it can broadcast member configuration instructions to the blockchain network. The instructions are used to indicate The node joins or exits the blockchain network, and the consensus node in the blockchain network uses the member configuration instructions together with regular instructions as a consensus proposal for consensus. After each consensus node reaches a consensus based on the consensus proposal, it can execute the member configuration instruction. Configuration instructions do not need to process member configuration instructions and regular instructions separately, that is, the member configuration process can be processed without stopping the consensus process for regular instructions, thus greatly improving the consensus efficiency of the blockchain network.
本申请实施例中的方案可以采用各种计算机语言实现,例如,面向对象的程序设计语言Java和直译式脚本语言JavaScript等。The solutions in the embodiments of the present application can be realized by using various computer languages, for example, the object-oriented programming language Java and the literal translation scripting language JavaScript.
为了使本申请实施例中的技术方案及优点更加清楚明白,以下结合附图对本申请的示例性实施例进行进一步详细的说明,显然,所描述的实施例仅是本申请的一部分实施例,而不是所有实施例的穷举。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。In order to make the technical solutions and advantages in the embodiments of the present application clearer, the exemplary embodiments of the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, and Not an exhaustive list of all embodiments. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.
为了使本领域人员更为清楚的了解本方案,下面对本说明书中出现的一些名称内容进行解释说明:In order for those skilled in the art to understand this solution more clearly, some names appearing in this manual are explained below:
在本说明书中,区块链网络中的节点包括1个主节点和N个从节点,主节点用于在共识过程中生成共识提议以及发起共识,从节点参与共识过程。In this specification, the nodes in the blockchain network include 1 master node and N slave nodes. The master node is used to generate consensus proposals and initiate consensus during the consensus process, and the slave nodes participate in the consensus process.
共识提议为主节点从本地指令池中获取的预设数量的指令。The consensus proposal is a preset number of instructions that the master node obtains from the local instruction pool.
在本说明书中,区块链的成员节点是指区块链网络中参与共识的共识节点,即主节点和从节点均称为成员节点,各个成员节点均维护有系统配置信息,系统配置信息具体是指区块链网络的成员节点集合,以及用于标识系统配置的系统配置编号,其中在有成员节点从区块链网络中退出,或有其他节点加入区块链网络成为成员节点的情况下,对该系统配置编号进行更新,一种具体的实施方式可以是将该系统配置编号以1为步长递增。In this specification, the member nodes of the blockchain refer to the consensus nodes participating in the consensus in the blockchain network, that is, both the master node and the slave nodes are called member nodes, each member node maintains system configuration information, and the system configuration information is specific Refers to the set of member nodes of the blockchain network and the system configuration number used to identify the system configuration, where a member node withdraws from the blockchain network, or other nodes join the blockchain network to become a member node , to update the system configuration number. A specific implementation manner may be to increment the system configuration number with a step size of 1.
如表1所示,为一种系统配置信息的具体实施例。As shown in Table 1, it is a specific embodiment of system configuration information.
系统配置编号system configuration number 成员节点集合set of member nodes
11 P1、P2、P3、P4P1, P2, P3, P4
表1Table 1
其中,系统配置编号以1为步长递增,例如,当节点P5加入区块链网络后,各个区块链网络中的成员节点将本地配置信息更新为如表2所示的信息。Among them, the system configuration number is incremented by 1. For example, when node P5 joins the blockchain network, the member nodes in each blockchain network update the local configuration information to the information shown in Table 2.
系统配置编号system configuration number 成员节点集合set of member nodes
22 P1、P2、P3、P4、P5P1, P2, P3, P4, P5
表2Table 2
本说明书中,区块链网络具体是遵循BFT(Byzantine Fault Tolerance)拜占庭容错的区块链网络,即该区块链网络包括M个共识节点,其中最多允许存在f个恶意节点,M≥3f+1,f和M均为大于0的整数。In this manual, the blockchain network is specifically a blockchain network that follows the BFT (Byzantine Fault Tolerance) Byzantine fault tolerance, that is, the blockchain network includes M consensus nodes, of which f malicious nodes are allowed at most, and M≥3f+ 1, f and M are all integers greater than 0.
如图1所示,为本说明书提出一种网络拓扑的结构示意图,图中节点P1-P4组成区块链网络,P5是指欲加入区块链网络的其他节点,其需要向节点P1-P4组成的区块链网络发送成员配置指令以加入区块链网络,另外,区块链网络中的任一节点如果想要退出区块链网络,则需要向区块链网络广播成员配置指令以从区块链网络退出。As shown in Figure 1, a structural diagram of a network topology is proposed for this specification. In the figure, nodes P1-P4 form a blockchain network, and P5 refers to other nodes that want to join the blockchain network. It needs to send data to nodes P1-P4 The formed blockchain network sends member configuration instructions to join the blockchain network. In addition, if any node in the blockchain network wants to exit the blockchain network, it needs to broadcast member configuration instructions to the blockchain network to start from The blockchain network exits.
在本说明书中,常规指令是指对数据进行增删改查等不涉及对区块链网络的成员节点进行更改的指令,成员配置指令是指指令发起节点发出的、用于指示将其自身加入或退出区块链网络的指令。In this specification, regular instructions refer to instructions that do not involve changes to member nodes of the blockchain network, such as adding, deleting, modifying, and querying data. Instructions to exit the blockchain network.
在本说明书中各个节点可以是服务器、移动终端等具有处理功能的硬件设备,本说明书对此不进行限定。In this specification, each node may be a hardware device with processing functions such as a server and a mobile terminal, which is not limited in this specification.
如图2所示,基于以上说明,本说明书提出的一种基于区块链的共识方法,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括区块链网络中的成员节点集合以及用于标识系统配置的系统配置编号;该方法包括:As shown in Figure 2, based on the above description, a blockchain-based consensus method proposed in this specification, any consensus node in the blockchain network maintains system configuration information locally, and the system configuration information includes the block A set of member nodes in the block chain network and a system configuration number used to identify the system configuration; the method includes:
S201,指令发起节点向区块链网络中的至少部分成员节点广播指令,以使区块链网络生成包括所述指令的共识提议并对所述共识提议进行共识处理;其中,所述指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或退出所述区块链网络;S201, the instruction initiating node broadcasts instructions to at least some member nodes in the blockchain network, so that the blockchain network generates consensus proposals including the instructions and performs consensus processing on the consensus proposals; wherein, the instructions include member Configuration instructions or general instructions, the member configuration instruction is used to instruct the instruction originating node to join or exit the blockchain network;
基于图1所示的网络拓扑图,可以理解的是,指令发起节点可以是区块链网络中的任一节点或不为区块链网络的其他节点,其可以向区块链网络发送指令,在区块链网络中,指令还可以称为交易,本说明书对此不进行限定。Based on the network topology diagram shown in Figure 1, it can be understood that the instruction originating node can be any node in the blockchain network or other nodes not in the blockchain network, which can send instructions to the blockchain network, In a blockchain network, an instruction can also be called a transaction, which is not limited in this manual.
具体的,当指令发起节点是区块链网络以外的其他节点时,其可以发送常规指令,以及用于指示将其自身加入到区块链网络的成员配置指令;Specifically, when the instruction initiating node is a node other than the blockchain network, it can send regular instructions, as well as member configuration instructions for instructing itself to join the blockchain network;
当指令发起节点是区块链网络中的成员节点时,其可以发送常规指令以及用于指示将其自身从区块链网络退出的成员配置指令。When the instruction initiating node is a member node in the blockchain network, it can send a general instruction and a member configuration instruction for instructing to withdraw itself from the blockchain network.
当指令发起节点如果是区块链网络以外的节点,其可以预先通过相应的渠道和方式获取区块链网络的系统配置信息,进而根据配置信息可以确定区块链网络中的成员节点,进而可以向成员节点发送指令。关于获取系统配置信息的具体内容可以参照下文的描述,这里先不进行详述。If the instruction originating node is a node other than the blockchain network, it can obtain the system configuration information of the blockchain network through corresponding channels and methods in advance, and then determine the member nodes in the blockchain network according to the configuration information, and then can Send instructions to member nodes. For the specific content of obtaining the system configuration information, reference may be made to the description below, and details will not be described here.
区块链网络中成员节点在接收到该指令后,可以生成包括该指令的共识提议,并基于该共识提议进行共识处理。After receiving the instruction, the member nodes in the blockchain network can generate a consensus proposal including the instruction, and perform consensus processing based on the consensus proposal.
S202,区块链网络中任一成员节点在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。S202. After any member node in the blockchain network reaches a consensus on the consensus proposal, if the consensus proposal includes a member configuration instruction, update locally maintained system configuration information according to the member configuration instruction.
区块链网络中的共识节点在针对该共识提议达成共识后,可以执行该共识提议,其中如果共识提议中包括成员配置指令,则根据成员配置指令更新本地维护的系统配置信息,以在各个共识节点中同步系统配置信息,即可以根据成员配置指令对本地维护的系统配置信息中的成员节点集合进行更新,并对系统配置编号进行更新。如上述将表1更改为表2的操作。After the consensus nodes in the blockchain network reach a consensus on the consensus proposal, they can execute the consensus proposal. If the consensus proposal includes member configuration instructions, the locally maintained system configuration information will be updated according to the member configuration instructions. The system configuration information is synchronized among the nodes, that is, the member node set in the locally maintained system configuration information can be updated according to the member configuration instruction, and the system configuration number can be updated. Change Table 1 to Table 2 as above.
采用上述方案,将成员配置指令和常规指令一同打包为共识提议进行共识,各个共识节点在基于共识提议达成共识后即可以执行该成员配置指令,不需要将成员配置指令与常规指令分别处理,即不需要将共识过程停止就可以处理成员配置过程,因此大大提升了区块链网络的共识效率。Using the above scheme, the member configuration instructions and regular instructions are packaged together into a consensus proposal for consensus, and each consensus node can execute the member configuration instruction after reaching a consensus based on the consensus proposal, and there is no need to process the member configuration instructions and regular instructions separately, that is The member configuration process can be processed without stopping the consensus process, thus greatly improving the consensus efficiency of the blockchain network.
上文提出,在执行上述S201前,指令发起节点如果是区块链网络以外的节点,其还需要获取区块链网络的系统配置信息,进而可以根据系统配置信息知晓区块链网络中的成员节点信息,进一步可以向区块链网络中的成员节点广播指令,下面对指令发起节点获取区块链网络的系统配置信息的方式进行说明。As mentioned above, before executing the above S201, if the instruction initiating node is a node other than the blockchain network, it also needs to obtain the system configuration information of the blockchain network, and then can know the members of the blockchain network according to the system configuration information Node information can further broadcast instructions to member nodes in the blockchain network. The following describes how the instruction initiator node obtains the system configuration information of the blockchain network.
在一个实施例中,由于指令发起节点通常是具有处理能力的服务器或者客户端,因此,其可以直接基于管理人员的输入获取系统配置信息,即管理人员直接将系统配置信息在该指令发起节点中进行配置。In one embodiment, since the instruction initiating node is usually a server or client with processing capability, it can directly obtain the system configuration information based on the input of the administrator, that is, the administrator directly stores the system configuration information in the instruction initiating node to configure.
在另一个实施例中,指令发起节点还可以向信息存储节点发送系统配置获取请求;信息存储节点在接收到系统配置获取请求后,可以向指令发起节点返回系统配置信息,指令发起节点根据该系统配置信息对本地系统配置信息进行更新,进而可以根据更新后的系统配置信息向区块链网络广播指令。In another embodiment, the instruction initiating node can also send a system configuration acquisition request to the information storage node; after receiving the system configuration acquisition request, the information storage node can return the system configuration information to the instruction initiating node, and the instruction initiating node according to the system The configuration information updates the local system configuration information, and then can broadcast instructions to the blockchain network according to the updated system configuration information.
在本实施例中,由于区块链网络中的成员节点均维护有系统配置信息,因此,区块链网络中的成员节点均可以作为信息存储节点,任一成员节点在接收到该系统配置获取请求后,均可以向指令发起节点返回系统配置信息,另外,由于该指令发起节点并不知道区块链网络中的成员节点有哪些,因此,其需 要向可能是区块链网络中的全部节点广播系统配置获取请求,以获取系统配置请求,具体的,其需要向包括至少一个区块链网络成员节点的节点集合广播系统配置获取请求,才能获取到相应的系统配置信息,这里可以理解为指令发起节点向其知晓的网络环境中所有节点广播系统配置获取请求。In this embodiment, since all member nodes in the blockchain network maintain system configuration information, all member nodes in the blockchain network can be used as information storage nodes, and any member node receives the system configuration acquisition After the request, the system configuration information can be returned to the instruction initiating node. In addition, since the instruction initiating node does not know the member nodes in the blockchain network, it needs to send information to all nodes in the blockchain network. Broadcast the system configuration acquisition request to obtain the system configuration request. Specifically, it needs to broadcast the system configuration acquisition request to a node set including at least one blockchain network member node in order to obtain the corresponding system configuration information, which can be understood as an instruction here The initiating node broadcasts a system configuration acquisition request to all nodes in the network environment it knows about.
另外,一方面考虑到区块链网络中的成员节点随时在变化,作为区块链网络以外的节点,不可能也不需要知悉区块链网络当前包括的成员节点,因此,其需要向所有可能为区块链网络成员节点广播系统配置获取请求,这无疑增加了网络带宽的消耗;另一方面,区块链网络中的成员节点随时都在进行着共识过程,如果成员节点还均需要响应指令发起节点发起的系统配置获取请求,无疑是增加了区块链网络中成员节点的负担。In addition, on the one hand, considering that the member nodes in the blockchain network are changing at any time, as a node outside the blockchain network, it is impossible and unnecessary to know the current member nodes included in the blockchain network. Therefore, it needs to report to all possible Configure the acquisition request for the broadcast system of the member nodes of the blockchain network, which undoubtedly increases the consumption of network bandwidth; on the other hand, the member nodes in the blockchain network are in the consensus process at any time. The system configuration acquisition request initiated by the initiating node undoubtedly increases the burden on the member nodes in the blockchain network.
因此,在一个实施例中,还可以预先规定一个指定节点,由该指定节点专用于响应指令发起节点发起的系统配置获取请求。Therefore, in an embodiment, a designated node may also be pre-specified, and the designated node is dedicated to responding to the system configuration acquisition request initiated by the instruction initiating node.
例如,该信息存储节点包括区块链网络中或区块链网络外任一指定节点;当区块链网络以外的指令发起节点需要获取区块链网络的系统配置信息时,其可以向该指定节点发送系统配置获取请求,由该指定节点向指令发起节点返回系统配置信息。另外,当指定的信息存储节点是区块链网络以外的节点时,其可以在区块链网络中的成员节点同步更新了系统配置信息时,也接收成员节点发送的信息,进而同步更新本地的系统配置信息。采用这种方式,指令发起节点只需要知晓信息存储节点一个节点的通信地址即可,同时指令发起节点不需要广播系统配置获取请求,因此,既减少了网络带宽的消耗,同时也减少了区块链网络中成员节点和指令发起节点的负担。For example, the information storage node includes any designated node in the blockchain network or outside the blockchain network; when an instruction initiation node outside the blockchain network needs to obtain the system configuration information of the blockchain network, it can send the designated node The node sends a system configuration acquisition request, and the designated node returns the system configuration information to the instruction originating node. In addition, when the designated information storage node is a node other than the blockchain network, it can also receive the information sent by the member nodes when the member nodes in the blockchain network update the system configuration information synchronously, and then update the local System configuration information. In this way, the instruction initiating node only needs to know the communication address of one node of the information storage node, and at the same time, the instruction initiating node does not need to broadcast the system configuration acquisition request. Therefore, it not only reduces the consumption of network bandwidth, but also reduces the number of blocks The burden of member nodes and instruction originating nodes in the chain network.
在一个实施例中,当指令发起节点是区块链网络中的节点时,由于网络原因,其也可能存在本地系统配置信息未更新的情况,因此在其需要向区块链网络发起指令时,其也可以向信息存储节点发送配置信息获取请求,本说明书对此不进行限定。In one embodiment, when the instruction initiating node is a node in the blockchain network, due to network reasons, it may also have the situation that the local system configuration information has not been updated, so when it needs to initiate an instruction to the blockchain network, It may also send a configuration information acquisition request to the information storage node, which is not limited in this description.
另外,在一些特殊的预定义网络环境中,例如,在一些节点较少、且全部节点身份公开的网络环境中,指令发起节点可以直接以该预定义网络中全部节点作为区块链网络的成员,即将预定义网络中的全部节点组成的集合作为系统配置信息中的成员节点集合,并且以预定义值作为系统配置编号,该预定义值可以为不为实际系统编号的任意预定义值,例如预定义值设置为nail。In addition, in some special predefined network environments, for example, in some network environments where there are few nodes and the identities of all nodes are disclosed, the instruction originating node can directly use all nodes in the predefined network as members of the blockchain network , that is, the set of all nodes in the predefined network is used as the set of member nodes in the system configuration information, and the predefined value is used as the system configuration number. The predefined value can be any predefined value that is not the actual system number, for example The predefined value is set to nail.
为了确保系统配置信息的可信性,信息存储节点在向指令发起节点返回系统配置信息时,可以将系统配置历史信息一同发送给指令发起节点,进而,指令发起节点在接收到该获取请求响应消息后,可以根据该系统配置历史信息对该系统配置信息进行验证,在验证通过,且该系统配置信息中的系统配置编号大于本地维护的系统配置编号,则根据该系统配置信息对本地系统配置进行更新。In order to ensure the credibility of the system configuration information, when the information storage node returns the system configuration information to the command initiating node, it can send the system configuration history information to the command initiating node together, and then, the command initiating node receives the request response message Afterwards, the system configuration information can be verified according to the system configuration history information. After the verification is passed, and the system configuration number in the system configuration information is greater than the system configuration number maintained locally, the local system configuration can be performed according to the system configuration information. renew.
可以理解的是,指令发起节点如果是首次与区块链网络建立联系,其本地可能未存储有任何系统配置信息,则可以直接在验证通过后,将系统配置信息存储在本地,即可以视为本地系统配置信息编号为0,则接收到的系统配置信息无论如何也大于本地的系统配置信息编号。另外,指令发起节点可能是之前从区块链网络退出的节点,或者向该区块链网络发过指令的节点,因此其本地存储有系统配置信息,因此,指令发起节点在接收到系统配置信息后,如果接收到的系统配置编号大于本地的系统配置编号,则说明本地系统配置信息未更新,则可以对接收到的系统配置信息验证通过后,根据接收到的系统配置信息对本地系统配置进行更新。It is understandable that if the instruction initiating node establishes contact with the blockchain network for the first time, there may not be any system configuration information stored locally, and the system configuration information can be stored locally after the verification is passed, which can be regarded as If the local system configuration information number is 0, the received system configuration information is greater than the local system configuration information number anyway. In addition, the instruction initiating node may be a node that has exited from the blockchain network before, or a node that has sent instructions to the blockchain network, so it stores system configuration information locally. Therefore, the instruction initiating node receives the system configuration information Finally, if the received system configuration number is greater than the local system configuration number, it means that the local system configuration information has not been updated. After the received system configuration information is verified, the local system configuration can be performed according to the received system configuration information. renew.
例如,信息存储节点可以向指令发起节点返回消息<CONF,c’,Mc’,chist’>,其中CONF标识消息类型,c’为系统配置编号,Mc’为对应该系统配置编号的成员节点集合,即c’和Mc’为系统配置信息,chist’为系统配置历史信息,chist’的具体内容,以及利用系统配置历史信息对系统配置信息进行验证的方式可以参照下文,这里不进行详述。For example, the information storage node can return the message <CONF,c',Mc',chist'> to the instruction originating node, where CONF identifies the message type, c' is the system configuration number, and Mc' is the set of member nodes corresponding to the system configuration number , that is, c' and Mc' are system configuration information, and chist' is system configuration history information. The specific content of chist' and the method of using system configuration history information to verify system configuration information can be referred to below, and will not be described in detail here.
可以理解的是,上述获取系统配置信息的方式不仅仅可以应用到本说明书提出的共识方法中,还可以应用到其他需要使用系统配置信息的共识方法,或其他需要使用系统配置信息的技术当中。It can be understood that the above method of obtaining system configuration information can not only be applied to the consensus method proposed in this specification, but also can be applied to other consensus methods that need to use system configuration information, or other technologies that need to use system configuration information.
根据上述内容所述,指令发起节点获取了系统配置信息,因此在上述S201中,指令发起节点发起的指令中可以携带系统配置编号,用于标识所述指令所针对的系统配置版本;例如,其可以发送形如<SUBMIT,c,<JOIN,pk>>的指令,其中SUBMIT为指令类型标识,c为系统配置编号,pk为其公钥,JOIN表示该指令用于指示将该指令发起节点加入区块链网络。或者,其可以发送形如<SUBMIT,c,<LEAVE,i>>,其中,i为该指令发起节点在区块链网络中的成员节点编号,LEAVE表示该指令用于指示将该指令发起节点移除区块链网络,通常情况下,指令发起节点可以基于本地当前的系统配置编号发起指令。According to the above content, the command initiating node has obtained the system configuration information, so in the above S201, the command initiated by the command initiating node may carry the system configuration number, which is used to identify the system configuration version targeted by the command; for example, its You can send a command in the form of <SUBMIT,c,<JOIN,pk>>, where SUBMIT is the command type identifier, c is the system configuration number, pk is its public key, and JOIN means that the command is used to instruct the node that initiated the command to join blockchain network. Alternatively, it can send a message in the form of <SUBMIT,c,<LEAVE,i>>, where i is the member node number of the instruction originating node in the blockchain network, and LEAVE indicates that the instruction is used to instruct the instruction originating node Remove the blockchain network, under normal circumstances, the instruction originating node can initiate the instruction based on the local current system configuration number.
根据上述内容可知,由于信息存储节点可以是指定的一个节点,也可以是区块链网络中的成员节点,当信息存储节点是区块链网络中的成员节点、或指定节点时,由于该节点更新本地系统配置信息不及时,因此其向指令发起节点返回的节点也可能少于区块链网络当前所拥有的全部成员节点。因此,在上述S201中,指令发起节点根据更新后的系统配置信息可以向当前区块链网络中的至少部分成员节点广播指令,在广播后,区块链网络中任一从节点在接收到该指令后,可以对该指令进行转发处理,即区块链网 络中的从节点在接收到指令发起节点发送的指令后,可以将该指令转发至区块链网络中的其他节点,同时也将指令存储在本地的指令池中。区块链网络中的主节点在接收到所述指令,且生成包括所述指令的共识提议后,协调其他节点对所述共识提议进行共识处理。According to the above content, since the information storage node can be a designated node or a member node in the blockchain network, when the information storage node is a member node or a designated node in the blockchain network, since the node The update of the local system configuration information is not timely, so the nodes returned to the instruction originating node may be less than all the member nodes currently owned by the blockchain network. Therefore, in the above S201, the instruction initiating node can broadcast the instruction to at least some member nodes in the current blockchain network according to the updated system configuration information. After the broadcast, any slave node in the blockchain network receives the instruction After the instruction, the instruction can be forwarded, that is, the slave node in the blockchain network can forward the instruction to other nodes in the blockchain network after receiving the instruction sent by the instruction originating node, and at the same time, the instruction Stored in the local instruction pool. After receiving the instruction and generating a consensus proposal including the instruction, the master node in the blockchain network coordinates other nodes to perform consensus processing on the consensus proposal.
区块链网络中的任一从节点在接收到该指令后,对该指令进行转发处理,具体可以为在本地未执行该指令的情况下,若确定该系统配置编号与本地存储的系统配置编号相同,则将所述成员配置指令转发至主节点;若确定该系统配置编号小于本地存储的系统配置编号,则将所述指令转发至本地维护的成员节点集合中的成员节点;After any slave node in the blockchain network receives the instruction, it forwards the instruction. Specifically, if the instruction is not executed locally, if the system configuration number and the locally stored system configuration number are determined If they are the same, forward the member configuration instruction to the master node; if it is determined that the system configuration number is smaller than the locally stored system configuration number, then forward the instruction to the member nodes in the locally maintained member node set;
任一从节点在接收到指令后,如果确定本地未执行该指令,说明并未针对该指令达成共识,进一步,如果确定该系统配置编号与本地存储的系统配置编号相同,则说明指令发起节点的系统配置编号与本地的系统配置编号相同,则直接将指令转发至主节点。After any slave node receives an instruction, if it is determined that the instruction has not been executed locally, it means that no consensus has been reached on the instruction. Further, if it is determined that the system configuration number is the same as the system configuration number stored locally, it means that the node that initiated the instruction If the system configuration number is the same as the local system configuration number, the command is directly forwarded to the master node.
如果确定该系统配置编号小于本地存储的系统配置编号,则说明指令发起节点的系统配置未更新,通过该指令发起节点广播的成员节点并不为最新的成员节点,因此需要将指令发起节点广播的指令转发至本地系统配置对应的全部成员节点。例如,指令发起节点发送的指令中携带系统配置编号为1,对应的成员节点集合中包括P1、P2、P3、P4四个节点。而本地系统配置编号为2,对应的成员节点集合中包括P1、P2、P3、P4、P5五个节点,因此可以向P1、P2、P3、P4、P5五个节点转发该指令,以使P5也可以接收到该指令。If it is determined that the system configuration number is smaller than the system configuration number stored locally, it means that the system configuration of the command initiating node has not been updated, and the member node broadcast by the command initiating node is not the latest member node, so it is necessary to The command is forwarded to all member nodes corresponding to the local system configuration. For example, the instruction sent by the instruction originating node carries a system configuration number of 1, and the corresponding member node set includes four nodes P1, P2, P3, and P4. The local system configuration number is 2, and the corresponding member node set includes five nodes P1, P2, P3, P4, and P5. Therefore, the command can be forwarded to five nodes P1, P2, P3, P4, and P5, so that P5 This command can also be received.
在指令发起节点发起的指令中携带的系统配置编号为预定义值时,各个从节点可以将其视为与本地系统配置编号相同的值,也可以将其视为与小于本地系统配置编号的值,进而触发相应的转发处理,本说明书对此不进行限定。When the system configuration number carried in the command initiated by the command initiating node is a predefined value, each slave node can regard it as the same value as the local system configuration number, or as a value smaller than the local system configuration number , and then trigger the corresponding forwarding process, which is not limited in this specification.
另外,由于网络延迟等原因,某节点接收到指令发起节点发送的指令会较晚,此时该节点可能已经因为区块链网络中其他节点早已接收到了该指令,因此已经完成了对该指令的共识处理,并且已经执行了该指令。因此,可以将执行结果和配置历史消息返回给该指令发起节点。例如,可以发送<REPLY,c,re,chist>消息给指令发起节点。其中,REPLY是指消息类型标识,c是指系统配置编号,re是指执行结果,chist是指配置历史消息。这里先不对chist进行说明,具体内容可以参照下文。In addition, due to network delays and other reasons, it will be late for a node to receive the instruction sent by the instruction originating node. At this time, the node may have already completed the instruction because other nodes in the blockchain network have already received the instruction. Consensus processing, and the instruction has been executed. Therefore, the execution result and configuration history information can be returned to the instruction originating node. For example, a <REPLY,c,re,chist> message may be sent to the instruction originating node. Among them, REPLY refers to the message type identifier, c refers to the system configuration number, re refers to the execution result, and chist refers to the configuration history message. Here we will not explain the Chist, the specific content can refer to the following.
在上述S201中,区块链网络中的主节点在接收到指令后,可以将指令存储在本地的指令池中,在达到预设共识周期或指令池中存储了预设数量的指令后,可以从指令池中获取一定数量的指令打包成为共识提议,主节点将成员配置指令以及常规指令均打包为共识提议进行处理,本说明书中对于主节点打包共识提议的触发机制以及打包方式不进行限定。In the above S201, after the master node in the blockchain network receives the instruction, it can store the instruction in the local instruction pool, and after reaching the preset consensus cycle or storing a preset number of instructions in the instruction pool, it can Obtain a certain number of instructions from the instruction pool and package them into consensus proposals. The master node will package member configuration instructions and regular instructions into consensus proposals for processing. This manual does not limit the trigger mechanism and packaging method of master node packaging consensus proposals.
主节点在从指令池中获取预设数量的指令后,针对所述预设数量的指令中的任一成员配置指令,若确定该成员配置指令为用于指示将发起该指令的指令发起节点加入区块链网络,则为该指令发起节点分配成员节点序号,将成员节点序号以及所述成员配置指令组合为成员加入指令。例如,为该指令发起节点分配的成员节点序号为j,成员配置指令为m,则组合后的成员加入指令为<ADD,j,m>,其中,ADD是指成员加入指令的类型标识。After the master node acquires a preset number of instructions from the instruction pool, it configures instructions for any member of the preset number of instructions. If it is determined that the member configuration instruction is an instruction that will initiate the instruction, the master node joins In the blockchain network, assign the member node serial number to the instruction originating node, and combine the member node serial number and the member configuration instruction into a member joining instruction. For example, if the member node serial number assigned to the instruction initiating node is j, and the member configuration instruction is m, then the combined member joining instruction is <ADD,j,m>, where ADD refers to the type identifier of the member joining instruction.
另外,若该成员配置指令用于指示将发起所述指令的指令发起节点从区块链网络退出,则将该指令发起节点的成员节点序号以及所述成员配置指令组合为成员退出指令。由于该指令发起节点为区块链网络中的节点,因此其具有成员节点序号,例如其成员节点序号为i,该指令为m,则组合后的成员退出指令为<REMOVE,i,m>,其中,REMOVE是指成员退出指令的类型标识。In addition, if the member configuration instruction is used to indicate that the instruction initiating node that will initiate the instruction withdraws from the blockchain network, the member node serial number of the instruction initiating node and the member configuration instruction are combined into a member exit instruction. Since the initiating node of this command is a node in the blockchain network, it has a member node serial number, for example, its member node serial number is i, and the command is m, then the combined member exit command is <REMOVE,i,m>, Wherein, REMOVE refers to the type identifier of the member exit instruction.
主节点在对获取的预设数量指令中的成员配置指令进行处理后,可以将得到的成员加入指令、成员退出指令,以及未处理的常规指令打包为共识提议。例如,主节点从指令池中共获取了10条指令,其中第1、10条为成员配置指令,其他指令为常规指令,主节点在对第1、10条指令改造为成员加入指令或成员退出指令后,将改造后的第1、10条指令以及其他常规指令打包为共识提议。After processing the member configuration instructions in the preset number of instructions obtained, the master node can package the obtained member joining instructions, member exit instructions, and unprocessed regular instructions into consensus proposals. For example, the master node has obtained a total of 10 instructions from the instruction pool, of which the 1st and 10th are member configuration instructions, and the other instructions are regular instructions. The master node is transforming the 1st and 10th instructions into member joining instructions or member exit instructions Finally, the transformed 1st and 10th instructions and other regular instructions are packaged into consensus proposals.
另外,主节点在为指令发起节点分配成员序号后,还可以将该指令发起节点加入到临时成员集合中。临时成员集合可以理解为接收区块链网络中的共识消息,但是不参加共识过程的节点。In addition, after the master node assigns a member sequence number to the instruction originating node, it can also add the instruction originating node to the temporary member set. The set of temporary members can be understood as nodes that receive consensus messages in the blockchain network but do not participate in the consensus process.
如图3所示,主节点维护的系统配置中,存在PA、PB、PC、PD四个节点,节点PE想要加入区块链网络,主节点为节点PE分配成员节点序号E后将E添加到临时成员集合TM中,图中M表示当前系统配置对应的成员节点集合,configuration c表示系统配置c,如果针对该成员配置指令达成共识并执行了该指令(对应图中Deliver递送分支),则将E添加到成员节点集合中,如果针对该成员配置指令未达成共识(对应图中FailToDeliver分支),则将E从临时成员节点集合中移除。As shown in Figure 3, in the system configuration maintained by the master node, there are four nodes PA, PB, PC, and PD. The node PE wants to join the blockchain network. The master node assigns the member node number E to the node PE and adds E In the temporary member set TM, M in the figure represents the member node set corresponding to the current system configuration, configuration c represents the system configuration c, if a consensus is reached on the member configuration command and the command is executed (corresponding to the Deliver delivery branch in the figure), then Add E to the member node set, and if no consensus is reached on the member configuration command (corresponding to the FailToDeliver branch in the figure), then E is removed from the temporary member node set.
在将该指令发起节点加入到临时成员集合中,并打包了共识提议后,主节点即可以协调其他节点对共识提议进行共识处理,其可以基于共识提议向临时成员集合中的成员节点广播预准备消息,即向临时成员集合中的成员节点广播携带共识提议的预准备消息,这样临时成员集合中的全部节点均可以接收到预准备消息;其中,预准备消息中携带主节点的签名。预准备消息可以是形如<PRE-PREPARE,v,c,s, batch>的消息,其中,PRE-PREPARE为消息类型标识、v表示当前视图、c标识主节点存储的系统配置编号、s为当前共识提议的编号、batch为共识提议。After the instruction originating node is added to the temporary member set and the consensus proposal is packaged, the master node can coordinate other nodes to perform consensus processing on the consensus proposal, and it can broadcast the pre-preparation to the member nodes in the temporary member set based on the consensus proposal message, that is, to broadcast the pre-preparation message carrying the consensus proposal to the member nodes in the temporary member set, so that all nodes in the temporary member set can receive the pre-preparation message; wherein, the pre-preparation message carries the signature of the master node. The pre-preparation message can be a message in the form of <PRE-PREPARE,v,c,s, batch>, where PRE-PREPARE is the message type identifier, v indicates the current view, c indicates the system configuration number stored by the master node, and s is The number and batch of the current consensus proposal are consensus proposals.
区块链网络中的从节点,也即主节点维护的系统配置中的成员节点集合中除主节点以外的其他节点,在接收到预准备消息后,针对该共识提议中的成员加入指令,将该成员加入指令中的成员节点序号加入到本地的临时成员集合中,并向本地临时成员集合中的节点广播针对所述共识提议的准备消息;其中,准备消息中携带该从节点的签名,准备消息可以是形如<PREPARE,v,c,s,h(batch)>的消息,其中,PREPARE为消息类型标识、h(batch)为对共识提议的hash值。The slave nodes in the blockchain network, that is, the nodes other than the master node in the set of member nodes in the system configuration maintained by the master node, after receiving the pre-preparation message, will add instructions to the members in the consensus proposal. The member node sequence number in the member joining instruction is added to the local temporary member set, and broadcasts the preparation message for the consensus proposal to the nodes in the local temporary member set; wherein, the preparation message carries the signature of the slave node, and prepares The message can be a message in the form of <PREPARE, v, c, s, h(batch)>, where PREPARE is the message type identifier, and h(batch) is the hash value proposed for the consensus.
可以理解的是区块链网络的全部从节点均会执行上述操作,即全部从节点在接收到预准备消息后均会发出针对该共识提议的准备消息。It can be understood that all slave nodes of the blockchain network will perform the above operations, that is, all slave nodes will send a preparation message for the consensus proposal after receiving the pre-preparation message.
任一节点包括主节点或从节点,在接收到本地系统配置的成员节点集合中2/3成员节点广播的准备消息后,将接收到的准备消息的签名作为该共识提议的证明进行存储,并广播针对所述共识提议的承诺消息;所述承诺消息中携带所述节点的签名,其中,承诺消息可以是形如<COMMIT,v,c,s,δ>的消息,其中,COMMIT为消息类型标识、δ也表示对共识提议的hash值。Any node, including the master node or slave node, after receiving the preparation message broadcast by 2/3 member nodes in the member node set configured by the local system, stores the signature of the received preparation message as the proof of the consensus proposal, and Broadcast a commitment message for the consensus proposal; the commitment message carries the signature of the node, where the commitment message can be a message in the form of <COMMIT, v, c, s, δ>, where COMMIT is the message type The logo and δ also represent the hash value of the consensus proposal.
由于在本说明书中,区块链网络中的恶意节点小于全部节点1/3,因此,在2/3成员节点广播的针对所述共识提议的准备消息后,可以认为是正确节点发送的准备消息,因此可以广播针对所述共识提议的承诺消息,并在承诺消息中存储自身的签名信息,同时将接收到的准备消息的签名作为该共识提议的证明进行存储。Since in this specification, the malicious nodes in the blockchain network are less than 1/3 of all nodes, therefore, after the preparation message for the consensus proposal broadcast by 2/3 member nodes, it can be considered as the preparation message sent by the correct node , so it is possible to broadcast a commitment message for the consensus proposal, store its own signature information in the commitment message, and store the signature of the received preparation message as a proof of the consensus proposal.
另外,任一从节点可能因为网络延迟等原因未接收到2/3成员节点广播的针对所述共识提议的准备消息,但是接收到了本地系统配置的成员节点集合中1/3成员节点广播的针对所述共识提议的承诺消息,则也说明超过恶意节点数量的节点广播了该承诺消息,可以认为该承诺消息是正确节点发出的,因此从节点也可以发送针对所述共识提议的承诺消息。In addition, any slave node may not have received the preparation message for the consensus proposal broadcast by 2/3 of the member nodes due to network delays, etc., but has received the message for the consensus proposal broadcast by 1/3 of the member nodes set configured by the local system. The commitment message of the consensus proposal also indicates that the number of nodes exceeding the number of malicious nodes has broadcast the commitment message, and it can be considered that the commitment message is sent by the correct node, so the slave node can also send the commitment message for the consensus proposal.
从节点在接收到当前配置中超过2/3成员节点的承诺消息后,确定针对该共识提议达成共识,执行所述共识提议。After receiving the commitment message of more than 2/3 member nodes in the current configuration, the slave node determines to reach a consensus on the consensus proposal, and executes the consensus proposal.
另外,当信息存储节点为区块链网络外的指定节点时,区块链网络中任一成员节点在确定针对共识提议达成共识后,会将共识消息发送给所述信息存储节点,以使所述信息存储节点更新本地的系统配置信息以及系统配置历史信息。In addition, when the information storage node is a designated node outside the blockchain network, any member node in the blockchain network will send a consensus message to the information storage node after determining that a consensus has been reached on the consensus proposal, so that all The information storage node updates the local system configuration information and system configuration history information.
具体的,区块链网络中的成员节点在每次共识完成后,会将承诺消息额外发送给该信息存储节点,由信息存储节点根据接收到的承诺消息,对本地维护的配置信息进行更新,并对系统配置历史信息进行更新,其中该信息存储节点也可以是在接收到2/3成员节点发送的承诺消息后,对本地维护的配置信息进行更新,同时对系统配置历史信息进行更新。Specifically, after each consensus is completed, the member nodes in the blockchain network will additionally send a commitment message to the information storage node, and the information storage node will update the locally maintained configuration information according to the received commitment message. And update the system configuration history information, wherein the information storage node can also update the locally maintained configuration information after receiving the commitment message sent by 2/3 member nodes, and update the system configuration history information at the same time.
如图4所示,为本说明书提出的对于常规指令进行共识过程的示意图,图中c为不为区块链网络中的节点,即指令发起节点,其向区块链网络中的至少部分成员节点广播指令,如图4中,其向成员节点0发送指令,成员节点0为主节点,其向其他成员节点,即节点1、2和3发送pre-prepare消息(预准备消息),图中节点3为恶意节点,节点0、1、2为正确节点,因此节点3接收到消息后不发送prepare消息(准备消息),节点1、节点2向区块链网络中的其他节点广播prepare消息,节点0、节点1、节点2在接收到足够数量的prepare消息后,发送commit消息(承诺消息),在接收到足够数量的commit消息后,确定针对该共识提议达成共识向指令发起节点返回执行结果,即reply消息。As shown in Figure 4, it is a schematic diagram of the consensus process for conventional instructions proposed in this specification. In the figure, c is a node that is not in the blockchain network, that is, the instruction originating node, which sends instructions to at least some members of the blockchain network. Node broadcasts instructions, as shown in Figure 4, it sends instructions to member node 0, member node 0 is the master node, and it sends pre-prepare messages (pre-preparation messages) to other member nodes, namely nodes 1, 2 and 3, as shown in the figure Node 3 is a malicious node, and nodes 0, 1, and 2 are correct nodes, so node 3 does not send a prepare message (preparation message) after receiving the message, and nodes 1 and 2 broadcast prepare messages to other nodes in the blockchain network. Node 0, Node 1, and Node 2 send a commit message (commitment message) after receiving a sufficient number of prepare messages. After receiving a sufficient number of commit messages, they determine to reach a consensus on the consensus proposal and return the execution result to the instruction originating node , that is, the reply message.
可以理解的是,图4所描述的是对于常规指令的共识示意图,对于成员配置指令的共识过程部分如图4所示,具体区别可以参照下文。It can be understood that what is described in Figure 4 is a schematic diagram of consensus for conventional instructions, and the consensus process for member configuration instructions is shown in Figure 4, and the specific differences can be referred to below.
在一个实施例中,任一从节点,在接收到主节点发送的预准备消息后,针对共识提议中的成员加入指令,将成员节点序号加入到临时成员组后,在该成员加入指令中携带的系统配置编号小于本地系统配置编号的情况下,可以向该成员节点序号对应的指令发起节点发送本地系统配置信息以及系统配置历史信息。例如,其可以向指令发起节点发送形如<CONF,c,Mc,chist>,其中c和Mc是当前的系统配置信息,chist为系统配置历史信息,CONF为消息类型标识。In one embodiment, any slave node, after receiving the pre-preparation message sent by the master node, according to the member joining instruction in the consensus proposal, after adding the member node serial number to the temporary member group, carries in the member joining instruction If the system configuration number of the member node is smaller than the local system configuration number, the local system configuration information and system configuration history information can be sent to the instruction originating node corresponding to the member node serial number. For example, it can send a command in the form of <CONF,c,Mc,chist> to the command initiating node, where c and Mc are the current system configuration information, chist is the system configuration history information, and CONF is the message type identifier.
即如果该成员加入指令中携带的系统配置编号小于本地系统配置编号,则说明该指令发起节点的系统配置编号未更新,因此需要将配置历史信息发送至该成员节点序号,即该指令发起节点。That is, if the system configuration number carried in the member joining command is smaller than the local system configuration number, it means that the system configuration number of the node initiating the command has not been updated, so the configuration history information needs to be sent to the serial number of the member node, that is, the node initiating the command.
所述指令发起节点在接收到该系统配置信息以及系统配置历史信息后,可以根据该配置信息对本地系统配置信息进行更新。考虑到系统配置信息的安全性和可信性,指令发起节点可以对系统配置信息进行验证,在验证通过后,再根据该系统配置信息对本地系统配置信息进行更新。具体的可以根据系统配置历史信息对该系统配置信息进行验证,其中,该系统配置历史信息为目标共识提议组成的集合,目标共识提议为包括成员加入指令或成员退出指令的共识提议。即该系统配置历史信息中记录有全部成员加入指令或成员退出指令。另外,由于在共识过程中,各个节点存储了共识提议的证明,因此可以直接将 目标共识提议的证明也作为系统配置历史信息的一部分发给指令发起节点,指令发起节点基于所述系统配置历史信息中的各个证明对各个目标提议进行验证,在对全部目标提议验证通过的情况下,确定所述系统配置历史信息是正确且安全的,又由于该系统配置信息是基于该系统配置历史信息演进而来的,因此可以确定该系统配置信息通过验证。After the instruction initiating node receives the system configuration information and system configuration history information, it can update the local system configuration information according to the configuration information. Considering the security and credibility of the system configuration information, the instruction originating node can verify the system configuration information, and then update the local system configuration information according to the system configuration information after the verification is passed. Specifically, the system configuration information can be verified according to the system configuration history information, wherein the system configuration history information is a set of target consensus proposals, and the target consensus proposals are consensus proposals including member joining instructions or member exit instructions. That is, all member joining instructions or member exit instructions are recorded in the system configuration history information. In addition, since each node stores the proof of the consensus proposal during the consensus process, the proof of the target consensus proposal can be directly sent to the instruction initiating node as part of the system configuration history information, and the instruction initiating node is based on the system configuration history information Each proof in each target proposal is verified. In the case of passing the verification of all target proposals, it is determined that the system configuration history information is correct and safe, and because the system configuration information evolves based on the system configuration history information , so it can be determined that the system configuration information has passed the verification.
如图5所示,为本说明书提出的一种系统配置历史信息的结构示意图,其中,系统配置历史信息中包括三个目标共识提议,分别为共识提议1、共识提议3,共识提议7,每个目标共识提议中均包含成员加入指令或成员退出指令,且由于区块链网络在基于目标共识提议进行共识和处理后,会对系统配置编号进行更新,因此各个目标提议对应的系统配置编号是递增的,例如共识提议1对应系统配置编号为1,共识提议3对应系统配置编号为2,共识提议7对应系统配置编号为3,指令发起节点在基于每个目标共识提议对应的证明分别对系统配置历史信息中各个目标共识提议进行验证后,可以确定该系统配置历史信息是正确的,而且该系统配置历史中记录的最新共识提议7的系统配置编号3即为当前的系统配置编号、当前的系统配置信息中的成员节点集合也是基于该系统配置历史信息中的目标共识提议演进而来的,因此,在确定该系统配置历史信息通过验证的情况下,即可以确定该获取的系统配置信息通过验证。As shown in Figure 5, it is a schematic structural diagram of a system configuration history information proposed in this manual, wherein the system configuration history information includes three target consensus proposals, namely, consensus proposal 1, consensus proposal 3, and consensus proposal 7, each Each target consensus proposal contains member joining instructions or member exit instructions, and since the blockchain network will update the system configuration number after consensus and processing based on the target consensus proposal, the system configuration number corresponding to each target proposal is Incremental, for example, consensus proposal 1 corresponds to system configuration number 1, consensus proposal 3 corresponds to system configuration number 2, consensus proposal 7 corresponds to system configuration number 3, and the instruction initiating node is based on the proof corresponding to each target consensus proposal. After the verification of each target consensus proposal in the configuration history information, it can be determined that the system configuration history information is correct, and the system configuration number 3 of the latest consensus proposal 7 recorded in the system configuration history is the current system configuration number, the current The set of member nodes in the system configuration information is also evolved based on the target consensus proposal in the system configuration history information. Therefore, when it is determined that the system configuration history information has passed the verification, it can be determined that the obtained system configuration information has passed verify.
进而可以基于系统配置信息对本地系统配置信息进行更新。Furthermore, the local system configuration information can be updated based on the system configuration information.
结合上述描述的内容,在上述S202中,区块链网络中任一节点具体可以是在针对所述共识提议达成共识后,针对所述共识提议中的任一成员加入指令,将所述节点接入指令中的成员节点序号加入到本地维护的系统配置信息中的成员节点集合中;针对所述共识提议中的任一成员退出指令,将所述成员退出指令中的成员节点序号,从到本地维护的系统配置信息中的成员节点集合中移除;将系统配置编号进行更新,如将系统配置编号加1。In combination with the content described above, in the above S202, any node in the blockchain network may specifically add instructions to any member of the consensus proposal after reaching a consensus on the consensus proposal, and connect the node to The member node serial number in the entry command is added to the member node set in the locally maintained system configuration information; for any member withdrawal command in the consensus proposal, the member node serial number in the member withdrawal command is transferred from to the local Remove from the set of member nodes in the maintained system configuration information; update the system configuration number, for example, add 1 to the system configuration number.
另外在上述S202之后,在该共识提议中包括成员加入指令或成员退出指令的情况下,还需要将该共识提议添加到系统配置历史信息中,以对系统配置历史信息进行更新。并且还需要在对全部编号低于该提议的共识提议都完成共识后,向所述共识提议中包括的成员加入指令对应的指令发起节点返回成员配置处理结果,即向成员配置指令的指令发起节点返回该成员配置处理结果。In addition, after the above S202, if the consensus proposal includes a member joining instruction or a member exit instruction, the consensus proposal needs to be added to the system configuration history information to update the system configuration history information. And it is also necessary to return the member configuration processing result to the instruction originating node corresponding to the member joining instruction included in the consensus proposal after completing the consensus on all consensus proposals whose number is lower than this proposal, that is, to the instruction originating node of the member configuration instruction Returns the member configuration processing result.
该指令的发起节点在接收到2/3成员节点发送的配置处理结果后,可以确定指令执行完毕,并确定本地加入到区块链网络。After receiving the configuration processing results sent by 2/3 member nodes, the initiating node of the instruction can confirm that the instruction has been executed and join the blockchain network locally.
例如,各个成员节点可以在对某个共识提议达成共识,且该共识提议中包括成员加入指令时,对全部编号低于该提议的共识提议都完成共识后,向指令发起节点返回形如<HISTORY,s,h,C,P>的消息,其中,HISTORY为消息类型标识,s为共识提议的编号,h为共识提议的hash值,C为本地最新检查点,P为本地存储的序号高于C中全部共识提议的证明。For example, each member node can reach a consensus on a consensus proposal, and the consensus proposal includes a member joining instruction, and after completing the consensus on all consensus proposals with numbers lower than the proposal, return the instruction to the node initiating the form <HISTORY ,s,h,C,P>, where HISTORY is the message type identifier, s is the number of the consensus proposal, h is the hash value of the consensus proposal, C is the latest local checkpoint, and P is the serial number of the local storage higher than Proofs of all consensus proposals in C.
对于指令发起节点,其在收到2/3成员节点发送的<HISTORY,s,h,C,P>的消息后,确定本地加入区块链网络,并参与区块链网络后续的共识过程。For the instruction originating node, after receiving the <HISTORY, s, h, C, P> message sent by 2/3 member nodes, it determines to join the blockchain network locally and participate in the subsequent consensus process of the blockchain network.
另外,为了提升指令发起节点加入区块链网络的效率,其也可以在确定包括本地发送的成员加入指令的共识提议已被达成共识,但还未收到足够多,即还未收到即2/3成员节点的配置处理结果的情况下,就加入区块链网络并参与共识投票。In addition, in order to improve the efficiency of the instruction originating node to join the blockchain network, it can also confirm that the consensus proposal including the member joining instruction sent locally has reached a consensus, but has not received enough, that is, has not received it. In the case of the configuration processing result of the /3 member node, it joins the blockchain network and participates in consensus voting.
对于任一成员配置指令的指令发起节点,将共识提议的证明进行存储后,若所述成员配置指令包含在所述共识提议中,且所述成员配置指令用于指示将所述指令发起节点从所述区块链网络退出,则确定本地从所述区块链网络退出。For the instruction initiating node of any member configuration instruction, after storing the proof of the consensus proposal, if the member configuration instruction is included in the consensus proposal, and the member configuration instruction is used to instruct the instruction initiating node from If the blockchain network exits, it is determined that the local exits from the blockchain network.
即,如果该成员发起节点发送的成员配置指令,用于将该指令发起节点从区块链网络中退出,其在共识过程中如果收集到了共识提议的证明,且本地发送的成员配置指令在该共识提议中,则可以确定该共识提议已经被大部分节点所接收,因此可以从区块链网络退出,不再参与共识过程,或接收共识消息。That is, if the member configuration instruction sent by the member initiating node is used to withdraw the instruction initiating node from the blockchain network, if it collects the proof of the consensus proposal during the consensus process, and the member configuration instruction sent locally is in the In the consensus proposal, it can be determined that the consensus proposal has been accepted by most nodes, so it can withdraw from the blockchain network, no longer participate in the consensus process, or receive consensus messages.
考虑到安全性问题,该成员节点也可以是在完成对该共识提议的共识处理后,且执行了该共识提议后,再从区块链网络退出。Considering security issues, the member node can also withdraw from the blockchain network after completing the consensus processing of the consensus proposal and executing the consensus proposal.
即任一成员配置指令的指令发起节点,在确定共识提议被执行,且所述成员配置指令包含在所述共识提议中,其中,所述成员配置指令用于指示将所述指令发起节点从所述区块链网络退出,则确定本地从所述区块链网络退出。That is, the instruction initiating node of any member configuration instruction determines that the consensus proposal is executed, and the member configuration instruction is included in the consensus proposal, wherein the member configuration instruction is used to instruct the instruction initiating node to If the block chain network exits, it is determined that the local exits from the block chain network.
另外,在上述S202之后,任一节点针对共识提议中的任一常规指令,在本地执行完成后,若确定该指令中的系统配置编号与本地的系统配置编号相同,则向该指令的指令发起节点返回处理结果,如图4所示,该指令发起节点接收到2/3本地系统配置对应的成员节点发送的处理结果确定指令执行完毕。In addition, after the above S202, any node, after local execution of any conventional command in the consensus proposal, if it is determined that the system configuration number in the command is the same as the local system configuration number, initiate The node returns the processing result, as shown in Figure 4, the instruction initiating node receives the processing result sent by the member node corresponding to the 2/3 local system configuration and determines that the instruction is executed.
若确定该指令中的系统配置编号小于本地的系统配置编号,则向该指令的指令发起节点返回处理结果以及系统配置信息,该指令发起节点接收到更新后的系统配置中的2/3成员节点发送的处理结果确定指令执行完毕,并根据系统配置信息对本地系统配置信息进行更新。同样的,为了确定系统配置信息的可信性,也可以将系统配置历史信息返回给指令发起节点,指令发起节点基于该系统配置历史信息对该 系统配置信息进行验证。If it is determined that the system configuration number in the instruction is smaller than the local system configuration number, then return the processing result and system configuration information to the instruction originating node of the instruction, and the instruction originating node receives 2/3 of the member nodes in the updated system configuration The sent processing result determines that the execution of the instruction is completed, and updates the local system configuration information according to the system configuration information. Similarly, in order to determine the credibility of the system configuration information, the system configuration history information can also be returned to the instruction originating node, and the instruction originating node verifies the system configuration information based on the system configuration history information.
在一个实施例中,考虑到在主节点宕机或作恶的情况下,主节点不发起提议、或发起错误的提议会导致各节点无法达成共识,因此需要切换主节点,即视图切换。In one embodiment, considering that when the master node is down or doing evil, the master node does not initiate a proposal, or initiates a wrong proposal, which will cause the nodes to fail to reach a consensus. Therefore, it is necessary to switch the master node, that is, view switching.
因此,任一从节点在检测到满足视图切换条件的情况下,可以向本地维护的成员节点集合中的成员节点广播视图切换指令;所述视图切换消息中携带目标系统配置编号。其中,视图切换条件可以是检测到足够长的时间内没有检测到主节点的心跳、或在指定的时间内没有完成共识过程。本说明书对此不进行限定,相关内容可以参照PBFT共识方法。Therefore, when any slave node detects that the view switching condition is met, it can broadcast a view switching instruction to the member nodes in the locally maintained member node set; the view switching message carries the target system configuration number. Among them, the view switching condition can be that the heartbeat of the master node is not detected for a long enough time, or the consensus process is not completed within the specified time. This manual does not limit this, and the relevant content can refer to the PBFT consensus method.
任一从节点在接收到其他节点广播的视图切换消息后,根据所述目标系统配置编号对该视图切换消息进行转发;Any slave node forwards the view switching message according to the target system configuration number after receiving the view switching message broadcast by other nodes;
具体可以是:任一从节点在接收到其他节点广播的视图切换消息后,若确定该视图切换消息中的目标系统配置编号小于本地系统配置编号,且本地系统配置编号对应的成员节点多于该目标系统配置编号对应的成员节点,则向第一节点转发所述视图切换消息;其中所述第一节点包括在本地系统配置的成员节点集合中,但不在目标系统配置的成员节点集合中的节点;Specifically, if any slave node receives the view switching message broadcast by other nodes, if it determines that the target system configuration number in the view switching message is smaller than the local system configuration number, and the local system configuration number corresponds to more member nodes than the The member node corresponding to the target system configuration number forwards the view switching message to the first node; wherein the first node is included in the member node set of the local system configuration, but not in the node of the target system configuration member node set ;
如图6所示,例如,目标系统配置编号为MC’,本地系统配置编号为Mc,且本地系统配置编号对应的成员节点为A、B、C、D、E、F、G。目标系统配置编号对应的成员节点为A、B、C、D,则向E、F、G转发所述视图切换消息,以使未收到视图切换消息的E、F、G也可以接收到该视图切换消息从而进入视图切换状态。As shown in Figure 6, for example, the target system configuration number is MC', the local system configuration number is Mc, and the member nodes corresponding to the local system configuration numbers are A, B, C, D, E, F, G. The member nodes corresponding to the target system configuration numbers are A, B, C, and D, then forward the view switch message to E, F, and G, so that E, F, and G that have not received the view switch message can also receive the view switch message. view switching message to enter the view switching state.
若确定该视图切换消息中的目标系统配置编号大于本地系统配置编号,则将本地系统配置更新至所述目标系统配置编号对应的系统配置,在本地本轮已发送过视图切换消息的情况下,将该视图切换消息转发至第二节点,所述第二节点为包括在目标系统配置的成员节点集合中,但不在本地系统配置的成员节点集合中的节点;If it is determined that the target system configuration number in the view switching message is greater than the local system configuration number, then the local system configuration is updated to the system configuration corresponding to the target system configuration number. Forwarding the view switching message to a second node, the second node being a node included in the set of member nodes configured by the target system but not in the set of member nodes configured by the local system;
在本地未发送过视图切换消息的情况下,将所述视图切换消息转发至目标系统配置编号对应的节点。If the view switching message has not been sent locally, the view switching message is forwarded to the node corresponding to the target system configuration number.
如图7所示,例如,目标系统配置编号为MC’,本地系统配置编号为MC,且目标系统配置编号对应的成员节点为A、B、C、D、E、F、G。本地系统配置编号对应的成员节点为A、B、C、D,则将本地系统配置更新后,如果本地未发送过针对当前主节点的视图切换的消息,则向A、B、C、D、E、F、G发送视图切换消息,如果发送过针对当前主节点的视图切换的消息,则向E、F、G发送视图切换消息,以使E、F、G也可以接收到视图切换的消息。As shown in Figure 7, for example, the target system configuration number is MC', the local system configuration number is MC, and the member nodes corresponding to the target system configuration number are A, B, C, D, E, F, G. The member nodes corresponding to the local system configuration number are A, B, C, and D. After updating the local system configuration, if no message for the current master node’s view switch has been sent locally, send the message to A, B, C, D, E, F, and G send view switching messages. If they have sent a view switching message for the current master node, they will send a view switching message to E, F, and G, so that E, F, and G can also receive the view switching message .
主节点在接收到本地维护的系统配置中成员节点集合中2/3的节点发送的视图切换消息的情况下,向本地维护的系统配置中的全部成员节点广播新视图消息,以使所述系统配置的成员节点集合中的节点进入新视图。可以理解的是,这里的主节点是指筛选出的新的主节点而非原来的主节点,例如可以是对各个节点排序,按序切换主节点,如果上一视图中节点1为主节点,则当前将节点2作为新的主节点。When the master node receives the view switching message sent by 2/3 nodes in the set of member nodes in the locally maintained system configuration, it broadcasts a new view message to all member nodes in the locally maintained system configuration, so that the system Nodes in the configured set of member nodes enter the new view. It can be understood that the master node here refers to the new master node selected instead of the original master node. For example, it can sort each node and switch the master node in order. If node 1 in the previous view is the master node, Then node 2 is currently used as the new primary node.
即主节点在接收到超过足够多的成员节点广播的视图切换消息后,向成员节点广播新视图消息。当然为了确定新视图消息的合法性,各个从节点需要验证新视图消息,具体的验证过程也可以参照PBFT共识方法,这里不进行详述。That is, the master node broadcasts a new view message to the member nodes after receiving the view switch message broadcast by more than enough member nodes. Of course, in order to determine the legitimacy of the new view message, each slave node needs to verify the new view message. The specific verification process can also refer to the PBFT consensus method, which will not be described in detail here.
在一个实施例中,在视图切换条件还可以包括:在针对共识提议达成共识后,且所述共识提议中包括成员配置指令。即每当各个共识节点对本地系统配置信息进行更新后,则进行视图切换。采用这种方式的同时,由于重新选择出的主节点会向新视图中的各个节点返回新视图消息,其中携带新系统配置信息,各个节点可以根据主节点发送的系统配置信息更新本地的系统配置信息,因此,在上述共识过程中,各个成员节点在确定对共识提议达成共识后,可以不向本次更新新增加的节点返回系统配置历史消息,而是等到视图切换后,由主节点向新视图中的节点发送历史消息,同时由于每次有成员增减均进行视图切换,因此也不需要设立临时成员组,即不需要将共识消息发送给临时成员。In an embodiment, the view switching condition may further include: after a consensus is reached on the consensus proposal, and the consensus proposal includes a member configuration instruction. That is, whenever each consensus node updates the local system configuration information, it switches views. While using this method, since the re-selected master node will return a new view message to each node in the new view, which carries new system configuration information, each node can update the local system configuration according to the system configuration information sent by the master node Therefore, in the above consensus process, each member node may not return the system configuration history message to the newly added node in this update after it is determined to reach a consensus on the consensus proposal, but wait until the view is switched, and the master node sends the new The nodes in the view send historical messages, and since the view is switched every time there is a member increase or decrease, there is no need to set up a temporary member group, that is, there is no need to send consensus messages to the temporary members.
在一个实施例中,任一从节点在共识过程中,若确定满足视图切换条件,则获取系统配置信息。其中,该从节点获取系统配置消息的方式可以参照上文描述的内容,即可以向信息存储节点获取,本说明书对此不进行限定。In one embodiment, during the consensus process, any slave node acquires system configuration information if it determines that the view switching condition is met. Wherein, the manner of obtaining the system configuration message from the slave node may refer to the content described above, that is, it may be obtained from the information storage node, which is not limited in this specification.
进一步比较获取的系统配置信息中的系统配置编号与本地维护的系统配置编号,若获取的系统配置编号与本地维护的系统配置编号相同,则执行视图切换过程,即可以向本地维护的成员节点集合中的成员节点广播视图切换指令。若获取的系统配置编号大于本地维护的系统配置编号,则进一步向获取的系统配置编号对应的成员节点集合中的成员节点广播历史数据获取消息<UPDATE,s,c,i>,该历史数据获取消息中携带该节点本地维护的系统配置编号c。Further compare the system configuration number in the obtained system configuration information with the locally maintained system configuration number, if the obtained system configuration number is the same as the locally maintained system configuration number, perform the view switching process, that is, the member nodes that are locally maintained can be aggregated The member nodes in broadcast the view switching command. If the obtained system configuration number is greater than the locally maintained system configuration number, further broadcast the historical data acquisition message <UPDATE, s, c, i> to the member nodes in the member node set corresponding to the obtained system configuration number, and the historical data acquisition The message carries the system configuration number c maintained locally by the node.
该成员节点集合中的任一成员节点,在接收到历史数据获取消息后,若确定其中携带的系统配置编号小于本地系统配置编号,且发送该历史数据获取消息的节点为本地维护的成员节点集合中的节点,则向该节点返回针对该历史数据获取消息的响应消息<RESULT,hist>,其中该响应消息中携带该成员节点 执行的所有共识提议hist,即该消息中RESULT为消息类型标识,hist为该成员节点的执行历史,即该成员节点执行的全部共识提议。Any member node in the member node set, after receiving the historical data acquisition message, if it is determined that the system configuration number carried in it is smaller than the local system configuration number, and the node sending the historical data acquisition message is a locally maintained member node set , then return to the node a response message <RESULT, hist> for the historical data acquisition message, where the response message carries all the consensus proposal hist executed by the member node, that is, the RESULT in the message is the message type identifier, hist is the execution history of the member node, that is, all consensus proposals executed by the member node.
该从节点在接收到该成员节点集合中1/3个成员节点返回的响应消息,且响应消息中携带的信息相同时,则根据响应消息对本地数据进行更新,即可以执行响应消息中的共识提议。When the slave node receives the response message returned by 1/3 of the member nodes in the member node set, and the information carried in the response message is the same, it will update the local data according to the response message, that is, the consensus in the response message can be implemented proposal.
本实施例中,在任一从节点若确定满足视图切换条件,首先,先要判断是否是自身的网络故障原因,而非其他节点的问题,因此其需要获取系统配置信息,如果本地系统配置信息与获取的系统配置信息一致,则说明并非是自身的问题,直接开始视图切换过程。如果获取的系统配置编号高于本地系统配置编号,则说明自己本地的数据已经落后于系统中的其他节点,则向系统中的其他节点获取历史数据对本地数据进行更新,在更新后可以继续参与共识过程,采用上述方式可以增强各节点的数据一致性,同时也可以有效减少进行视图切换的次数,进而节省了网络带宽。In this embodiment, if any slave node is determined to meet the view switching condition, first of all, it is necessary to judge whether it is the cause of its own network failure rather than other nodes, so it needs to obtain system configuration information. If the local system configuration information is consistent with If the obtained system configuration information is consistent, it means that it is not a problem with itself, and the view switching process starts directly. If the obtained system configuration number is higher than the local system configuration number, it means that your local data has lagged behind other nodes in the system, and you can obtain historical data from other nodes in the system to update the local data, and you can continue to participate after the update In the consensus process, the above method can enhance the data consistency of each node, and can also effectively reduce the number of view switching, thereby saving network bandwidth.
在目前通用的各种共识方法中,在成员节点动态变化的情况下,无法保证各个节点在共识阶段能够就共识提议顺利达成共识(因为各个节点维护的当前网络中的成员节点无法达成一致,也就无法接收到满足数量要求的共识消息),同理也无法保证在视图切换阶段可以顺利完成视图切换,即无法保证共识阶段以及视图切换阶段的活性。In the various consensus methods currently in use, in the case of dynamic changes in member nodes, it is impossible to guarantee that each node can successfully reach a consensus on the consensus proposal during the consensus stage (because the member nodes in the current network maintained by each node cannot reach a consensus, nor It is impossible to receive consensus messages that meet the quantity requirements), and similarly, there is no guarantee that the view switch can be successfully completed during the view switching phase, that is, the activity of the consensus phase and the view switching phase cannot be guaranteed.
本说明书中,引入系统配置信息以及系统配置历史信息,能够让各个节点获知当前区块链网络中的最新的成员节点信息,共识过程中可以保证系统配置中的正确节点都拥有一致的状态,因此,可以在成员节点动态变化时,保证视图切换阶段以及共识阶段的活性。In this manual, the introduction of system configuration information and system configuration history information enables each node to know the latest member node information in the current blockchain network. During the consensus process, it can ensure that the correct nodes in the system configuration have a consistent state, so , which can ensure the activity of the view switching phase and the consensus phase when the member nodes change dynamically.
若一个正确节点提交了指令m,该正确节点可以根据有效的系统配置历史验证当前系统配置,从而判定是否有足够多的共识节点接收了m,关于m的共识是否达成。If a correct node submits the command m, the correct node can verify the current system configuration based on the effective system configuration history, so as to determine whether there are enough consensus nodes to receive m, and whether the consensus on m is reached.
上述两者结合,确保该正确节点可以获得关于m的正确回复。因此协议可实现一致接收性(consistent delivery),并在成员节点动态变化时,保证视图切换阶段以及共识阶段的安全性与活性。其中,一致接收性(consistent delivery)是指如果一个正确的节点提交一个指令m,那么这个节点一定会收到关于m的回复,且该回复与m被处理的那个系统配置中产生的回复一致。例如,某个节点在系统配置编号为c的区块链网络中发送了指令m,在系统配置编号为c’中的节点返回的回复,与系统配置编号为c中节点返回的回复是一致的。The combination of the above two ensures that the correct node can obtain the correct reply about m. Therefore, the protocol can achieve consistent delivery, and ensure the security and activity of the view switching phase and the consensus phase when the member nodes change dynamically. Among them, consistent delivery means that if a correct node submits a command m, then this node will definitely receive a reply about m, and the reply is consistent with the reply generated in the system configuration where m is processed. For example, if a node sends command m in the blockchain network with system configuration number c, the reply returned by the node in system configuration number c' is consistent with the reply returned by the node in system configuration number c .
为了更为清楚的了解本方案,下面从单侧的角度对本说明书提出的共识方法进行说明,对于指令发起节点而言,其主要执行的任务如下:In order to understand this solution more clearly, the consensus method proposed in this specification is described below from a one-sided perspective. For the instruction originating node, its main tasks are as follows:
获取系统配置信息;Obtain system configuration information;
根据获取的系统配置信息对本地系统配置信息进行更新,并根据更新后的系统配置信息向区块链网络中的至少部分成员节点广播指令,以使区块链网络生成包括所述指令的共识提议并对所述共识提议进行共识处理;其中,指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或退出所述区块链网络。Update the local system configuration information according to the obtained system configuration information, and broadcast instructions to at least some member nodes in the blockchain network according to the updated system configuration information, so that the blockchain network generates a consensus proposal including the instructions And carry out consensus processing on the consensus proposal; wherein, the instruction includes a member configuration instruction or a general instruction, and the member configuration instruction is used to instruct the node originating the instruction to join or withdraw from the blockchain network.
对于区块链网络中的主节点,其主要执行的任务包括:For the master node in the blockchain network, its main tasks include:
在接收到指令发起节点发送的指令,且生成包括所述指令的共识提议后,协调其他节点对所述共识提议进行共识处理;其中所述指令包括成员配置指令或常规指令;After receiving the instruction sent by the instruction initiating node and generating a consensus proposal including the instruction, coordinate other nodes to perform consensus processing on the consensus proposal; wherein the instruction includes a member configuration instruction or a regular instruction;
在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。After a consensus is reached on the consensus proposal, if the consensus proposal includes a member configuration instruction, locally maintained system configuration information is updated according to the member configuration instruction.
对于区块链网络中的从节点,其主要执行的任务包括:For the slave nodes in the blockchain network, their main tasks include:
在接收到指令发起节点发送的指令后,对该指令进行转发处理;其中所述指令包括成员配置指令或常规指令;After receiving the instruction sent by the instruction originating node, the instruction is forwarded; wherein the instruction includes a member configuration instruction or a general instruction;
针对包括所述指令的共识提议进行共识处理;Consensus processing is performed on consensus proposals including said instructions;
在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。After a consensus is reached on the consensus proposal, if the consensus proposal includes a member configuration instruction, locally maintained system configuration information is updated according to the member configuration instruction.
下面从伪代码实现的角度,对本说明书提出的共识方法进行说明,本说明书中将上述共识方法命名为动态BFT共识方法Dyno。From the perspective of pseudo-code implementation, the consensus method proposed in this manual is described below. In this manual, the above-mentioned consensus method is named as the dynamic BFT consensus method Dyno.
在以下伪代码中,各字符所表示的含义如下:In the following pseudo-code, the meanings of each character are as follows:
pk:副本公钥、c:系统配置编号、fc:当前系统中1/3个节点、MC:系统配置成员节点集合、TM:临时成员节点集合、C:本地最新固定检查点、v:当前视图序号、s:共识提议的序号、P:本地存储的、序号高于C中最新指令的全部包的certificate,certificate:某共识提议被处理的有效证明或新提出指令的有效性证明,其中,针对某指令包即共识提议的certificate具体有两种可能:(1)某系统配置中超过2/3个节点对<PREPARE(准备),v,c,s,h(batch)>的消息签名;(2)某系统配置中超过1/3个节点对<COMMIT(保证),v,c,s,δ>的消息签名δ=h(batch)。PP:成员关系指令集合、ts:时间戳、o:指令发起节点提 出的操作、re:指令执行结果、V:viewchange消息集合、O:指令集合、h(batch):batch(共识提议)的hash值,有时也简记为δ、Π:共识系统中全部可能的共识节点(包含尚未加入或已退出的共识节点)、Chist:系统配置历史。Chist定义为一组按系统配置递增顺序排列的包含成员关系指令的batch。具体说来,Chist是全部共识batch集合的子集,只包含那些含有至少一个成员关系指令的batch。Chist中每一个batch对应的系统配置是递增的,且间隔为1。每一个replica(共识节点)针对chist中的每个batch都存储相应的certificate并包含在chist中。因此一个Chist的有效性可以被任意已知系统初始状态的副本或客户验证。Deliver(<TYPE>):某成员关系指令被递送。在BFT协议中,这一事件代表某副本完成了一轮共识,本地commit该指令。FailToDeliever(<TYPE>):某成员关系指令递送失败。在BFT协议中,这一事件代表在该指令被递送前,共识系统中发生了视图切换。pk: copy public key, c: system configuration number, fc: 1/3 nodes in the current system, MC: system configuration member node set, TM: temporary member node set, C: local latest fixed checkpoint, v: current view Serial number, s: the serial number of the consensus proposal, P: the certificate of all packages stored locally with a serial number higher than the latest instruction in C, certificate: a valid proof that a consensus proposal has been processed or a valid proof of a newly proposed instruction, among which, for There are two possibilities for a certain instruction package, namely the certificate of the consensus proposal: (1) More than 2/3 nodes in a certain system configuration sign the message of <PREPARE (preparation), v, c, s, h (batch)>; ( 2) In a certain system configuration, more than 1/3 nodes sign the message δ=h(batch) for <COMMIT (guarantee), v, c, s, δ>. PP: membership instruction set, ts: timestamp, o: operation proposed by the instruction originating node, re: instruction execution result, V: viewchange message set, O: instruction set, h(batch): batch (consensus proposal) hash Value, sometimes abbreviated as δ, Π: all possible consensus nodes in the consensus system (including consensus nodes that have not yet joined or exited), Chist: system configuration history. Chist is defined as a group of batches containing membership instructions arranged in increasing order of system configuration. Specifically, Chist is a subset of the set of all consensus batches, including only those batches that contain at least one membership directive. The system configuration corresponding to each batch in Chist is incremental, and the interval is 1. Each replica (consensus node) stores a corresponding certificate for each batch in the chist and includes it in the chist. Thus the validity of a Chist can be verified by any replica or client of the known initial state of the system. Deliver(<TYPE>): A membership command is delivered. In the BFT protocol, this event represents that a copy has completed a round of consensus, and the instruction is committed locally. FailToDeliever(<TYPE>): Failed to deliver a certain membership order. In the BFT protocol, this event represents a view switch in the consensus system before the instruction was delivered.
对于指令发起节点而言,其获取系统配置信息时的伪代码如下:For the command initiating node, the pseudo code for obtaining system configuration information is as follows:
一种获取方式如下:One way to get it is as follows:
Figure PCTCN2022111013-appb-000001
Figure PCTCN2022111013-appb-000001
上述伪代码中,其发生条件与具体操作如下:In the above pseudo code, the occurrence conditions and specific operations are as follows:
1)节点pi运行ObtainConfig()函数,则:1) Node pi runs the ObtainConfig() function, then:
a)Pi向全部可能的共识节点广播<DISCOVER,c>消息,c是pi已知的最新系统配置。随后pi设置计时器,在计时器时间内持续等待。a) Pi broadcasts a <DISCOVER, c> message to all possible consensus nodes, where c is the latest system configuration known to pi. Then pi sets a timer and waits continuously within the timer time.
b)若pi收到<CONF,c’,Mc’,chist’>消息,其中chist’是有效的系统配置历史,且c’>c,则pi更新其本地配置历史chist,系统配置c及配置成员集合Mc。b) If pi receives <CONF,c',Mc',chist'> message, where chist' is a valid system configuration history, and c'>c, then pi updates its local configuration history chist, system configuration c and configuration Member set Mc.
c)计时器结束时,返回当前系统配置c及配置成员集合Mc。c) When the timer ends, return the current system configuration c and configuration member set Mc.
2)共识节点pi收到<DISCOVER,c’>消息,则向消息发送者返回<CONF,c,Mc,chist>消息。2) Consensus node pi receives <DISCOVER, c’> message, and returns <CONF, c, Mc,chist> message to the message sender.
另一种获取系统配置信息的方式如下:Another way to obtain system configuration information is as follows:
Figure PCTCN2022111013-appb-000002
Figure PCTCN2022111013-appb-000002
上述伪代码中,其发生条件与具体操作如下:In the above pseudo code, the occurrence conditions and specific operations are as follows:
节点pi运行ObtainConfig()函数,则函数返回nil,Π。其中,nil为空,Π为网络环境中全部节点。Node pi runs the ObtainConfig() function, and the function returns nil, Π. Among them, nil is empty, and Π is all nodes in the network environment.
又一种获取系统配置信息的方式如下:Another way to obtain system configuration information is as follows:
Figure PCTCN2022111013-appb-000003
Figure PCTCN2022111013-appb-000003
Figure PCTCN2022111013-appb-000004
Figure PCTCN2022111013-appb-000004
上述伪代码中,其发生条件与具体操作如下:In the above pseudo code, the occurrence conditions and specific operations are as follows:
1)共识节点pi运行ObtainConfig()函数,则:1) The consensus node pi runs the ObtainConfig() function, then:
a)Pi向配置管理器cMaster发送<QUERY,cid>消息,随后pi设置计时器,在计时器时间内持续等待。a) Pi sends a <QUERY, cid> message to the configuration manager cMaster, then pi sets a timer and waits continuously within the timer time.
b)若pi收到<CONF,c’,Mc’,chist’>消息,其中chist’是有效的系统配置历史,且c’>c,则pi更新其本地配置历史chist,系统配置c及配置成员集合Mc,函数返回c,Mc。b) If pi receives <CONF,c',Mc',chist'> message, where chist' is a valid system configuration history, and c'>c, then pi updates its local configuration history chist, system configuration c and configuration Member set Mc, the function returns c,Mc.
c)Pi发生超时,则再次运行ObtainConfig()函数。c) If Pi timeout occurs, run the ObtainConfig() function again.
2)cMaster收到<QUERY,j>消息,则向消息发送者返回<CONF,c,Mc,chist>消息。2) cMaster receives <QUERY, j> message, then returns <CONF, c, Mc, Chist> message to the message sender.
3)cMaster收到2/3个<COMMIT,v,c,s,h(batch)>消息,则令chist←chist∪M,依照batch中包含的成员关系指令(如果有)更新系统配置c和Mc。3) cMaster receives 2/3 <COMMIT, v, c, s, h(batch)> messages, then order chist←chist∪M to update the system configuration c and Mc.
对于指令发起节点而言,其发送指令和接收成员节点返回消息后的处理方式的伪代码如下:For the instruction initiating node, the pseudocode of the processing method after sending the instruction and receiving the message returned by the member node is as follows:
Figure PCTCN2022111013-appb-000005
Figure PCTCN2022111013-appb-000005
Figure PCTCN2022111013-appb-000006
Figure PCTCN2022111013-appb-000006
指令发起节点发起指令后,后续流程根据指令发起节点发出的指令不同分为以下3种:After the instruction originating node initiates the instruction, the follow-up process is divided into the following three types according to the instructions issued by the instruction originating node:
1)加入指令:指令发起节点pi通过ObtainConfig()函数获得当前最新系统配置(ObtainConfig()是黑盒实现的,具体函数不确定。此处可简单设置为输出(0,Π)),向该系统配置中全部节点广播其签名的<SUBMIT,c,<JOIN,pk>>指令并设置计时器。pi在计时器时间内持续等待,有以下三种情况:1) Adding instructions: the instruction originating node pi obtains the latest system configuration through the ObtainConfig() function (ObtainConfig() is implemented by a black box, and the specific function is uncertain. Here it can be simply set as the output (0, Π)), to the All nodes in the system configuration broadcast their signed <SUBMIT,c,<JOIN,pk>>command and set a timer. pi continues to wait within the timer time, there are three situations as follows:
a)pi收到<CONF,c’,Mc’,chist’>,c<c’且chist’是有效的,则pi更新其系统配置。其中,CONF标识该指令类型,c’为该指令的发送方的系统配置编号,Mc’为该指令的发送方的系统配置成员节点集合,chist’为该指令的发送方的系统配置历史信息。a) pi receives <CONF,c’,Mc’,chist’>, if c<c’ and chist’ is valid, then pi updates its system configuration. Among them, CONF identifies the command type, c' is the system configuration number of the sender of the command, Mc' is the system configuration member node set of the sender of the command, and chist' is the system configuration history information of the sender of the command.
b)指令发起节点收到当前配置中超过2/3共识节点的<HISTORY,s,h,C,P>消息,状态传输完成。该客户加入当前系统配置,成为共识节点。计时器结束。b) The instruction initiating node receives <HISTORY, s, h, C, P> messages from more than 2/3 of the consensus nodes in the current configuration, and the state transmission is completed. The client joins the current system configuration and becomes a consensus node. The timer ends.
其中,<HISTORY,s,h,C,P>消息即为成员配置处理结果。HISTORY,标识该指令的类型,s用于标识共识提议,h为该共识提议的hash值,C为本地最新固定检查点,P为本地存储的,序号高于C中最新共识提议的全部提议的certificate,其中certificate为共识提议的证明。Among them, the <HISTORY, s, h, C, P> message is the member configuration processing result. HISTORY, identifies the type of the instruction, s is used to identify the consensus proposal, h is the hash value of the consensus proposal, C is the latest local fixed checkpoint, P is the local storage, and the sequence number is higher than all proposals of the latest consensus proposal in C certificate, where certificate is the proof of the consensus proposal.
c)超时,初始化运行上述过程。c) Timeout, initialize and run the above process.
2)离开指令:指令发起节点pi向当前系统配置中全部节点广播签名的<SUBMIT,c,<LEAVE,i>>指令并设置计时器,在计时器时间内持续等待,有以下两种情况:2) Leaving command: The command initiating node pi broadcasts the signed <SUBMIT,c,<LEAVE,i>>command to all nodes in the current system configuration and sets a timer, and waits continuously within the timer time. There are the following two situations:
a)指令发起节点Pi收集某指令集合共识提议batch的certificate,而且<REMOVE,i,m>∈batch,则pi离开共识系统,计时器结束。a) The instruction originating node Pi collects the certificate of a certain instruction set consensus proposal batch, and <REMOVE,i,m>∈batch, then pi leaves the consensus system and the timer ends.
b)超时,初始化运行上述过程。b) timeout, initialize and run the above process.
3)常规指令:指令发起节点pi通过ObtainConfig()函数获得当前最新系统配置(ObtainConfig()是黑盒实现的,具体函数不确定。此处可简单设置为输出(0,Π);向该系统配置中全部节点广播其签名的指令m=<SUBMIT,c,<REQUEST,cid,o,ts>>,cid是用户id,o是操作,ts是时间戳;并设置计时器。pi在计时器时间内持续等待,有以下三种情况:3) General instructions: the instruction originating node pi obtains the current latest system configuration through the ObtainConfig() function (ObtainConfig() is implemented by a black box, and the specific function is uncertain. Here it can be simply set as the output (0, Π); to the system In the configuration, all nodes broadcast their signature command m=<SUBMIT,c,<REQUEST,cid,o,ts>>, cid is the user id, o is the operation, ts is the timestamp; and set the timer. pi is in the timer There are three situations as follows:
a)pi收到本地系统配置中1/3节点返回的<REPLY,c,re>,则确定指令执行结束。其中REPLY标识消息类型,re为执行结果。a) When pi receives <REPLY, c, re> returned by 1/3 nodes in the local system configuration, it determines that the execution of the command is complete. Among them, REPLY identifies the message type, and re is the execution result.
b)pi收到本地系统配置中1/3节点返回的<REPLY,c’,re,chist’>,则确定指令执行结束。其中,chist’为指令发起方发送的系统配置历史信息。b) When pi receives the <REPLY, c’, re,chist’> returned by 1/3 nodes in the local system configuration, it determines that the execution of the command is over. Among them, chist' is the system configuration history information sent by the command initiator.
对于区块链网络中的成员节点而言,其执行的伪代码如下:For the member nodes in the blockchain network, the pseudo-code executed is as follows:
用户指令处理过程:User command processing process:
Figure PCTCN2022111013-appb-000007
Figure PCTCN2022111013-appb-000007
上述伪代码中,区块链中任一节点pi收到包含用户cid指令的submit消息m=<SUBMIT,c’,<REQUEST,cid,o,ts>>后开始执行以下操作。此时有三种情况:In the above pseudo-code, any node pi in the blockchain receives the submit message m=<SUBMIT,c’,<REQUEST,cid,o,ts>> that contains the user’s cid command and starts to perform the following operations. There are three situations at this point:
1)m已经被pi递送即处理了:则pi将包含当前状态的<REPLY,c,re,chist>消息发送给用户cid,re是最新执行结果。1) m has been delivered and processed by pi: then pi sends a <REPLY, c, re,chist> message containing the current state to user cid, and re is the latest execution result.
2)m没有被pi递送,c=c’;则pi将m发送给当前主节点leader,并将m存在指令队列queue即指令池中。2) m is not delivered by pi, c=c'; then pi sends m to the current master node leader, and stores m in the instruction queue queue, that is, the instruction pool.
3)m没有被pi递送,c>c’:则pi将m发送给当前系统配置中全部成员,并将m存在指令队列queue中。3) m is not delivered by pi, c>c': then pi sends m to all members in the current system configuration, and stores m in the command queue queue.
若pi是leader,pi需要额外打包queue中的用户指令成batch,并向临时成员组TM中全部成员广播预准备消息<PRE-PREPARE,v,c,s,batch>,v是当前视图序号。If pi is the leader, pi needs to pack user commands in the queue into batches, and broadcast a pre-preparation message <PRE-PREPARE,v,c,s,batch> to all members of the temporary member group TM, where v is the current view number.
a)对任意queue中的常规指令,直接存入共识提议batch中。a) For regular instructions in any queue, directly store them in the consensus proposal batch.
b)对任意queue中的加入指令m=<SUBMIT,c’,<JOIN,pk>>,为公钥为pk的节点分配成员序号j,生成成员加入指令<ADD,j,m>,将其存入batch,并将客户j存入TM。b) For the join command m=<SUBMIT,c',<JOIN,pk>> in any queue, assign member number j to the node whose public key is pk, generate member join command <ADD,j,m>, and send it Deposit into batch, and deposit customer j into TM.
c)对任意queue中的加入指令m=<SUBMIT,c’,<LEAVE,j>>,生成节点移除指令<REMOVE,j,m>,将其存入batch。c) For the join command m=<SUBMIT,c’,<LEAVE,j>> in any queue, generate a node removal command <REMOVE,j,m>, and store it in the batch.
共识过程:Consensus process:
Figure PCTCN2022111013-appb-000008
Figure PCTCN2022111013-appb-000008
上述伪代码中,区块链中节点pi收到有效的pre-prepare消息m=<PRE-PREPARE,v,c,s,batch>。后开始运行共识过程,pi随后进行如下操作:In the above pseudo-code, the node pi in the blockchain receives a valid pre-prepare message m=<PRE-PREPARE,v,c,s,batch>. After starting to run the consensus process, pi then performs the following operations:
1)对任意batch中的<ADD,j,m’>指令,pi将pj存入TM,如果c>c’,向pj发送<CONF,c,Mc,chist>消息。1) For the <ADD, j, m’> instruction in any batch, pi stores pj in TM, and if c>c’, sends <CONF, c, Mc,chist> message to pj.
2)向TM广播<PREPARE,v,c,s,h(batch)>消息并持续等待。有以下三种情况:2) Broadcast <PREPARE, v, c, s, h(batch)> message to TM and keep waiting. There are three situations:
a)pi收到当前配置中超过2/3共识节点的<PREPARE,v,c,s,h(batch)>消息,将这些消息签名作为m的certificate存储下来,向TM广播<commit,v,c,s,δ>其中,δ为共识提议的hash值。a) pi receives <PREPARE, v, c, s, h (batch)> messages from more than 2/3 consensus nodes in the current configuration, stores these message signatures as the certificate of m, and broadcasts <commit, v, c, s, δ> Among them, δ is the hash value of the consensus proposal.
b)pi收到当前配置中超过1/3共识节点的<COMMIT,v,c,s,δ>消息,将这些消息签名作为batch的certificate存储下来,向TM广播<COMMIT,v,c,s,δ>b) pi receives <COMMIT, v, c, s, δ> messages from more than 1/3 consensus nodes in the current configuration, stores these message signatures as batch certificates, and broadcasts <COMMIT, v, c, s to TM ,δ>
c)pi收到当前配置中超过2/3共识节点的<COMMIT,v,c,s,δ>消息,运行deliver(batch)。c) pi receives <COMMIT, v, c, s, δ> messages from more than 2/3 consensus nodes in the current configuration, and runs deliver(batch).
在一个实施例中,上述共识过程中任一从节点,若确定超时,执行的共识方法本说明书命名为Dyno-A,其执行的伪代码如下:In one embodiment, if any slave node in the above consensus process is determined to be timed out, the consensus method executed in this specification is named Dyno-A, and the pseudo-code executed is as follows:
Figure PCTCN2022111013-appb-000009
Figure PCTCN2022111013-appb-000009
Figure PCTCN2022111013-appb-000010
Figure PCTCN2022111013-appb-000010
上述伪代码中,区块链中节点pi若发生超时,首先运行ObtainConfig()函数获得当前最新系统配置c’,Mc’。(ObtainConfig()是黑盒实现的,具体函数不确定。随后pi设置计时器并持续等待,有以下三种情况:In the above pseudo-code, if node pi in the blockchain times out, first run the ObtainConfig() function to obtain the current latest system configuration c’, Mc’. (ObtainConfig() is implemented in a black box, and the specific function is uncertain. Then pi sets the timer and waits continuously, there are the following three situations:
a)c’=c,此时pi运行viewchange()a) c'=c, at this time pi runs viewchange()
b)否则,pi向Mc’<UPDATE,s,c,i>消息并等待,若计时器时间内收到1/3个相同的<RESULT,hist>,则结束计时器,对hist中的全部指令运行deliver函数。b) Otherwise, pi sends a message to Mc'<UPDATE, s, c, i> and waits. If 1/3 of the same <RESULT, hist> is received within the timer time, the timer ends, and all The command runs the deliver function.
c)若pi发生超时,重新运行超时时的协议。c) If pi times out, re-run the protocol at the time of timeout.
成员节点若收到<UPDATE,s,c’,j>消息,若pj∈Mc’且c>c’,pi向pj发送<RESULT,hist>消息。If the member node receives <UPDATE, s, c’, j> message, if pj∈Mc’ and c>c’, pi sends <RESULT, hist> message to pj.
指令执行过程:Instruction execution process:
Figure PCTCN2022111013-appb-000011
Figure PCTCN2022111013-appb-000011
上述过程中,副本pi运行指令执行协议始于其运行deliver(batch)。pi随后进行如下操作:In the above process, the replica pi runs the instruction execution protocol starting from its running deliver(batch). pi then proceeds as follows:
1)对任意batch中的指令m,m’=m=<SUBMIT,c’,<REQUEST,cid,o,ts>>,如果c>c’,向cid发送<REPLY,c,re,chist>消息,否则向cid发送<REPLY,c,re>消息。1) For instruction m in any batch, m'=m=<SUBMIT,c',<REQUEST,cid,o,ts>>, if c>c', send <REPLY,c,re,chist> to cid message, otherwise send a <REPLY,c,re> message to cid.
2)如果batch中存在成员关系指令,更新pi本地系统配置c为c+1,并进行下述操作:2) If there is a membership instruction in the batch, update the pi local system configuration c to c+1, and perform the following operations:
a)对任意queue中的加入指令m=<ADD,j,m>,令Mc=Mc+pja) For the adding instruction m=<ADD,j,m> in any queue, let Mc=Mc+pj
b)对任意queue中的离开指令m=<REMOVE,j,m>,令Mc=Mc-pjb) For the leaving command m=<REMOVE,j,m> in any queue, let Mc=Mc-pj
c)更新chist为chist∪batchc) Update Chist to Chist∪batch
d)向Mc-Mc-1中的全部节点发送<HISTORY,s,h,C,P>消息,其中C是最新固定检查点;P是pi存储的,序号高于C中最新包即共识提议的全部包的certificate。此处要求副本pi将序号低于batch的全部指令区块都commit才发送History消息。d) Send <HISTORY, s, h, C, P> messages to all nodes in Mc-Mc-1, where C is the latest fixed checkpoint; P is stored by pi, and the sequence number is higher than the latest package in C, which is the consensus proposal The certificate of all packages. Here, the replica pi is required to commit all command blocks with sequence numbers lower than the batch before sending the History message.
视图切换过程如下:The view switching process is as follows:
Figure PCTCN2022111013-appb-000012
Figure PCTCN2022111013-appb-000012
Figure PCTCN2022111013-appb-000013
Figure PCTCN2022111013-appb-000013
区块链网络中节点pi运行视图切换过程有三种情况:There are three situations in which the node pi runs the view switching process in the blockchain network:
1)pi在发生超时时(即它在足够长的时间内没有递送新消息)或在接收到至少1/3个节点发送的有效的视图切换消息时触发视图切换指令。1) pi triggers a view switching instruction when a timeout occurs (i.e. it has not delivered a new message for a long enough time) or when it receives valid view switching messages sent by at least 1/3 nodes.
此时,pi更新其视图v=v+1,并向Mc广播m=m’=<VIEW-CHANGE,v,c,C,P,PP,i>其中,PPAt this point, pi updates its view v=v+1, and broadcasts m=m'=<VIEW-CHANGE,v,c,C,P,PP,i> to Mc where PP
为成员关系指令集合。A collection of membership directives.
2)Pi收到m’=<VIEW-CHANGE,v,c’,C,P,PP,j>消息:2) Pi receives m'=<VIEW-CHANGE,v,c',C,P,PP,j> message:
若c’<c,pi将这一消息转发给Mc-Mc’中的全部副本。If c'<c, pi forwards the message to all replicas in Mc-Mc'.
若c’>c,pi更新其系统配置c与M,随后有两种情况:若pi在当前轮发送过视图切换消息,则额外将其视图切换消息发送给Mc-Mc’中全部节点,或者,若pi未发送过视图切换消息,将发送视图切换消息给Mc的中全部节点。If c'>c, pi updates its system configuration c and M, then there are two situations: if pi has sent a view switching message in the current round, it will additionally send its view switching message to all nodes in Mc-Mc', or , if pi has not sent a view switching message, it will send a view switching message to all nodes in Mc.
3)Pi收到当前系统配置中超过2/3的<VIEW-CHANGE,v,c’,C,P,j>消息,且pi是这些消息中最新系统配置中的领导人,则pi将向Mc所有副本发送<NEW-VIEW,v,c,V,O>消息,并进入新视图。3) Pi receives more than 2/3 of the <VIEW-CHANGE, v, c', C, P, j> messages in the current system configuration, and pi is the leader in the latest system configuration in these messages, then pi will send All replicas of Mc send <NEW-VIEW, v, c, V, O> messages and enter the new view.
可以理解的是,上述共识方法不仅可以应用到区块链网络中,还可以应用到其他应用场景中,如,有固定数量服务器节点的系统中,用于系统恢复和重新配置,当系统中某些服务器死机、出错或者受到了攻击时,或者系统需要维护时,可以通过创建一个新的节点或移除一个旧的节点来实现。It is understandable that the above consensus method can be applied not only to the blockchain network, but also to other application scenarios, for example, in a system with a fixed number of server nodes, it is used for system recovery and reconfiguration. When some servers crash, have errors or are attacked, or when the system needs maintenance, it can be achieved by creating a new node or removing an old node.
当在需要主动恢复时,也可以使用上述方式,例如当系统中的多个节点受病毒的影响无法去除掉时,可以采用上述方式引入新的节点,因为新的节点都是新的操作系统和环境,没有被病毒感染,也可以利用上述方式去除掉一些旧的节点。When active recovery is required, the above method can also be used. For example, when multiple nodes in the system are affected by viruses and cannot be removed, the above method can be used to introduce new nodes, because the new nodes are all new operating systems and If the environment is not infected by viruses, you can also use the above method to remove some old nodes.
在联盟链网络中,各个联盟成员在需要动态变化时,如A公司退出,B公司加入也可以采用上述共识方法,同样在混合链中也可以采用上述共识方法。In the consortium chain network, when each consortium member needs to change dynamically, such as company A withdrawing and company B joining, the above consensus method can also be used, and the above consensus method can also be used in the hybrid chain.
与前述一种基于区块链网络的共识方法相对应,本说明书还提供了一种基于区块链网络的共识系统,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括所述区块链网络的成员节点集合以及用于标识系统配置的系统配置编号;所述系统包括:Corresponding to the aforementioned consensus method based on a blockchain network, this specification also provides a consensus system based on a blockchain network, where any consensus node in the blockchain network maintains system configuration information locally, The system configuration information includes a set of member nodes of the blockchain network and a system configuration number used to identify the system configuration; the system includes:
指令发起节点,用于获取系统配置信息;The instruction originating node is used to obtain system configuration information;
所述指令发起节点,还用于根据获取的系统配置信息对本地系统配置信息进行更新,并根据更新后的系统配置信息向区块链网络中的至少部分成员节点广播指令,以使区块链网络生成包括所述指令的共识提议并对所述共识提议进行共识处理;其中,指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或退出所述区块链网络;The instruction initiating node is also used to update the local system configuration information according to the acquired system configuration information, and broadcast instructions to at least some member nodes in the block chain network according to the updated system configuration information, so that the block chain The network generates a consensus proposal including the instruction and performs consensus processing on the consensus proposal; wherein, the instruction includes a member configuration instruction or a general instruction, and the member configuration instruction is used to indicate that the instruction originating node joins or withdraws from the blockchain network;
区块链网络中任一成员节点,用于在确定针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。Any member node in the blockchain network is configured to update locally maintained system configuration information according to the member configuration instruction after determining that a consensus has been reached on the consensus proposal, if the consensus proposal includes a member configuration instruction.
在一个实施例中,指令发起节点,用于向信息存储节点发送系统配置获取请求;In one embodiment, the instruction initiating node is configured to send a system configuration acquisition request to the information storage node;
信息存储节点,用于向指令发起节点返回系统配置信息。The information storage node is used to return the system configuration information to the instruction originating node.
在一个实施例中,所述信息存储节点包括区块链网络中的成员节点;In one embodiment, the information storage node includes a member node in the blockchain network;
指令发起节点,具体用于向包括至少一个区块链网络成员节点的节点集合广播系统配置获取请求。The instruction initiating node is specifically configured to broadcast a system configuration acquisition request to a node set including at least one block chain network member node.
在一个实施例中,所述信息存储节点包括区块链网络中或区块链网络外一指定节点;所述指令发起节点,具体用于向所述指定节点发送系统配置信息获取请求。In one embodiment, the information storage node includes a designated node in or outside the blockchain network; the instruction initiating node is specifically configured to send a system configuration information acquisition request to the designated node.
在一个实施例中,所述信息存储节点,用于向指令发起节点返回获取请求响应消息,所述响应消息中携带系统配置信息以及系统配置历史信息。In one embodiment, the information storage node is configured to return an acquisition request response message to the instruction initiating node, and the response message carries system configuration information and system configuration history information.
在本实施例中,所述指令发起节点,用于根据该系统配置历史信息对获取的系统配置信息进行验证,在验证通过,且获取的系统配置信息中的系统配置编号大于本地维护的系统配置编号,则根据获取的系统配置信息对本地系统配置进行更新。In this embodiment, the instruction initiating node is configured to verify the obtained system configuration information according to the system configuration history information, and if the verification passes, and the system configuration number in the obtained system configuration information is greater than the locally maintained system configuration number, the local system configuration is updated according to the obtained system configuration information.
在一个实施例中,所述指令发起节点以预定义网络中的全部节点组成的集合作为系统配置信息中的成员节点集合,并以预定义值作为系统配置编号。In one embodiment, the instruction initiating node uses a set of all nodes in the predefined network as the member node set in the system configuration information, and uses a predefined value as the system configuration number.
在一个实施例中,所述区块链网络中的任一从节点,用于在接收到该指令后,对该指令进行转发处理;In one embodiment, any slave node in the blockchain network is configured to forward the instruction after receiving the instruction;
所述区块链网络中的主节点,用于在接收到所述指令,且生成包括所述指令的共识提议后,协调其他节点对所述共识提议进行共识处理。The master node in the blockchain network is configured to coordinate other nodes to perform consensus processing on the consensus proposal after receiving the instruction and generating a consensus proposal including the instruction.
在一个实施例中,所述指令中携带系统配置编号,用于标识所述指令所针对的系统配置;所述区块 链网络中任一从节点,用于在本地未执行该指令的情况下,若确定该系统配置编号与本地存储的系统配置编号相同,则将所述成员配置指令转发至主节点;若确定该系统配置编号小于本地存储的系统配置编号,则将所述指令转发至本地维护的成员节点集合中的成员节点;在本地执行了该指令的情况下,将执行结果以及系统配置历史信息返回给该指令发起节点。In one embodiment, the instruction carries a system configuration number, which is used to identify the system configuration targeted by the instruction; any slave node in the blockchain network is used to execute the instruction locally if the instruction is not executed locally. , if it is determined that the system configuration number is the same as the system configuration number stored locally, then forward the member configuration instruction to the master node; if it is determined that the system configuration number is smaller than the system configuration number stored locally, then forward the instruction to the local A member node in the maintained member node set; when the instruction is executed locally, the execution result and system configuration history information are returned to the instruction originating node.
在一个实施例中,所述主节点,还用于在接收到指令后,将指令在本地指令池中进行存储;从本地指令池中获取预设数量的指令;针对所述预设数量的指令中的任一成员配置指令,若所述成员配置指令用于指示将发起所述指令的指令发起节点加入区块链网络,则为该指令发起节点分配成员节点序号,将所述成员节点序号以及所述成员配置指令组合为成员加入指令;若所述成员配置指令用于指示将发起所述指令的指令发起节点从区块链网络退出,则将该指令发起节点的成员节点序号以及所述成员配置指令组合为成员退出指令;针对所述预设数量的指令,将成员加入指令、成员退出指令和常规指令打包为共识提议。In one embodiment, the master node is further configured to store the instructions in the local instruction pool after receiving the instructions; obtain a preset number of instructions from the local instruction pool; In any member configuration instruction, if the member configuration instruction is used to indicate that the instruction initiating node that initiates the instruction will join the blockchain network, then assign a member node serial number to the instruction initiating node, and assign the member node serial number and The member configuration instruction is combined into a member joining instruction; if the member configuration instruction is used to indicate that the instruction initiating node that will initiate the instruction withdraws from the blockchain network, the member node serial number of the instruction initiating node and the member node The configuration instructions are combined into a member exit instruction; for the preset number of instructions, the member join instruction, member exit instruction and regular instructions are packaged into a consensus proposal.
在一个实施例中,所述主节点,还用于在为该指令发起节点分配成员序号后,将该指令发起节点加入到临时成员集合中;所述临时成员集合中包括本地系统配置中的全部成员节点;基于所述共识提议向临时成员集合中的节点广播预准备消息;In one embodiment, the master node is further configured to add the instruction initiating node to the temporary member set after allocating the member serial number to the instruction initiating node; the temporary member set includes all Member nodes; broadcast a pre-preparation message to nodes in the temporary member set based on the consensus proposal;
任一从节点,用于在接收到有效的预准备消息后,针对所述共识提议中的成员加入指令,将该成员加入指令中的成员节点序号加入到本地的临时成员集合中,并向本地临时成员集合中的节点广播针对所述共识提议的准备消息;所述准备消息中携带所述从节点的签名;Any slave node, after receiving a valid pre-preparation message, for the member joining instruction in the consensus proposal, add the member node serial number in the member joining instruction to the local temporary member set, and send the local Nodes in the temporary member set broadcast a preparation message for the consensus proposal; the preparation message carries the signature of the slave node;
任一成员节点,用于在接收到本地系统配置的成员节点集合中2/3成员节点广播的针对所述共识提议的准备消息后,将接收到的准备消息的签名作为该共识提议的证明进行存储,并广播针对所述共识提议的承诺消息,或,在接收到本地系统配置的成员节点集合中1/3成员节点广播的针对所述共识提议的承诺消息后,将接收到的承诺消息的签名作为该共识提议的证明进行存储,并广播针对所述共识提议的承诺消息;其中,所述承诺消息中携带所述节点的签名;在收到本地系统配置的成员节点集合中2/3成员节点广播的针对所述共识提议的承诺消息后,确定针对所述共识提议达成共识,执行所述共识提议。Any member node, after receiving the preparation message for the consensus proposal broadcast by 2/3 member nodes in the member node set configured by the local system, take the signature of the received preparation message as the proof of the consensus proposal Store and broadcast the commitment message for the consensus proposal, or, after receiving the commitment message for the consensus proposal broadcast by 1/3 member nodes in the set of member nodes configured by the local system, the received commitment message The signature is stored as a proof of the consensus proposal, and a commitment message for the consensus proposal is broadcast; wherein, the commitment message carries the signature of the node; 2/3 of the member nodes in the set of member nodes that have received the local system configuration After the node broadcasts a commitment message for the consensus proposal, it is determined that a consensus is reached for the consensus proposal, and the consensus proposal is executed.
在一个实施例中,任一从节点还用于,将成员加入指令中的成员节点序号加入到临时成员组后,在成员加入指令中携带的系统配置编号小于本地系统配置号的情况下,向该成员节点序号对应的指令发起节点发送本地系统配置信息以及系统配置历史信息;In one embodiment, any slave node is also used to, after adding the member node serial number in the member joining instruction to the temporary member group, if the system configuration number carried in the member joining instruction is smaller than the local system configuration number, send The instruction originating node corresponding to the member node serial number sends local system configuration information and system configuration history information;
所述指令发起节点,还用于在接收到该系统配置信息以及系统配置历史信息后,根据该系统配置历史信息对接收到的系统配置信息进行验证,并在验证通过后,根据接收到的系统配置历史信息对本地系统配置信息进行更新;所述系统配置历史信息为目标共识提议组成的集合,其中,目标共识提议为包括成员加入指令或成员退出指令的共识提议。The instruction initiating node is further configured to verify the received system configuration information according to the system configuration history information after receiving the system configuration information and the system configuration history information, and after the verification is passed, according to the received system configuration information The configuration history information updates the local system configuration information; the system configuration history information is a set of target consensus proposals, wherein the target consensus proposals are consensus proposals including member joining instructions or member exit instructions.
在一个实施例中,所述系统配置历史信息中包括每个目标共识提议的证明;In one embodiment, the system configuration history information includes a proof of each target consensus proposal;
所述指令发起节点,具体用于基于所述系统配置历史信息中的证明对目标提议进行验证,在对全部目标提议验证通过的情况下,确定所述系统配置历史信息以及所述系统配置信息通过验证。The instruction initiating node is specifically configured to verify the target proposal based on the proof in the system configuration history information, and determine that the system configuration history information and the system configuration information pass the verification if all target proposals pass the verification. verify.
在一个实施例中,区块链网络中任一节点,用于在针对所述共识提议达成共识后,针对所述共识提议中的任一成员加入指令,将所述成员加入指令中的成员节点序号加入到本地维护的系统配置信息中的成员节点集合中;针对所述共识提议中的任一成员退出指令,将所述成员退出指令中的成员节点序号,从到本地维护的系统配置信息中的成员节点集合中移除;将系统配置编号进行更新。In one embodiment, any node in the blockchain network is configured to, after reaching a consensus on the consensus proposal, add an instruction to any member in the consensus proposal, and add the member to the member node in the instruction The sequence number is added to the member node set in the locally maintained system configuration information; for any member exit instruction in the consensus proposal, the member node sequence number in the member exit instruction is added to the locally maintained system configuration information Removed from the set of member nodes; update the system configuration number.
在一个实施例中,区块链网络中任一节点,还用于将所述共识提议添加到系统配置历史信息中;向所述共识提议中包括的成员配置指令对应的发起节点返回成员配置处理结果;其中,所述成员配置指令用于指示将所述指令的指令发起节点加入到区块链网络中;In one embodiment, any node in the blockchain network is also used to add the consensus proposal to the system configuration history information; return the member configuration process to the initiating node corresponding to the member configuration instruction included in the consensus proposal Result; wherein, the member configuration instruction is used to indicate that the instruction originating node of the instruction is added to the block chain network;
任一成员配置指令的指令发起节点,还用于在接收到2/3成员节点发送的配置处理结果后,可以确定该指令执行完毕,确定本地加入所述区块链网络。The instruction originating node of any member configuration instruction is also used to determine that the instruction has been executed after receiving the configuration processing result sent by 2/3 member nodes, and determine to join the blockchain network locally.
在一个实施例中,任一成员配置指令的指令发起节点,还用于在共识过程中将共识提议的证明进行存储后,若所述成员配置指令包含在所述共识提议中,其中,所述成员配置指令用于指示将所述指令发起节点从所述区块链网络退出,则确定本地从所述区块链网络退出。In one embodiment, the instruction initiating node of any member configuration instruction is also used to store the proof of the consensus proposal during the consensus process, if the member configuration instruction is included in the consensus proposal, wherein the The member configuration instruction is used to instruct the instruction initiating node to withdraw from the blockchain network, and then it is determined to withdraw locally from the blockchain network.
在一个实施例中,任一成员配置指令的指令发起节点,还用于在确定共识提议被执行,且所述成员配置指令包含在所述共识提议中,其中,所述成员配置指令用于指示将所述指令发起节点从所述区块链网络退出,则确定本地从所述区块链网络退出。In one embodiment, the instruction initiating node of any member configuration instruction is also used to determine that the consensus proposal is executed, and the member configuration instruction is included in the consensus proposal, wherein the member configuration instruction is used to indicate If the instruction initiating node is withdrawn from the blockchain network, it is determined to locally withdraw from the blockchain network.
在一个实施例中,区块链网络中任一节点,还用于针对所述共识提议中的任一常规指令,在本地执行完成后,若确定该指令中的系统配置编号与本地的系统配置编号相同,则向该指令的指令发起节点返回处理结果;若确定该指令中的系统配置编号小于本地的系统配置编号,则向该指令的指令发起节点返回处理结果以及系统配置历史信息。In one embodiment, any node in the blockchain network is also used to determine that the system configuration number in the instruction is consistent with the local system configuration number after local execution of any conventional instruction in the consensus proposal If the numbers are the same, return the processing result to the instruction originating node of the instruction; if it is determined that the system configuration number in the instruction is smaller than the local system configuration number, then return the processing result and system configuration history information to the instruction originating node of the instruction.
在一个实施例中,任一从节点,还用于在检测到满足视图切换条件的情况下,获取系统配置信息;若获取的系统配置编号与本地维护的系统配置编号相同,则向本地维护的成员节点集合中的成员节点广播视图切换指令;若获取的系统配置编号大于本地维护的系统配置编号,则向获取的系统配置编号对应的成员节点集合中的成员节点广播历史数据获取消息;其中,所述历史数据获取消息中携带本地维护的系统配置编号;In one embodiment, any slave node is also used to obtain system configuration information when it detects that the view switching condition is met; if the obtained system configuration number is the same as the locally maintained system The member nodes in the member node set broadcast the view switching instruction; if the obtained system configuration number is greater than the locally maintained system configuration number, broadcast the historical data acquisition message to the member nodes in the member node set corresponding to the obtained system configuration number; wherein, The system configuration number maintained locally is carried in the historical data acquisition message;
所述成员节点集合中的任一成员节点,还用于在接收到历史数据获取消息后,若确定其中携带的系统配置编号小于本地系统配置编号,且发送该历史数据获取消息的节点为本地维护的成员节点集合中的节点,则向该节点返回针对该历史数据获取消息的响应消息;其中,响应消息中携带该成员节点执行的所有共识提议;Any member node in the set of member nodes is further configured to, after receiving the historical data acquisition message, determine that the system configuration number carried in it is smaller than the local system configuration number, and the node sending the historical data acquisition message is a local maintenance node. A node in the set of member nodes returns to the node a response message for the historical data acquisition message; wherein, the response message carries all the consensus proposals executed by the member node;
该从节点,还用于在接收到该成员节点集合中1/3个成员节点返回的响应消息,且响应消息中携带的信息相同时,则根据响应消息对本地数据进行更新。The slave node is further configured to update local data according to the response message when receiving the response message returned by 1/3 of the member nodes in the set of member nodes and the information carried in the response message is the same.
在一个实施例中,任一从节点,还用于在检测到满足视图切换条件的情况下,向本地维护的成员节点集合中的成员节点广播视图切换指令;所述视图切换消息中携带目标系统配置编号;在接收到其他节点广播的视图切换消息后,根据所述目标系统配置编号对该视图切换消息进行转发;In one embodiment, any slave node is further configured to broadcast a view switching instruction to the member nodes in the locally maintained member node set when it detects that the view switching condition is met; the view switching message carries the target system configuration number; after receiving the view switching message broadcast by other nodes, forwarding the view switching message according to the target system configuration number;
主节点,还用于在接收到本地维护的系统配置的成员节点集合中2/3的节点发送的视图切换消息的情况下,向本地维护的系统配置的全部成员节点广播新视图消息,以使所述系统配置的成员节点集合中的节点进入新视图。The master node is also used to broadcast a new view message to all member nodes of the locally maintained system configuration when receiving the view switching message sent by 2/3 of the locally maintained system configured member node sets, so that Nodes in the member node set of the system configuration enter a new view.
在一个实施例中,任一从节点,还用于在接收到其他节点广播的视图切换消息后,若确定该视图切换消息中的目标系统配置编号小于本地系统配置编号,且本地系统配置编号对应的成员节点多于该目标系统配置编号对应的成员节点,则向第一节点转发所述视图切换消息;其中所述第一节点包括在本地系统配置的成员节点集合中,但不在目标系统配置的成员节点集合中的节点;若确定该视图切换消息中的目标系统配置编号大于本地系统配置编号,则将本地系统配置更新至所述目标系统配置编号对应的系统配置,在本地本轮已发送过视图切换消息的情况下,将该视图切换消息转发至第二节点,所述第二节点为包括在目标系统配置的成员节点集合中,但不在本地系统配置的成员节点集合中的节点;在本地本轮未发送过视图切换消息的情况下,将所述视图切换消息转发至目标系统配置编号对应的全部节点。In one embodiment, any slave node is further configured to determine that the target system configuration number in the view switching message is smaller than the local system configuration number after receiving the view switching message broadcast by other nodes, and the local system configuration number corresponds to If there are more member nodes than the member nodes corresponding to the target system configuration number, the view switching message is forwarded to the first node; wherein the first node is included in the member node set of the local system configuration, but not in the target system configuration Nodes in the member node set; if it is determined that the target system configuration number in the view switching message is greater than the local system configuration number, then update the local system configuration to the system configuration corresponding to the target system configuration number, which has been sent locally in this round In the case of a view switch message, the view switch message is forwarded to a second node, and the second node is a node included in the set of member nodes configured by the target system but not in the set of member nodes configured by the local system; locally If no view switching message has been sent in this round, the view switching message is forwarded to all nodes corresponding to the target system configuration number.
在一个实施例中,所述视图切换条件包括在针对共识提议达成共识后,且所述共识提议中包括成员配置指令。In one embodiment, the view switching condition includes after a consensus is reached on the consensus proposal, and the consensus proposal includes a member configuration instruction.
如图8所示,与前述一种基于区块链网络的共识方法相对应,本说明书还提供了一种基于区块链网络的共识装置,应用于指令发起节点,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括所述区块链网络的成员节点集合以及用于标识系统配置的系统配置编号;所述装置包括:As shown in Figure 8, corresponding to the aforementioned consensus method based on the blockchain network, this specification also provides a consensus device based on the blockchain network, which is applied to the instruction initiating node, and in the blockchain network Any consensus node of the system maintains system configuration information locally, and the system configuration information includes a set of member nodes of the blockchain network and a system configuration number used to identify the system configuration; the device includes:
获取模块810,用于获取系统配置信息;An acquisition module 810, configured to acquire system configuration information;
广播模块820,根据获取的系统配置信息对本地系统配置信息进行更新,并根据更新后的系统配置信息向区块链网络中的至少部分成员节点广播指令,以使区块链网络生成包括所述指令的共识提议并对所述共识提议进行共识处理;其中,指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或退出所述区块链网络。The broadcast module 820 updates the local system configuration information according to the acquired system configuration information, and broadcasts instructions to at least some member nodes in the block chain network according to the updated system configuration information, so that the block chain network generates the Consensus proposal of the instruction and perform consensus processing on the consensus proposal; wherein, the instruction includes a member configuration instruction or a regular instruction, and the member configuration instruction is used to instruct the instruction originating node to join or withdraw from the blockchain network.
如图9所示,与前述一种基于区块链网络的共识方法相对应,本说明书还提供了一种基于区块链网络的共识装置,应用于区块链网络中的从节点,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括所述区块链网络的成员节点集合以及用于标识系统配置的系统配置编号;所述装置包括:As shown in Figure 9, corresponding to the aforementioned consensus method based on the blockchain network, this specification also provides a consensus device based on the blockchain network, which is applied to the slave nodes in the blockchain network. Any consensus node in the blockchain network maintains system configuration information locally, and the system configuration information includes a set of member nodes of the blockchain network and a system configuration number used to identify the system configuration; the device includes:
转发模块910,用于在接收到指令发起节点的发送的指令后,对该指令进行转发处理;其中所述指令包括成员配置指令或常规指令;The forwarding module 910 is configured to forward the instruction after receiving the instruction sent by the instruction initiating node; wherein the instruction includes a member configuration instruction or a regular instruction;
共识模块920,用于针对包括所述指令的共识提议进行共识处理;A consensus module 920, configured to perform consensus processing on the consensus proposal including the instruction;
更新模块930,用于在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。The update module 930 is configured to update the locally maintained system configuration information according to the member configuration instruction after reaching a consensus on the consensus proposal, if the consensus proposal includes a member configuration instruction.
如图10所示,与前述一种基于区块链网络的共识方法相对应,本说明书还提供了一种基于区块链网络的共识装置,应用于区块链网络中的主节点,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括所述区块链网络的成员节点集合以及用于标识系统配置的系统配置编号;所述装置包括:As shown in Figure 10, corresponding to the aforementioned consensus method based on the blockchain network, this specification also provides a consensus device based on the blockchain network, which is applied to the master node in the blockchain network. Any consensus node in the blockchain network maintains system configuration information locally, and the system configuration information includes a set of member nodes of the blockchain network and a system configuration number used to identify the system configuration; the device includes:
共识模块1110,用于在接收到指令发起节点的发送的指令,且生成包括所述指令的共识提议后,协调其他节点对所述共识提议进行共识处理;其中所述指令包括成员配置指令或常规指令;The consensus module 1110 is configured to coordinate other nodes to perform consensus processing on the consensus proposal after receiving the instruction sent by the instruction initiating node and generating a consensus proposal including the instruction; wherein the instruction includes a member configuration instruction or a regular instruction;
更新模块1120,用于在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根 据所述成员配置指令更新本地维护的系统配置信息。The update module 1120 is configured to update the locally maintained system configuration information according to the member configuration instruction after reaching a consensus on the consensus proposal, if the consensus proposal includes a member configuration instruction.
上述装置中各个部件的功能和作用的实现过程具体详见上述方法中对应步骤的实现过程,在此不再赘述。For the implementation process of the functions and effects of each component in the above-mentioned device, please refer to the implementation process of the corresponding steps in the above-mentioned method for details, and details will not be repeated here.
对于装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。As for the device embodiment, since it basically corresponds to the method embodiment, for related parts, please refer to the part description of the method embodiment. The device embodiments described above are illustrative only. Part or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. It can be understood and implemented by those skilled in the art without creative effort.
本说明书实施例还提供一种计算机设备,其至少包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,其中,处理器执行所述程序时实现前述的方法。该方法至少包括上述指令发起节点、区块链网络中的从节点或区块链网络中的主节点所执行的方法。The embodiment of this specification also provides a computer device, which at least includes a memory, a processor, and a computer program stored in the memory and operable on the processor, wherein the aforementioned method is implemented when the processor executes the program. The method at least includes the method executed by the above instruction originating node, the slave node in the block chain network or the master node in the block chain network.
图11示出了本说明书实施例所提供的一种更为具体的计算设备硬件结构示意图,该设备可以包括:处理器1010、存储器1020、输入/输出接口1030、通信接口1040和总线1050。其中处理器1010、存储器1020、输入/输出接口1030和通信接口1040通过总线1050实现彼此之间在设备内部的通信连接。FIG. 11 shows a schematic diagram of a more specific hardware structure of a computing device provided by the embodiment of this specification. The device may include: a processor 1010 , a memory 1020 , an input/output interface 1030 , a communication interface 1040 and a bus 1050 . The processor 1010 , the memory 1020 , the input/output interface 1030 and the communication interface 1040 are connected to each other within the device through the bus 1050 .
处理器1010可以采用通用的CPU(CeNtral ProcessiNg UNit,中央处理器)、微处理器、应用专用集成电路(ApplicatioN Specific INtegrated Circuit,ASIC)、或者一个或多个集成电路等方式实现,用于执行相关程序,以实现本说明书实施例所提供的技术方案。The processor 1010 can be implemented by a general-purpose CPU (Central ProcessiNg UNit, central processing unit), a microprocessor, an application-specific integrated circuit (ApplicationN Specific INtegrated Circuit, ASIC), or one or more integrated circuits, and is used to execute related programs to realize the technical solutions provided by the embodiments of this specification.
存储器1020可以采用ROM(Read ONly Memory,只读存储器)、RAM(RaNdom Access Memory,随机存取存储器)、静态存储设备,动态存储设备等形式实现。存储器1020可以存储操作系统和其他应用程序,在通过软件或者固件来实现本说明书实施例所提供的技术方案时,相关的程序代码保存在存储器1020中,并由处理器1010来调用执行。The memory 1020 can be implemented in the form of ROM (Read ONly Memory, read-only memory), RAM (RaNdom Access Memory, random access memory), static storage device, dynamic storage device, etc. The memory 1020 can store operating systems and other application programs. When implementing the technical solutions provided by the embodiments of this specification through software or firmware, the relevant program codes are stored in the memory 1020 and invoked by the processor 1010 for execution.
输入/输出接口1030用于连接输入/输出模块,以实现信息输入及输出。输入输出/模块可以作为组件配置在设备中(图中未示出),也可以外接于设备以提供相应功能。其中输入设备可以包括键盘、鼠标、触摸屏、麦克风、各类传感器等,输出设备可以包括显示器、扬声器、振动器、指示灯等。The input/output interface 1030 is used to connect the input/output module to realize information input and output. The input/output/module can be configured in the device as a component (not shown in the figure), or can be externally connected to the device to provide corresponding functions. The input device may include a keyboard, mouse, touch screen, microphone, various sensors, etc., and the output device may include a display, a speaker, a vibrator, an indicator light, and the like.
通信接口1040用于连接通信模块(图中未示出),以实现本设备与其他设备的通信交互。其中通信模块可以通过有线方式(例如USB、网线等)实现通信,也可以通过无线方式(例如移动网络、WIFI、蓝牙等)实现通信。The communication interface 1040 is used to connect a communication module (not shown in the figure), so as to realize the communication interaction between the device and other devices. The communication module can realize communication through wired means (such as USB, network cable, etc.), and can also realize communication through wireless means (such as mobile network, WIFI, Bluetooth, etc.).
总线1050包括一通路,在设备的各个组件(例如处理器1010、存储器1020、输入/输出接口1030和通信接口1040)之间传输信息。 Bus 1050 includes a path that carries information between the various components of the device (eg, processor 1010, memory 1020, input/output interface 1030, and communication interface 1040).
需要说明的是,尽管上述设备仅示出了处理器1010、存储器1020、输入/输出接口1030、通信接口1040以及总线1050,但是在具体实施过程中,该设备还可以包括实现正常运行所必需的其他组件。此外,本领域的技术人员可以理解的是,上述设备中也可以仅包含实现本说明书实施例方案所必需的组件,而不必包含图中所示的全部组件。It should be noted that although the above device only shows the processor 1010, the memory 1020, the input/output interface 1030, the communication interface 1040, and the bus 1050, in the specific implementation process, the device may also include other components. In addition, those skilled in the art can understand that the above-mentioned device may only include components necessary to implement the solutions of the embodiments of this specification, and does not necessarily include all the components shown in the figure.
本说明书实施例还提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现前述的方法。该方法至少包括上述指令发起节点、区块链网络中的从节点、或区块链网络中的主节点所执行方法。The embodiment of the present specification also provides a computer-readable storage medium, on which a computer program is stored, and when the program is executed by a processor, the aforementioned method is implemented. The method at least includes the method executed by the above instruction originating node, the slave node in the blockchain network, or the master node in the blockchain network.
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(traNsitory media),如调制的数据信号和载波。Computer-readable media, including both permanent and non-permanent, removable and non-removable media, can be implemented by any method or technology for storage of information. 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 Disc (DVD) or other optical storage, A magnetic tape cartridge, disk storage or other magnetic storage device or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory computer-readable media (traNsitory media), such as modulated data signals and carrier waves.
通过以上的实施方式的描述可知,本领域的技术人员可以清楚地了解到本说明书实施例可借助软件加必需的通用硬件平台的方式来实现。基于这样的理解,本说明书实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,或者网络设备等)执行本说明书实施例各个实施例或者实施例的某些部分所述的方法。It can be known from the above description of the implementation manners that those skilled in the art can clearly understand that the embodiments of this specification can be implemented by means of software plus a necessary general hardware platform. Based on this understanding, the essence of the technical solutions of the embodiments of this specification or the part that contributes to the prior art can be embodied in the form of software products, and the computer software products can be stored in storage media, such as ROM/RAM, A magnetic disk, an optical disk, etc., include several instructions to enable a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in various embodiments or some parts of the embodiments of this specification.
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。The systems, devices, modules, or units described in the above embodiments can be specifically implemented by computer chips or entities, or by products with certain functions. A typical implementing device is a computer, which may take the form of a personal computer, laptop computer, cellular phone, camera phone, smart phone, personal digital assistant, media player, navigation device, e-mail device, game control device, etc. desktops, tablets, wearables, or any combination of these.
本说明书中的各个实施例均采用递进的方式描述,各个实施例之间相同相似的部分互相参见即可, 每个实施例重点说明的都是与其他实施例的不同之处。尤其,对于装置实施例而言,由于其基本相似于方法实施例,所以描述得比较简单,相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的模块可以是或者也可以不是物理上分开的,在实施本说明书实施例方案时可以把各模块的功能在同一个或多个软件和/或硬件中实现。也可以根据实际的需要选择其中的部分或者全部模块来实现本实施例方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。Each embodiment in this specification is described in a progressive manner, the same and similar parts of each embodiment can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, as for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and for relevant parts, please refer to part of the description of the method embodiment. The device embodiments described above are only illustrative, and the modules described as separate components may or may not be physically separated, and the functions of each module may be integrated in the same or multiple software and/or hardware implementations. Part or all of the modules can also be selected according to actual needs to achieve the purpose of the solution of this embodiment. It can be understood and implemented by those skilled in the art without creative effort.
以上所述仅是本说明书实施例的具体实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本说明书实施例原理的前提下,还可以做出若干改进和润饰,这些改进和润饰也应视为本说明书实施例的保护范围。The above is only the specific implementation of the embodiment of this specification. It should be pointed out that for those of ordinary skill in the art, without departing from the principle of the embodiment of this specification, some improvements and modifications can also be made. These Improvements and modifications should also be regarded as the scope of protection of the embodiments of this specification.

Claims (24)

  1. 一种基于区块链网络的共识方法,其特征在于,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述方法包括:A consensus method based on a block chain network, characterized in that any consensus node in the block chain network maintains system configuration information locally, and the system configuration information includes a set of member nodes and an ID for identifying system configuration system configuration number; the methods described include:
    指令发起节点向区块链网络中的至少部分成员节点广播携带系统配置编号的指令;其中,所述指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或移除所述区块链网络;The instruction initiating node broadcasts an instruction carrying a system configuration number to at least some member nodes in the blockchain network; wherein, the instruction includes a member configuration instruction or a general instruction, and the member configuration instruction is used to instruct the instruction initiating node to join or remove remove said blockchain network;
    区块链网络中的任一从节点根据所述指令中携带的系统配置编号以及本地维护的系统配置编号对该指令进行转发处理;Any slave node in the blockchain network forwards the instruction according to the system configuration number carried in the instruction and the locally maintained system configuration number;
    区块链网络中的主节点在接收到所述指令,且生成包括所述指令的共识提议后,协调其他节点根据本地的系统配置编号对所述共识提议进行共识处理;所述共识提议中包括成员配置指令和/或常规指令;After receiving the instruction and generating a consensus proposal including the instruction, the master node in the blockchain network coordinates other nodes to perform consensus processing on the consensus proposal according to the local system configuration number; the consensus proposal includes membership configuration directives and/or general directives;
    区块链网络中任一成员节点在确定针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。After any member node in the blockchain network determines that a consensus has been reached on the consensus proposal, if the consensus proposal includes a member configuration instruction, then update the locally maintained system configuration information according to the member configuration instruction.
  2. 根据权利要求1所述的方法,其特征在于,所述指令中携带的系统配置编号,用于标识所述指令所针对的系统配置;The method according to claim 1, wherein the system configuration number carried in the instruction is used to identify the system configuration targeted by the instruction;
    区块链网络中的任一从节点根据所述指令中携带的系统配置编号以及本地维护的系统配置编号对该指令进行转发处理,包括:Any slave node in the blockchain network forwards the instruction according to the system configuration number carried in the instruction and the system configuration number maintained locally, including:
    在本地未执行该指令的情况下,若确定该系统配置编号与本地存储的系统配置编号相同,则将所述成员配置指令转发至主节点;若确定该系统配置编号小于本地存储的系统配置编号,则将所述指令转发至本地维护的成员节点集合中的成员节点;If the instruction is not executed locally, if it is determined that the system configuration number is the same as the locally stored system configuration number, then forward the member configuration instruction to the master node; if it is determined that the system configuration number is smaller than the locally stored system configuration number , forward the instruction to the member nodes in the locally maintained member node set;
    在本地执行了该指令的情况下,将执行结果以及系统配置历史信息返回给该指令发起节点。When the instruction is executed locally, the execution result and system configuration history information are returned to the instruction originating node.
  3. 根据权利要求2所述的方法,其特征在于,所述方法还包括:The method according to claim 2, further comprising:
    主节点在接收到指令后,将指令在本地指令池中进行存储;After the master node receives the instruction, it stores the instruction in the local instruction pool;
    所述生成包括所述指令的共识提议,包括:Said generating a consensus proposal comprising said instructions, comprising:
    从本地指令池中获取预设数量的指令;Obtain a preset number of instructions from the local instruction pool;
    针对所述预设数量的指令中的任一成员配置指令,若所述成员配置指令用于指示将发起所述指令的指令发起节点加入区块链网络,则为该指令发起节点分配成员节点序号,将所述成员节点序号以及所述成员配置指令组合为成员加入指令;若所述成员配置指令用于指示将发起所述指令的指令发起节点从区块链网络退出,则将该指令发起节点的成员节点序号以及所述成员配置指令组合为成员退出指令;For any member configuration instruction in the preset number of instructions, if the member configuration instruction is used to indicate that the instruction originating node that will initiate the instruction joins the blockchain network, assign a member node serial number to the instruction originating node , combining the member node serial number and the member configuration instruction into a member joining instruction; if the member configuration instruction is used to indicate that the instruction originating node that will initiate the instruction withdraws from the blockchain network, then the instruction originating node The combination of the member node serial number and the member configuration instruction is a member exit instruction;
    针对所述预设数量的指令,将成员加入指令、成员退出指令和常规指令打包为共识提议。For the preset number of instructions, the member join instruction, member exit instruction and regular instructions are packaged into a consensus proposal.
  4. 根据权利要求3所述的方法,其特征在于,还包括:The method according to claim 3, further comprising:
    在为该指令发起节点分配成员序号后,将该指令发起节点加入到临时成员集合中;所述临时成员集合中包括本地系统配置中的全部成员节点;After assigning a member sequence number to the instruction initiating node, adding the instruction initiating node to a temporary member set; the temporary member set includes all member nodes in the local system configuration;
    所述协调其他节点对所述共识提议进行共识处理,包括:The coordinating other nodes to perform consensus processing on the consensus proposal, including:
    基于所述共识提议向临时成员集合中的节点广播预准备消息;broadcasting a pre-preparation message to nodes in the temporary membership set based on the consensus proposal;
    任一从节点,在接收到有效的预准备消息后,针对所述共识提议中的成员加入指令,将该成员加入指令中的成员节点序号加入到本地的临时成员集合中,并向本地临时成员集合中的节点广播针对所述共识提议的准备消息;所述准备消息中携带所述从节点的签名;Any slave node, after receiving a valid pre-preparation message, for the member joining instruction in the consensus proposal, adds the member node serial number in the member joining instruction to the local temporary member set, and sends the local temporary member The nodes in the set broadcast a preparation message for the consensus proposal; the preparation message carries the signature of the slave node;
    任一成员节点,在接收到本地系统配置的成员节点集合中2/3成员节点广播的针对所述共识提议的准备消息后,将接收到的准备消息的签名作为该共识提议的证明进行存储,并广播针对所述共识提议的承诺消息,或,在接收到本地系统配置的成员节点集合中1/3成员节点广播的针对所述共识提议的承诺消息后,将接收到的承诺消息的签名作为该共识提议的证明进行存储,并广播针对所述共识提议的承诺消息;其中,所述承诺消息中携带所述节点的签名;Any member node, after receiving the preparation message for the consensus proposal broadcast by 2/3 member nodes in the member node set configured by the local system, stores the signature of the received preparation message as the proof of the consensus proposal, And broadcast the commitment message for the consensus proposal, or, after receiving the commitment message for the consensus proposal broadcast by 1/3 member nodes in the set of member nodes configured by the local system, use the signature of the received commitment message as Store the proof of the consensus proposal, and broadcast a commitment message for the consensus proposal; wherein, the commitment message carries the signature of the node;
    在收到本地系统配置的成员节点集合中2/3成员节点广播的针对所述共识提议的承诺消息后,确定针对所述共识提议达成共识,执行所述共识提议。After receiving the commitment message for the consensus proposal broadcast by 2/3 member nodes in the set of member nodes configured by the local system, it is determined that a consensus is reached for the consensus proposal, and the consensus proposal is executed.
  5. 根据权利要求4所述的方法,其特征在于,所述方法还包括:The method according to claim 4, characterized in that the method further comprises:
    任一从节点,将成员加入指令中的成员节点序号加入到临时成员组后,在成员加入指令中携带的系统配置编号小于本地系统配置号的情况下,向该成员节点序号对应的指令发起节点发送本地系统配置信息以及系统配置历史信息;Any slave node, after adding the member node serial number in the member joining command to the temporary member group, in the case that the system configuration number carried in the member joining command is smaller than the local system configuration number, send the node to the command corresponding to the member node serial number Send local system configuration information and system configuration history information;
    所述指令发起节点在接收到该系统配置信息以及系统配置历史信息后,根据该系统配置历史信息对接收到的系统配置信息进行验证,并在验证通过后,根据接收到的系统配置历史信息对本地系统配置信息进行更新;所述系统配置历史信息为目标共识提议组成的集合,其中,目标共识提议为包括成员加入指令或成员退出指令的共识提议。After the instruction initiating node receives the system configuration information and the system configuration history information, it verifies the received system configuration information according to the system configuration history information, and after the verification is passed, it verifies the system configuration information according to the received system configuration history information. The local system configuration information is updated; the system configuration history information is a set of target consensus proposals, wherein the target consensus proposals are consensus proposals including member joining instructions or member exit instructions.
  6. 根据权利要求5所述的方法,其特征在于,所述系统配置历史信息中包括每个目标共识提议的证明;The method according to claim 5, wherein the system configuration history information includes a proof of each target consensus proposal;
    所述根据该系统配置历史信息对接收到的系统配置信息进行验证包括:The verification of the received system configuration information according to the system configuration history information includes:
    基于所述系统配置历史信息中的证明对目标提议进行验证,在对全部目标提议验证通过的情况下,确定所述系统配置历史信息以及所述系统配置信息通过验证。The target proposal is verified based on the proof in the system configuration history information, and when all target proposals pass the verification, it is determined that the system configuration history information and the system configuration information pass the verification.
  7. 根据权利要求3所述的方法,其特征在于,所述根据所述成员配置指令更新本地维护的系统配置信息包括:The method according to claim 3, wherein updating the locally maintained system configuration information according to the member configuration instruction comprises:
    区块链网络中任一节点在针对所述共识提议达成共识后,针对所述共识提议中的任一成员加入指令,将所述成员加入指令中的成员节点序号加入到本地维护的系统配置信息中的成员节点集合中;After reaching a consensus on the consensus proposal, any node in the blockchain network will add the member node serial number in the member joining instruction to the locally maintained system configuration information for any member joining instruction in the consensus proposal In the set of member nodes in ;
    针对所述共识提议中的任一成员退出指令,将所述成员退出指令中的成员节点序号,从到本地维护的系统配置信息中的成员节点集合中移除;For any member exit instruction in the consensus proposal, remove the member node serial number in the member exit instruction from the member node set in the locally maintained system configuration information;
    将系统配置编号进行更新。Update the system configuration number.
  8. 根据权利要求7所述的方法,其特征在于,所述方法还包括:The method according to claim 7, wherein the method further comprises:
    区块链网络中任一节点将所述共识提议添加到系统配置历史信息中;Any node in the blockchain network adds the consensus proposal to the system configuration history information;
    向所述共识提议中包括的成员配置指令对应的发起节点返回成员配置处理结果;其中,所述成员配置指令用于指示将所述指令的指令发起节点加入到区块链网络中;Return the member configuration processing result to the initiating node corresponding to the member configuration instruction included in the consensus proposal; wherein, the member configuration instruction is used to indicate that the instruction initiating node of the instruction is added to the blockchain network;
    任一成员配置指令的指令发起节点在接收到2/3成员节点发送的配置处理结果后,可以确定该指令 执行完毕,确定本地加入所述区块链网络。After receiving the configuration processing results sent by 2/3 member nodes, the instruction originating node of any member configuration instruction can determine that the instruction has been executed and determine to join the blockchain network locally.
  9. 根据权利要求8所述的方法,其特征在于,所述方法还包括:The method according to claim 8, characterized in that the method further comprises:
    任一成员配置指令的指令发起节点,在共识过程中将共识提议的证明进行存储后,若所述成员配置指令包含在所述共识提议中,其中,所述成员配置指令用于指示将所述指令发起节点从所述区块链网络退出,则确定本地从所述区块链网络退出。The instruction initiating node of any member configuration instruction, after storing the proof of the consensus proposal during the consensus process, if the member configuration instruction is included in the consensus proposal, wherein the member configuration instruction is used to indicate that the If the initiating node is instructed to withdraw from the blockchain network, it is determined to withdraw locally from the blockchain network.
  10. 根据权利要求8所述的方法,其特征在于,所述方法还包括:The method according to claim 8, characterized in that the method further comprises:
    任一成员配置指令的指令发起节点,在确定共识提议被执行,且所述成员配置指令包含在所述共识提议中,其中,所述成员配置指令用于指示将所述指令发起节点从所述区块链网络退出,则确定本地从所述区块链网络退出。The instruction initiating node of any member configuration instruction determines that the consensus proposal is executed, and the member configuration instruction is included in the consensus proposal, wherein the member configuration instruction is used to instruct the instruction initiating node from the If the block chain network exits, it is determined that the local exits from the block chain network.
  11. 根据权利要求9或10任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 9 or 10, further comprising:
    区块链网络中任一节点针对所述共识提议中的任一常规指令,在本地执行完成后,若确定该指令中的系统配置编号与本地的系统配置编号相同,则向该指令的指令发起节点返回处理结果;Any node in the blockchain network for any conventional command in the consensus proposal, after the local execution is completed, if it is determined that the system configuration number in the command is the same as the local system configuration number, it will initiate a The node returns the processing result;
    若确定该指令中的系统配置编号小于本地的系统配置编号,则向该指令的指令发起节点返回处理结果以及系统配置历史信息。If it is determined that the system configuration number in the instruction is smaller than the local system configuration number, then return the processing result and system configuration history information to the instruction originating node of the instruction.
  12. 根据权利要求11所述的方法,其特征在于,所述方法还包括:The method according to claim 11, characterized in that the method further comprises:
    任一从节点,在检测到满足视图切换条件的情况下,获取系统配置信息;Any slave node obtains system configuration information when it detects that the view switching condition is met;
    若获取的系统配置编号与本地维护的系统配置编号相同,则向本地维护的成员节点集合中的成员节点广播视图切换指令;If the obtained system configuration number is the same as the locally maintained system configuration number, broadcast the view switching command to the member nodes in the locally maintained member node set;
    若获取的系统配置编号大于本地维护的系统配置编号,则向获取的系统配置编号对应的成员节点集合中的成员节点广播历史数据获取消息;其中,所述历史数据获取消息中携带本地维护的系统配置编号;If the obtained system configuration number is greater than the locally maintained system configuration number, broadcast a historical data acquisition message to the member nodes in the member node set corresponding to the acquired system configuration number; wherein, the historical data acquisition message carries the locally maintained system configuration number;
    所述成员节点集合中的任一成员节点,在接收到历史数据获取消息后,若确定其中携带的系统配置编号小于本地系统配置编号,且发送该历史数据获取消息的节点为本地维护的成员节点集合中的节点,则向该节点返回针对该历史数据获取消息的响应消息;其中,响应消息中携带该成员节点执行的所有共识提议;Any member node in the member node set, after receiving the historical data acquisition message, if it is determined that the system configuration number carried in it is smaller than the local system configuration number, and the node sending the historical data acquisition message is a locally maintained member node A node in the set returns a response message to the node for the historical data acquisition message; wherein, the response message carries all the consensus proposals executed by the member node;
    该从节点在接收到该成员节点集合中1/3个成员节点返回的响应消息,且响应消息中携带的信息相同时,则根据响应消息对本地数据进行更新。When the slave node receives the response message returned by 1/3 of the member nodes in the member node set, and the information carried in the response message is the same, it updates the local data according to the response message.
  13. 根据权利要求11所述的方法,其特征在于,所述方法还包括:The method according to claim 11, characterized in that the method further comprises:
    任一从节点,在检测到满足视图切换条件的情况下,向本地维护的成员节点集合中的成员节点广播视图切换指令;所述视图切换消息中携带目标系统配置编号;Any slave node, when it detects that the view switching condition is met, broadcasts a view switching instruction to the member nodes in the locally maintained member node set; the view switching message carries the target system configuration number;
    任一从节点在接收到其他节点广播的视图切换消息后,根据所述目标系统配置编号对该视图切换消息进行转发;Any slave node forwards the view switching message according to the target system configuration number after receiving the view switching message broadcast by other nodes;
    主节点在接收到本地维护的系统配置的成员节点集合中2/3的节点发送的视图切换消息的情况下,向本地维护的系统配置的全部成员节点广播新视图消息,以使所述系统配置的成员节点集合中的节点进入新视图。When the master node receives the view switching message sent by 2/3 nodes in the locally maintained system configuration member node set, it broadcasts a new view message to all member nodes of the locally maintained system configuration, so that the system configuration The nodes in the member node collection of the enter into the new view.
  14. 根据权利要求13所述的方法,其特征在于,所述根据所述目标系统配置编号对该视图切换消息 进行转发,包括:The method according to claim 13, wherein the forwarding of the view switching message according to the target system configuration number comprises:
    任一从节点在接收到其他节点广播的视图切换消息后,若确定该视图切换消息中的目标系统配置编号小于本地系统配置编号,且本地系统配置编号对应的成员节点多于该目标系统配置编号对应的成员节点,则向第一节点转发所述视图切换消息;其中所述第一节点包括在本地系统配置的成员节点集合中,但不在目标系统配置的成员节点集合中的节点;After any slave node receives the view switching message broadcast by other nodes, if it determines that the target system configuration number in the view switching message is smaller than the local system configuration number, and the member nodes corresponding to the local system configuration number are more than the target system configuration number The corresponding member node forwards the view switching message to the first node; wherein the first node includes nodes in the member node set configured by the local system but not in the member node set configured by the target system;
    若确定该视图切换消息中的目标系统配置编号大于本地系统配置编号,则将本地系统配置更新至所述目标系统配置编号对应的系统配置,在本地本轮已发送过视图切换消息的情况下,将该视图切换消息转发至第二节点,所述第二节点为包括在目标系统配置的成员节点集合中,但不在本地系统配置的成员节点集合中的节点;在本地本轮未发送过视图切换消息的情况下,将所述视图切换消息转发至目标系统配置编号对应的全部节点。If it is determined that the target system configuration number in the view switching message is greater than the local system configuration number, then the local system configuration is updated to the system configuration corresponding to the target system configuration number. Forward the view switch message to a second node, which is a node included in the member node set configured by the target system but not in the member node set configured by the local system; no view switch has been sent locally in this round In the case of a message, the view switching message is forwarded to all nodes corresponding to the target system configuration number.
  15. 根据权利要求14所述的方法,其特征在于,所述视图切换条件包括:The method according to claim 14, wherein the view switching condition comprises:
    在针对共识提议达成共识后,且所述共识提议中包括成员配置指令。After a consensus is reached on the consensus proposal, and the consensus proposal includes a member configuration instruction.
  16. 一种基于区块链网络的共识方法,其特征在于,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括所述区块链网络的成员节点集合以及用于标识系统配置的系统配置编号;所述方法包括:A consensus method based on a block chain network, characterized in that any consensus node in the block chain network maintains system configuration information locally, and the system configuration information includes a set of member nodes of the block chain network and a system configuration number for identifying the system configuration; said method comprising:
    向区块链网络中的至少部分成员节点广播携带系统配置编号的指令,以使区块链网络生成包括所述指令的共识提议并根据系统配置编号对所述共识提议进行共识处理;其中,所述指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或移除所述区块链网络。Broadcast an instruction carrying a system configuration number to at least some member nodes in the blockchain network, so that the blockchain network generates a consensus proposal including the instruction and performs consensus processing on the consensus proposal according to the system configuration number; wherein, the The instructions include member configuration instructions or general instructions, and the member configuration instructions are used to instruct the instruction originating node to join or remove from the blockchain network.
  17. 一种基于区块链网络的共识方法,其特征在于,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述方法包括:A consensus method based on a block chain network, characterized in that any consensus node in the block chain network maintains system configuration information locally, and the system configuration information includes a set of member nodes and an ID for identifying system configuration system configuration number; the methods described include:
    在接收到指令发起节点发送的指令后,根据所述指令中携带的系统配置编号以及本地维护的系统配置编号对该指令进行转发处理;其中所述指令包括成员配置指令或常规指令;After receiving the instruction sent by the instruction originating node, the instruction is forwarded according to the system configuration number carried in the instruction and the locally maintained system configuration number; wherein the instruction includes a member configuration instruction or a regular instruction;
    针对包括所述指令的共识提议进行共识处理;所述共识提议中包括成员配置指令和/或常规指令;Consensus processing is performed on the consensus proposal including the instructions; the consensus proposal includes member configuration instructions and/or general instructions;
    在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。After a consensus is reached on the consensus proposal, if the consensus proposal includes a member configuration instruction, locally maintained system configuration information is updated according to the member configuration instruction.
  18. 一种基于区块链网络的共识方法,其特征在于,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述方法包括:A consensus method based on a block chain network, characterized in that any consensus node in the block chain network maintains system configuration information locally, and the system configuration information includes a set of member nodes and an ID for identifying system configuration system configuration number; the methods described include:
    在接收到指令发起节点发送的指令,且生成包括所述指令的共识提议后,协调其他节点根据本地的系统配置编号对所述共识提议进行共识处理;其中所述指令包括成员配置指令或常规指令;所述共识提议中包括成员配置指令和/或常规指令;After receiving the instruction sent by the instruction initiating node and generating a consensus proposal including the instruction, coordinate other nodes to perform consensus processing on the consensus proposal according to the local system configuration number; wherein the instruction includes member configuration instructions or regular instructions ; The consensus proposal includes member configuration instructions and/or general instructions;
    在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。After a consensus is reached on the consensus proposal, if the consensus proposal includes a member configuration instruction, locally maintained system configuration information is updated according to the member configuration instruction.
  19. 一种基于区块链网络的共识系统,其特征在于,所述区块链网络中的任一共识节点在本地维护 系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述系统包括:A consensus system based on a block chain network, characterized in that any consensus node in the block chain network maintains system configuration information locally, and the system configuration information includes a set of member nodes and an ID for identifying system configuration System configuration number; said system includes:
    指令发起节点,用于向区块链网络中的至少部分成员节点广播携带系统配置编号的指令;其中,所述指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或移除所述区块链网络;The instruction originating node is used to broadcast the instruction carrying the system configuration number to at least some member nodes in the blockchain network; wherein, the instruction includes a member configuration instruction or a general instruction, and the member configuration instruction is used to instruct the instruction originating node to join or leave said blockchain network;
    区块链网络中的任一从节点,用于根据所述指令中携带的系统配置编号以及本地维护的系统配置编号对该指令进行转发处理;Any slave node in the blockchain network is used to forward the instruction according to the system configuration number carried in the instruction and the system configuration number maintained locally;
    区块链网络中的主节点,用于在接收到所述指令,且生成包括所述指令的共识提议后,协调其他节点根据本地的系统配置编号对所述共识提议进行共识处理;所述共识提议中包括成员配置指令和/或常规指令;The master node in the blockchain network is used to coordinate other nodes to perform consensus processing on the consensus proposal according to the local system configuration number after receiving the instruction and generating a consensus proposal including the instruction; the consensus Proposals include membership directives and/or general directives;
    区块链网络中任一节点,用于在确定针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。Any node in the blockchain network is configured to update locally maintained system configuration information according to the member configuration instruction after determining that a consensus has been reached on the consensus proposal, if the consensus proposal includes a member configuration instruction.
  20. 一种基于区块链网络的共识装置,其特征在于,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述装置包括:A consensus device based on a block chain network, characterized in that any consensus node in the block chain network maintains system configuration information locally, and the system configuration information includes a set of member nodes and an ID for identifying system configuration System configuration number; the unit described includes:
    获取模块,用于获取系统配置信息;The obtaining module is used to obtain system configuration information;
    广播模块,根据获取的系统配置信息对本地系统配置信息进行更新,并根据更新后的系统配置信息向区块链网络中的至少部分成员节点广播携带系统配置编号的指令,以使区块链网络生成包括所述指令的共识提议并根据系统配置编号对所述共识提议进行共识处理;其中,指令包括成员配置指令或常规指令,成员配置指令用于指示将所述指令发起节点加入或退出所述区块链网络。The broadcast module updates the local system configuration information according to the acquired system configuration information, and broadcasts instructions carrying system configuration numbers to at least some member nodes in the blockchain network according to the updated system configuration information, so that the blockchain network Generate a consensus proposal including the instruction and perform consensus processing on the consensus proposal according to the system configuration number; wherein, the instruction includes a member configuration instruction or a general instruction, and the member configuration instruction is used to indicate that the instruction originating node joins or withdraws from the blockchain network.
  21. 一种基于区块链网络的共识装置,其特征在于,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述装置包括:A consensus device based on a block chain network, characterized in that any consensus node in the block chain network maintains system configuration information locally, and the system configuration information includes a set of member nodes and an ID for identifying system configuration System configuration number; the unit described includes:
    转发模块,用于在接收到指令发起节点的发送的指令后,根据所述指令中携带的系统配置编号以及本地维护的系统配置编号对该指令进行转发处理;其中所述指令包括成员配置指令或常规指令;The forwarding module is configured to forward the instruction according to the system configuration number carried in the instruction and the locally maintained system configuration number after receiving the instruction sent by the instruction initiating node; wherein the instruction includes a member configuration instruction or general order;
    共识模块,用于针对包括所述指令的共识提议进行共识处理;所述共识提议中包括成员配置指令和/或常规指令;A consensus module, configured to perform consensus processing on the consensus proposal including the instructions; the consensus proposal includes member configuration instructions and/or regular instructions;
    更新模块,用于在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。An update module, configured to update the locally maintained system configuration information according to the member configuration instruction after reaching a consensus on the consensus proposal, if the consensus proposal includes a member configuration instruction.
  22. 一种基于区块链网络的共识装置,其特征在于,所述区块链网络中的任一共识节点在本地维护系统配置信息,所述系统配置信息包括成员节点集合以及用于标识系统配置的系统配置编号;所述装置包括:A consensus device based on a block chain network, characterized in that any consensus node in the block chain network maintains system configuration information locally, and the system configuration information includes a set of member nodes and an ID for identifying system configuration System configuration number; the unit described includes:
    共识模块,用于在接收到指令发起节点的发送的指令,且生成包括所述指令的共识提议后,协调其他节点根据本地的系统配置编号对所述共识提议进行共识处理;其中所述指令包括成员配置指令或常规指令;所述共识提议中包括成员配置指令和/或常规指令;The consensus module is used to coordinate other nodes to perform consensus processing on the consensus proposal according to the local system configuration number after receiving the instruction sent by the instruction initiating node and generating a consensus proposal including the instruction; wherein the instruction includes Member configuration instructions or regular instructions; the consensus proposal includes member configuration instructions and/or regular instructions;
    更新模块,用于在针对所述共识提议达成共识后,若所述共识提议中包括成员配置指令,则根据所述成员配置指令更新本地维护的系统配置信息。An update module, configured to update the locally maintained system configuration information according to the member configuration instruction after reaching a consensus on the consensus proposal, if the consensus proposal includes a member configuration instruction.
  23. 一种计算机设备,其特征在于,包括存储器、处理器、通信接口及存储在存储器上并可在处理器上运行的计算机程序,其中,所述处理器执行所述程序时实现如权利要求16至18任一项所述的方法。A computer device, characterized by comprising a memory, a processor, a communication interface, and a computer program stored on the memory and operable on the processor, wherein, when the processor executes the program, it implements claims 16 to The method of any one of 18.
  24. 一种计算机可读存储介质,其特征在于,其上存储有计算机程序,该程序被处理器执行时实现如权利要求16至18任一项所述的方法。A computer-readable storage medium, characterized in that a computer program is stored thereon, and when the program is executed by a processor, the method according to any one of claims 16 to 18 is realized.
PCT/CN2022/111013 2022-01-17 2022-08-09 Consensus method and apparatus based on blockchain network, electronic device and storage medium WO2023134159A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210046656.1A CN114070733B (en) 2022-01-17 2022-01-17 Consensus method, device and system based on block chain network
CN202210046656.1 2022-01-17

Publications (1)

Publication Number Publication Date
WO2023134159A1 true WO2023134159A1 (en) 2023-07-20

Family

ID=80231020

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/111013 WO2023134159A1 (en) 2022-01-17 2022-08-09 Consensus method and apparatus based on blockchain network, electronic device and storage medium

Country Status (2)

Country Link
CN (1) CN114070733B (en)
WO (1) WO2023134159A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114070733B (en) * 2022-01-17 2023-01-31 清华大学 Consensus method, device and system based on block chain network
CN114625802A (en) * 2022-03-15 2022-06-14 北京广元科技有限公司 High-concurrency transaction optimization method and system based on energy source block chain
WO2024011373A1 (en) * 2022-07-11 2024-01-18 Huawei Cloud Computing Technologies Co., Ltd. Membership service for microsecond applications

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110727731A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method for adding node in block chain network and block chain system
CN110730204A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method for deleting nodes in block chain network and block chain system
CN110768798A (en) * 2019-10-24 2020-02-07 中国人民解放军国防科技大学 Lightweight block chain consensus method, system and medium for Internet of things
US20220004665A1 (en) * 2020-07-03 2022-01-06 Alipay (Hangzhou) Information Technology Co., Ltd. Consensus method and data verification method, apparatus, and system of consortium blockchain
CN114070733A (en) * 2022-01-17 2022-02-18 清华大学 Consensus method, device and system based on block chain network

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111865608B (en) * 2020-07-02 2022-08-26 南京邮电大学 Consensus mechanism operation method applied to alliance chain
CN113821569B (en) * 2021-09-30 2024-02-06 广州智链未来科技有限公司 Block chain consensus method and block chain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110727731A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method for adding node in block chain network and block chain system
CN110730204A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method for deleting nodes in block chain network and block chain system
CN110768798A (en) * 2019-10-24 2020-02-07 中国人民解放军国防科技大学 Lightweight block chain consensus method, system and medium for Internet of things
US20220004665A1 (en) * 2020-07-03 2022-01-06 Alipay (Hangzhou) Information Technology Co., Ltd. Consensus method and data verification method, apparatus, and system of consortium blockchain
CN114070733A (en) * 2022-01-17 2022-02-18 清华大学 Consensus method, device and system based on block chain network

Also Published As

Publication number Publication date
CN114070733B (en) 2023-01-31
CN114070733A (en) 2022-02-18

Similar Documents

Publication Publication Date Title
WO2023134159A1 (en) Consensus method and apparatus based on blockchain network, electronic device and storage medium
US11632441B2 (en) Methods, systems, and devices for electronic note identifier allocation and electronic note generation
KR102566892B1 (en) Blockchain consensus method, device and system
JP6549787B2 (en) Method and apparatus for deploying network services
WO2023016428A1 (en) Byzantine fault tolerance method and apparatus, and electronic device and storage medium
KR20210055734A (en) Block processing methods, nodes and systems
CN111240732B (en) Method, device, equipment and storage medium for distributing distributed microservice
CN109981279B (en) Block chain system, communication method, device, equipment and medium
CN102118263A (en) Method and system for distribution of configuration information
WO2023024886A1 (en) Reliable broadcast-based binary consensus method and apparatus, electronic device, and storage medium
CN110661658A (en) Node management method and device of block chain network and computer storage medium
CN111259072B (en) Data synchronization method, device, electronic equipment and computer readable storage medium
WO2021229304A1 (en) Updating of smart contract
WO2023016426A1 (en) Asynchronous binary agreement method and apparatus, and electronic device and storage medium
WO2023134160A1 (en) Blockchain network-based consensus method and apparatus, and electronic device and storage medium
CN110890987A (en) Method, device, equipment and system for automatically creating cluster
WO2023231335A1 (en) Method for executing transaction in blockchain, and master node of blockchain
CN111769950B (en) Key management method and system for token authentication in openstack system
WO2023016429A1 (en) Binary consensus method and apparatus capable of revoting, electronic device, and storage medium
CN113238996A (en) Block chain data archiving method based on DHT, electronic equipment and storage medium
US20230259930A1 (en) Cross-chain transaction processing method and apparatus, electronic device, and storage medium
CN113157450A (en) Method and apparatus for performing blocks in a blockchain system
WO2023207076A1 (en) Method and apparatus for establishing blockchain subnet
CN115604120A (en) Multi-cloud cluster resource sharing method, device, equipment and storage medium
CN112231415B (en) Data synchronization method and system of block chain network, electronic device and readable medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22919796

Country of ref document: EP

Kind code of ref document: A1