+

CN116389040A - Reputation-based block chain consensus method, device and computer equipment - Google Patents

Reputation-based block chain consensus method, device and computer equipment Download PDF

Info

Publication number
CN116389040A
CN116389040A CN202310050815.XA CN202310050815A CN116389040A CN 116389040 A CN116389040 A CN 116389040A CN 202310050815 A CN202310050815 A CN 202310050815A CN 116389040 A CN116389040 A CN 116389040A
Authority
CN
China
Prior art keywords
reputation
consensus
round
node
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310050815.XA
Other languages
Chinese (zh)
Inventor
刘齐军
丁孟
王诗堃
储超尘
谭林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hunan Tianhe Guoyun Technology Co Ltd
Original Assignee
Hunan Tianhe Guoyun Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hunan Tianhe Guoyun Technology Co Ltd filed Critical Hunan Tianhe Guoyun Technology Co Ltd
Priority to CN202310050815.XA priority Critical patent/CN116389040A/en
Publication of CN116389040A publication Critical patent/CN116389040A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/101Access control lists [ACL]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • H04L63/102Entity profiles
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/14Network architectures or network communication protocols for network security for detecting or protecting against malicious traffic
    • H04L63/1441Countermeasures against malicious traffic
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/30Decision processes by autonomous network management units using voting and bidding
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)
  • Complex Calculations (AREA)

Abstract

本发明涉及区块链技术领域,提供了一种基于信誉的区块链共识方法、装置和计算机设备,所述方法包括:统计节点的历史共识投票信息,根据所述历史共识投票信息和恶意投票惩罚权重进行逻辑回归计算,得到所述节点的当前信任度;利用信誉修正阈值对所述节点的上一轮信誉值和所述当前信任度进行权重均衡,确定当前轮信誉值;根据各所述节点的所述当前轮信誉值进行当前轮的共识。采用本方法能够避免权益粉碎攻击、贿赂攻击以及Sybil攻击等而提高健壮性且保证去中心化特性。

Figure 202310050815

The present invention relates to the technical field of blockchain, and provides a reputation-based blockchain consensus method, device and computer equipment. The method includes: counting historical consensus voting information of nodes, and according to the historical consensus voting information and malicious voting Perform logistic regression calculation on the penalty weight to obtain the current trust degree of the node; use the reputation correction threshold to carry out weight balance on the previous round reputation value and the current trust degree of the node to determine the current round reputation value; The current round of reputation value of the node is used for the current round of consensus. Adopting this method can avoid rights and interests crushing attacks, bribery attacks, Sybil attacks, etc., thereby improving robustness and ensuring decentralization.

Figure 202310050815

Description

基于信誉的区块链共识方法、装置和计算机设备Reputation-based block chain consensus method, device and computer equipment

技术领域technical field

本发明属于区块链技术领域,尤其涉及一种基于信誉的区块链共识方法。The invention belongs to the technical field of block chains, and in particular relates to a reputation-based block chain consensus method.

背景技术Background technique

区块链技术也被称为分布式账本技术,可以解决不受信任的各方达成协议的问题。它具有去中心化、可追溯、匿名性、可审计性等特点。共识协议用于保证区块链网络中所有节点维护的数据副本的一致性,避免数据不统一和信息不对称问题的发生,是一种用于驱动区块链向前推进的算法。目前,区块链技术使用三种主流共识协议,包括PoW(Proof ofWork,工作量证明机制)协议,PoS(Proof of Stake,权益证明机制)协议和PBFT(PracticalByzantine Fault Tolerance,拜占庭容错协议)协议。其中,PoW协议通常被称为中本聪共识,共识内节点必须反复计算哈希值以达成共识。哈希值的计算使得在PoW中生成区块必须消耗算力,并且随着区块高度的增加,所消耗的算力也在增加,这就造成了不必要的浪费。此外,为了确保安全,PoW中的交易必须等待六个区块被确认,这大大降低了PoW协议的吞吐量。Blockchain technology, also known as distributed ledger technology, can solve the problem of agreement between untrusted parties. It has the characteristics of decentralization, traceability, anonymity, and auditability. The consensus protocol is used to ensure the consistency of data copies maintained by all nodes in the blockchain network, avoiding data inconsistency and information asymmetry, and is an algorithm used to drive the blockchain forward. At present, blockchain technology uses three mainstream consensus protocols, including PoW (Proof of Work, workload proof mechanism) protocol, PoS (Proof of Stake, equity certification mechanism) protocol and PBFT (Practical Byzantine Fault Tolerance, Byzantine fault tolerance protocol) protocol. Among them, the PoW protocol is usually called the Nakamoto consensus, and the nodes in the consensus must repeatedly calculate the hash value to reach a consensus. The calculation of the hash value makes it necessary to consume computing power to generate blocks in PoW, and as the block height increases, the consumed computing power also increases, which causes unnecessary waste. In addition, in order to ensure security, transactions in PoW must wait for six blocks to be confirmed, which greatly reduces the throughput of the PoW protocol.

PoS协议达成共识的核心原则是基于节点持有的股权而非PoW中的计算能力,已经被应用于PPCoin中,其能有效避免PoW共识中算力浪费的问题。但是,由于PPCoin使用币龄作为权重,所以即使节点没有连接到网络,硬币的“年龄”也会增加。如图1所示,节点J通过故意网络离线,积累了高达70%的权重。它允许节点J逐渐主导了共识,甚至决定了新区块的生成。也就是说,一个节点主导了区块链的记账,这不符合区块链的去中心化特性。衍生协议PoA将PoS与中本聪共识结合起来,使得只有在线节点才能获得采矿收入和交易费用。然而,这些协议都是依靠节点的权益来达成共识的,这不能保证区块链的稳健性。如图2所示,低权益的节点O可以尝试不同的利益相关者的序列(分叉)来最大化自身利益,因为分叉不消耗任何资源,这在区块链中被称为权益粉碎攻击。高权益的节点P则会不断贿赂其他节点,而一旦他们的股权达到50%以上,就可以控制整个区块链来发动双花攻击,这只要在贿赂金额小于商品交易价格的情况下总是有利可图,这在区块链中被称为贿赂攻击。另外还有一种随机选举竞争机制Follow-the-satoshi算法,它与PoS不同在于其使用安全的多方计算来保持领导人的不可预测性,但它假设了大多数参与联合炒币协议的节点在相当长的时间内不会被对手破坏。总的来说,上述基于PoS协议所衍生出来的几个协议都存在易遭受权益粉碎攻击、贿赂攻击、需要安全假设等问题。The core principle of the consensus reached by the PoS protocol is based on the equity held by the nodes rather than the computing power in PoW, which has been applied to PPCoin, which can effectively avoid the waste of computing power in the PoW consensus. However, since PPCoin uses coin age as a weight, the coin's "age" will increase even if the node is not connected to the network. As shown in Figure 1, node J accumulates up to 70% of the weight by intentionally going offline from the network. It allows node J to gradually dominate the consensus and even determine the generation of new blocks. In other words, a node dominates the bookkeeping of the blockchain, which does not conform to the decentralized nature of the blockchain. The derivative protocol PoA combines PoS with Nakamoto consensus, so that only online nodes can obtain mining income and transaction fees. However, these protocols rely on the rights and interests of nodes to reach consensus, which cannot guarantee the robustness of the blockchain. As shown in Figure 2, node O with low stake can try different sequences of stakeholders (fork) to maximize its own interests, because fork does not consume any resources, which is called stake crushing attack in the blockchain . Node P with high equity will continue to bribe other nodes, and once their equity reaches more than 50%, they can control the entire blockchain to launch double-spending attacks, which is always beneficial as long as the bribe amount is less than the commodity transaction price However, this is known as a bribery attack in blockchain. There is also a random election competition mechanism Follow-the-satoshi algorithm, which differs from PoS in that it uses secure multi-party computing to keep the leader unpredictable, but it assumes that most nodes participating in the joint coin speculation agreement It will not be destroyed by the opponent for a long time. In general, several protocols derived from the above-mentioned PoS-based protocols are vulnerable to rights smashing attacks, bribery attacks, and security assumptions.

而PBFT协议由BFT(拜占庭容错)协议改进而来,相比PoW协议和PoS协议来说,能够实现良好的容错性和出色的性能。但是在PBFT协议中,区块链中的节点是平等的,可以随意参与。因此就容易导致恶意节点可以创建任意数量的假名,如图3所示,然后就可以利用这些假名为自己的不正当利益投票(即双重消费),从而容易破坏网络的安全性,甚至控制整个网络系统,这在区块链中被称为Sybil攻击。虽然已有人提出将中本聪共识与PoS或BFT协议结合,以及用BFT协议完全取代中本聪共识的方式来规避Sybil攻击。然而,所有这些协议都是基于节点最近的资源、股权或外部信任来实现共识,可能会潜在地在节点之间建立了不理想的等级制度,并损害了区块链系统的去中心化。The PBFT protocol is improved from the BFT (Byzantine Fault Tolerance) protocol. Compared with the PoW protocol and the PoS protocol, it can achieve good fault tolerance and excellent performance. But in the PBFT protocol, the nodes in the blockchain are equal and can participate at will. Therefore, it is easy for malicious nodes to create any number of pseudonyms, as shown in Figure 3, and then use these pseudonyms to vote for their own improper interests (that is, double consumption), thus easily destroying the security of the network, and even controlling the entire network system, which is known as a Sybil attack in blockchain. Although it has been proposed to combine the Nakamoto consensus with the PoS or BFT protocol, and to completely replace the Nakamoto consensus with the BFT protocol to avoid Sybil attacks. However, all of these protocols achieve consensus based on a node’s recent resources, stake, or external trust, potentially creating an undesirable hierarchy among nodes and compromising the decentralization of the blockchain system.

发明内容Contents of the invention

基于此,有必要针对上述技术问题,提供一种能够避免权益粉碎攻击、贿赂攻击以及Sybil攻击等而提高健壮性且保证去中心化特性的基于信誉的区块链共识方法、装置、计算机设备和存储介质。Based on this, it is necessary to address the above technical problems and provide a reputation-based blockchain consensus method, device, computer equipment and storage medium.

本发明提供一种基于信誉的区块链共识方法,包括:The present invention provides a reputation-based block chain consensus method, including:

统计节点的历史共识投票信息,根据所述历史共识投票信息和恶意投票惩罚权重进行逻辑回归计算,得到所述节点的当前信任度;Statistical historical consensus voting information of the node, performing logistic regression calculation according to the historical consensus voting information and malicious voting penalty weight, to obtain the current trust degree of the node;

利用信誉修正阈值对所述节点的上一轮信誉值和所述当前信任度进行权重均衡,确定当前轮信誉值;performing weight balance on the last round of reputation value of the node and the current trust degree by using the reputation correction threshold to determine the current round of reputation value;

根据各所述节点的所述当前轮信誉值进行当前轮的共识。A current round of consensus is performed according to the current round of reputation values of each of the nodes.

在其中一个实施例中,所述利用信誉修正阈值对所述节点的上一轮信誉值和所述当前信任度进行权重均衡,确定当前轮信誉值,包括:In one of the embodiments, the weight balancing of the previous round of reputation value and the current trust degree of the node by using the reputation correction threshold to determine the current round of reputation value includes:

计算所述当前信任度与所述上一轮信誉值的绝对值之差,根据所述绝对值之差和上一轮共识确定的累计偏差计算当前轮累计偏差;Calculate the difference between the absolute value of the current trust degree and the reputation value of the previous round, and calculate the cumulative deviation of the current round according to the difference between the absolute value and the cumulative deviation determined by the previous round of consensus;

根据所述绝对值之差和所述当前轮累计偏差计算信誉修正阈值;calculating a reputation correction threshold according to the difference between the absolute values and the cumulative deviation of the current round;

利用信誉修正阈值对所述上一轮信誉值和所述当前信任度进行权重均衡,确定当前轮信誉值。Perform weight balance on the last round of reputation value and the current trust degree by using the reputation correction threshold to determine the current round of reputation value.

在其中一个实施例中,所述利用信誉修正阈值对所述节点的上一轮信誉值和所述当前信任度进行权重均衡,确定当前轮信誉值之前,还包括:In one of the embodiments, the weight balancing of the previous round of reputation value and the current trust degree of the node by using the reputation correction threshold, before determining the current round of reputation value, further includes:

根据所述历史共识投票信息判断所述节点在历史共识投票中是否存在离线未投票行为;Judging whether the node has offline non-voting behavior in the historical consensus voting according to the historical consensus voting information;

当确定存在离线未投票行为时,保留所述当前信任度,当确定不存在离线未投票行为时,利用区块生成时间对所述当前信任度进行信誉消耗。When it is determined that there is an offline non-voting behavior, the current trust degree is retained, and when it is determined that there is no offline non-voting behavior, the reputation consumption of the current trust degree is performed using the block generation time.

在其中一个实施例中,所述逻辑回归计算公式如下:In one of the embodiments, the logistic regression calculation formula is as follows:

Figure SMS_1
Figure SMS_1

其中,repu(i)cur是当前信任度;n表示当前第n轮共识;μ是节点i累计参与的共识轮数;

Figure SMS_2
表示节点i在第x轮共识中是否正常参与投票,正常投票为1,未正常投票为0;τ x表示节点i在第x轮共识中是否恶意投票,恶意投票为1,未恶意投票为0;υ表示恶意投票惩罚权重;e为自然对数。Among them, repu(i) cur is the current trust degree; n represents the current nth round of consensus; μ is the cumulative number of consensus rounds participated by node i;
Figure SMS_2
Indicates whether node i participates in voting normally in the x-th round of consensus, normal voting is 1, and abnormal voting is 0; τ x indicates whether node i voted maliciously in the x-th round of consensus, malicious voting is 1, and non-malicious voting is 0 ; υ represents the malicious voting penalty weight; e is the natural logarithm.

在其中一个实施例中,信誉消耗函数如下:In one of the embodiments, the reputation consumption function is as follows:

Figure SMS_3
Figure SMS_3

其中,

Figure SMS_4
=0表示节点i在第x轮共识中离线未投票;e为自然对数;ΔB表示区块生成时间。in,
Figure SMS_4
=0 means that node i was offline and did not vote in the x-round consensus; e is the natural logarithm; ΔB means the block generation time.

在其中一个实施例中,所述权重均衡的计算公式如下:In one of the embodiments, the calculation formula of the weight balance is as follows:

Figure SMS_5
Figure SMS_5

其中,t表示当前第t轮共识;repu(i)t表示第t轮共识的信誉值;repu(i)t-1表示第t-1轮的信誉值;γ表示信誉修正阈值,γ的初始值为1。Among them, t represents the current t-round consensus; repu(i) t represents the reputation value of the t-round consensus; repu(i) t-1 represents the reputation value of the t-1 round; γ represents the reputation correction threshold, and the initial value of γ The value is 1.

在其中一个实施例中,所述信誉修正阈值的计算公式如下:In one of the embodiments, the calculation formula of the reputation correction threshold is as follows:

Figure SMS_6
Figure SMS_6

其中,thershold为设置的阈值,thershold=0.25;c为定义参数,c=0.6;φ trepu(i)表示节点i的绝对值之差,ψ trepu(i)表示当前轮累计偏差,ψ t-1repu(i)表示上一轮共识确定的累计偏差。Among them, thershold is the set threshold, thershold =0.25; c is the definition parameter, c=0.6; φ t repu(i) indicates the difference of the absolute value of node i, ψ t repu(i) indicates the cumulative deviation of the current round, ψ t -1 repu(i) represents the cumulative bias determined by the last round of consensus.

一种基于信誉的区块链共识装置,包括:A reputation-based blockchain consensus device, including:

信誉确定模块,用于统计节点的历史共识投票信息,根据所述历史共识投票信息和恶意投票惩罚权重进行逻辑回归计算,得到所述节点的当前信任度;The reputation determination module is used to count the historical consensus voting information of the node, and perform logistic regression calculation according to the historical consensus voting information and the malicious voting penalty weight to obtain the current trust degree of the node;

信誉修正模块,用于利用信誉修正阈值对所述节点的上一轮信誉值和所述当前信任度进行权重均衡,确定当前轮信誉值;A reputation correction module, configured to use a reputation correction threshold to perform weight balance on the previous round of reputation value of the node and the current trust degree, and determine the current round of reputation value;

共识模块,用于根据各所述节点的所述当前轮信誉值进行当前轮的共识。A consensus module, configured to perform a current round of consensus according to the current round of reputation values of each of the nodes.

本发明还提供一种计算机设备,所述计算机设备包括处理器和存储器,所述存储器存储由计算机程序,所述处理器执行所述计算机程序时实现上述基于信誉的区块链共识方法的步骤。The present invention also provides a computer device, the computer device includes a processor and a memory, the memory stores a computer program, and when the processor executes the computer program, the steps of the above reputation-based block chain consensus method are realized.

本发明还提供一种计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现上述基于信誉的区块链共识方法的步骤。The present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the above reputation-based block chain consensus method are realized.

上述基于信誉的区块链共识方法、装置、计算机设备和存储介质,通过引入信誉作为共识节点的投票权重来达成共识,由于节点的总信誉不会改变,所以能够有效抵御Sybil攻击。并且,利用逻辑回归基于节点的行为动态更新节点的信誉,惩罚恶意节点以减少它们发起权益粉碎攻击和贿赂攻击的概率。同时,利用信誉修正阈值对信誉进行修正,使得信誉增长的非常缓慢,这就保证了区块链的去中心化性质。The above reputation-based blockchain consensus method, device, computer equipment and storage medium achieve consensus by introducing reputation as the voting weight of consensus nodes. Since the total reputation of nodes will not change, it can effectively resist Sybil attacks. Moreover, logistic regression is used to dynamically update the reputation of nodes based on the behavior of nodes, and punish malicious nodes to reduce the probability of them launching stake smashing attacks and bribery attacks. At the same time, using the reputation correction threshold to correct the reputation makes the reputation grow very slowly, which ensures the decentralized nature of the blockchain.

附图说明Description of drawings

图1为一个实施例中币龄累积导致区块链节点权益中心化的示意图。Figure 1 is a schematic diagram of the centralization of blockchain node rights and interests caused by the accumulation of currency age in an embodiment.

图2为一个实施例中低权益节点尝试分叉高权益节点执行贿赂的示意图。Fig. 2 is a schematic diagram of a low-stake node trying to fork a high-stake node to perform bribery in an embodiment.

图3为一个实施例中恶意节点实施Sybil攻击的示意图。Fig. 3 is a schematic diagram of a malicious node implementing a Sybil attack in an embodiment.

图4为一个实施例中基于信誉的区块链共识方法的流程示意图。Fig. 4 is a schematic flow diagram of a blockchain consensus method based on reputation in an embodiment.

图5为一个实施例中在区块大小变化下,本发明共识协议与PBFT协议比对时延性能的曲线示意图。Fig. 5 is a schematic diagram of the comparison curve of the delay performance between the consensus protocol of the present invention and the PBFT protocol under the change of the block size in an embodiment.

图6为一个实施例中在区块大小变化下,本发明共识协议与PBFT协议比对吞吐量性能的曲线示意图。Fig. 6 is a schematic diagram of the throughput performance curve of the consensus protocol of the present invention and the PBFT protocol under the change of the block size in an embodiment.

图7为一个实施例中在节点数量变化下,本发明共识协议与PBFT协议比对时延性能的曲线示意图。Fig. 7 is a schematic diagram of the delay performance curve of the consensus protocol of the present invention and the PBFT protocol under the change of the number of nodes in an embodiment.

图8为一个实施例中在节点数量变化下,本发明共识协议与PBFT协议比对吞吐量性能的曲线示意图。Fig. 8 is a schematic diagram of the throughput performance curve of the consensus protocol of the present invention compared with the PBFT protocol under the change of the number of nodes in an embodiment.

图9为一个实施例中基于信誉的区块链共识装置的结构框图。Fig. 9 is a structural block diagram of a reputation-based block chain consensus device in an embodiment.

具体实施方式Detailed ways

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the object, technical solution and advantages of the present invention clearer, the present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present invention, not to limit the present invention.

在一个实施例中,如图4所示,提供一种基于信誉的区块链共识方法,包括以下步骤:In one embodiment, as shown in Figure 4, a reputation-based block chain consensus method is provided, comprising the following steps:

步骤S101,统计节点的历史共识投票信息,根据历史共识投票信息和恶意投票惩罚权重进行逻辑回归计算,得到节点的当前信任度。In step S101, the historical consensus voting information of the nodes is counted, and logistic regression calculation is performed according to the historical consensus voting information and malicious voting penalty weights to obtain the current trust degree of the node.

步骤S103,利用信誉修正阈值对节点的上一轮信誉值和当前信任度进行权重均衡,确定当前轮信誉值。Step S103, using the reputation correction threshold to weight balance the previous round of reputation value and current trust degree of the node, and determine the current round of reputation value.

其中,历史共识投票信息是指节点在当前这一轮共识之前已经共识过的投票情况,包括每一轮共识中是否正常参与投票、每一轮共识中是否恶意投票等。恶意投票惩罚权重是对于恶意投票预设的惩罚权重,基于实际需求设置,恶意投票惩罚权重越大,对节点恶意投票的惩罚就越大。逻辑回归模型是研究二分法问题的主要常用模型,该模型描述了一组自变量与二元因变量之间的关系。它使用一个基于线性回归的sigmoid函数,使预测结果位于[0,1]区间内,本实施例通过建立逻辑回归模型来评估节点信誉的变化与它的共识行为能够实现信誉的动态授权。作为共识协议的一部分,该模型可以在参与共识的每个节点中执行。而信誉是独立计算的,信誉的计算由节点在执行共识时的行为决定,并且可以与共识信息同时广播。根据节点行为对区块共识结果的影响程度,本实施例将节点的行为分为以下三种类型:#good:正常接收和广播网络中的交易信息列表,并向其他节点发送相同的信息列表。#bad:正常接收和广播网络中的交易信息列表,并向其他节点发送不同的信息列表或自身伪造的信息列表。以及#offline:不接收和广播网络中的交易信息列表。由于节点在每一轮共识的行为不是固定的,所以本实施例信誉是一个动态变化的过程。在模型中,设定的信誉值R是0~1的实数,信誉值越大,可信度越高。对于系统新添加的共识节点,其初始信誉值都设为 0.5。Among them, the historical consensus voting information refers to the voting situation that the nodes have agreed on before the current round of consensus, including whether they normally participate in voting in each round of consensus, whether they vote maliciously in each round of consensus, etc. The malicious voting penalty weight is the preset penalty weight for malicious voting. It is set based on actual needs. The greater the malicious voting penalty weight, the greater the penalty for malicious voting of nodes. The main commonly used model for studying dichotomous problems is the logistic regression model, which describes the relationship between a set of independent variables and a binary dependent variable. It uses a sigmoid function based on linear regression, so that the prediction result is in the [0,1] interval. In this embodiment, the dynamic authorization of reputation can be realized by establishing a logistic regression model to evaluate the change of node reputation and its consensus behavior. As part of the consensus protocol, this model can be enforced in each node participating in the consensus. The reputation is calculated independently, and the calculation of the reputation is determined by the behavior of the nodes when implementing the consensus, and can be broadcast simultaneously with the consensus information. According to the degree of influence of node behavior on the block consensus result, this embodiment divides the behavior of nodes into the following three types: #good: normally receive and broadcast the transaction information list in the network, and send the same information list to other nodes. #bad: Receive and broadcast transaction information lists in the network normally, and send different information lists or forged information lists to other nodes. And #offline: Do not receive and broadcast the list of transaction information in the network. Since the behavior of nodes in each round of consensus is not fixed, the reputation of this embodiment is a process of dynamic change. In the model, the set reputation value R is a real number from 0 to 1, and the larger the reputation value, the higher the credibility. For the newly added consensus nodes in the system, their initial reputation value is set to 0.5.

信誉修正阈值是用于对信誉的增长速率进行修正而设定的阈值,通过信誉修正阈值使得节点的信誉值增长不会太快,避免在网络初期阶段的信誉中心化,由于刚开始并不知道节点是否有作恶倾向,所以初始时信誉修正阈值γ设为1。上一轮信誉值是节点在上一轮共识时的信誉,节点在第t轮共识开始时的信誉与第t-1轮共识结束时的信誉相等。当前轮信誉值就是最终确定的当前轮共识的信誉,当前信任度就是没有进行修正之前所确定的信誉。The reputation correction threshold is a threshold set for correcting the growth rate of reputation. Through the reputation correction threshold, the reputation value of the node will not grow too fast, avoiding the reputation centralization in the initial stage of the network, because it is not known at the beginning Whether the node has a tendency to do evil, so the initial reputation correction threshold γ is set to 1. The last round of reputation value is the reputation of the node in the last round of consensus, and the reputation of the node at the beginning of the t-th round of consensus is equal to the reputation at the end of the t-1 round of consensus. The current round of reputation value is the finalized reputation of the current round of consensus, and the current trust degree is the reputation determined before modification.

具体的,首先利用历史共识投票信息和恶意投票惩罚权重等参数根据逻辑回归模型计算得到节点的当前信任度。然后利用信誉修正阈值对当前信任度和上一轮信誉值进行权重均衡得到修正后的信誉值作为该节点当前这一轮共识的信誉值,即当前轮信誉值,通过修正能够避免逻辑回归模型导致信誉值快速增长而破坏共识协议的稳定。Specifically, firstly, the current trust degree of the node is calculated according to the logistic regression model by using parameters such as historical consensus voting information and malicious voting penalty weight. Then use the reputation correction threshold to balance the current trust degree and the previous round of reputation value to obtain the corrected reputation value as the reputation value of the node's current round of consensus, that is, the current round of reputation value. Through the correction, the logistic regression model can be avoided. The reputation value grows rapidly and destabilizes the consensus agreement.

在一个实施例中,步骤S101, 基于逻辑回归模型的节点信誉度量函数的计算公式如下:In one embodiment, step S101, the calculation formula of the node reputation measurement function based on the logistic regression model is as follows:

Figure SMS_7
Figure SMS_7

其中,repu(i)cur是当前信任度;n表示当前第n轮共识;μ是节点i累计参与的共识轮数,即轮长;

Figure SMS_8
表示节点i在第x轮共识中是否正常参与投票,正常投票为1,未正常投票为0;τ x表示节点i在第x轮共识中是否恶意投票,恶意投票为1,未恶意投票为0;υ表示恶意投票惩罚权重;e为自然对数。本实施例共识协议的运行从时间上被划分为一系列轮数,每一轮产生一个区块,执行相同的步骤。信誉则以每轮开始前的历史值进行计算,通过节点在每轮中的诚实签名和恶意签名行为的判别,进行动态的信任度授信。Among them, repu(i) cur is the current trust degree; n represents the current nth round of consensus; μ is the cumulative number of consensus rounds participated by node i, that is, the round length;
Figure SMS_8
Indicates whether node i participates in voting normally in the x-th round of consensus, normal voting is 1, and abnormal voting is 0; τ x indicates whether node i voted maliciously in the x-th round of consensus, malicious voting is 1, and non-malicious voting is 0 ; υ represents the malicious voting penalty weight; e is the natural logarithm. The operation of the consensus protocol in this embodiment is divided into a series of rounds in terms of time, and each round generates a block and performs the same steps. The reputation is calculated based on the historical value before the start of each round, and the dynamic trust degree credit is carried out through the discrimination of the honest signature and malicious signature behavior of the node in each round.

在一个实施例中,步骤S103包括:计算当前信任度与上一轮信誉值的绝对值之差,根据绝对值之差和上一轮共识确定的累计偏差计算当前轮累计偏差;根据绝对值之差和当前轮累计偏差计算信誉修正阈值;利用信誉修正阈值对上一轮信誉值和当前信任度进行权重均衡,确定当前轮信誉值。In one embodiment, step S103 includes: calculating the difference between the absolute value of the current trust degree and the previous round of reputation value, calculating the current round of cumulative deviation according to the difference between the absolute value and the cumulative deviation determined by the previous round of consensus; The reputation correction threshold is calculated based on the difference and the cumulative deviation of the current round; the reputation correction threshold is used to balance the weight of the previous round of reputation value and the current trust degree to determine the current round of reputation value.

具体的,由于逻辑回归这样的模型在对数增长期节点的信誉值的增长是相当快的,从而无法惩罚共识前期故意表现好的恶意节点,不利于共识协议稳定的实施。因此,为了避免出现这种情况,本实施例进一步对模型进行了修正,根据节点的当前信誉和上一轮共识时的信誉,对在共识投票时的信誉进行权重均衡,修正后的信誉度量函数,即权重均衡的计算公式如下:Specifically, due to the rapid growth of the reputation value of nodes in the logarithmic growth period of a model such as logistic regression, it is impossible to punish malicious nodes that deliberately performed well in the early stage of consensus, which is not conducive to the stable implementation of the consensus protocol. Therefore, in order to avoid this situation, this embodiment further modifies the model. According to the current reputation of the node and the reputation of the last round of consensus, the weight of the reputation in the consensus voting is balanced, and the revised reputation measurement function , that is, the calculation formula of weight balance is as follows:

Figure SMS_9
Figure SMS_9

其中,t表示当前第t轮共识;repu(i)t表示第t轮共识的信誉值;repu(i)t-1表示第t-1轮的信誉值;γ表示信誉修正阈值,γ的初始值为1,通过γ可以对信誉的增加速率进行修正,使其增长不会太快,避免在网络初期阶段的信誉中心化。其中,信誉修正阈值γ的计算公式如下:Among them, t represents the current t-round consensus; repu(i) t represents the reputation value of the t-round consensus; repu(i) t-1 represents the reputation value of the t-1 round; γ represents the reputation correction threshold, and the initial value of γ The value is 1, and the increase rate of reputation can be corrected through γ, so that it will not grow too fast, avoiding the centralization of reputation in the initial stage of the network. Among them, the calculation formula of reputation correction threshold γ is as follows:

Figure SMS_10
Figure SMS_10

其中,thershold为设置的阈值,是为了防止γ过于饱和趋近于1而设置的阈值,本实施例优选thershold设置为0.25,可以防止γ过于饱和趋近于1的同时,也能让repu(i)t不会过分倚重一种当前信誉函数直接评价所得的信誉。c为定义参数,用于控制对节点的最近行为的反应权重。c越大,说明用户给予的最近的信誉偏差的权重比之前累计信誉偏差要高,本实施例优选c=0.6。φ trepu(i)则表示节点i当前信任度与上一轮信誉值的绝对值之差。ψ trepu(i)表示当前轮累计偏差,ψ t-1repu(i)表示上一轮共识确定的累计偏差,即节点前t轮最终的累计偏差。Wherein, thershold is a set threshold, which is set to prevent γ from being too saturated and approaching 1. In this embodiment, it is preferred that thershold is set to 0.25, which can prevent γ from being too saturated and approaching 1, and also allow repu(i ) t will not rely too much on the reputation obtained by direct evaluation of a current reputation function. c is the definition parameter used to control the weight of the reaction to the most recent behavior of the node. The larger c is, it means that the weight of the latest reputation deviation given by the user is higher than the previous cumulative reputation deviation. In this embodiment, c=0.6 is preferred. φ t repu(i) represents the difference between the absolute value of the current trust degree of node i and the reputation value of the previous round. ψ t repu(i) represents the cumulative deviation of the current round, and ψ t-1 repu(i) represents the cumulative deviation determined by the previous round of consensus, that is, the final cumulative deviation of the previous t rounds of the node.

在一个实施例中,在步骤S101之后步骤S103之前还包括:根据历史共识投票信息判断节点在历史共识投票中是否存在离线未投票行为;当确定存在离线未投票行为时,保留当前信任度,当确定不存在离线未投票行为时,利用区块生成时间对当前信任度进行信誉消耗。In one embodiment, after step S101 and before step S103, it also includes: judging whether the node has an offline non-voting behavior in the historical consensus voting according to the historical consensus voting information; when it is determined that there is an offline non-voting behavior, retain the current trust degree, when When it is determined that there is no offline non-voting behavior, the current trust degree is consumed by using the block generation time.

其中,由于信誉是节点被选择成为委员会概率及共识投票权重的表现形式,信誉越大,参与生成区块的概率就越高,由此带来不菲的效益。为了保持网络中在线节点的数量,本实施例进一步引入信誉消耗函数。即,本实施例动态授予信誉的方法由信誉度量函数与信誉消耗函数两个函数组成。信誉消耗是为了保证节点的参与度而设置,而不是为了让节点以消耗信誉的方式参与区块的生成。因为当委员会中在线成员数量过少时,网络的安全与稳定就得不到保证。Among them, since reputation is the manifestation of the probability of a node being selected as a committee and the consensus voting weight, the greater the reputation, the higher the probability of participating in generating blocks, which brings considerable benefits. In order to maintain the number of online nodes in the network, this embodiment further introduces a reputation consumption function. That is, the method for dynamically awarding reputation in this embodiment consists of two functions: a reputation measurement function and a reputation consumption function. Reputation consumption is set to ensure the participation of nodes, not to allow nodes to participate in the generation of blocks by consuming reputation. Because when the number of online members in the committee is too small, the security and stability of the network cannot be guaranteed.

具体的,节点的信誉消耗在对信誉进行修正之前进行,主要基于节点的历史投票情况来决定。当根据历史共识投票信息判断节点在历史共识投票中存在离线未投票行为时,则保留当前信任度不进行信誉消耗,而当确定不存在离线未投票行为时,利用区块生成时间对当前信任度进行信誉消耗。Specifically, the reputation consumption of the node is performed before the reputation is revised, and is mainly determined based on the historical voting situation of the node. When it is judged according to the historical consensus voting information that the node has offline non-voting behavior in the historical consensus voting, the current trust degree is retained without credit consumption, and when it is determined that there is no offline non-voting behavior, the current trust degree is determined by the block generation time. Carry out credit consumption.

在一个实施例中,信誉消耗函数如下:In one embodiment, the reputation consumption function is as follows:

Figure SMS_11
Figure SMS_11

其中,

Figure SMS_12
=0表示节点i在第x轮共识中离线未投票;e为自然对数;ΔB表示区块生成时间。提高区块生成时间,意味着区块上链的难度增加,这时候理性节点可能会选择暂时离线(#offline),以寻求上链难度更低、机会更大的时候参与区块生成。越来越多的节点开始离线,节点参与共识的比例也越来越低,恶意节点成功的概率就会变得很大。因此在区块生成时间增高的同时,也增大对于不参与区块生成的节点的信誉消耗,将有助于提高节点的参与度,维护区块链网络的运行安全。in,
Figure SMS_12
=0 means that node i was offline and did not vote in the x-round consensus; e is the natural logarithm; ΔB means the block generation time. Improving the block generation time means that the difficulty of block chaining increases. At this time, rational nodes may choose to temporarily go offline (#offline) in order to participate in block generation when the chaining difficulty is lower and the opportunity is greater. More and more nodes are going offline, and the proportion of nodes participating in the consensus is getting lower and lower, and the probability of success of malicious nodes will become very high. Therefore, while the block generation time increases, it also increases the reputation consumption of nodes that do not participate in block generation, which will help increase the participation of nodes and maintain the operational security of the blockchain network.

步骤S105,根据各节点的当前轮信誉值进行当前轮的共识。In step S105, the current round of consensus is performed according to the current round of reputation values of each node.

具体的,当得到个节点的当前轮信誉值后,在共识过程中即可以基于该信誉值进行当前轮的共识。应当理解的是,各个节点的当前轮信誉值可以在共识之前预先进行计算,也可以在共识过程中当需要用到时由各个节点进行实时计算。本实施例共识分为两个过程:主节点更新算法和改进的PBFT共识算法。Specifically, after obtaining the current round reputation value of a node, the current round of consensus can be carried out based on the reputation value during the consensus process. It should be understood that the current round reputation value of each node can be pre-calculated before the consensus, or can be calculated in real time by each node when needed during the consensus process. The consensus in this embodiment is divided into two processes: master node update algorithm and improved PBFT consensus algorithm.

主节点更新算法是根据节点的信誉进行主节点的替换。假设节点的信誉值越高,则在主节点更新过程中被选为主节点的概率就越高,比如:

Figure SMS_13
。其中,N是共识节点的集合,N={N1 , N2 ,... NQ }。在每一轮的共识中,有一个主要的主节点Np,其他节点为备份节点。所有的共识节点首先在本地缓存收到的交易信息。而Np将客户端发送的有效交易打包成一个区块。每个节点都会维护一个更新的节点信息表NIL。NIL包含了当前区块链系统中的相邻节点的集合与该节点的信息、信誉(对应于投票权重)以及节点ID,节点的初始信誉为0.5。P是被选为主节点的概率。D是指数分布(C2C网络和大多数社会网络中的信誉分布网络中的声誉分布是指数型)。主节点更新主要在副本节点怀疑主节点或主节点在共识开始后的设置时间内没有发起共识提议时进行,副本节点选择当前节点中信誉值最大的节点作为主节点,并向其他节点广播主节点变更消息。而节点收到主节点变更消息后,计算收到的消息数量是否超过2f(f为拜占庭节点数量),超过后即对主节点进行更新。The master node update algorithm is to replace the master node according to the reputation of the node. Assume that the higher the reputation value of the node, the higher the probability of being selected as the master node during the master node update process, for example:
Figure SMS_13
. Among them, N is the set of consensus nodes, N={N 1 , N 2 ,... N Q }. In each round of consensus, there is a main master node Np, and other nodes are backup nodes. All consensus nodes first cache the received transaction information locally. And Np packs the valid transactions sent by the client into a block. Each node maintains an updated node information table NIL. NIL contains the set of adjacent nodes in the current blockchain system and the node's information, reputation (corresponding to voting weight) and node ID, and the initial reputation of the node is 0.5. P is the probability of being selected as a master node. D is an exponential distribution (reputation distribution in C2C networks and most social networks is exponential). The update of the master node is mainly carried out when the replica node suspects that the master node or the master node has not initiated a consensus proposal within the set time after the start of the consensus. The replica node selects the node with the highest reputation value among the current nodes as the master node, and broadcasts the master node to other nodes Change message. After the node receives the master node change message, it calculates whether the number of received messages exceeds 2f (f is the number of Byzantine nodes), and updates the master node after exceeding.

在改进的PBFT共识算法中,本实施例基于每个共识节点所提供的信息列表NIL评估每个节点的信誉值,这不仅可以检测出其中的恶意节点,还可以从NIL中删除这些节点。而因为对于恶意节点高的惩罚,诚实节点的信誉将会逐渐积累起来,从而使得在共识过程中的发言权将逐渐增加,进而恶意节点的影响将逐渐减少。本实施例改进的PBFT算法如下:In the improved PBFT consensus algorithm, this embodiment evaluates the reputation value of each node based on the information list NIL provided by each consensus node, which can not only detect malicious nodes among them, but also delete these nodes from NIL. And because of the high punishment for malicious nodes, the reputation of honest nodes will gradually accumulate, so that the right to speak in the consensus process will gradually increase, and the influence of malicious nodes will gradually decrease. The improved PBFT algorithm of this embodiment is as follows:

输入:交易Tx。Input: Transaction Tx.

输出:包含交易Tx的新区块BnOutput: New block B n containing transaction Tx.

步骤1:客户端c:广播交易簇TxCluster到主节点0。Step 1: Client c: Broadcast transaction cluster TxCluster to master node 0.

步骤2:主节点0:验证交易簇内交易Tx是否有效,若无效直接将其删除。然后将有效交易打包到区块中,并根据区块体内的消息生成区块头Bhead Step 2: Master node 0: Verify whether the transaction Tx in the transaction cluster is valid, and delete it directly if it is invalid. Then pack the valid transaction into the block, and generate the block header B head according to the message in the block body.

步骤3:主节点0:广播预准备(pre-prepare)消息到各副本节点,内容为

Figure SMS_14
,其中h是当前新区块的高度,d是区块头Bhead的摘要,t是当前的时间戳,D0是当前主节点0的ID,NIL0是主节点0的节点信息列表。Step 3: master node 0: broadcast a pre-prepare message to each copy node, the content is
Figure SMS_14
, where h is the height of the current new block, d is the summary of the block header B head , t is the current timestamp, D 0 is the ID of the current master node 0, and NIL 0 is the node information list of master node 0.

步骤4:副本节点1,2:收到主节点0发送的预准备消息后,首先验证新区块的有效性,验证通过则分别向其他节点发送prepare消息,内容为

Figure SMS_15
,Di是副本节点i的ID ,NILi是副本节点i的节点信息列表。Step 4: Replica nodes 1 and 2: After receiving the pre-preparation message sent by the master node 0, they first verify the validity of the new block, and if the verification passes, they send prepare messages to other nodes, the content of which is
Figure SMS_15
, D i is the ID of replica node i, and NIL i is the node information list of replica node i.

步骤5:副本节点1,2:计算当前向其发送消息的节点的信誉值R,如果R ≥Rthershold则在本地更新交易信息的共识状态并发送 pre_commit(预提交)信息,内容为

Figure SMS_16
。Step 5: Replica nodes 1 and 2: Calculate the reputation value R of the node currently sending the message to it, if R ≥ R thershold , update the consensus status of the transaction information locally and send the pre_commit (pre-submit) information, the content is
Figure SMS_16
.

步骤6:主节点0:比较从副本节点收到的预提交信息,根据改进的逻辑回归计算出每个节点当前的声誉,并更新本地共识节点的信息列表,将共识结果发回给客户端和所有副本节点,并发送提交消息

Figure SMS_17
;Step 6: Master node 0: Compare the pre-commit information received from the copy node, calculate the current reputation of each node according to the improved logistic regression, and update the information list of the local consensus node, and send the consensus result back to the client and All replica nodes, and send a commit message
Figure SMS_17
;

步骤7:副本节点1,2:完成提交状态后,更新本地共识节点信息列表,并将共识结果反馈给客户端,以便为下一轮的共识过程做准备。Step 7: Replica nodes 1 and 2: After completing the submission status, update the local consensus node information list, and feed back the consensus results to the client to prepare for the next round of consensus process.

另外,本实施例节点更新其共识状态的条件是共识节点向其发送消息的信誉值R足够大。R应不低于设定的阈值Rthershold,阈值Rthershold的计算公式如下:In addition, the condition for a node in this embodiment to update its consensus state is that the reputation value R of the consensus node sending a message to it is sufficiently large. R should not be lower than the set threshold R thershold , the calculation formula of the threshold R thershold is as follows:

Figure SMS_18
Figure SMS_18

由此可知,本实施例改进的PBFT共识算法的共识过程分为四个主要阶段:预准备、准备、预提交和提交。通过在共识协议中增加了一个预提交阶段,这不仅能够保证各节点正确达成共识,同时还能提高性能。It can be seen that the consensus process of the improved PBFT consensus algorithm in this embodiment is divided into four main stages: pre-preparation, preparation, pre-submission and submission. By adding a pre-commit phase to the consensus protocol, this not only ensures that the nodes reach consensus correctly, but also improves performance.

与现有技术相比较,上述基于信誉的区块链共识方法具有以下优点:Compared with existing technologies, the above reputation-based blockchain consensus method has the following advantages:

抵御Sybil攻击:通过引入信誉作为共识节点的投票权重来达成共识,由于这些节点的总信誉不会改变,所以恶意节点无法创造大量假节点提高影响力来破坏网络安全,从而能够有效避免Sybil攻击。Resisting Sybil attacks: Consensus is reached by introducing reputation as the voting weight of consensus nodes. Since the total reputation of these nodes will not change, malicious nodes cannot create a large number of fake nodes to increase their influence and undermine network security, thus effectively avoiding Sybil attacks.

避免权益粉碎攻击和贿赂攻击:由于惩罚权重的存在恶意节点无法承担高额的信誉惩罚。比如在第一轮共识中,一个节点在投出恶意票后的信誉只有其投出诚实票的36%。而且信誉惩罚随着共识轮数的增加会迅速上升,这种惩罚力度的存在对任何理性的节点来说都是不可接受的,从而能够减少它们发起权益粉碎攻击和贿赂攻击的概率达到避免攻击。Avoid stake crushing attacks and bribery attacks: Malicious nodes cannot bear high reputation penalties due to the existence of penalty weights. For example, in the first round of consensus, the reputation of a node after casting a malicious vote is only 36% of that of an honest vote. Moreover, the reputation penalty will rise rapidly with the increase of the number of consensus rounds. The existence of such punishment is unacceptable to any rational node, so as to reduce the probability of them launching rights smashing attacks and bribery attacks to avoid attacks.

保证去中心化性质:通过信誉修正阈值进行修正,使得信誉增长非常缓慢,而且信誉位于0~1之间有一个上限,这就保证了区块链的去中心化性质。Guarantee the nature of decentralization: Correction through the reputation correction threshold makes the growth of reputation very slow, and there is an upper limit for reputation between 0 and 1, which guarantees the decentralized nature of the blockchain.

低通信开销:在节点共识过程中增加了节点信誉的动态授权,并在节点共识的过程中增加了预提交阶段,虽然本发明的时间复杂度仍为O(N2),但是总通信量为(n2+2n-3),相比PBFT的通信总数(2n2-n-1)来说本发明节点间的通信数量减少了。Low communication overhead: the dynamic authorization of node reputation is added in the process of node consensus, and the pre-submission stage is added in the process of node consensus. Although the time complexity of the present invention is still O(N 2 ), the total communication volume is (n 2 +2n-3), compared with the total number of PBFT communications (2n 2 -n-1), the number of communications between nodes in the present invention is reduced.

另外,上述基于信誉的区块链共识方法还具备高性能优点。如图5、图6、图7和图8所示,提供了本发明共识协议(以下称为RIPPB)与传统PBFT协议的性能实验结果示意图。In addition, the above-mentioned reputation-based blockchain consensus method also has the advantage of high performance. As shown in FIG. 5 , FIG. 6 , FIG. 7 and FIG. 8 , a schematic diagram of the performance experiment results of the consensus protocol of the present invention (hereinafter referred to as RIPPB) and the traditional PBFT protocol is provided.

参考图5和图6,其为节点数量固定为20个,通过改变区块大小来比对时延和吞吐量等性能的曲线示意图。可以发现,RIPPB和PBFT的延迟(Latency)随着块大小的增加而显著增加,但是RIPPB的增长率比PBFT的增长率低30%。另外,区块大小的增加意味着区块内交易数量的增加,这就增加了PBFT和RIPPB协议的吞吐量(TPS),显然RIPPB的吞吐量高于PBFT。然而,因为网络容量的限制,当区块大小接近或超过4M时,吞吐量的增长速度都明显变慢。Referring to Fig. 5 and Fig. 6, it is a schematic diagram of curves comparing performance such as delay and throughput by changing the block size when the number of nodes is fixed at 20. It can be found that the latency (Latency) of RIPPB and PBFT increases significantly as the block size increases, but the growth rate of RIPPB is 30% lower than that of PBFT. In addition, an increase in the block size means an increase in the number of transactions in the block, which increases the throughput (TPS) of the PBFT and RIPPB protocols. Obviously, the throughput of RIPPB is higher than that of PBFT. However, due to the limitation of network capacity, when the block size is close to or exceeds 4M, the growth rate of throughput will be significantly slower.

参考图7和图8,其为区块大小固定为1/8MB,通过改变节点数量来比对时延和吞吐量等性能的曲线示意图。可以发现,与PBFT协议相比,RIPPB协议大大减少了由共识节点生成区块的延迟。而且共识节点的块生成的延迟的减少随着共识节点数量的增加而更加明显。与PBFT相比协议相比,RIPPB的吞吐量全面提高,最高达到28%,吞吐量的下降速度随着共识节点数量增加而减慢。Referring to Figure 7 and Figure 8, it is a schematic diagram of curves comparing performance such as delay and throughput by changing the number of nodes when the block size is fixed at 1/8MB. It can be found that compared with the PBFT protocol, the RIPPB protocol greatly reduces the delay in generating blocks by consensus nodes. Moreover, the reduction in delay of block generation by consensus nodes becomes more pronounced as the number of consensus nodes increases. Compared with the PBFT protocol, the throughput of RIPPB has been improved in an all-round way, up to 28%, and the decline rate of throughput slows down as the number of consensus nodes increases.

在一个实施例中,如图9所示,提供一种基于信誉的区块链共识装置,包括:In one embodiment, as shown in Figure 9, a credit-based block chain consensus device is provided, including:

信誉确定模块901,用于统计节点的历史共识投票信息,根据历史共识投票信息和恶意投票惩罚权重进行逻辑回归计算,得到节点的当前信任度。The reputation determination module 901 is used to count the historical consensus voting information of the node, and perform logistic regression calculation according to the historical consensus voting information and malicious voting penalty weight to obtain the current trust degree of the node.

信誉修正模块903,用于利用信誉修正阈值对节点的上一轮信誉值和当前信任度进行权重均衡,确定当前轮信誉值。The reputation correction module 903 is configured to use the reputation correction threshold to carry out weight balance between the previous round of reputation value and the current trust degree of the node, and determine the current round of reputation value.

共识模块905,用于根据各节点的当前轮信誉值进行当前轮的共识。Consensus module 905, configured to perform current round consensus according to the current round reputation value of each node.

在一个实施例中,信誉修正模块903还用于计算当前信任度与上一轮信誉值的绝对值之差,根据绝对值之差和上一轮共识确定的累计偏差计算当前轮累计偏差;根据绝对值之差和当前轮累计偏差计算信誉修正阈值;利用信誉修正阈值对上一轮信誉值和当前信任度进行权重均衡,确定当前轮信誉值。In one embodiment, the reputation correction module 903 is also used to calculate the difference between the absolute value of the current trust degree and the previous round of reputation value, and calculate the cumulative deviation of the current round according to the difference between the absolute value and the cumulative deviation determined by the previous round of consensus; The difference between the absolute value and the cumulative deviation of the current round is used to calculate the reputation correction threshold; the reputation correction threshold is used to balance the weight of the previous round of reputation value and the current trust degree to determine the current round of reputation value.

在一个实施例中,还包括信誉消耗模块,用于根据历史共识投票信息判断节点在历史共识投票中是否存在离线未投票行为;当确定存在离线未投票行为时,保留当前信任度,当确定不存在离线未投票行为时,利用区块生成时间对当前信任度进行信誉消耗。In one embodiment, it also includes a reputation consumption module, which is used to judge whether the node has offline non-voting behavior in the historical consensus voting according to the historical consensus voting information; when it is determined that there is an offline non-voting behavior, the current trust degree is retained; When there is offline non-voting behavior, the current trust degree is consumed by using the block generation time.

关于基于信誉的区块链共识装置的具体限定可以参见上文中对于基于信誉的区块链共识方法的限定,在此不再赘述。上述基于信誉的区块链共识装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。基于这样的理解,本发明实现上述实施例方法中的全部或部分流程,也可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一计算机可读存储介质中,该计算机程序在被处理器执行时,可实现上述各个基于信誉的区块链共识方法实施例的步骤。其中,所述计算机程序包括计算机程序代码,所述计算机程序代码可以为源代码形式、对象代码形式、可执行文件或某些中间形式等。For the specific limitations of the reputation-based blockchain consensus device, please refer to the limitations of the reputation-based blockchain consensus method above, and will not be repeated here. Each module in the above reputation-based block chain consensus device can be fully or partially realized by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of the processor in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that the processor can call and execute the corresponding operations of the above modules. Based on this understanding, the present invention realizes all or part of the processes in the methods of the above embodiments, and can also be completed by instructing related hardware through a computer program. The computer program can be stored in a computer-readable storage medium, and the computer When the program is executed by the processor, it can realize the steps of the above embodiments of the reputation-based blockchain consensus method. Wherein, the computer program includes computer program code, and the computer program code may be in the form of source code, object code, executable file or some intermediate form.

在一个实施例中,提供一种计算机设备,该计算机设备可以是服务器,包括处理器,存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种基于信誉的区块链共识方法。示例性的,计算机程序可以被分割成一个或多个模块,一个或者多个模块被存储在存储器中,并由处理器执行以完成本发明。一个或多个模块可以是能够完成特定功能的一系列计算机程序指令段,该指令段用于描述计算机程序在计算机装置中的执行过程。所称处理器可以是中央处理单元(Central Processing Unit,CPU),还可以是其他通用处理器、数字信号处理器 (Digital Signal Processor,DSP)、专用集成电路 (Application SpecificIntegrated Circuit,ASIC)、现成可编程门阵列 (Field-Programmable Gate Array,FPGA) 或者其他可编程逻辑器件、分立门或者晶体管逻辑器件、分立硬件组件等。通用处理器可以是微处理器或者该处理器也可以是任何常规的处理器等,所述处理器是所述计算机装置的控制中心,利用各种接口和线路连接整个计算机装置的各个部分。In one embodiment, a computer device is provided, which may be a server, and includes a processor, a memory, and a network interface. Wherein, the processor of the computer device is used to provide calculation and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database of the computer device is used to store data. The network interface of the computer device is used to communicate with an external terminal via a network connection. The computer program, when executed by the processor, implements a reputation-based blockchain consensus method. Exemplarily, a computer program can be divided into one or more modules, and one or more modules are stored in a memory and executed by a processor to implement the present invention. One or more modules may be a series of computer program instruction segments capable of accomplishing specific functions, and the instruction segments are used to describe the execution process of the computer program in the computer device. The so-called processor can be a central processing unit (Central Processing Unit, CPU), and can also be other general-purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf Field-Programmable Gate Array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc., and the processor is the control center of the computer device, using various interfaces and lines to connect various parts of the entire computer device.

所述存储器可用于存储所述计算机程序和/或模块,所述处理器通过运行或执行存储在所述存储器内的计算机程序和/或模块,以及调用存储在存储器内的数据,实现所述计算机装置的各种功能。所述存储器可主要包括存储程序区和存储数据区,其中,存储程序区可存储操作系统、至少一个功能所需的应用程序(比如声音播放功能、图像播放功能等)等;存储数据区可存储根据手机的使用所创建的数据(比如音频数据、电话本等)等。此外,存储器可以包括高速随机存取存储器,还可以包括非易失性存储器,例如硬盘、内存、插接式硬盘,智能存储卡(Smart Media Card, SMC),安全数字(Secure Digital, SD)卡,闪存卡(Flash Card)、至少一个磁盘存储器件、闪存器件、或其他易失性固态存储器件。The memory can be used to store the computer programs and/or modules, and the processor realizes the computer by running or executing the computer programs and/or modules stored in the memory and calling the data stored in the memory Various functions of the device. The memory may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playback function, an image playback function, etc.) and the like; the storage data area may store Data created based on the use of the mobile phone (such as audio data, phonebook, etc.), etc. In addition, the memory can include high-speed random access memory, and can also include non-volatile memory, such as hard disk, internal memory, plug-in hard disk, smart memory card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card , a flash memory card (Flash Card), at least one magnetic disk storage device, flash memory device, or other volatile solid-state storage devices.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered to be within the range described in this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several implementation modes of the present application, and the description thereof is relatively specific and detailed, but it should not be construed as limiting the scope of the patent for the invention. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the scope of protection of the patent application should be based on the appended claims.

Claims (10)

1. A reputation-based blockchain consensus method, comprising:
counting historical consensus voting information of a node, and performing logistic regression calculation according to the historical consensus voting information and malicious voting penalty weight to obtain the current trust degree of the node;
performing weight balance on the last-round reputation value of the node and the current trust degree by using a reputation correction threshold value to determine a current-round reputation value;
and carrying out current round consensus according to the current round credit values of the nodes.
2. The method of claim 1, wherein the weighting the previous round of reputation values for the node and the current trust level using a reputation correction threshold to determine a current round of reputation values comprises:
calculating the difference between the current trust and the absolute value of the credit value of the previous round, and calculating the current round of accumulated deviation according to the difference between the absolute values and the accumulated deviation determined by the consensus of the previous round;
calculating a reputation correction threshold according to the difference between the absolute values and the current wheel accumulated deviation;
and carrying out weight balance on the previous-round reputation value and the current trust degree by utilizing a reputation correction threshold value, and determining the current-round reputation value.
3. The method according to claim 1 or 2, wherein the weighting of the previous round of reputation values of the node and the current trust level using a reputation correction threshold, before determining the current round of reputation values, further comprises:
judging whether the node has offline non-voting behaviors in the history consensus voting according to the history consensus voting information;
and when the offline non-voting behavior is determined to exist, the current trust level is reserved, and when the offline non-voting behavior is determined to not exist, the block generation time is utilized to conduct reputation consumption on the current trust level.
4. The method of claim 1, wherein the logistic regression calculation formula is as follows:
Figure QLYQS_1
wherein, repu (i) cur Is the current confidence level; n represents the current nth round consensus; mu is the cumulative number of consensus rounds participated by the node i;
Figure QLYQS_2
indicating whether the node i normally participates in voting in the x-th round of consensus, wherein the normal voting is 1, and the abnormal voting is 0;τ x indicating whether the node i maliciously votes in the x-th round of consensus, wherein the maliciously votes are 1, and the maliciously votes are 0;υrepresenting malicious voting penalty weights; e is the natural logarithm.
5. The method of claim 3, wherein the reputation consumption function is as follows:
Figure QLYQS_3
wherein,,
Figure QLYQS_4
=0 means node i was not voted offline in the x-th round of consensus; e is natural logarithm; Δb represents the block generation time.
6. The method according to claim 1 or 2, characterized in that the weight equalization is calculated as follows:
Figure QLYQS_5
wherein t represents the current t-th round consensus; repu (i) t A reputation value representing a t-th round consensus; repu (i) t-1 Representing the reputation value of the t-1 th round; gamma denotes a reputation correction threshold, and the initial value of gamma is 1.
7. The method of claim 2, wherein the reputation correction threshold is calculated as:
Figure QLYQS_6
wherein,,thersholdfor the set threshold value(s),thershold=0.25; c is a defined parameter, c=0.6;φ t the repu (i) represents the difference in absolute value of node i,ψ t the repu (i) represents the current wheel accumulated bias,ψ t-1 the repu (i) represents the accumulated bias of the previous consensus determination.
8. A reputation-based blockchain consensus apparatus, comprising:
the credit determining module is used for counting historical consensus voting information of the node, and carrying out logistic regression calculation according to the historical consensus voting information and malicious voting penalty weight to obtain the current trust degree of the node;
the reputation correction module is used for carrying out weight balance on the previous-round reputation value of the node and the current trust degree by utilizing a reputation correction threshold value to determine the current-round reputation value;
and the consensus module is used for carrying out current round consensus according to the current round credit value of each node.
9. A computer device comprising a processor and a memory, the memory storing a computer program, wherein the processor is configured to implement the blockchain consensus method of the reputation of any of claims 1-7 when executing the computer program.
10. A computer readable storage medium having stored thereon a computer program, which when executed by a processor implements the reputation blockchain consensus method according to any of claims 1-7.
CN202310050815.XA 2023-02-01 2023-02-01 Reputation-based block chain consensus method, device and computer equipment Pending CN116389040A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310050815.XA CN116389040A (en) 2023-02-01 2023-02-01 Reputation-based block chain consensus method, device and computer equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310050815.XA CN116389040A (en) 2023-02-01 2023-02-01 Reputation-based block chain consensus method, device and computer equipment

Publications (1)

Publication Number Publication Date
CN116389040A true CN116389040A (en) 2023-07-04

Family

ID=86979472

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310050815.XA Pending CN116389040A (en) 2023-02-01 2023-02-01 Reputation-based block chain consensus method, device and computer equipment

Country Status (1)

Country Link
CN (1) CN116389040A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116709341A (en) * 2023-07-31 2023-09-05 中国人民解放军军事科学院系统工程研究院 Practical Bayesian-busy fault-tolerant consensus algorithm optimization method and system for unmanned bee colony

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108492103A (en) * 2018-02-07 2018-09-04 北京大学深圳研究生院 A kind of alliance's block chain common recognition method
CN109493062A (en) * 2018-12-29 2019-03-19 中国科学院合肥物质科学研究院 A kind of block chain common recognition method proved based on prestige equity
CN109767199A (en) * 2018-12-10 2019-05-17 西安电子科技大学 Reputation-based PBFT consensus system and method, blockchain data processing system
KR20200083145A (en) * 2018-12-28 2020-07-08 연세대학교 산학협력단 Fault tolerance consensus method for eliminating interference factors in blockchain networks

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108492103A (en) * 2018-02-07 2018-09-04 北京大学深圳研究生院 A kind of alliance's block chain common recognition method
CN109767199A (en) * 2018-12-10 2019-05-17 西安电子科技大学 Reputation-based PBFT consensus system and method, blockchain data processing system
KR20200083145A (en) * 2018-12-28 2020-07-08 연세대학교 산학협력단 Fault tolerance consensus method for eliminating interference factors in blockchain networks
CN109493062A (en) * 2018-12-29 2019-03-19 中国科学院合肥物质科学研究院 A kind of block chain common recognition method proved based on prestige equity

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
丁孟: "区块链中高效健壮的双重共识机制研究", 中国优秀硕士学位论文全文数据库(信息科技辑), 15 July 2024 (2024-07-15) *
赖英旭等: "基于改进PBFT算法防御区块链中sybil攻击的研究", 通信学报, vol. 41, no. 9, 25 September 2020 (2020-09-25), pages 3 *
黄建华等: "基于动态授权的信任度证明机制", 软件学报, vol. 30, no. 9, 29 September 2019 (2019-09-29), pages 2 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116709341A (en) * 2023-07-31 2023-09-05 中国人民解放军军事科学院系统工程研究院 Practical Bayesian-busy fault-tolerant consensus algorithm optimization method and system for unmanned bee colony
CN116709341B (en) * 2023-07-31 2024-04-30 中国人民解放军军事科学院系统工程研究院 Practical Bayesian-busy fault-tolerant consensus algorithm optimization method and system for unmanned bee colony

Similar Documents

Publication Publication Date Title
US11133939B2 (en) Private blockchain transaction management and termination
EP3811316B1 (en) Blockchain system and method
US11734260B2 (en) Methods and apparatus for a distributed database within a network
EP3418915B1 (en) Methods and apparatus for a distributed database within a network
US9646029B1 (en) Methods and apparatus for a distributed database within a network
US20200322175A1 (en) Cross-Chain Messaging and Message Validation
EP3857850A1 (en) High throughput blockchain consensus systems and methods with low finalization time
CN110599177A (en) Transaction verification method and related equipment
US11275564B2 (en) Decentralized random number generator
CN111800274B (en) Verifiable calculation energy consumption optimization method based on block chain
CN113420323A (en) Data sharing method and terminal equipment
CN116389040A (en) Reputation-based block chain consensus method, device and computer equipment
US12166896B2 (en) Preventing an incorrect transmission of a copy of a record of data to a distributed ledger system
WO2020229922A1 (en) Systems and methods for non-parallelised mining on a proof-of-work blockchain network
CN115801336A (en) Block chain-based target node acquisition method and device, electronic equipment and medium
CN112511312A (en) Assembled consensus method and system
WO2024159804A1 (en) Blockchain-based key generation method and apparatus, electronic device, computer-readable storage medium, and computer program product
CN115834054B (en) A multi-level key series management method and device
CN116471041A (en) Blockchain consensus method, system, equipment and medium based on consortium chain
CN115879889A (en) Block chain-based business processing method, device and computer equipment
CN117332871A (en) Federal learning processing method based on blockchain and related equipment
CN113887745A (en) Joint learning method and device for heterogeneous data
CN116722966B (en) Efficient trusted chain data feeding method based on DAG predictor network
CN108616363B (en) A kind of accounting right confirmation method, device and computer storage medium
CN118798397A (en) Training methods and devices for efficient collaborative learning

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载