WO2020199179A1 - Method and apparatus for determining consensus node, and computer device and storage medium - Google Patents

Method and apparatus for determining consensus node, and computer device and storage medium Download PDF

Info

Publication number
WO2020199179A1
WO2020199179A1 PCT/CN2019/081432 CN2019081432W WO2020199179A1 WO 2020199179 A1 WO2020199179 A1 WO 2020199179A1 CN 2019081432 W CN2019081432 W CN 2019081432W WO 2020199179 A1 WO2020199179 A1 WO 2020199179A1
Authority
WO
WIPO (PCT)
Prior art keywords
nodes
candidate
node
consensus
candidate node
Prior art date
Application number
PCT/CN2019/081432
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 云图有限公司
Priority to PCT/CN2019/081432 priority Critical patent/WO2020199179A1/en
Publication of WO2020199179A1 publication Critical patent/WO2020199179A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange

Landscapes

  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Engineering & Computer Science (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Provided are a method and apparatus for determining a consensus node, and a computer device and a storage medium. The method comprises: acquiring a selection proportion of each target node from among a plurality of target nodes in a blockchain system; according to the selection proportion of each target node from among the plurality of target nodes, selecting candidate nodes from the plurality of target nodes to form a candidate node set; and randomly selecting a plurality of nodes from the candidate node set as consensus nodes. The solution solves the technical problem of a low degree of decentralization in the existing consensus node determination method, and achieves the technical effects of effectively improving the degree of decentralization and improving the security and expandability of a system.

Description

共识节点确定方法、装置、计算机设备和存储介质Method, device, computer equipment and storage medium for determining consensus node 技术领域Technical field
本申请涉及区块链技术领域,特别涉及一种共识节点确定方法、装置、计算机设备和存储介质。This application relates to the field of blockchain technology, in particular to a method, device, computer equipment and storage medium for determining consensus nodes.
背景技术Background technique
区块链的“不可能三角”理论提出了区块链的三个核心性能不能同时兼得:可扩展性、去中心化和安全性。去中心化的量化指标就是参与共识的节点数量,可扩展性的量化指标是共识性能,安全性的量化指标是作恶的经济成本。共识算法作为区块链的核心组件,同样存在这几个问题的权衡。The "impossible triangle" theory of the blockchain proposes that the three core properties of the blockchain cannot be achieved at the same time: scalability, decentralization, and security. The quantitative indicator of decentralization is the number of nodes participating in the consensus, the quantitative indicator of scalability is the consensus performance, and the quantitative indicator of security is the economic cost of evil. As the core component of the blockchain, the consensus algorithm also has these trade-offs.
目前主流区块链都倾向于采用PoS(Proof of Stake,权益证明)共识算法,但是所有PoS系统都会存在共识节点数量和性能之间的权衡问题。DPoS(Delegated Proof of Stake,委任权益证明)共识算法偏向较少的共识节点,换取较高的性能,但去中心化程度较低。Algorand采用随机方式在全网选取共识节点,但是只能在强同步网络上运行,个人用户很难参与,严重影响去中心化特性。At present, mainstream blockchains tend to adopt PoS (Proof of Stake) consensus algorithms, but all PoS systems have a trade-off between the number of consensus nodes and performance. DPoS (Delegated Proof of Stake) consensus algorithm favors fewer consensus nodes in exchange for higher performance, but the degree of decentralization is lower. Algorand uses a random method to select consensus nodes in the entire network, but it can only run on a strong synchronization network, and it is difficult for individual users to participate, which seriously affects the decentralization characteristics.
针对上述问题,目前尚未提出有效的解决方案。In view of the above problems, no effective solutions have been proposed yet.
发明内容Summary of the invention
本申请实施例提供了一种共识节点确定方法、装置、计算机设备和存储介质,以解决现有技术中选取共识节点存在去中心化程度低的问题。The embodiments of the present application provide a consensus node determination method, device, computer equipment, and storage medium to solve the problem of low decentralization in selecting consensus nodes in the prior art.
本申请实施例提供了一种共识节点确定方法,包括:获取区块链系统中多个目标节点中各目标节点的选定率;根据多个目标节点中各目标节点的选定率,从多个目标节点中选择出候选节点形成候选节点集;从候选节点集中随机选取多个节点作为共识节点。The embodiment of the application provides a method for determining a consensus node, including: obtaining the selection rate of each target node among multiple target nodes in the blockchain system; according to the selection rate of each target node among the multiple target nodes, A candidate node is selected from the target nodes to form a candidate node set; multiple nodes are randomly selected from the candidate node set as consensus nodes.
在一个实施例中,选定率包括以下至少之一:目标节点被区块链系统中的节点选定的比例、目标节点自身的份额占比。In an embodiment, the selection rate includes at least one of the following: the proportion of the target node selected by the node in the blockchain system, and the proportion of the target node's own share.
在一个实施例中,根据多个目标节点中各目标节点的选定率,从多个目标节点中选择出候选节点形成候选节点集,包括:将多个目标节点中被区块链系统中的节点选定的比例大于预设比例阈值的节点,作为入选节点,形成入选节点集;将入选节点集中自身的份额占比满足预设条件的入选节点,作为候选节点,形成候选节点集。In one embodiment, according to the selection rate of each target node in the multiple target nodes, selecting candidate nodes from the multiple target nodes to form a candidate node set includes: dividing the multiple target nodes into a block chain system. Nodes whose selected ratio is greater than a preset ratio threshold are used as selected nodes to form a selected node set; selected nodes whose share in the selected node set satisfies preset conditions are used as candidate nodes to form a candidate node set.
在一个实施例中,预设条件包括以下之一:超出预定占比阈值、位于前预设位数。In one embodiment, the preset condition includes one of the following: exceeding a preset proportion threshold and being located in the front preset number of digits.
在一个实施例中,从候选节点集中随机选取多个节点作为共识节点,包括:获取候选节点集中每个候选节点的权重,其中,每个候选节点的权重为每个候选节点获取的选票总票龄;获取区块链系统中多个区块的随机种子,其中,当前区块的随机种子是根据VRF算法和前一个区块的随机种子生成的;根据多个区块的随机种子和候选节点集中每个候选节点的排序序号,分别为候选节点集中的每个候选节点选取一个随机数;根据每个候选节点的权重和随机数确定候选节点集中每个候选节点被选中的票龄数;根据每个候选节点被选中的票龄数从候选节点集中确定多个共识节点。In one embodiment, randomly selecting multiple nodes from the set of candidate nodes as consensus nodes includes: obtaining the weight of each candidate node in the set of candidate nodes, where the weight of each candidate node is the total votes obtained by each candidate node Age; Get random seeds of multiple blocks in the blockchain system, where the random seed of the current block is generated according to the VRF algorithm and the random seed of the previous block; according to the random seeds and candidate nodes of multiple blocks The sorting sequence number of each candidate node in the set is selected, and a random number is selected for each candidate node in the candidate node set; according to the weight and random number of each candidate node, the number of votes for each candidate node in the candidate node set is determined; The number of votes each candidate node is selected determines multiple consensus nodes from the set of candidate nodes.
在一个实施例中,获取候选节点集中每个候选节点的权重,包括按照以下公式确定候选节点集中的每个候选节点的权重:In one embodiment, obtaining the weight of each candidate node in the candidate node set includes determining the weight of each candidate node in the candidate node set according to the following formula:
Figure PCTCN2019081432-appb-000001
Figure PCTCN2019081432-appb-000001
其中,w i是候选节点集中第i个候选节点的权重,A i,k为第i个候选节点获得的第k张选票的票龄,M i为第i个候选节点获取的选票的总张数,N为候选节点集中的候选节点的个数。 Among them, w i is the weight of the i-th candidate node in the candidate node set, A i,k is the age of the k- th vote obtained by the i-th candidate node, and Mi is the total number of votes obtained by the i-th candidate node Number, N is the number of candidate nodes in the candidate node set.
在一个实施例中,当前区块的随机种子是根据VRF算法和前一个区块的随机种子按照以下公式生成的:In one embodiment, the random seed of the current block is generated according to the VRF algorithm and the random seed of the previous block according to the following formula:
Figure PCTCN2019081432-appb-000002
Figure PCTCN2019081432-appb-000002
其中,r i和π i分别是当前区块的随机种子和证明数据,r i-1是当前区块的前一个区块的随机种子,sk i为生成当前区块的私钥,VRF函数为VRF算法,n为区块链系统的区块高度。 Wherein, r i and π i are the current block and random seed data demonstrate, r i-1 is a random seed block before the current block, sk i of the current block to generate a private key, VRF function VRF algorithm, n is the block height of the blockchain system.
在一个实施例中,根据多个区块的随机种子和候选节点集中每个候选节点的排序序号,分别为候选节点集中的每个候选节点选取一个随机数,包括按照以下公式为候选节点集中的每个候选节点选取一个随机数:In one embodiment, a random number is selected for each candidate node in the candidate node set according to the random seeds of multiple blocks and the sorting sequence number of each candidate node in the candidate node set, including selecting a random number for each candidate node in the candidate node set according to the following formula: Each candidate node selects a random number:
Figure PCTCN2019081432-appb-000003
Figure PCTCN2019081432-appb-000003
其中,i为候选节点集中的候选节点的排序序号,R i是候选节点集中的第i个候选节点的随机数,r n是区块链系统中第n个区块的随机种子,r n-i是区块链系统中第n-i个区块的随机种子,其中,n为区块链系统的区块高度,N为候选节点集中的候选节点的个数。 Among them, i is the sequence number of the candidate node in the candidate node set, R i is the random number of the i-th candidate node in the candidate node set, r n is the random seed of the nth block in the blockchain system, and r ni is The random seed of the nith block in the blockchain system, where n is the block height of the blockchain system, and N is the number of candidate nodes in the candidate node set.
在一个实施例中,根据每个候选节点的权重和随机数确定候选节点集中每个候选节点被选中的票龄数,包括:将满足以下不等式的最小J i值确定为第i个候选节点被选中的票 龄数: In one embodiment, determining the number of votes for each candidate node in the candidate node set according to the weight and random number of each candidate node includes: determining the minimum Ji value that satisfies the following inequality as the i-th candidate node Number of votes selected:
R i/2 hashlen≥F X(J i+1),i=1,2...N; R i /2 hashlen ≥F X (J i +1), i=1,2...N;
其中,R i是候选节点集中第i个候选节点的随机数,hashlen是根据VRF算法生成的随机种子的位数,F x为累计分布函数,N为候选节点集中的候选节点的个数,其中,F X(x)=P(X≤x),其中,
Figure PCTCN2019081432-appb-000004
表示候选节点集中第i个候选节点被选中的票龄数为k的概率,其中,
Figure PCTCN2019081432-appb-000005
其中,t为参与共识的多个共识节点的个数,
Figure PCTCN2019081432-appb-000006
为候选节点集中所有候选节点的权重的平均值,
Figure PCTCN2019081432-appb-000007
为候选节点集中所有候选节点的总权重,其中,w i是候选节点集中第i个候选节点的权重。
Among them, R i is the random number of the i-th candidate node in the candidate node set, hashlen is the number of bits of the random seed generated according to the VRF algorithm, F x is the cumulative distribution function, and N is the number of candidate nodes in the candidate node set, where , F X (x)=P(X≤x), where,
Figure PCTCN2019081432-appb-000004
Represents the probability that the number of votes of the i-th candidate node in the candidate node set is k, where,
Figure PCTCN2019081432-appb-000005
Among them, t is the number of multiple consensus nodes participating in the consensus,
Figure PCTCN2019081432-appb-000006
Is the average of the weights of all candidate nodes in the candidate node set,
Figure PCTCN2019081432-appb-000007
Is the total weight of all candidate nodes in the candidate node set, where w i is the weight of the i-th candidate node in the candidate node set.
在一个实施例中,根据每个候选节点被选中的票龄数从候选节点集中确定多个共识节点,包括:根据候选节点被选中的票龄数对候选节点集中的候选节点进行降序排序;对于被选中的票龄数相同的多个候选节点,根据候选节点的权重对多个候选节点进行降序排序;将排在前面预设个数的候选节点确定为参与共识的多个共识节点。In one embodiment, determining a plurality of consensus nodes from the candidate node set according to the number of votes each candidate node has been selected includes: sorting the candidate nodes in the candidate node set in descending order according to the number of votes the candidate node has been selected; The selected multiple candidate nodes with the same number of votes are sorted in descending order according to the weight of the candidate nodes; the candidate nodes ranked in the front preset number are determined as multiple consensus nodes participating in the consensus.
在一个实施例中,在根据每个候选节点被选中的票龄数从候选节点集中确定多个共识节点之后,还包括:多个共识节点轮流作为提议节点生成区块,其中,在生成最后一个区块时,分别在每个共识节点获得的选票中随机选取一张选票作为奖励选票,以获得多张奖励选票;针对多张奖励选票中的每一张奖励选票,对区块链系统中投出该奖励选票的节点进行奖励。In one embodiment, after determining multiple consensus nodes from the candidate node set according to the number of votes each candidate node has been selected, the method further includes: multiple consensus nodes take turns as proposed nodes to generate blocks, where the last one is generated During the block, randomly select one ballot from the votes obtained by each consensus node as the reward ballot to obtain multiple reward votes; for each of the multiple reward votes, vote in the blockchain system The node that gave the reward ballot will be rewarded.
在一个实施例中,分别在每个共识节点获得的选票中随机选取一张奖励选票,包括:针对每个共识节点,将该共识节点获得的所有选票按投票时间进行排序;针对每个共识节点,根据该共识节点获得的所有选票中各选票的票龄和排序序号确定各选票的票龄区间;针对每个共识节点,根据该共识节点被选中的票龄数所处的票龄区间,将该票龄区间对应的选票确定为奖励选票。In one embodiment, randomly selecting a reward vote from the votes obtained by each consensus node, including: for each consensus node, sort all votes obtained by the consensus node according to the voting time; for each consensus node , Determine the age range of each ballot according to the age and sort number of all votes obtained by the consensus node; for each consensus node, according to the age range of the vote age of the consensus node, The ballots corresponding to this ballot age range are determined as bonus ballots.
在一个实施例中,针对每个共识节点,根据该共识节点获得的所有选票中各选票的票龄和排序序号确定各选票的票龄区间,包括:将第i个共识节点的第μ张选票的票龄区间划分为:In one embodiment, for each consensus node, the vote age interval of each vote among all the votes obtained by the consensus node is determined according to the vote age and the ranking sequence number, including: the μth vote of the i-th consensus node The age range of votes is divided into:
Figure PCTCN2019081432-appb-000008
Figure PCTCN2019081432-appb-000008
其中,μ为选票的排序序号,I i,μ为第i个共识节点的第μ张选票的票龄区间,A i,k为 第i个候选节点获得的第k张选票的票龄,M i为第i个候选节点获取的选票的总张数,t为参与共识的多个共识节点的个数。 Among them, μ is the sequence number of the votes, I i, μ are the age intervals of the μth vote of the i-th consensus node, Ai ,k is the age of the k- th vote obtained by the i-th candidate node, M i is the total number of votes obtained by the i-th candidate node, and t is the number of multiple consensus nodes participating in the consensus.
本申请实施例还提供了一种共识节点确定装置,包括:获取模块,用于获取区块链系统中多个目标节点中各目标节点的选定率;选择模块,用于根据多个目标节点中各目标节点的选定率,从多个目标节点中选择出候选节点形成候选节点集;随机选取模块,用于从候选节点集中随机选取多个节点作为共识节点。The embodiment of the present application also provides a consensus node determination device, which includes: an acquisition module for acquiring the selection rate of each target node among multiple target nodes in the blockchain system; In the selection rate of each target node in the selection rate, candidate nodes are selected from multiple target nodes to form a candidate node set; the random selection module is used to randomly select multiple nodes from the candidate node set as consensus nodes.
本申请实施例还提供一种计算机设备,包括处理器以及用于存储处理器可执行指令的存储器,所述处理器执行所述指令时实现上述任意实施例中所述的共识节点确定方法的步骤。An embodiment of the present application also provides a computer device, including a processor and a memory for storing executable instructions of the processor. When the processor executes the instructions, the steps of the consensus node determination method described in any of the foregoing embodiments are implemented. .
本申请实施例还提供一种计算机可读存储介质,其上存储有计算机指令,所述指令被执行时实现上述任意实施例中所述的共识节点确定方法的步骤。An embodiment of the present application also provides a computer-readable storage medium on which computer instructions are stored, which when executed, implement the steps of the consensus node determination method described in any of the foregoing embodiments.
在本申请实施例中,提供了一种共识节点确定方法,根据多个目标节点中各目标节点的选定率,从多个目标节点中选择出候选节点形成候选节点集;然后从候选节点集中随机选取多个节点作为共识节点以参与共识。上述方法中,通过根据各目标节点的选定率来确定候选节点集,然后在候选节点集中随机选取多个共识节点,使得数量有限的共识节点参与共识,可以保证系统的共识性能,从而提高系统的可扩展性;同时,由于根据选定率从多个目标节点中确定候选节点集,一方面使得确定的候选节点集中的候选节点更具有代表性,另一方面可以维持较大的共识节点群的规模,有效避免了过于中心化的问题;另外,通过随机选取在候选节点集中确定多个共识节点,可以保证区块链系统的安全性。通过上述方案解决了现有的共识节点确定方法存在去中心化程度低的技术问题,达到了有效提升去中心化程度、提高系统安全性和可扩展性的技术效果。In the embodiment of the present application, a method for determining consensus nodes is provided. According to the selection rate of each of the multiple target nodes, candidate nodes are selected from multiple target nodes to form a candidate node set; Randomly select multiple nodes as consensus nodes to participate in the consensus. In the above method, the candidate node set is determined according to the selection rate of each target node, and then multiple consensus nodes are randomly selected from the candidate node set, so that a limited number of consensus nodes participate in the consensus, which can ensure the consensus performance of the system, thereby improving the system At the same time, because the candidate node set is determined from multiple target nodes according to the selection rate, on the one hand, the candidate nodes in the determined candidate node set are more representative, and on the other hand, a larger consensus node group can be maintained The scale of, effectively avoids the problem of over-centralization; in addition, the security of the blockchain system can be guaranteed by randomly selecting multiple consensus nodes in the candidate nodes. The above solution solves the technical problem of low decentralization in the existing consensus node determination method, and achieves the technical effect of effectively improving the degree of decentralization and improving the security and scalability of the system.
附图说明Description of the drawings
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,并不构成对本申请的限定。在附图中:The drawings described here are used to provide a further understanding of the application, constitute a part of the application, and do not constitute a limitation to the application. In the attached picture:
图1示出了本申请一实施例中的共识节点确定方法的示意图;FIG. 1 shows a schematic diagram of a method for determining a consensus node in an embodiment of the present application;
图2示出了本申请一实施例中的共识节点确定方法的流程图;Figure 2 shows a flowchart of a method for determining a consensus node in an embodiment of the present application;
图3示出了本申请一实施例中的共识节点确定方法的流程图;FIG. 3 shows a flowchart of a method for determining a consensus node in an embodiment of the present application;
图4示出了本申请一实施例中的共识节点确定装置的示意图;FIG. 4 shows a schematic diagram of a consensus node determining device in an embodiment of the present application;
图5示出了本申请一实施例中的计算机设备的示意图。Fig. 5 shows a schematic diagram of a computer device in an embodiment of the present application.
具体实施方式detailed description
下面将参考若干示例性实施方式来描述本申请的原理和精神。应当理解,给出这些实施方式仅仅是为了使本领域技术人员能够更好地理解进而实现本申请,而并非以任何方式限制本申请的范围。相反,提供这些实施方式是为了使本申请公开更加透彻和完整,并且能够将本公开的范围完整地传达给本领域的技术人员。The principle and spirit of the present application will be described below with reference to several exemplary embodiments. It should be understood that these embodiments are only provided to enable those skilled in the art to better understand and then implement the application, but not to limit the scope of the application in any way. On the contrary, these embodiments are provided to make the disclosure of this application more thorough and complete, and to fully convey the scope of the disclosure to those skilled in the art.
本领域的技术人员知道,本申请的实施方式可以实现为一种系统、装置设备、方法或计算机程序产品。因此,本申请公开可以具体实现为以下形式,即:完全的硬件、完全的软件(包括固件、驻留软件、微代码等),或者硬件和软件结合的形式。Those skilled in the art know that the implementation manners of this application can be implemented as a system, apparatus, method, or computer program product. Therefore, the disclosure of the present application can be specifically implemented in the following forms, namely: complete hardware, complete software (including firmware, resident software, microcode, etc.), or a combination of hardware and software.
虽然本申请提供了如下述实施例或附图所示的方法操作步骤或装置结构,但基于常规或者无需创造性的劳动在所述方法或装置中可以包括更多或者更少的操作步骤或模块单元。在逻辑性上不存在必要因果关系的步骤或结构中,这些步骤的执行顺序或装置的模块结构不限于本申请实施例描述及附图所示的执行顺序或模块结构。所述的方法或模块结构的在实际中的装置或终端产品应用时,可以按照实施例或者附图所示的方法或模块结构连接进行顺序执行或者并行执行(例如并行处理器或者多线程处理的环境,甚至分布式处理环境)。Although this application provides method operation steps or device structures as shown in the following embodiments or drawings, the method or device may include more or fewer operation steps or module units based on conventional or no creative labor. . In steps or structures where there is no necessary causal relationship logically, the execution order of these steps or the module structure of the device is not limited to the execution order or module structure shown in the description of the embodiments of this application and the drawings. When the described method or module structure is applied to an actual device or terminal product, it can be executed sequentially or in parallel according to the method or module structure connection shown in the embodiments or drawings (for example, parallel processor or multi-threaded processing Environment, even distributed processing environment).
本申请实施例提供了一种共识节点确定方法,该方法具体可以应用于区块链系统,其中,首先获取区块链系统中的多个目标节点中各目标节点的选定率,然后根据各目标节点的选定率从所述多个目标节点中选择候选节点形成候选节点集,然后从所述候选节点集中随机选取多个共识节点以参与共识,通过使得数量有限的共识节点参与共识可以保证系统的共识性能、提高系统的可扩展性,通过随机选取共识节点可以保证系统的安全性,通过从多个目标节点中确定候选节点集,可以维持较大的共识节点群的规模,有效避免过于中心化的问题,从而有效提高区块链系统的去中心化程度。The embodiment of the application provides a method for determining a consensus node, which can be specifically applied to a blockchain system, in which the selection rate of each target node among multiple target nodes in the blockchain system is first obtained, and then the selection rate of each target node Selection rate of target nodes Select candidate nodes from the multiple target nodes to form a candidate node set, and then randomly select multiple consensus nodes from the set of candidate nodes to participate in the consensus, which can ensure that a limited number of consensus nodes participate in the consensus The consensus performance of the system and the scalability of the system are improved. The security of the system can be ensured by randomly selecting consensus nodes. By determining the candidate node set from multiple target nodes, a large consensus node group can be maintained, effectively avoiding excessive The problem of centralization can effectively improve the degree of decentralization of the blockchain system.
在一个具体的场景示例中,参阅图1所示。其中,区块链系统中的目标节点集包括多个目标节点,根据目标节点集中各目标节点的选定率从多个目标节点中选择候选节点,形成候选节点集,然后从候选节点集中随机选取多个共识节点,以参与下一轮的共识过程。In a specific scenario example, refer to Figure 1. Among them, the target node set in the blockchain system includes multiple target nodes. According to the selection rate of each target node in the target node set, candidate nodes are selected from the multiple target nodes to form a candidate node set, and then randomly selected from the candidate node set Multiple consensus nodes to participate in the next round of consensus process.
其中,目标节点是区块链系统中可以接受投票节点的投票的区块链节点。区块链系统中的节点可以通过质押一定的令牌(Token)或其他形式的资产成为准目标节点。根据质押的令牌数,对区块链系统中的准目标节点进行降序排序;对于质押令牌数相同的多个准目标节点,根据质押时间对该多个准目标节点进行二次排序;然后将排在前面的预设位数 的准目标节点确定为所述多个目标节点,形成目标节点集。其中,预设位数可以根据实际需求来设置。通过控制目标节点集中的目标节点的个数可以控制共识节点群的规模,从而控制区块链系统的去中心化程度。其中,投票节点是区块链中的可以向目标节点投票的节点,区块链系统中的节点可以通过质押一定的令牌或其他形式的资产换取选票,成为投票节点。Among them, the target node is a blockchain node in the blockchain system that can accept votes from voting nodes. Nodes in the blockchain system can become quasi-target nodes by staking certain tokens or other forms of assets. According to the number of pledged tokens, sort the quasi-target nodes in the blockchain system in descending order; for multiple quasi-target nodes with the same number of pledged tokens, sort the multiple quasi-target nodes twice according to the pledge time; then The quasi-target nodes with a preset number of digits in front are determined as the multiple target nodes to form a target node set. Among them, the preset number of bits can be set according to actual needs. By controlling the number of target nodes in the target node set, the scale of the consensus node group can be controlled, thereby controlling the degree of decentralization of the blockchain system. Among them, voting nodes are nodes in the blockchain that can vote for target nodes. Nodes in the blockchain system can pledge certain tokens or other forms of assets in exchange for votes to become voting nodes.
图2示出了本申请一实施例中共识节点确定方法的流程图。如图2所示,本申请实施例提供的共识节点确定方法可以包括以下步骤:Fig. 2 shows a flowchart of a method for determining a consensus node in an embodiment of the present application. As shown in Figure 2, the method for determining a consensus node provided by the embodiment of the present application may include the following steps:
步骤S201,获取区块链系统中多个目标节点中各目标节点的选定率。Step S201: Obtain the selection rate of each target node among multiple target nodes in the blockchain system.
其中,目标节点是区块链系统中可以接受投票的区块链节点。为了从多个目标节点中选取具有代表性的节点作为候选节点,需要获取多个目标节点中各目标节点的选定率。Among them, the target node is a blockchain node that can accept votes in the blockchain system. In order to select representative nodes from multiple target nodes as candidate nodes, it is necessary to obtain the selection rate of each target node in the multiple target nodes.
在本申请一些实施例中,选定率可以包括以下至少之一:目标节点被区块链系统中的节点选定的比例、目标节点自身的份额占比。其中,目标节点被区块链系统中的节点选定的比例可以用目标节点从去区块链系统中的投票节点获得的选票数来表征。目标节点自身的份额占比可以指目标节点质押到合约账户中的令牌数或其他资产金额等。In some embodiments of the present application, the selection rate may include at least one of the following: the proportion of the target node selected by the node in the blockchain system, and the proportion of the target node's own share. Among them, the proportion of target nodes selected by nodes in the blockchain system can be characterized by the number of votes the target node obtains from voting nodes in the blockchain system. The proportion of the target node's own share can refer to the number of tokens or other assets pledged by the target node in the contract account.
步骤S202,根据多个目标节点中各目标节点的选定率,从多个目标节点中选择出候选节点形成候选节点集。Step S202: According to the selection rate of each target node among the multiple target nodes, candidate nodes are selected from the multiple target nodes to form a candidate node set.
为了使形成的候选节点集中的候选节点更具代表性,可以根据多个目标节点中各目标节点的选定率来从多个目标节点中选择出候选节点形成候选节点集。In order to make the candidate nodes in the formed candidate node set more representative, the candidate nodes may be selected from the multiple target nodes to form the candidate node set according to the selection rate of each of the multiple target nodes.
在本申请一些实施例中,步骤S202具体可以包括:将多个目标节点中被区块链系统中的节点选定的比例大于预设比例阈值的节点,作为入选节点,形成入选节点集;将入选节点集中自身的份额占比满足预设条件的入选节点,作为候选节点,形成候选节点集。In some embodiments of the present application, step S202 may specifically include: among the multiple target nodes, nodes whose ratios selected by nodes in the blockchain system are greater than a preset ratio threshold are used as selected nodes to form a selected node set; The selected nodes whose shares in the selected node set meet the preset conditions are regarded as candidate nodes to form a candidate node set.
具体地,可以将多个目标节点中获得的选票数大于预设阈值的目标节点作为入选节点,形成入选节点集;然后将入选节点集中各入选节点质押的令牌数满足预设条件的入选节点作为候选节点,形成候选节点集。通过两层筛选,可以获取获得的选票数较多而且质押的令牌数满足一定条件的节点作为候选节点集,从而使得候选节点集中的候选节点更有代表性,还可以维持较大规模的共识节点群,有效提高区块链系统的去中心化程度。Specifically, a target node whose number of votes obtained by multiple target nodes is greater than a preset threshold can be used as a selected node to form a selected node set; then the number of tokens pledged by each selected node in the selected node set meets the preset conditions. As candidate nodes, a candidate node set is formed. Through two-layer screening, nodes with a large number of votes and pledged tokens that meet certain conditions can be obtained as a candidate node set, so that the candidate nodes in the candidate node set are more representative and a larger-scale consensus can be maintained The node group effectively improves the degree of decentralization of the blockchain system.
进一步地,在本申请的一些实施例中,上述预设条件可以包括以下之一:超出预定占比阈值、位于前预设位数。其中,超出预定占比阈值可以指目标节点质押的令牌数或其他资产额高于预设阈值;位于前预设位数可以指对目标节点质押的令牌数或其他资产额进行降序排序时,位于前预设位数的目标节点。其中,预设条件的具体选取可以根据实际需求 来确定。Further, in some embodiments of the present application, the foregoing predetermined condition may include one of the following: exceeding a predetermined proportion threshold and being located in the front predetermined number of digits. Among them, exceeding the predetermined proportion threshold can mean that the number of tokens or other assets pledged by the target node is higher than the preset threshold; the first preset digit can refer to when the number of tokens or other assets pledged by the target node is sorted in descending order , The target node located in the front preset digits. Among them, the specific selection of preset conditions can be determined according to actual needs.
步骤S203,从候选节点集中随机选取多个节点作为共识节点。Step S203: randomly select multiple nodes from the set of candidate nodes as consensus nodes.
具体地,在形成候选节点集中,为了提高系统的安全性,可以从候选节点集中随机选取多个节点作为共识节点。其中,多个共识节点可以用于参与下一轮的共识过程,以生成多个区块。多个共识节点中的每一个节点轮流作为提议节点生成区块,生成的区块由多个共识节点中的其他节点进行验证,验证通过后将区块上链。Specifically, in forming the candidate node set, in order to improve the security of the system, multiple nodes can be randomly selected from the candidate node set as consensus nodes. Among them, multiple consensus nodes can be used to participate in the next round of consensus process to generate multiple blocks. Each of the multiple consensus nodes takes turns as a proposal node to generate a block, and the generated block is verified by other nodes in the multiple consensus nodes, and the block is uploaded to the chain after the verification is passed.
可以理解的是,上述方法可以用于确定参加下一轮共识的多个共识节点,可以在本轮共识生成最后一个区块时执行上述步骤,以确定下一轮的共识节点。其中,区块提议节点和验证节点都按照相同的规则在生产和验证每一轮的最后一个区块时,执行相同的选取逻辑(上述步骤S201-S203),最后达成共识,从而成功选取参与下一轮共识的多个共识节点。对于第一轮共识的共识节点可以通过创世区块直接设置,例如,可以由创世区块中的配置文件配置或直接写在代码中。It is understandable that the above method can be used to determine multiple consensus nodes participating in the next round of consensus, and the above steps can be executed when the last block of the current round of consensus is generated to determine the next consensus node. Among them, the block proposal node and the verification node execute the same selection logic (the above steps S201-S203) when producing and verifying the last block of each round according to the same rules, and finally reach a consensus, thereby successfully selecting and participating in the next block. Multiple consensus nodes for a round of consensus. The consensus node for the first round of consensus can be directly set through the genesis block, for example, it can be configured by the configuration file in the genesis block or written directly in the code.
上述方法中,通过根据各目标节点的选定率来确定候选节点集,然后在候选节点集中随机选取多个共识节点,使得数量有限的共识节点参与共识,可以保证系统的共识性能,从而提高系统的可扩展性;同时,由于根据选定率从多个目标节点中确定候选节点集,一方面使得确定的候选节点集中的候选节点更具有代表性,另一方面可以维持较大的共识节点群的规模,有效避免了过于中心化的问题;另外,通过随机选取在候选节点集中确定多个共识节点,可以保证区块链系统的安全性。通过上述方案解决了现有的共识节点确定方法存在去中心化程度低的技术问题,达到了有效提升去中心化程度、提高系统安全性和可扩展性的技术效果。In the above method, the candidate node set is determined according to the selection rate of each target node, and then multiple consensus nodes are randomly selected from the candidate node set, so that a limited number of consensus nodes participate in the consensus, which can ensure the consensus performance of the system, thereby improving the system At the same time, because the candidate node set is determined from multiple target nodes according to the selection rate, on the one hand, the candidate nodes in the determined candidate node set are more representative, and on the other hand, a larger consensus node group can be maintained The scale of, effectively avoids the problem of over-centralization; in addition, the security of the blockchain system can be guaranteed by randomly selecting multiple consensus nodes in the candidate nodes. The above solution solves the technical problem of low decentralization in the existing consensus node determination method, and achieves the technical effect of effectively improving the degree of decentralization and improving the security and scalability of the system.
进一步地,在本申请一些实施例中,如图3所示,从候选节点集中随机选取多个节点作为共识节点,可以包括以下步骤:Further, in some embodiments of the present application, as shown in FIG. 3, randomly selecting multiple nodes from a set of candidate nodes as consensus nodes may include the following steps:
步骤S301,获取候选节点集中每个候选节点的权重,其中,每个候选节点的权重为每个候选节点获取的选票总票龄。Step S301: Obtain the weight of each candidate node in the candidate node set, where the weight of each candidate node is the total vote age obtained by each candidate node.
具体地,候选节点的权重可以是候选节点获取的所有选票的总票龄,在从候选节点集中随机选取共识节点时,可以考虑候选节点集中的候选节点的权重。Specifically, the weight of the candidate node may be the total vote age of all votes obtained by the candidate node. When a consensus node is randomly selected from the candidate node set, the weight of the candidate node in the candidate node set may be considered.
步骤S302,获取区块链系统中多个区块的随机种子,其中,当前区块的随机种子是根据VRF算法和前一个区块的随机种子生成的。Step S302: Obtain random seeds of multiple blocks in the blockchain system, where the random seed of the current block is generated according to the VRF algorithm and the random seed of the previous block.
步骤S303,根据多个区块的随机种子和候选节点集中每个候选节点的排序序号,分别为候选节点集中的每个候选节点选取一个随机数。In step S303, a random number is selected for each candidate node in the candidate node set according to the random seeds of multiple blocks and the sorting sequence number of each candidate node in the candidate node set.
具体地,为了从候选节点集中随机选取共识节点,可以为每个候选节点选取一个随机数,进行伯努利实验。其中,区块链系统中的每个区块都有一个随机种子,当前区块的随机种子是根据VRF算法和前一个区块的随机种子生成的。其中,候选节点的排序序号是指按照候选节点获得的选票数对候选节点进行降序排序并根据候选节点质押的令牌数或其他资产额进行二次排序后得到的序号。在获取多个区块的随机种子和候选节点集中每个候选节点的排序序号之后,可以根据随机种子和排序序号分别为每个候选节点选取一个随机数。Specifically, in order to randomly select consensus nodes from a set of candidate nodes, a random number can be selected for each candidate node to perform a Bernoulli experiment. Among them, each block in the blockchain system has a random seed, and the random seed of the current block is generated according to the VRF algorithm and the random seed of the previous block. Among them, the sorting sequence number of the candidate node refers to the sequence number obtained by sorting the candidate nodes in descending order according to the number of votes obtained by the candidate node and secondly sorting according to the number of tokens or other assets pledged by the candidate node. After obtaining the random seeds of multiple blocks and the sorting sequence number of each candidate node in the candidate node set, a random number can be selected for each candidate node according to the random seed and sorting sequence number.
步骤S304,根据每个候选节点的权重和随机数确定候选节点集中每个候选节点被选中的票龄数。Step S304: Determine the number of votes for each candidate node in the candidate node set according to the weight and random number of each candidate node.
步骤S305,根据每个候选节点被选中的票龄数从候选节点集中确定多个共识节点。Step S305: Determine multiple consensus nodes from the set of candidate nodes according to the number of votes each candidate node has been selected.
其中,候选节点的权重越高,被选中的概率就越高,由于候选节点的权重是候选节点获得的选票总票龄,所以可以通过计算候选节点被选中的票龄数来确定共识节点。根据每个候选节点的权重和随机数两者来候选节点集中每个候选节点被选中的票龄数,可以保证共识节点的代表性和随机性。Among them, the higher the weight of the candidate node, the higher the probability of being selected. Since the weight of the candidate node is the total age of votes obtained by the candidate node, the consensus node can be determined by calculating the number of votes the candidate node has been selected. According to the weight and random number of each candidate node, the number of votes of each candidate node in the candidate node set is selected to ensure the representativeness and randomness of the consensus node.
上述方法中,根据VRF算法按照候选节点的权重从候选节点集中选取多个节点作为共识节点,一方面可以保证共识节点选取的随机性,另一方面按照候选节点的权重进行随机选取,可以使得被选定的共识节点更具有代表性,可以有效保证区块链系统的安全性。In the above method, according to the VRF algorithm, multiple nodes are selected from the candidate nodes as consensus nodes according to the weight of the candidate nodes. On the one hand, the randomness of the consensus node selection can be guaranteed, and on the other hand, the random selection according to the weight of the candidate nodes can make the The selected consensus nodes are more representative and can effectively ensure the security of the blockchain system.
在本申请一些实施例中,获取候选节点集中每个候选节点的权重,可以包括按照以下公式确定候选节点集中的每个候选节点的权重:In some embodiments of the present application, obtaining the weight of each candidate node in the candidate node set may include determining the weight of each candidate node in the candidate node set according to the following formula:
Figure PCTCN2019081432-appb-000009
Figure PCTCN2019081432-appb-000009
其中,w i是候选节点集中第i个候选节点的权重,即第i个候选节点获取的选票总票龄,A i,k为第i个候选节点获得的第k张选票的票龄,M i为第i个候选节点获取的选票的总张数,N为候选节点集中的候选节点的个数。其中,A i,k=H i,k-L i,k,H i,k为在当前时刻的区块高度,L i,k为第i个候选节点的第k张选票产生时的区块高度。 Among them, w i is the weight of the i-th candidate node in the candidate node set, that is, the total age of votes obtained by the i-th candidate node, Ai,k is the age of the k- th vote obtained by the i-th candidate node, M i is the total number of votes obtained by the i-th candidate node, and N is the number of candidate nodes in the candidate node set. Among them, Ai,k = Hi,k- Li ,k , Hi,k is the block height at the current moment, Li ,k is the block when the k-th vote of the i-th candidate node is generated height.
在本申请一些实施例中,当前区块的随机种子是根据VRF算法和前一个区块的随机种子按照以下公式生成的:In some embodiments of this application, the random seed of the current block is generated according to the VRF algorithm and the random seed of the previous block according to the following formula:
Figure PCTCN2019081432-appb-000010
Figure PCTCN2019081432-appb-000010
其中,r i和π i分别是当前区块的随机种子和证明数据,r i-1是当前区块的前一个区块 的随机种子,sk i为生成当前区块的私钥,VRF函数为VRF算法,n为区块链系统的区块高度。 Wherein, r i and π i are the current block and random seed data demonstrate, r i-1 is a random seed block before the current block, sk i of the current block to generate a private key, VRF function VRF algorithm, n is the block height of the blockchain system.
具体地,每个共识节点在本地产生公私钥对(pk i,sk i),私钥sk i本地保管用于生成随机种子,公钥pk i公开用于验证生成的随机种子。其中,创世区块生成一个随机数作为初始伪随机种子r 0。每个共识节点产生新区块时根据VRF函数和本地保存的私钥sk i进行计算生成该区块的随机种子r i,该函数返回一个哈希值和一个证明数据π i,哈希值和证明数据π i都打包在新区块上。哈希值作为当前区块的随机种子r i,哈希值由私钥sk i和前一个区块r i-1的随机种子根据确定,不可伪造。证明数据π i可以用于任何知晓生成该区块的共识节点的公钥的其他共识节点验证哈希值确实由该共识节点根据前一个区块的随机种子生成的,该哈希值的随机范围在[0,2 hashlen-1],其中,hashlen就是VRF函数产生的哈希值的上限值的位数,一般为2048。 Specifically, each node generates a random seed common public and private key pair (pk i, sk i), the private key sk i local storage for generating a random seed, is disclosed for verifying the public key pk i generated locally. Among them, the genesis block generates a random number as the initial pseudo-random seed r 0 . Each common node when a new block is generated according to the stored VRF function and the local private key sk i is calculated for the block to generate random seed r i, the function returns a hash value and a proof data π i, and the hash value proof The data π i are packed on the new block. The hash value is used as the random seed r i of the current block, and the hash value is determined by the private key sk i and the random seed of the previous block r i-1 , and cannot be forged. The proof data π i can be used by any other consensus node that knows the public key of the consensus node that generated the block to verify that the hash value is indeed generated by the consensus node according to the random seed of the previous block, and the random range of the hash value In [0,2 hashlen -1], where hashlen is the upper limit of the number of bits of the hash value generated by the VRF function, generally 2048.
在本申请一些实施例中,根据随机种子和候选节点集中的每个候选节点的排序序号,分别为候选节点集中的每个候选节点选取一个随机数,可以包括按照以下公式为候选节点集中的每个候选节点选取一个随机数:In some embodiments of the present application, according to the random seed and the sequence number of each candidate node in the candidate node set, selecting a random number for each candidate node in the candidate node set may include selecting a random number for each candidate node in the candidate node set according to the following formula: Select a random number for each candidate node:
Figure PCTCN2019081432-appb-000011
Figure PCTCN2019081432-appb-000011
其中,i为候选节点集中的候选节点的排序序号,R i是候选节点集中的第i个候选节点的随机数,r n是区块链系统中第n个区块的随机种子,r n-i是区块链系统中第n-i个区块的随机种子,其中,n为区块链系统的区块高度,N为候选节点集中的候选节点的个数。一般地,n为负责选取下一轮共识节点的区块的高度。给候选节点集中每个候选节点选择一个随机数进行伯努利试验,随机数的选取规则为:根据候选节点在候选节点集中的排序序号i,选择随机种子r n和r n-i,为降低被攻击的风险,进行伯努利试验的随机数R i为两个随机种子r n和r n-i的异或。通过上述方式选择随机数,可以进一步提高区块链系统的安全性。 Among them, i is the sequence number of the candidate node in the candidate node set, R i is the random number of the i-th candidate node in the candidate node set, r n is the random seed of the nth block in the blockchain system, and r ni is The random seed of the nith block in the blockchain system, where n is the block height of the blockchain system, and N is the number of candidate nodes in the candidate node set. Generally, n is the height of the block responsible for selecting the next round of consensus nodes. Choose a random number for each candidate node in the candidate node set for Bernoulli test. The selection rule of random number is: According to the sort number i of the candidate node in the candidate node set, random seeds r n and r ni are selected to reduce the attack The random number R i for Bernoulli test is the exclusive OR of two random seeds r n and r ni . By selecting random numbers in the above manner, the security of the blockchain system can be further improved.
在本申请一些实施例中,根据每个候选节点的随机数确定候选节点集中每个候选节点被选中的票龄数,可以包括:将满足以下不等式的最小J i值确定为第i个候选节点被选中的票龄数: In some embodiments of the present application, determining the number of vote ages of each candidate node in the candidate node set according to the random number of each candidate node may include: determining the minimum Ji value satisfying the following inequality as the i-th candidate node Number of vote ages selected:
R i/2 hashlen≥F X(J i+1),i=1,2...N; R i /2 hashlen ≥F X (J i +1), i=1,2...N;
其中,R i是候选节点集中第i个候选节点的随机数,hashlen是根据VRF算法生成的随机种子的位数,F x为累计分布函数,N为候选节点集中的候选节点的个数,其中, F X(x)=P(X≤x),其中,
Figure PCTCN2019081432-appb-000012
表示候选节点集中第i个候选节点被选中的票龄数为k的概率,其中,
Figure PCTCN2019081432-appb-000013
其中,t为参与共识的多个共识节点的个数,
Figure PCTCN2019081432-appb-000014
为候选节点集中所有候选节点的权重的平均值,
Figure PCTCN2019081432-appb-000015
为候选节点集中所有候选节点的总权重,其中,w i是候选节点集中第i个候选节点的权重。
Among them, R i is the random number of the i-th candidate node in the candidate node set, hashlen is the number of bits of the random seed generated according to the VRF algorithm, F x is the cumulative distribution function, and N is the number of candidate nodes in the candidate node set, where ,F X (x)=P(X≤x), where,
Figure PCTCN2019081432-appb-000012
Represents the probability that the number of votes of the i-th candidate node in the candidate node set is k, where,
Figure PCTCN2019081432-appb-000013
Among them, t is the number of multiple consensus nodes participating in the consensus,
Figure PCTCN2019081432-appb-000014
Is the average of the weights of all candidate nodes in the candidate node set,
Figure PCTCN2019081432-appb-000015
Is the total weight of all candidate nodes in the candidate node set, where w i is the weight of the i-th candidate node in the candidate node set.
具体地,假设每位候选节点的权重记为w i(i=1,2…N,每个候选节点的选票总票龄),那么总的权重为
Figure PCTCN2019081432-appb-000016
(所有候选节点的总票龄),那么第i个候选节点被选为共识节点的概率就与其权重占比相匹配w i/W。每一轮从候选节点池中的N个候选节点中选取t个共识节点,如果所有候选节点的平均票龄数为
Figure PCTCN2019081432-appb-000017
则每一个票龄单位被选中的概率为
Figure PCTCN2019081432-appb-000018
在候选节点池中随机选取共识节点实际就是做伯努利试验,因此每个候选节点的w个票龄中被选中k个的概率遵循二项分布
Figure PCTCN2019081432-appb-000019
累积分布函数为F X(x)=P(X≤x)。每一轮的最后一个区块提议节点负责选取下一轮的共识节点:给候选节点池中每个候选节点选择一个随机数R i进行伯努利试验。对每个候选节点根据二项分布累积函数计算不等式R i/2 hashlen≥F X(J i+1),i=1,2...N,找到满足该不等式的最小J i值,即说明该候选节点被选中J i个票龄。
Specifically, assuming that the weight of each candidate node is denoted as w i (i=1, 2...N, the total vote age of each candidate node), then the total weight is
Figure PCTCN2019081432-appb-000016
(The total vote age of all candidate nodes), then the probability of the i-th candidate node being selected as a consensus node matches its weight ratio w i /W. In each round, t consensus nodes are selected from N candidate nodes in the candidate node pool, if the average vote age of all candidate nodes is
Figure PCTCN2019081432-appb-000017
Then the probability of each voting age unit being selected is
Figure PCTCN2019081432-appb-000018
Random selection of consensus nodes in the candidate node pool is actually a Bernoulli test, so the probability of k selected among the w vote ages of each candidate node follows a binomial distribution
Figure PCTCN2019081432-appb-000019
The cumulative distribution function is F X (x)=P (X≤x). The last block proposal node of each round is responsible for selecting the consensus node for the next round: a random number R i is selected for each candidate node in the candidate node pool for Bernoulli test. For each candidate node, calculate the inequality R i /2 hashlen ≥F X (J i +1), i=1, 2...N according to the binomial distribution cumulative function, and find the minimum J i value that satisfies the inequality, which means the selected candidate node J i is a ticket age.
在本申请一些实施例中,根据每个候选节点被选中的票龄数从候选节点集中确定多个共识节点,可以包括:根据候选节点被选中的票龄数对候选节点集中的候选节点进行降序排序;对于被选中的票龄数相同的多个候选节点,根据候选节点的权重对多个候选节点进行降序排序;将排在前面预设个数的候选节点确定为参与共识的多个共识节点。In some embodiments of the present application, determining a plurality of consensus nodes from the candidate node set according to the number of vote ages of each candidate node being selected may include: descending order of the candidate nodes in the candidate node set according to the number of vote ages of the candidate nodes being selected Sorting; for selected multiple candidate nodes with the same number of votes, sort multiple candidate nodes in descending order according to the weight of the candidate nodes; determine the preset number of candidate nodes in the front as multiple consensus nodes participating in the consensus .
在确定候选节点池中每个候选节点被选中的票龄数之后,可以根据票龄数从候选节点池中选取共识节点。具体地,先根据候选节点被选中的票龄数对候选节点集中的候选节点进行降序排序;然后对于被选中的票龄数相同的多个候选节点,根据候选节点的权重对多个候选节点进行二次排序;将排在前面预设个数的候选节点确定为参与共识的多个共识节点。通过上述方式,可以根据被选中的票龄数方便地从候选节点池中选取共识节点。After determining the number of votes for each candidate node in the candidate node pool, consensus nodes can be selected from the candidate node pool according to the number of votes. Specifically, the candidate nodes in the candidate node set are sorted in descending order according to the number of vote ages of the candidate nodes being selected; then for multiple candidate nodes with the same vote age selected, the multiple candidate nodes are performed according to the weight of the candidate nodes. Secondary sorting; the candidate nodes ranked in the front preset number are determined as multiple consensus nodes participating in the consensus. Through the above method, the consensus node can be conveniently selected from the candidate node pool according to the number of vote ages selected.
为激励区块链系统中的投票节点参与投票,可以在每一轮共识中,在每个共识节点获取的选票中随机选取一张选票,被选中的选票会获取一定的激励。因此,在本申请一些实施例中,在根据每个候选节点被选中的票龄数从候选节点集中确定多个共识节点之后,还 可以包括:多个共识节点轮流作为提议节点生成区块,其中,在生成最后一个区块时,分别在每个共识节点获得的选票中随机选取一张选票作为奖励选票,以获得多张奖励选票;针对多张奖励选票中的每一张奖励选票,对区块链系统中投出该奖励选票的节点进行奖励。通过上述方式,可以激励区块链系统中的投票节点参与投票,从而使得被选出来的共识节点更具有代表性。In order to encourage voting nodes in the blockchain system to participate in voting, in each round of consensus, a vote can be randomly selected from the votes obtained by each consensus node, and the selected vote will get a certain incentive. Therefore, in some embodiments of the present application, after determining multiple consensus nodes from the candidate nodes based on the number of votes each candidate node has been selected, it may further include: multiple consensus nodes taking turns as proposed nodes to generate blocks, where When the last block is generated, one vote is randomly selected from the votes obtained by each consensus node as a reward vote to obtain multiple reward votes; for each of the multiple reward votes, the district The node in the blockchain system that casts the reward ballot will be rewarded. Through the above method, the voting nodes in the blockchain system can be encouraged to participate in voting, so that the selected consensus nodes are more representative.
在本申请一些实施例中,分别在每个共识节点获得的选票中随机选取一张奖励选票,可以包括:针对每个共识节点,将该共识节点获得的所有选票按投票时间进行排序;针对每个共识节点,根据该共识节点获得的所有选票中各选票的票龄和排序序号确定各选票的票龄区间;针对每个共识节点,根据该共识节点被选中的票龄数所处的票龄区间,将该票龄区间对应的选票确定为奖励选票。通过上述方式,可以根据各选票的票龄以及排序序号随机选取奖励选票,操作方便。In some embodiments of this application, randomly selecting a reward ballot from the votes obtained by each consensus node may include: for each consensus node, sort all votes obtained by the consensus node according to the voting time; A consensus node determines the age range of each vote according to the age and sorting sequence number of each vote in all the votes obtained by the consensus node; for each consensus node, according to the vote age of the consensus node selected by the vote age In the interval, the ballot corresponding to the voting age interval is determined as the reward ballot. Through the above method, the reward ballots can be randomly selected according to the voting age and the ranking sequence number of each ballot, which is convenient to operate.
进一步地,在本申请一些实施例中,针对每个共识节点,根据该共识节点获得的所有选票中各选票的票龄和排序序号确定各选票的票龄区间,可以包括:将第i个共识节点的第μ张选票的票龄区间划分为:Further, in some embodiments of this application, for each consensus node, the vote age range of each vote among all the votes obtained by the consensus node and the sequence number of each vote are determined, which may include: the i-th consensus The age interval of the μth vote of the node is divided into:
Figure PCTCN2019081432-appb-000020
Figure PCTCN2019081432-appb-000020
其中,μ为选票的排序序号,I i,μ为第i个共识节点的第μ张选票的票龄区间,A i,k为第i个候选节点获得的第k张选票的票龄,M i为第i个候选节点获取的选票的总张数,t为参与共识的多个共识节点的个数。例如,对于第j个共识节点,其被选中的票龄数为J j,当确定J j所处的票龄区间为I j,ν时,则可以将第j个共识节点获得的第ν张选票确定为该共识节点对应的奖励选票。通过上述方式,可以根据票龄和排序序号划分票龄区间,然后根据票龄区间和每个共识节点被选中的票龄数确定每个节点对应的奖励选票,并对获得多个奖励选票进行奖励。 Among them, μ is the sequence number of the votes, I i, μ are the age intervals of the μth vote of the i-th consensus node, Ai ,k is the age of the k- th vote obtained by the i-th candidate node, M i is the total number of votes obtained by the i-th candidate node, and t is the number of multiple consensus nodes participating in the consensus. For example, for the j-th consensus node, the number of vote ages selected is J j . When it is determined that the age range of J j is I j,ν , then the νth ticket obtained by the j-th consensus node can be The votes are determined as the reward votes corresponding to the consensus node. Through the above method, the voting age interval can be divided according to the voting age and the sorting sequence number, and then the reward votes corresponding to each node are determined according to the voting age interval and the number of voting ages selected by each consensus node, and rewards for obtaining multiple reward votes .
一般地,可以在本轮共识中生成最后一个区块时,确定本轮参加共识的共识节点对应的奖励选票,以及确定参与下轮共识的多个共识节点。Generally, when the last block is generated in the current round of consensus, the reward votes corresponding to the consensus nodes participating in the current round of consensus can be determined, and multiple consensus nodes participating in the next round of consensus can be determined.
此外,为了激励参与共识的共识节点积极出块,可以通过奖励出块节点来实现。例如,共识节点中的出块节点每出一个区块可以获得一定的奖励,这个奖励规则是固定的,比如每个区块固定奖励5个令牌,这样在该区块被其他共识节点验证的时候,除了执行区块中打包的交易外,还会额外执行奖励规则,并将这些交易执行结果和奖励结果跟区块头中的根哈希值对比,如果一致则表示区块被验证通过,在验证通过后,奖励就给到出块节点的 账户。In addition, in order to encourage consensus nodes participating in the consensus to actively produce blocks, this can be achieved by rewarding block producers. For example, the block producer in the consensus node can get a certain reward for each block. This reward rule is fixed, such as a fixed reward of 5 tokens per block, so that the block is verified by other consensus nodes At this time, in addition to executing the transactions packaged in the block, additional reward rules will be executed, and the transaction execution results and reward results will be compared with the root hash value in the block header. If they are consistent, the block has been verified. After the verification is passed, the reward is given to the account of the block producer.
同样,为了提高区块链系统的安全性,可以对恶意节点进行惩罚。具体地,共识节点在共识过程中如果违反BFT(拜占庭容错)协议,如在自己的出块轮次中没有出块,在相同块高打包或确认不同的块造成分叉等,将会被触发,除被淘汰出候选节点集和目标节点集外,质押到合约账户中的令牌还需要被扣除。惩罚跟奖励的执行方法是一样的,不过惩罚是打包在下一轮共识的第一个区块中,所有共识节点对下一轮的第一个区块共识验证时进行惩罚。通过对共识节点进行奖励或惩罚,可以提高区块链系统的安全性和系统可靠性。Similarly, in order to improve the security of the blockchain system, malicious nodes can be punished. Specifically, if a consensus node violates the BFT (Byzantine Fault Tolerance) protocol during the consensus process, such as not producing a block in its own block generation round, packing at the same block height or confirming that different blocks cause a fork, it will be triggered In addition to being eliminated from the candidate node set and target node set, the tokens pledged to the contract account also need to be deducted. The execution method of the penalty and reward is the same, but the penalty is packaged in the first block of the next round of consensus, and all consensus nodes will punish the first block of the next round of consensus verification. By rewarding or punishing consensus nodes, the security and system reliability of the blockchain system can be improved.
下面结合一个具体实施例对上述方法进行说明,然而,值得注意的是,该具体实施例仅是为了更好地说明本申请,并不构成对本申请的不当限定。The above method will be described below in conjunction with a specific embodiment. However, it is worth noting that this specific embodiment is only for better describing the application, and does not constitute an improper limitation of the application.
具体地,本实施例中的共识节点确定方法可以称为PPoS(Probabilistic Proof of Stake,概率权益证明),基于DPOS和VRF算法在规模可控制的候选节点池中按照权重随机抽取出数量有限的共识节点。具体地,每轮共识过程中生成最后一个区块的共识节点从候选节点池中根据候选节点的权重重新随机选出t个节点作为下轮参与共识的共识节点,负责下一轮区块的打包,可以包括以下步骤:Specifically, the method for determining consensus nodes in this embodiment can be called PPoS (Probabilistic Proof of Stake). Based on DPOS and VRF algorithms, a limited number of consensuses are randomly selected based on the weight of the candidate node pool with a controllable scale. node. Specifically, the consensus node that generates the last block in each round of consensus process randomly selects t nodes from the candidate node pool according to the weight of the candidate node as the consensus nodes participating in the next round of consensus, and is responsible for the next round of block packaging , Can include the following steps:
步骤1,获取区块链系统中多个目标节点中各目标节点获得的选票数和质押金额;Step 1. Obtain the number of votes and pledge amount obtained by each target node among multiple target nodes in the blockchain system;
步骤2,将多个目标节点中被区块链系统中的节点获得的选票数大于预设阈值的节点,作为入选节点,形成入选节点集;Step 2: Take the node whose number of votes obtained by the node in the blockchain system from the multiple target nodes is greater than the preset threshold as the selected node to form the selected node set;
步骤3,根据入选节点集中各入选节点的质押金额对入选节点进行降序排序,在质押金额相同的多个入选节点,根据各入选节点的质押时间进行二次排序,并排在前面的预设个数的入选节点确定为候选节点,形成候选节点集;Step 3: Sort the selected nodes in descending order according to the pledge deposit amount of each selected node in the selected node set. In multiple selected nodes with the same pledge deposit amount, perform a secondary sorting according to the pledge time of each selected node, and rank in the front preset number The selected nodes of are determined as candidate nodes to form a candidate node set;
步骤4,按照以下公式确定候选节点集中的每个候选节点的权重:Step 4. Determine the weight of each candidate node in the candidate node set according to the following formula:
Figure PCTCN2019081432-appb-000021
Figure PCTCN2019081432-appb-000021
其中,w i是候选节点集中第i个候选节点的权重,A i,k为第i个候选节点获得的第k张选票的票龄,M i为第i个候选节点获取的选票的总张数,N为候选节点集中的候选节点的个数; Among them, w i is the weight of the i-th candidate node in the candidate node set, A i,k is the age of the k- th vote obtained by the i-th candidate node, and Mi is the total number of votes obtained by the i-th candidate node Number, N is the number of candidate nodes in the candidate node set;
步骤5,获取区块链系统中多个区块的随机种子,其中,创世区块随机生成一个随机数作为创世区块的随机种子r 0,当前区块的随机种子是根据VRF算法和前一个区块的随机种子按照以下公式生成的: Step 5: Obtain random seeds of multiple blocks in the blockchain system. Among them, the genesis block randomly generates a random number as the random seed r 0 of the genesis block. The random seed of the current block is based on the VRF algorithm and The random seed of the previous block is generated according to the following formula:
Figure PCTCN2019081432-appb-000022
Figure PCTCN2019081432-appb-000022
其中,r i和π i分别是当前区块的随机种子和证明数据,r i-1是当前区块的前一个区块的随机种子,sk i为生成当前区块的私钥,VRF函数为VRF算法,n为区块链系统的区块高度; Wherein, r i and π i are the current block and random seed data demonstrate, r i-1 is a random seed block before the current block, sk i of the current block to generate a private key, VRF function VRF algorithm, n is the block height of the blockchain system;
步骤6,按照以下公式为候选节点集中的每个候选节点选取一个随机数:Step 6. Select a random number for each candidate node in the candidate node set according to the following formula:
Figure PCTCN2019081432-appb-000023
Figure PCTCN2019081432-appb-000023
其中,i为候选节点集中的候选节点的排序序号,R i是候选节点集中的第i个候选节点的随机数,r n是区块链系统中第n个区块的随机种子,r n-i是区块链系统中第n-i个区块的随机种子,其中,n为区块链系统的区块高度,N为候选节点集中的候选节点的个数; Among them, i is the sequence number of the candidate node in the candidate node set, R i is the random number of the i-th candidate node in the candidate node set, r n is the random seed of the nth block in the blockchain system, and r ni is The random seed of the nith block in the blockchain system, where n is the block height of the blockchain system, and N is the number of candidate nodes in the candidate node set;
步骤7,将满足以下不等式的最小J i值确定为第i个候选节点被选中的票龄数: Step 7. Determine the minimum Ji value that satisfies the following inequality as the number of votes of the i-th candidate node:
R i/2 hashlen≥F X(J i+1),i=1,2...N; R i /2 hashlen ≥F X (J i +1), i=1,2...N;
其中,R i是候选节点集中第i个候选节点的随机数,hashlen是根据VRF算法生成的随机种子的位数,F x为累计分布函数,N为候选节点集中的候选节点的个数,其中,F X(x)=P(X≤x),其中,
Figure PCTCN2019081432-appb-000024
表示候选节点集中第i个候选节点被选中的票龄数为k的概率,其中,
Figure PCTCN2019081432-appb-000025
其中,t为参与共识的多个共识节点的个数,
Figure PCTCN2019081432-appb-000026
为候选节点集中所有候选节点的权重的平均值,
Figure PCTCN2019081432-appb-000027
为候选节点集中所有候选节点的总权重,其中,w i是候选节点集中第i个候选节点的权重;
Among them, R i is the random number of the i-th candidate node in the candidate node set, hashlen is the number of bits of the random seed generated according to the VRF algorithm, F x is the cumulative distribution function, and N is the number of candidate nodes in the candidate node set, where , F X (x)=P(X≤x), where,
Figure PCTCN2019081432-appb-000024
Represents the probability that the number of votes of the i-th candidate node in the candidate node set is k, where,
Figure PCTCN2019081432-appb-000025
Among them, t is the number of multiple consensus nodes participating in the consensus,
Figure PCTCN2019081432-appb-000026
Is the average of the weights of all candidate nodes in the candidate node set,
Figure PCTCN2019081432-appb-000027
Is the total weight of all candidate nodes in the candidate node set, where w i is the weight of the i-th candidate node in the candidate node set;
步骤8,根据候选节点被选中的票龄数J i对候选节点集中的候选节点进行降序排序;对于被选中的票龄数相同的多个候选节点,根据候选节点的权重对多个候选节点进行降序排序;将排在前面t个的候选节点确定为参与共识的多个共识节点; Step 8. Sort the candidate nodes in the candidate node set in descending order according to the number of vote ages J i of the candidate nodes are selected; for multiple candidate nodes with the same number of vote ages selected, perform multiple candidate nodes according to their weight Sort in descending order; determine the top t candidate nodes as multiple consensus nodes participating in the consensus;
步骤9,本轮共识中的其他共识节点负责对生成最后一个区块时所选取的用于参与下一轮共识节点的结果进行验证,可以包括以下步骤:使用生成最后一个区块的共识节点的公钥对该区块的随机种子r n和证明数据π n进行VRF验证;按照生成最后一个区块的共识节点相同的逻辑选出t个候选节点,对比验证参与下一轮共识的共识节点的选取结果是否正确。 Step 9. The other consensus nodes in this round of consensus are responsible for verifying the results of the nodes selected when the last block is generated to participate in the next round of consensus nodes, which can include the following steps: use the consensus node that generated the last block The public key performs VRF verification on the random seed r n and proof data π n of the block; select t candidate nodes according to the same logic as the consensus node that generated the last block, and compare and verify the consensus nodes participating in the next round of consensus Whether the selection result is correct.
上述实施例中的PPoS共识算法中的共识节点确定方法,基于DPOS和VRF算法在规模可控制的候选节点池中按照权重随机抽取出数量有限的共识节点。通过根据各目标节点的选票数和质押金额来确定候选节点集,然后在候选节点集中根据VRF算法和候选节点的 权重随机选取多个共识节点,使得数量有限的共识节点参与共识,可以保证系统的共识性能,从而提高系统的可扩展性;同时,由于根据选票数和质押金额从多个目标节点中确定候选节点集,一方面使得确定的候选节点集中的候选节点更具有代表性,另一方面可以维持较大的共识节点群的规模,有效避免了过于中心化的问题;另外,通过VRF算法在候选节点集中随机选取多个共识节点,可以保证区块链系统的安全性。The method for determining the consensus node in the PPoS consensus algorithm in the foregoing embodiment is based on the DPOS and VRF algorithm to randomly extract a limited number of consensus nodes from a controllable candidate node pool according to weights. The candidate node set is determined according to the number of votes of each target node and the amount of pledge deposit, and then multiple consensus nodes are randomly selected in the candidate node set according to the VRF algorithm and the weight of the candidate nodes, so that a limited number of consensus nodes participate in the consensus, which can ensure the system Consensus performance, thereby improving the scalability of the system; at the same time, because the candidate node set is determined from multiple target nodes according to the number of votes and the pledge amount, on the one hand, the candidate nodes in the determined candidate node set are more representative, on the other hand A large consensus node group can be maintained, effectively avoiding the problem of over-centralization; in addition, the VRF algorithm is used to randomly select multiple consensus nodes in the candidate node set to ensure the security of the blockchain system.
基于同一发明构思,本申请实施例中还提供了一种共识节点确定装置,如下面的实施例所述。由于共识节点确定装置解决问题的原理与共识节点确定方法相似,因此共识节点确定装置的实施可以参见共识节点确定方法的实施,重复之处不再赘述。以下所使用的,术语“单元”或者“模块”可以实现预定功能的软件和/或硬件的组合。尽管以下实施例所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。图4是本申请实施例的共识节点确定装置的一种结构框图,如图4所示,可以包括:获取模块401、选择模块402和随机选取模块403,下面对该结构进行说明。Based on the same inventive concept, an apparatus for determining a consensus node is also provided in an embodiment of the present application, as described in the following embodiment. Since the principle of the consensus node determination device to solve the problem is similar to the consensus node determination method, the implementation of the consensus node determination device can refer to the implementation of the consensus node determination method, and the repetition will not be repeated. As used below, the term "unit" or "module" can be a combination of software and/or hardware that implements predetermined functions. Although the devices described in the following embodiments are preferably implemented by software, hardware or a combination of software and hardware is also possible and conceived. Fig. 4 is a structural block diagram of the consensus node determining apparatus according to an embodiment of the present application. As shown in Fig. 4, it may include: an acquisition module 401, a selection module 402, and a random selection module 403. The structure is described below.
获取模块401用于获取区块链系统中多个目标节点中各目标节点的选定率。The obtaining module 401 is used to obtain the selection rate of each target node among multiple target nodes in the blockchain system.
选择模块402用于根据多个目标节点中各目标节点的选定率,从多个目标节点中选择出候选节点形成候选节点集。The selection module 402 is configured to select candidate nodes from the plurality of target nodes to form a candidate node set according to the selection rate of each target node in the plurality of target nodes.
随机选取模块403用于从候选节点集中随机选取多个节点作为共识节点。The random selection module 403 is used to randomly select multiple nodes from a set of candidate nodes as consensus nodes.
在本申请一些实施例中,选定率可以包括以下至少之一:目标节点被区块链系统中的节点选定的比例、目标节点自身的份额占比。In some embodiments of the present application, the selection rate may include at least one of the following: the proportion of the target node selected by the node in the blockchain system, and the proportion of the target node's own share.
在本申请一些实施例中,选择模块402可以具体用于:将多个目标节点中被区块链系统中的节点选定的比例大于预设比例阈值的节点,作为入选节点,形成入选节点集;将入选节点集中自身的份额占比满足预设条件的入选节点,作为候选节点,形成候选节点集。In some embodiments of the present application, the selection module 402 may be specifically configured to: among multiple target nodes, nodes whose ratios selected by nodes in the blockchain system are greater than a preset ratio threshold are used as selected nodes to form a selected node set ; The selected nodes whose shares in the selected node set meet the preset conditions are used as candidate nodes to form a candidate node set.
在本申请一些实施例中,预设条件可以包括以下之一:超出预定占比阈值、位于前预设位数。In some embodiments of the present application, the preset condition may include one of the following: exceeding a preset proportion threshold and being located in the front preset digits.
在本申请一些实施例中,随机选取模块403可以具体用于:获取候选节点集中每个候选节点的权重,其中,每个候选节点的权重为每个候选节点获取的选票总票龄;获取区块链系统中多个区块的随机种子,其中,当前区块的随机种子是根据VRF算法和前一个区块的随机种子生成的;根据多个区块的随机种子和候选节点集中每个候选节点的排序序号,分别为候选节点集中的每个候选节点选取一个随机数;根据每个候选节点的权重和随机数确定候选节点集中每个候选节点被选中的票龄数;根据每个候选节点被选中的票龄数从候 选节点集中确定多个共识节点。In some embodiments of the present application, the random selection module 403 may be specifically used to: obtain the weight of each candidate node in the candidate node set, where the weight of each candidate node is the total vote age obtained by each candidate node; The random seed of multiple blocks in the blockchain system, where the random seed of the current block is generated according to the VRF algorithm and the random seed of the previous block; each candidate is set according to the random seed of multiple blocks and candidate nodes The sorting sequence number of the node, a random number is selected for each candidate node in the candidate node set; the weight of each candidate node and the random number are used to determine the number of votes for each candidate node in the candidate node set; according to each candidate node The number of selected votes determines multiple consensus nodes from the set of candidate nodes.
在本申请一些实施例中,获取候选节点集中每个候选节点的权重,可以包括按照以下公式确定候选节点集中的每个候选节点的权重:In some embodiments of the present application, obtaining the weight of each candidate node in the candidate node set may include determining the weight of each candidate node in the candidate node set according to the following formula:
Figure PCTCN2019081432-appb-000028
Figure PCTCN2019081432-appb-000028
其中,w i是候选节点集中第i个候选节点的权重,A i,k为第i个候选节点获得的第k张选票的票龄,M i为第i个候选节点获取的选票的总张数,N为候选节点集中的候选节点的个数。 Among them, w i is the weight of the i-th candidate node in the candidate node set, A i,k is the age of the k- th vote obtained by the i-th candidate node, and Mi is the total number of votes obtained by the i-th candidate node Number, N is the number of candidate nodes in the candidate node set.
在本申请一些实施例中,当前区块的随机种子是根据VRF算法和前一个区块的随机种子可以按照以下公式生成的:In some embodiments of this application, the random seed of the current block is generated according to the VRF algorithm and the random seed of the previous block according to the following formula:
Figure PCTCN2019081432-appb-000029
Figure PCTCN2019081432-appb-000029
其中,r i和π i分别是当前区块的随机种子和证明数据,r i-1是当前区块的前一个区块的随机种子,sk i为生成当前区块的私钥,VRF函数为VRF算法,n为区块链系统的区块高度。 Wherein, r i and π i are the current block and random seed data demonstrate, r i-1 is a random seed block before the current block, sk i of the current block to generate a private key, VRF function VRF algorithm, n is the block height of the blockchain system.
在本申请一些实施例中,根据多个区块的随机种子和候选节点集中每个候选节点的排序序号,分别为候选节点集中的每个候选节点选取一个随机数,可以包括按照以下公式为候选节点集中的每个候选节点选取一个随机数:In some embodiments of this application, selecting a random number for each candidate node in the candidate node set according to the random seeds of multiple blocks and the sorting sequence number of each candidate node in the candidate node set may include selecting a random number as a candidate according to the following formula Each candidate node in the node set selects a random number:
Figure PCTCN2019081432-appb-000030
Figure PCTCN2019081432-appb-000030
其中,i为候选节点集中的候选节点的排序序号,R i是候选节点集中的第i个候选节点的随机数,r n是区块链系统中第n个区块的随机种子,r n-i是区块链系统中第n-i个区块的随机种子,其中,n为区块链系统的区块高度,N为候选节点集中的候选节点的个数。 Among them, i is the sequence number of the candidate node in the candidate node set, R i is the random number of the i-th candidate node in the candidate node set, r n is the random seed of the nth block in the blockchain system, and r ni is The random seed of the nith block in the blockchain system, where n is the block height of the blockchain system, and N is the number of candidate nodes in the candidate node set.
在本申请一些实施例中,根据每个候选节点的权重和随机数确定候选节点集中每个候选节点被选中的票龄数,可以包括:将满足以下不等式的最小J i值确定为第i个候选节点被选中的票龄数: In some embodiments of the present application, determining the number of votes for each candidate node in the candidate node set according to the weight and random number of each candidate node may include: determining the minimum Ji value that satisfies the following inequality as the i-th The number of votes the candidate node has been selected:
R i/2 hashlen≥F X(J i+1),i=1,2...N; R i /2 hashlen ≥F X (J i +1), i=1,2...N;
其中,R i是候选节点集中第i个候选节点的随机数,hashlen是根据VRF算法生成的随机种子的位数,F x为累计分布函数,N为候选节点集中的候选节点的个数,其中,F X(x)=P(X≤x),其中,
Figure PCTCN2019081432-appb-000031
表示候选节点集中第i个候选节点被选 中的票龄数为k的概率,其中,
Figure PCTCN2019081432-appb-000032
其中,t为参与共识的多个共识节点的个数,
Figure PCTCN2019081432-appb-000033
为候选节点集中所有候选节点的权重的平均值,
Figure PCTCN2019081432-appb-000034
为候选节点集中所有候选节点的总权重,其中,w i是候选节点集中第i个候选节点的权重。
Among them, R i is the random number of the i-th candidate node in the candidate node set, hashlen is the number of bits of the random seed generated according to the VRF algorithm, F x is the cumulative distribution function, and N is the number of candidate nodes in the candidate node set, where , F X (x)=P(X≤x), where,
Figure PCTCN2019081432-appb-000031
Represents the probability that the number of votes of the i-th candidate node in the candidate node set is k, where,
Figure PCTCN2019081432-appb-000032
Among them, t is the number of multiple consensus nodes participating in the consensus,
Figure PCTCN2019081432-appb-000033
Is the average of the weights of all candidate nodes in the candidate node set,
Figure PCTCN2019081432-appb-000034
Is the total weight of all candidate nodes in the candidate node set, where w i is the weight of the i-th candidate node in the candidate node set.
在本申请一些实施例中,根据每个候选节点被选中的票龄数从候选节点集中确定多个共识节点,可以包括:根据候选节点被选中的票龄数对候选节点集中的候选节点进行降序排序;对于被选中的票龄数相同的多个候选节点,根据候选节点的权重对多个候选节点进行降序排序;将排在前面预设个数的候选节点确定为参与共识的多个共识节点。In some embodiments of the present application, determining a plurality of consensus nodes from the candidate node set according to the number of vote ages of each candidate node being selected may include: descending order of the candidate nodes in the candidate node set according to the number of vote ages of the candidate nodes being selected Sorting; for selected multiple candidate nodes with the same number of votes, sort multiple candidate nodes in descending order according to the weight of the candidate nodes; determine the preset number of candidate nodes in the front as multiple consensus nodes participating in the consensus .
在本申请一些实施例中,在根据每个候选节点被选中的票龄数从候选节点集中确定多个共识节点之后,还可以包括:多个共识节点轮流作为提议节点生成区块,其中,在生成最后一个区块时,分别在每个共识节点获得的选票中随机选取一张选票作为奖励选票,以获得多张奖励选票;针对多张奖励选票中的每一张奖励选票,对区块链系统中投出该奖励选票的节点进行奖励。In some embodiments of the present application, after determining multiple consensus nodes from the candidate node set according to the number of votes each candidate node has been selected, it may further include: multiple consensus nodes taking turns as proposed nodes to generate blocks, where When the last block is generated, one vote is randomly selected from the votes obtained by each consensus node as the reward vote to obtain multiple reward votes; for each of the multiple reward votes, the blockchain The node in the system that casts the reward ballot will be rewarded.
在本申请一些实施例中,分别在每个共识节点获得的选票中随机选取一张奖励选票,可以包括:针对每个共识节点,将该共识节点获得的所有选票按投票时间进行排序;针对每个共识节点,根据该共识节点获得的所有选票中各选票的票龄和排序序号确定各选票的票龄区间;针对每个共识节点,根据该共识节点被选中的票龄数所处的票龄区间,将该票龄区间对应的选票确定为奖励选票。In some embodiments of this application, randomly selecting a reward ballot from the votes obtained by each consensus node may include: for each consensus node, sort all votes obtained by the consensus node according to the voting time; A consensus node determines the age range of each vote according to the age and sorting sequence number of each vote in all the votes obtained by the consensus node; for each consensus node, according to the vote age of the consensus node selected by the vote age In the interval, the ballot corresponding to the voting age interval is determined as the reward ballot.
在本申请一些实施例中,针对每个共识节点,根据该共识节点获得的所有选票中各选票的票龄和排序序号确定各选票的票龄区间,可以包括:将第i个共识节点的第μ张选票的票龄区间划分为:In some embodiments of the present application, for each consensus node, the vote age interval of each vote among all the votes obtained by the consensus node and the sorting sequence number are determined, which may include: the ith consensus node The age range of μ votes is divided into:
Figure PCTCN2019081432-appb-000035
Figure PCTCN2019081432-appb-000035
其中,μ为选票的排序序号,I i,μ为第i个共识节点的第μ张选票的票龄区间,A i,k为第i个候选节点获得的第k张选票的票龄,M i为第i个候选节点获取的选票的总张数,t为参与共识的多个共识节点的个数。 Among them, μ is the sequence number of the votes, I i, μ are the age intervals of the μth vote of the i-th consensus node, Ai ,k is the age of the k- th vote obtained by the i-th candidate node, M i is the total number of votes obtained by the i-th candidate node, and t is the number of multiple consensus nodes participating in the consensus.
从以上的描述中,可以看出,本申请实施例实现了如下技术效果:通过根据各目标节点的选定率来确定候选节点集,然后在候选节点集中随机选取多个共识节点,使得数量有限的共识节点参与共识,可以保证系统的共识性能,从而提高系统的可扩展性;同时,由 于根据选定率从多个目标节点中确定候选节点集,一方面使得确定的候选节点集中的候选节点更具有代表性,另一方面可以维持较大的共识节点群的规模,有效避免了过于中心化的问题;另外,通过随机选取在候选节点集中确定多个共识节点,可以保证区块链系统的安全性。通过上述方案解决了现有的共识节点确定方法存在去中心化程度低的技术问题,达到了有效提升去中心化程度、提高系统安全性和可扩展性的技术效果。From the above description, it can be seen that the embodiments of this application achieve the following technical effects: the candidate node set is determined according to the selection rate of each target node, and then multiple consensus nodes are randomly selected from the candidate node set, making the number limited Participation of consensus nodes in the consensus can ensure the consensus performance of the system, thereby improving the scalability of the system; at the same time, since the candidate node set is determined from multiple target nodes according to the selection rate, on the one hand, the candidate node in the determined candidate node set It is more representative. On the other hand, it can maintain a large consensus node group scale, which effectively avoids the problem of over-centralization; in addition, by randomly selecting multiple consensus nodes in the candidate node set, the blockchain system can be guaranteed safety. The above solution solves the technical problem of low decentralization in the existing consensus node determination method, and achieves the technical effect of effectively improving the degree of decentralization and improving the security and scalability of the system.
本申请实施方式还提供了一种计算机设备,具体可以参阅图5所示的基于本申请实施例提供的共识节点确定方法的计算机设备组成结构示意图,所述计算机设备具体可以包括输入设备51、处理器52、存储器53。其中,所述存储器53用于存储处理器可执行指令。所述处理器52执行所述指令时实现上述任意实施例中所述的共识节点确定方法的步骤。The embodiment of the present application also provides a computer device. For details, please refer to the schematic diagram of the structure of the computer device based on the consensus node determination method provided by the embodiment of the present application shown in FIG. 5. The computer device may specifically include an input device 51, processing器52, memory 53. Wherein, the memory 53 is used to store processor executable instructions. The processor 52 implements the steps of the consensus node determination method described in any of the foregoing embodiments when executing the instructions.
在本实施方式中,所述输入设备具体可以是用户和计算机系统之间进行信息交换的主要装置之一。所述输入设备可以包括键盘、鼠标、摄像头、扫描仪、光笔、手写输入板、语音输入装置等;输入设备用于把原始数据和处理这些数的程序输入到计算机中。所述输入设备还可以获取接收其他模块、单元、设备传输过来的数据。所述处理器可以按任何适当的方式实现。例如,处理器可以采取例如微处理器或处理器以及存储可由该(微)处理器执行的计算机可读程序代码(例如软件或固件)的计算机可读介质、逻辑门、开关、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程逻辑控制器和嵌入微控制器的形式等等。所述存储器具体可以是现代信息技术中用于保存信息的记忆设备。所述存储器可以包括多个层次,在数字系统中,只要能保存二进制数据的都可以是存储器;在集成电路中,一个没有实物形式的具有存储功能的电路也叫存储器,如RAM、FIFO等;在系统中,具有实物形式的存储设备也叫存储器,如内存条、TF卡等。In this embodiment, the input device may specifically be one of the main devices for information exchange between the user and the computer system. The input device may include a keyboard, a mouse, a camera, a scanner, a light pen, a handwriting input board, a voice input device, etc.; the input device is used to input raw data and programs for processing these numbers into the computer. The input device can also obtain and receive data transmitted from other modules, units, and devices. The processor can be implemented in any suitable way. For example, the processor may take the form of a microprocessor or a processor and a computer-readable medium, logic gates, switches, application specific integrated circuits that store computer-readable program codes (such as software or firmware) executable by the (micro)processor ( Application Specific Integrated Circuit (ASIC), programmable logic controller and embedded microcontroller form, etc. The memory may specifically be a memory device used to store information in modern information technology. The memory can include multiple levels. In a digital system, as long as it can store binary data, it can be a memory; in an integrated circuit, a circuit with a storage function without a physical form is also called a memory, such as RAM, FIFO, etc.; In the system, storage devices in physical form are also called memory, such as memory sticks, TF cards, etc.
在本实施方式中,该计算机设备具体实现的功能和效果,可以与其它实施方式对照解释,在此不再赘述。In this embodiment, the specific functions and effects implemented by the computer device can be explained in comparison with other embodiments, and will not be repeated here.
本申请实施方式中还提供了一种基于共识节点确定方法的计算机存储介质,所述计算机存储介质存储有计算机程序指令,在所述计算机程序指令被执行时实现上述任意实施例中所述共识节点确定方法的步骤。The embodiment of the present application also provides a computer storage medium based on a consensus node determination method, the computer storage medium stores computer program instructions, and when the computer program instructions are executed, the consensus node in any of the above embodiments is realized Determine the steps of the method.
在本实施方式中,上述存储介质包括但不限于随机存取存储器(Random Access Memory,RAM)、只读存储器(Read-Only Memory,ROM)、缓存(Cache)、硬盘(Hard Disk Drive,HDD)或者存储卡(Memory Card)。所述存储器可以用于存储计算机程序指令。网 络通信单元可以是依照通信协议规定的标准设置的,用于进行网络连接通信的接口。In this embodiment, the above-mentioned storage medium includes but is not limited to random access memory (Random Access Memory, RAM), read-only memory (Read-Only Memory, ROM), cache (Cache), hard disk (Hard Disk Drive, HDD) Or memory card (Memory Card). The memory can be used to store computer program instructions. The network communication unit may be set up in accordance with the standards stipulated by the communication protocol, and is an interface used for network connection communication.
在本实施方式中,该计算机存储介质存储的程序指令具体实现的功能和效果,可以与其它实施方式对照解释,在此不再赘述。In this embodiment, the specific functions and effects realized by the program instructions stored in the computer storage medium can be explained in comparison with other embodiments, and will not be repeated here.
显然,本领域的技术人员应该明白,上述的本申请实施例的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本申请实施例不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that the modules or steps of the above-mentioned embodiments of the application can be implemented by a general computing device, and they can be concentrated on a single computing device or distributed among multiple computing devices. Optionally, they can be implemented with program codes executable by a computing device, so that they can be stored in a storage device for execution by the computing device, and in some cases, can be different from here The steps shown or described are executed in the order of, or they are respectively fabricated into individual integrated circuit modules, or multiple modules or steps of them are fabricated into a single integrated circuit module to achieve. In this way, the embodiments of the present application are not limited to any specific hardware and software combination.
应该理解,以上描述是为了进行图示说明而不是为了进行限制。通过阅读上述描述,在所提供的示例之外的许多实施方式和许多应用对本领域技术人员来说都将是显而易见的。因此,本申请的范围不应该参照上述描述来确定,而是应该参照前述权利要求以及这些权利要求所拥有的等价物的全部范围来确定。It should be understood that the above description is for illustration and not for limitation. By reading the above description, many implementations and many applications beyond the examples provided will be apparent to those skilled in the art. Therefore, the scope of this application should not be determined with reference to the above description, but should be determined with reference to the foregoing claims and the full range of equivalents possessed by these claims.
以上所述仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请实施例可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本申请的保护范围之内。The foregoing descriptions are only preferred embodiments of the present application, and are not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various modifications and changes. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this application shall be included in the protection scope of this application.

Claims (16)

  1. 一种共识节点确定方法,其特征在于,包括:A method for determining consensus nodes is characterized in that it includes:
    获取区块链系统中多个目标节点中各目标节点的选定率;Obtain the selection rate of each target node among multiple target nodes in the blockchain system;
    根据所述多个目标节点中各目标节点的选定率,从所述多个目标节点中选择出候选节点形成候选节点集;Selecting candidate nodes from the plurality of target nodes according to the selection rate of each target node in the plurality of target nodes to form a candidate node set;
    从所述候选节点集中随机选取多个节点作为共识节点。A plurality of nodes are randomly selected from the set of candidate nodes as consensus nodes.
  2. 根据权利要求1所述的方法,其特征在于,所述选定率包括以下至少之一:目标节点被区块链系统中的节点选定的比例、目标节点自身的份额占比。The method according to claim 1, wherein the selection rate comprises at least one of the following: the proportion of the target node selected by the node in the blockchain system, and the proportion of the target node's own share.
  3. 根据权利要求2所述的方法,其特征在于,根据所述多个目标节点中各目标节点的选定率,从所述多个目标节点中选择出候选节点形成候选节点集,包括:The method according to claim 2, characterized in that, according to the selection rate of each of the multiple target nodes, selecting candidate nodes from the multiple target nodes to form a candidate node set comprises:
    将所述多个目标节点中被区块链系统中的节点选定的比例大于预设比例阈值的节点,作为入选节点,形成入选节点集;Taking a node whose ratio selected by nodes in the blockchain system among the plurality of target nodes is greater than a preset ratio threshold as a selected node to form a selected node set;
    将所述入选节点集中自身的份额占比满足预设条件的入选节点,作为候选节点,形成候选节点集。The selected nodes whose share in the selected node set satisfies preset conditions are used as candidate nodes to form a candidate node set.
  4. 根据权利要求3所述的方法,其特征在于,所述预设条件包括以下之一:超出预定占比阈值、位于前预设位数。The method according to claim 3, wherein the preset condition comprises one of the following: exceeding a preset proportion threshold and being located in the front preset number of digits.
  5. 根据权利要求1所述的方法,其特征在于,从所述候选节点集中随机选取多个节点作为共识节点,包括:The method according to claim 1, wherein randomly selecting multiple nodes from the set of candidate nodes as consensus nodes comprises:
    获取所述候选节点集中每个候选节点的权重,其中,每个候选节点的权重为每个候选节点获取的选票总票龄;Acquiring the weight of each candidate node in the candidate node set, where the weight of each candidate node is the total vote age obtained by each candidate node;
    获取所述区块链系统中多个区块的随机种子,其中,当前区块的随机种子是根据VRF算法和前一个区块的随机种子生成的;Obtaining random seeds of multiple blocks in the blockchain system, where the random seed of the current block is generated according to the VRF algorithm and the random seed of the previous block;
    根据所述多个区块的随机种子和所述候选节点集中每个候选节点的排序序号,分别为所述候选节点集中的每个候选节点选取一个随机数;Selecting a random number for each candidate node in the candidate node set according to the random seeds of the multiple blocks and the ranking sequence number of each candidate node in the candidate node set;
    根据每个候选节点的权重和随机数确定所述候选节点集中每个候选节点被选中的票龄数;Determining the number of vote ages of each candidate node in the candidate node set according to the weight and random number of each candidate node;
    根据每个候选节点被选中的票龄数从所述候选节点集中确定所述多个共识节点。The multiple consensus nodes are determined from the candidate node set according to the number of votes each candidate node is selected.
  6. 根据权利要求5所述的方法,其特征在于,获取所述候选节点集中每个候选节点的权重,包括按照以下公式确定所述候选节点集中的每个候选节点的权重:The method according to claim 5, wherein obtaining the weight of each candidate node in the candidate node set comprises determining the weight of each candidate node in the candidate node set according to the following formula:
    Figure PCTCN2019081432-appb-100001
    Figure PCTCN2019081432-appb-100001
    其中,w i是所述候选节点集中第i个候选节点的权重,A i,k为第i个候选节点获得的第k张选票的票龄,M i为第i个候选节点获取的选票的总张数,N为所述候选节点集中的候选节点的个数。 Among them, w i is the weight of the i-th candidate node in the set of candidate nodes, A i,k is the age of the k- th vote obtained by the i-th candidate node, and M i is the number of votes obtained by the i-th candidate node The total number of sheets, where N is the number of candidate nodes in the candidate node set.
  7. 根据权利要求5所述的方法,其特征在于,当前区块的随机种子是根据VRF算法和前一个区块的随机种子按照以下公式生成的:The method according to claim 5, wherein the random seed of the current block is generated according to the VRF algorithm and the random seed of the previous block according to the following formula:
    Figure PCTCN2019081432-appb-100002
    Figure PCTCN2019081432-appb-100002
    其中,r i和π i分别是当前区块的随机种子和证明数据,r i-1是当前区块的前一个区块的随机种子,sk i为生成所述当前区块的私钥,VRF函数为所述VRF算法,n为所述区块链系统的区块高度。 Among them, r i and π i are the random seed and proof data of the current block, respectively, r i-1 is the random seed of the previous block of the current block, sk i is the private key for generating the current block, VRF The function is the VRF algorithm, and n is the block height of the blockchain system.
  8. 根据权利要求5所述的方法,其特征在于,根据所述多个区块的随机种子和所述候选节点集中每个候选节点的排序序号,分别为所述候选节点集中的每个候选节点选取一个随机数,包括按照以下公式为所述候选节点集中的每个候选节点选取一个随机数:The method according to claim 5, characterized in that, according to the random seeds of the multiple blocks and the sorting sequence number of each candidate node in the candidate node set, each candidate node in the candidate node set is selected A random number includes selecting a random number for each candidate node in the candidate node set according to the following formula:
    Figure PCTCN2019081432-appb-100003
    Figure PCTCN2019081432-appb-100003
    其中,i为所述候选节点集中的候选节点的排序序号,R i是所述候选节点集中的第i个候选节点的随机数,r n是区块链系统中第n个区块的随机种子,r n-i是区块链系统中第n-i个区块的随机种子,其中,n为所述区块链系统的区块高度,N为所述候选节点集中的候选节点的个数。 Where i is the sorting sequence number of the candidate node in the candidate node set, R i is the random number of the i-th candidate node in the candidate node set, and r n is the random seed of the n-th block in the blockchain system , R ni is the random seed of the nith block in the blockchain system, where n is the block height of the blockchain system, and N is the number of candidate nodes in the candidate node set.
  9. 根据权利要求5所述的方法,其特征在于,根据每个候选节点的权重和随机数确定所述候选节点集中每个候选节点被选中的票龄数,包括:The method according to claim 5, wherein determining the number of votes of each candidate node in the candidate node set according to the weight and random number of each candidate node comprises:
    将满足以下不等式的最小J i值确定为第i个候选节点被选中的票龄数: Determine the minimum Ji value that satisfies the following inequality as the number of votes of the i-th candidate node:
    R i/2 hashlen≥F X(J i+1),i=1,2...N; R i /2 hashlen ≥F X (J i +1), i=1,2...N;
    其中,R i是所述候选节点集中第i个候选节点的随机数,hashlen是根据VRF算法生成的随机种子的位数,F x为累计分布函数,N为所述候选节点集中的候选节点的个数,其中,F X(x)=P(X≤x),其中,
    Figure PCTCN2019081432-appb-100004
    表示所述候选节点集中第i个候选节点被选中的票龄数为k的概率,其中,
    Figure PCTCN2019081432-appb-100005
    其中,t为参与共识的多 个共识节点的个数,
    Figure PCTCN2019081432-appb-100006
    为所述候选节点集中所有候选节点的权重的平均值,
    Figure PCTCN2019081432-appb-100007
    为所述候选节点集中所有候选节点的总权重,其中,w i是所述候选节点集中第i个候选节点的权重。
    Where R i is the random number of the i-th candidate node in the candidate node set, hashlen is the number of bits of the random seed generated according to the VRF algorithm, F x is the cumulative distribution function, and N is the number of the candidate node in the candidate node set. Number, where F X (x) = P ( X ≤ x), where,
    Figure PCTCN2019081432-appb-100004
    Indicates the probability that the number of votes of the i-th candidate node in the candidate node set is k, where,
    Figure PCTCN2019081432-appb-100005
    Among them, t is the number of multiple consensus nodes participating in the consensus,
    Figure PCTCN2019081432-appb-100006
    Is the average of the weights of all candidate nodes in the candidate node set,
    Figure PCTCN2019081432-appb-100007
    Is the total weight of all candidate nodes in the candidate node set, where w i is the weight of the i-th candidate node in the candidate node set.
  10. 根据权利要求5所述的方法,其特征在于,根据每个候选节点被选中的票龄数从所述候选节点集中确定所述多个共识节点,包括:The method according to claim 5, wherein the determining the plurality of consensus nodes from the set of candidate nodes according to the number of votes each candidate node has been selected comprises:
    根据候选节点被选中的票龄数对所述候选节点集中的候选节点进行降序排序;Sorting the candidate nodes in the candidate node set in descending order according to the number of votes of the candidate nodes being selected;
    对于被选中的票龄数相同的多个候选节点,根据候选节点的权重对所述多个候选节点进行降序排序;For selected multiple candidate nodes with the same vote age, sort the multiple candidate nodes in descending order according to the weight of the candidate nodes;
    将排在前面预设个数的候选节点确定为参与共识的多个共识节点。The candidate nodes ranked in the front preset number are determined as multiple consensus nodes participating in the consensus.
  11. 根据权利要求5所述的方法,其特征在于,在根据每个候选节点被选中的票龄数从所述候选节点集中确定所述多个共识节点之后,还包括:The method according to claim 5, characterized in that, after determining the plurality of consensus nodes from the set of candidate nodes according to the number of votes each candidate node has been selected, the method further comprises:
    所述多个共识节点轮流作为提议节点生成区块;The multiple consensus nodes take turns as proposal nodes to generate blocks;
    其中,在生成最后一个区块时,分别在每个共识节点获得的选票中随机选取一张选票作为奖励选票,以获得多张奖励选票;Among them, when the last block is generated, one vote is randomly selected from the votes obtained by each consensus node as a reward vote to obtain multiple reward votes;
    针对所述多张奖励选票中的每一张奖励选票,对区块链系统中投出该奖励选票的节点进行奖励。For each of the multiple reward votes, the node that casts the reward vote in the blockchain system is rewarded.
  12. 根据权利要求11所述的方法,其特征在于,分别在每个共识节点获得的选票中随机选取一张奖励选票,包括:The method according to claim 11, characterized in that randomly selecting a reward ballot among the ballots obtained by each consensus node, respectively, comprises:
    针对每个共识节点,将该共识节点获得的所有选票按投票时间进行排序;For each consensus node, sort all votes obtained by the consensus node according to voting time;
    针对每个共识节点,根据该共识节点获得的所有选票中各选票的票龄和排序序号确定各选票的票龄区间;For each consensus node, determine the vote age range of each vote according to the vote age and sort sequence number of all votes obtained by the consensus node;
    针对每个共识节点,根据该共识节点被选中的票龄数所处的票龄区间,将该票龄区间对应的选票确定为所述奖励选票。For each consensus node, the vote corresponding to the vote age range is determined as the reward vote according to the vote age range in which the vote age number of the consensus node is selected.
  13. 根据权利要求12所述的方法,其特征在于,针对每个共识节点,根据该共识节点获得的所有选票中各选票的票龄和排序序号确定各选票的票龄区间,包括:The method according to claim 12, characterized in that, for each consensus node, determining the vote age range of each vote according to the vote age and sorting sequence number of each vote among all the votes obtained by the consensus node includes:
    将第i个共识节点的第μ张选票的票龄区间划分为:Divide the age range of the μth vote of the i-th consensus node into:
    Figure PCTCN2019081432-appb-100008
    Figure PCTCN2019081432-appb-100008
    其中,μ为选票的排序序号,I i,μ为第i个共识节点的第μ张选票的票龄区间,A i,k为第i个候选节点获得的第k张选票的票龄,M i为第i个候选节点获取的选票的总张数,t为参与共识的多个共识节点的个数。 Among them, μ is the sequence number of the votes, I i, μ are the age intervals of the μth vote of the i-th consensus node, Ai ,k is the age of the k- th vote obtained by the i-th candidate node, M i is the total number of votes obtained by the i-th candidate node, and t is the number of multiple consensus nodes participating in the consensus.
  14. 一种共识节点确定装置,其特征在于,包括:A device for determining a consensus node is characterized in that it comprises:
    获取模块,用于获取区块链系统中多个目标节点中各目标节点的选定率;The obtaining module is used to obtain the selection rate of each target node among multiple target nodes in the blockchain system;
    选择模块,用于根据所述多个目标节点中各目标节点的选定率,从所述多个目标节点中选择出候选节点形成候选节点集;The selection module is configured to select candidate nodes from the plurality of target nodes to form a candidate node set according to the selection rate of each target node in the plurality of target nodes;
    随机选取模块,用于从所述候选节点集中随机选取多个节点作为共识节点。The random selection module is used to randomly select multiple nodes from the candidate node set as consensus nodes.
  15. 一种计算机设备,包括处理器以及用于存储处理器可执行指令的存储器,所述处理器执行所述指令时实现权利要求1至13中任一项所述方法的步骤。A computer device comprising a processor and a memory for storing executable instructions of the processor, and the processor implements the steps of the method according to any one of claims 1 to 13 when executing the instructions.
  16. 一种计算机可读存储介质,其上存储有计算机指令,所述指令被执行时实现权利要求1至13中任一项所述方法的步骤。A computer-readable storage medium having computer instructions stored thereon, which implement the steps of the method described in any one of claims 1 to 13 when the instructions are executed.
PCT/CN2019/081432 2019-04-04 2019-04-04 Method and apparatus for determining consensus node, and computer device and storage medium WO2020199179A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/081432 WO2020199179A1 (en) 2019-04-04 2019-04-04 Method and apparatus for determining consensus node, and computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/081432 WO2020199179A1 (en) 2019-04-04 2019-04-04 Method and apparatus for determining consensus node, and computer device and storage medium

Publications (1)

Publication Number Publication Date
WO2020199179A1 true WO2020199179A1 (en) 2020-10-08

Family

ID=72664584

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/081432 WO2020199179A1 (en) 2019-04-04 2019-04-04 Method and apparatus for determining consensus node, and computer device and storage medium

Country Status (1)

Country Link
WO (1) WO2020199179A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7386113B2 (en) 2020-03-19 2023-11-24 本田技研工業株式会社 Vehicle management equipment and programs

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107040594A (en) * 2017-04-12 2017-08-11 山大地纬软件股份有限公司 The method and device of license block chain node access based on PBFT
CN107423152A (en) * 2017-04-24 2017-12-01 杭州趣链科技有限公司 A kind of block chain common recognition node automatic recovery method
CN107590738A (en) * 2017-08-24 2018-01-16 阿里巴巴集团控股有限公司 Processing method, device and the server of selection common recognition node
WO2018149505A1 (en) * 2017-02-17 2018-08-23 Nokia Technologies Oy Voting-consensus distributed ledger
CN108846667A (en) * 2018-04-23 2018-11-20 上海分布信息科技有限公司 A kind of logical card regulation method based on block chain and logical card regulator control system
CN109309723A (en) * 2018-08-18 2019-02-05 上海分布信息科技有限公司 A kind of common recognition node variation and its realize system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018149505A1 (en) * 2017-02-17 2018-08-23 Nokia Technologies Oy Voting-consensus distributed ledger
CN107040594A (en) * 2017-04-12 2017-08-11 山大地纬软件股份有限公司 The method and device of license block chain node access based on PBFT
CN107423152A (en) * 2017-04-24 2017-12-01 杭州趣链科技有限公司 A kind of block chain common recognition node automatic recovery method
CN107590738A (en) * 2017-08-24 2018-01-16 阿里巴巴集团控股有限公司 Processing method, device and the server of selection common recognition node
CN108846667A (en) * 2018-04-23 2018-11-20 上海分布信息科技有限公司 A kind of logical card regulation method based on block chain and logical card regulator control system
CN109309723A (en) * 2018-08-18 2019-02-05 上海分布信息科技有限公司 A kind of common recognition node variation and its realize system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP7386113B2 (en) 2020-03-19 2023-11-24 本田技研工業株式会社 Vehicle management equipment and programs

Similar Documents

Publication Publication Date Title
CN110049029B (en) Consensus node determination method, device, computer equipment and storage medium
Abuidris et al. Secure large‐scale E‐voting system based on blockchain contract using a hybrid consensus model combined with sharding
JP6518838B6 (en) Method and apparatus for distributed database in a network
US10965466B2 (en) Estimable proof-of-work for blockchain
CN108377206B (en) Method, apparatus and computer-readable storage medium for configuring consensus algorithm
KR102250810B1 (en) Blockchain system with consensus algorithm based on proof-of -transaction and method there of
CN109981281B (en) Method and device for determining candidate elements based on block chain proposal random consensus
CN109493062B (en) Block chain consensus method based on credit equity certification
CN110855432B (en) Asynchronous BFT & DPOS consensus mechanism for assigning verifier rewards based on verifiable random functions
Chen et al. Falling dominoes: a theory of rare events and crisis contagion
CN112804101B (en) Master-slave multi-chain cross-link method and system based on voting and credit mechanism
CN111935207A (en) Block chain system consensus method based on improved C4.5 algorithm
CN112118138B (en) System and method for realizing block chain consensus mechanism
Nobandegani et al. A Resource‐Rational, Process‐Level Account of the St. Petersburg Paradox
CN114741721A (en) Consensus device and consensus method based on contribution value certification for file block chain
CN114372589A (en) Federated learning method and related device
CN111078787A (en) Block chain consensus method based on random number mapping
CN114281888A (en) Block chain consensus method, device, equipment and storage medium
WO2020199179A1 (en) Method and apparatus for determining consensus node, and computer device and storage medium
US20220292489A1 (en) Methods and devices for tracking and measuring proof-of-work contributions in a mining pool
WO2021074848A1 (en) Computer-implemented method for reaching a distributed consensus in a blockchain network and node implementing the method
Gartheeban et al. A data-driven method for in-game decision making in mlb: when to pull a starting pitcher
CN115720227A (en) Election method and device for consensus nodes of block chain and electronic equipment
Stone An examination of single transaction blocks and their effect on network throughput and block size
CN112235425B (en) Block chain mine pool forming method, device and system and readable storage 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: 19923261

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19923261

Country of ref document: EP

Kind code of ref document: A1