[go: up one dir, main page]

CN111404928A - A blockchain node consensus method suitable for real-time transaction scenarios - Google Patents

A blockchain node consensus method suitable for real-time transaction scenarios Download PDF

Info

Publication number
CN111404928A
CN111404928A CN202010175157.3A CN202010175157A CN111404928A CN 111404928 A CN111404928 A CN 111404928A CN 202010175157 A CN202010175157 A CN 202010175157A CN 111404928 A CN111404928 A CN 111404928A
Authority
CN
China
Prior art keywords
node
blockchain
nodes
primary
message
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.)
Granted
Application number
CN202010175157.3A
Other languages
Chinese (zh)
Other versions
CN111404928B (en
Inventor
武畅
杨洋
魏学麟
张康
金雪敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anshun Dixun Technology Co ltd
University of Electronic Science and Technology of China
Original Assignee
Anshun Dixun Technology Co ltd
University of Electronic Science and Technology of China
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anshun Dixun Technology Co ltd, University of Electronic Science and Technology of China filed Critical Anshun Dixun Technology Co ltd
Priority to CN202010175157.3A priority Critical patent/CN111404928B/en
Publication of CN111404928A publication Critical patent/CN111404928A/en
Application granted granted Critical
Publication of CN111404928B publication Critical patent/CN111404928B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/08Network architectures or network communication protocols for network security for authentication of entities
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Business, Economics & Management (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • Physics & Mathematics (AREA)
  • General Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer And Data Communications (AREA)

Abstract

本发明公开了一种适用于实时交易场景的区块链节点共识方法,通过分析和量化区块链中各节点设备在网络中的属性,设定了一套多元的且考虑权重的节点可信度量化方法,通过向量、矩阵方法得到量化数值,并依此选举Primary主节点,使得区块链Primary主节点发生故障的可能性降低,进而有效降低视图变更的频率且降低延迟,具有较高的稳定性和较大的交易吞吐量;通过在各节点相互通信响应的过程中设定了多个广播及应答机制,并在多个环节中保障正常节点均在区块链系统能够容忍的无效或者恶意节点数之上,其整体的安全性、实时性、稳定性均适用于金融等严苛场景。

Figure 202010175157

The invention discloses a block chain node consensus method suitable for real-time transaction scenarios. By analyzing and quantifying the attributes of each node device in the block chain in the network, a set of multi-level and weighted node trustworthiness is set The quantification method obtains the quantified value through the vector and matrix methods, and elects the primary master node accordingly, which reduces the possibility of failure of the primary master node of the blockchain, thereby effectively reducing the frequency of view changes and reducing the delay. Stability and large transaction throughput; by setting up multiple broadcast and response mechanisms in the process of each node communicating and responding to each other, and ensuring that normal nodes are ineffective or tolerated by the blockchain system in multiple links Above the number of malicious nodes, its overall security, real-time performance, and stability are suitable for severe scenarios such as finance.

Figure 202010175157

Description

一种适用于实时交易场景的区块链节点共识方法A blockchain node consensus method suitable for real-time transaction scenarios

技术领域technical field

本发明涉及区块链技术领域,具体涉及一种适用于实时交易场景的区块链节点共识方法。The invention relates to the technical field of blockchain, in particular to a blockchain node consensus method suitable for real-time transaction scenarios.

背景技术Background technique

区块链起源于比特币,其本质是一个分布式的去中心化数据库,可形象地比喻为共享账本,具有去中心化、不可篡改、全程留痕、可以追溯、集体维护以及公开透明的特点。区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。一般来说区块链系统由应用层、合约层、共识层、网络层和数据层组成。The blockchain originated from Bitcoin. Its essence is a distributed decentralized database, which can be vividly compared to a shared ledger. It has the characteristics of decentralization, non-tampering, full traces, traceability, collective maintenance, and openness and transparency. . Blockchain is a new application mode of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Generally speaking, the blockchain system consists of application layer, contract layer, consensus layer, network layer and data layer.

区块链共识层主要封装网络节点的各类共识算法,如何在分布式系统中高效地达成共识是分布式计算领域的重要研究问题。区块链技术的核心优势之一就是能够在决策权高度分散的去中心化系统中使得各节点高效地针对区块数据的有效性达成共识。早期的比特币区块链采用高度依赖节点算力的工作量证明(Proof of work,PoW)机制来保证比特币网络分布式记账的一致性。The blockchain consensus layer mainly encapsulates various consensus algorithms of network nodes. How to efficiently reach consensus in a distributed system is an important research problem in the field of distributed computing. One of the core advantages of blockchain technology is that it enables nodes to efficiently reach consensus on the validity of block data in a decentralized system with highly decentralized decision-making power. The early Bitcoin blockchain adopted a Proof of Work (PoW) mechanism that highly relied on the computing power of nodes to ensure the consistency of the distributed accounting of the Bitcoin network.

然而,PoW共识机制需要难题证明,不适用于金融等需要实时交易的场景;而传统的实用拜占庭容错算法(Practical Byzantine Fault Tolerance,PBFT)虽可作为PoW的替代方法,但仍存在不可忽视的问题:在选取主节点时是轮询进行选取,可能存在选取的节点不稳定、不诚实等情况,后续导致触发频繁的视图变更的问题。However, the PoW consensus mechanism requires difficult proofs and is not suitable for scenarios that require real-time transactions such as finance. Although the traditional Practical Byzantine Fault Tolerance (PBFT) algorithm can be used as an alternative to PoW, there are still problems that cannot be ignored. : When selecting the master node, it is selected by polling, and the selected node may be unstable or dishonest, which will lead to the problem of triggering frequent view changes.

发明内容SUMMARY OF THE INVENTION

针对现有技术中的上述不足,本发明提供的一种适用于实时交易场景的区块链节点共识方法解决了现有的包括传统PBFT算法在内的区块链节点共识机制不适用于金融等需要实时交易的场景的问题。In view of the above deficiencies in the prior art, a blockchain node consensus method suitable for real-time transaction scenarios provided by the present invention solves the problem that the existing blockchain node consensus mechanism including the traditional PBFT algorithm is not suitable for finance, etc. Questions for scenarios that require real-time transactions.

为了达到上述发明目的,本发明采用的技术方案为:一种适用于实时交易场景的区块链节点共识方法,包括以下步骤:In order to achieve the above purpose of the invention, the technical solution adopted in the present invention is: a blockchain node consensus method suitable for real-time transaction scenarios, comprising the following steps:

S1、选举Primary主节点;S1, elect the Primary master node;

S2、通过Client客户端向Primary主节点发起m请求,并通过Primary主节点接收m请求;S2. Initiate an m request to the Primary master node through the Client client, and receive the m request through the Primary master node;

S3、通过Primary主节点给m请求分配序号n,形成Pre-prepare消息,将Pre-prepare消息广播给区块链中的所有follower跟随者节点,并将Pre-prepare消息保存在Primary主节点的log日志中;S3. Assign the sequence number n to the request m through the Primary master node, form a Pre-prepare message, broadcast the Pre-prepare message to all follower nodes in the blockchain, and save the Pre-prepare message in the log of the Primary master node in the log;

S4、通过所有的follower跟随者节点校验Pre-prepare消息;S4. Verify the Pre-prepare message through all follower nodes;

S5、将校验后的Pre-prepare消息分别保存在所有follower跟随者节点的log日志中,并通过所有的follower跟随者节点分别广播Prepare消息;S5. Save the verified Pre-prepare messages in the log logs of all follower nodes, and broadcast the Prepare messages through all follower nodes;

S6、校验各节点接收的Prepare消息,并将通过校验的节点的工作状态调整为Prepared状态;S6. Verify the Prepare message received by each node, and adjust the working state of the node that has passed the verification to the Prepared state;

S7、通过达成Prepared状态的节点广播Commit消息,并验证Commit消息接收及执行情况,实现Client客户端交易确认。S7. By broadcasting the Commit message through the node that has reached the Prepared state, and verifying the reception and execution of the Commit message, the client client transaction confirmation is realized.

进一步地,所述步骤S1包括以下步骤:Further, the step S1 includes the following steps:

S11、根据区块链网络特征和金融数学特征,建立多元组模型,得到各节点的属性向量x={x1,x2,…xN},其中x1,x2,…xN为该节点的属性,N为属性总数,其值为不小于1的整数;S11. Establish a tuple model according to the characteristics of the blockchain network and financial mathematics, and obtain the attribute vector x={x 1 , x 2 , ... xN} of each node, where x 1 , x 2 , ... x N is the node attribute, N is the total number of attributes, and its value is an integer not less than 1;

S12、通过隶属度评价算法对各节点的属性向量x={x1,x2,…,xN}中各属性进行可信程度量化,得到各节点的可信程度矩阵R;S12, quantify the reliability of each attribute in the attribute vector x = {x 1 , x 2 , .

S13、根据区块链节点各属性的重要程度,建立各节点的属性权重向量w={w1,w2,…,wN};S13. According to the importance of each attribute of the blockchain node, establish the attribute weight vector w={w 1 , w 2 , . . . , w N } of each node;

S14、根据各节点的可信程度矩阵R和属性权重向量w,计算各节点的可信度向量v;S14, according to the credibility matrix R of each node and the attribute weight vector w, calculate the credibility vector v of each node;

S15、根据各节点的可信度向量v,将区块链各节点划分为可信节点,一般节点和不可信节点,并将可信节点加入Primary主节点备选集合;S15. According to the credibility vector v of each node, each node of the blockchain is divided into trusted nodes, general nodes and untrusted nodes, and the trusted nodes are added to the primary master node candidate set;

S16、将区块链每达成M个共识作为一个周期,在一个周期内,切换视图更换Primary主节点在Primary主节点备选集合中轮询选取Primary主节点。S16. Take each M consensus of the blockchain as a cycle, within a cycle, switch the view to replace the primary master node, and poll the primary master node candidate set to select the primary master node.

进一步地,所述步骤S12中各节点的可信度矩阵

Figure BDA0002410570280000031
为N×3矩阵,其第i行元素中:ri1表示该节点属性向量x={x1,x2,…,xN}中xi属性的可信隶属度;ri2表示该节点属性向量x={x1,x2,…,xN}中xi属性的一般可信隶属度;ri3表示该节点属性向量x={x1,x2,…,xN}中xi属性的不可信隶属度,i∈[1,N]。Further, the reliability matrix of each node in the step S12
Figure BDA0002410570280000031
is an N×3 matrix, in the i-th row element: r i1 represents the credible membership degree of the x i attribute in the node attribute vector x={x 1 , x 2 ,..., x N }; r i2 represents the node attribute Vector x={x 1 , x 2 ,...,x N } The general credible membership degree of x i attribute; r i3 represents x i in the node attribute vector x={x 1 , x 2 ,..., x N } The untrusted membership of the attribute, i ∈ [1, N].

进一步地,所述步骤S14的计算表达式为:Further, the calculation expression of the step S14 is:

Figure BDA0002410570280000032
Figure BDA0002410570280000032

其中,v1为该节点的可信隶属度,v2为该节点的一般可信隶属度,v3为该节点的不可信隶属度。Among them, v 1 is the credible membership degree of the node, v 2 is the general credible membership degree of the node, and v 3 is the unreliable membership degree of the node.

进一步地,所述步骤S4包括:对Pre-prepare消息进行签名验证;验证Pre-prepare消息是否是当前follower跟随者节点所在view视图的消息;验证当前follower跟随者节点在当前view视图下是否收到序号n以外的消息;验证Pre-prepare消息是否在当前接收窗口内。Further, the step S4 includes: performing signature verification on the Pre-prepare message; verifying whether the Pre-prepare message is a message of the view where the current follower node is located; verifying whether the current follower node receives the current view in the current view. Messages other than sequence number n; verify that the Pre-prepare message is within the current receive window.

进一步地,所述步骤S6包括:验证当前节点的log日志中是否存在Pre-prepare消息;验证当前节点是否接收到2f个来自其它节点Prepare消息,其中f为区块链系统能够容忍的无效或者恶意节点数。Further, the step S6 includes: verifying whether there is a Pre-prepare message in the log log of the current node; verifying whether the current node has received 2f Prepare messages from other nodes, where f is invalid or malicious that the blockchain system can tolerate number of nodes.

进一步地,所述步骤S7包括以下步骤:Further, the step S7 includes the following steps:

S71、通过达成Prepared状态的节点广播Commit消息;S71. Broadcast the Commit message through the nodes that have reached the Prepared state;

S72、通过已接收到2+1个节点发出的Commit消息且自身已广播Commit消息的节点,执行Commit消息,并向Client客户端发出反馈;S72, through the node that has received the Commit message sent by the 2+1 nodes and has broadcast the Commit message itself, executes the Commit message, and sends feedback to the Client;

S73、判断Client客户端在有效时间内接收到的反馈数目是否大于f,若是,则结束,若否,则跳转至步骤S74;S73, determine whether the number of feedbacks received by the Client client within the valid time is greater than f, if so, end, if not, jump to step S74;

S74、通过Client客户端向所有的节点广播m请求;S74, broadcast the m request to all nodes through the Client client;

S75、通过接收到m请求的非Primary节点向Primary主节点转发Client客户端的m请求,所述非Primary节点为区块链中除Primary主节点之外的节点;S75, forward the m request of the Client client to the Primary master node by the non-Primary node receiving the m request, where the non-Primary node is a node other than the Primary master node in the blockchain;

S76、判断已向Primary主节点转发m请求的非Primary节点是否在有效时间内收到Primary主节点的回应,若是,则跳转至步骤S3,若否,则跳转至步骤S77;S76, determine whether the non-Primary node that has forwarded the m request to the Primary main node has received the response of the Primary main node within the valid time, if so, jump to step S3, if not, then jump to step S77;

S77、在Primary主节点备选集合中主节点轮询选取下一个节点作为Primary主节点,并切换view视图,Client客户端在当前视图下重传请求m。S77 , in the primary primary node candidate set, the primary node polls and selects the next node as the primary primary node, and switches the view view, and the client retransmits the request m in the current view.

本发明的有益效果为:通过分析和量化区块链中各节点设备在网络中的属性,设定了一套多元的且考虑权重的节点可信度量化方法,通过向量、矩阵方法得到量化数值,并依此选举Primary主节点,使得区块链Primary主节点发生故障的可能性降低,进而有效降低视图变更的频率且降低延迟,具有较高的稳定性和较大的交易吞吐量;通过在各节点相互通信响应的过程中设定了多个广播及应答机制,并在多个环节中保障正常节点均在区块链系统能够容忍的无效或者恶意节点数之上,其整体的安全性、实时性、稳定性均适用于金融等严苛场景。The beneficial effects of the present invention are as follows: by analyzing and quantifying the attributes of each node device in the blockchain in the network, a set of multivariate and weight-considering node credibility quantification methods are set, and the quantified values are obtained through vector and matrix methods. , and elect the primary master node accordingly, which reduces the possibility of failure of the primary master node of the blockchain, thereby effectively reducing the frequency of view changes and reducing the delay, with higher stability and greater transaction throughput; In the process of mutual communication and response of each node, multiple broadcast and response mechanisms are set, and in multiple links, it is ensured that normal nodes are above the number of invalid or malicious nodes that the blockchain system can tolerate, and its overall security, Real-time performance and stability are suitable for severe scenarios such as finance.

附图说明Description of drawings

图1为一种适用于实时交易场景的区块链节点共识方法流程示意图。FIG. 1 is a schematic flowchart of a blockchain node consensus method suitable for real-time transaction scenarios.

具体实施方式Detailed ways

下面对本发明的具体实施方式进行描述,以便于本技术领域的技术人员理解本发明,但应该清楚,本发明不限于具体实施方式的范围,对本技术领域的普通技术人员来讲,只要各种变化在所附的权利要求限定和确定的本发明的精神和范围内,这些变化是显而易见的,一切利用本发明构思的发明创造均在保护之列。The specific embodiments of the present invention are described below to facilitate those skilled in the art to understand the present invention, but it should be clear that the present invention is not limited to the scope of the specific embodiments. For those of ordinary skill in the art, as long as various changes Such changes are obvious within the spirit and scope of the present invention as defined and determined by the appended claims, and all inventions and creations utilizing the inventive concept are within the scope of protection.

如图1所示,在本发明的一个实施例中,一种适用于实时交易场景的区块链节点共识方法,包括以下步骤:As shown in Figure 1, in one embodiment of the present invention, a blockchain node consensus method suitable for a real-time transaction scenario includes the following steps:

S1、选举Primary主节点。其具体步骤包括:S1. Elect the primary master node. The specific steps include:

S11、根据区块链网络特征和金融数学特征,建立多元组模型,得到各节点的属性向量x={x1,x2,…xN},其中x1,x2,…xN为该节点的属性,N为属性总数,其值为不小于1的整数。S11. Establish a tuple model according to the characteristics of the blockchain network and financial mathematics, and obtain the attribute vector x={x 1 , x 2 , ... x N } of each node, where x 1 , x 2 , ... x N is the The attributes of the node, N is the total number of attributes, and its value is an integer not less than 1.

本实施例的区块链系统共有7个节点,根据其所在的网络属性和应用环境,建立的模型中的节点属性向量包括3个属性:有效带宽、该节点连接的可靠节点数量和该节点完成的交易情况。The blockchain system of this embodiment has a total of 7 nodes. According to the network attributes and application environment where they are located, the node attribute vector in the established model includes 3 attributes: effective bandwidth, the number of reliable nodes connected to the node, and the completion of the node. transaction situation.

S12、通过隶属度评价算法对各节点的属性向量x={x1,x2,…,xN}中各属性进行可信程度量化,得到各节点的可信程度矩阵R。各节点的可信度矩阵

Figure BDA0002410570280000051
为N×3矩阵,其第i行元素中:ri1表示该节点属性向量x={x1,x2,…,xN}中xi属性的可信隶属度;ri2表示该节点属性向量x={x1,x2,…,xN}中xi属性的一般可信隶属度;ri3表示该节点属性向量x={x1,x2,…,xN}中xi属性的不可信隶属度,i∈[1,N]。S12 , quantify the reliability of each attribute in the attribute vector x = {x 1 , x 2 , . The reliability matrix of each node
Figure BDA0002410570280000051
is an N×3 matrix, in the i-th row element: r i1 represents the credible membership degree of the x i attribute in the node attribute vector x={x 1 , x 2 ,..., x N }; r i2 represents the node attribute Vector x={x 1 , x 2 ,...,x N } The general credible membership degree of x i attribute; r i3 represents x i in the node attribute vector x={x 1 , x 2 ,..., x N } The untrusted membership of the attribute, i ∈ [1, N].

S13、根据区块链节点各属性的重要程度,建立各节点的属性权重向量w={w1,w2,…,wN}。S13. According to the importance of each attribute of the blockchain node, establish the attribute weight vector w={w 1 , w 2 , . . . , w N } of each node.

S14、根据各节点的可信程度矩阵R和属性权重向量w,计算各节点的可信度向量v。计算表达式为:S14: Calculate the credibility vector v of each node according to the credibility matrix R and the attribute weight vector w of each node. The calculation expression is:

Figure BDA0002410570280000061
Figure BDA0002410570280000061

其中,v1为该节点的可信隶属度,v2为该节点的一般可信隶属度,v3为该节点的不可信隶属度。Among them, v 1 is the credible membership degree of the node, v 2 is the general credible membership degree of the node, and v 3 is the unreliable membership degree of the node.

经过计算之后,得到本实施例的7个节点的可信度向量分别为:After the calculation, the credibility vectors of the seven nodes in this embodiment are obtained as:

节点1:(1,0,0);node 1: (1, 0, 0);

节点2:(0.4211,0.4566,0.1223);Node 2: (0.4211, 0.4566, 0.1223);

节点3:(0.1835,0.5000,0.3165);Node 3: (0.1835, 0.5000, 0.3165);

节点4:(0.2770,0.4566,0.2664);node4: (0.2770, 0.4566, 0.2664);

节点5:(0.4812,0.4130,0.1057);Node 5: (0.4812, 0.4130, 0.1057);

节点6:(0.1686,0.3856,0.4559);Node 6: (0.1686, 0.3856, 0.4559);

节点7:(0.0949,0.1771,0.7280)。Node 7: (0.0949, 0.1771, 0.7280).

S15、根据各节点的可信度向量v,将区块链各节点划分为可信节点、一般节点和不可信节点,并将可信节点加入Primary主节点备选集合。7个节点的信任情况分别为:S15. According to the credibility vector v of each node, each node of the blockchain is divided into a trusted node, a general node and an untrusted node, and the trusted node is added to the primary master node candidate set. The trust conditions of the 7 nodes are:

可信节点(节点1,节点5);Trusted nodes (node 1, node 5);

一般可信节点(节点2,节点3,节点4);General trusted nodes (node 2, node 3, node 4);

不可信节点(节点6,节点7)。Untrusted nodes (node 6, node 7).

S16、将区块链每达成M个共识作为一个周期,在一个周期内,切换视图更换Primary主节点在Primary主节点备选集合中轮询选取Primary主节点。S16. Take each M consensus of the blockchain as a cycle, within a cycle, switch the view to replace the primary master node, and poll the primary master node candidate set to select the primary master node.

选择节点1和节点5作为Primary主节点备选节点集合,从该集合中轮询选取Primary主节点。Select node 1 and node 5 as the primary primary node candidate node set, and poll the primary primary node from the set.

S2、通过Client客户端向Primary主节点发起m请求,并通过Primary主节点接收m请求。S2, initiate an m request to the Primary master node through the Client client, and receive the m request through the Primary master node.

S3、通过Primary主节点给m请求分配序号n,形成Pre-prepare消息,将Pre-prepare消息广播给区块链中的所有follower跟随者节点,并将Pre-prepare消息保存在Primary主节点的log日志中。S3. Assign the sequence number n to the request m through the Primary master node, form a Pre-prepare message, broadcast the Pre-prepare message to all follower nodes in the blockchain, and save the Pre-prepare message in the log of the Primary master node in the log.

S4、通过所有的follower跟随者节点校验Pre-prepare消息。验证内容包括:对Pre-prepare消息进行签名验证;验证Pre-prepare消息是否是当前follower跟随者节点所在view视图的消息;验证当前follower跟随者节点在当前view视图下是否收到序号n以外的消息;验证Pre-prepare消息是否在当前接收窗口内。S4. Verify the Pre-prepare message through all follower nodes. The verification content includes: verifying the signature of the Pre-prepare message; verifying whether the Pre-prepare message is a message in the view view of the current follower node; verifying whether the current follower node receives a message other than sequence number n in the current view view ; Verify that the Pre-prepare message is within the current receive window.

S5、将校验后的Pre-prepare消息分别保存在所有follower跟随者节点的log日志中,并通过所有的follower跟随者节点分别广播Prepare消息。S5. Save the verified Pre-prepare messages in the log logs of all follower nodes respectively, and broadcast the Prepare messages through all follower nodes respectively.

S6、校验各节点接收的Prepare消息,并将通过校验的节点的工作状态调整为Prepared状态,校验内容包括:验证当前节点的log日志中是否存在Pre-prepare消息;验证当前节点是否接收到2个来自其它节点Prepare消息,其中f为区块链系统能够容忍的无效或者恶意节点数。S6. Verify the Prepare message received by each node, and adjust the working state of the node that has passed the verification to the Prepared state. The verification content includes: verifying whether there is a Pre-prepare message in the log log of the current node; verifying whether the current node receives the message. To 2 Prepare messages from other nodes, where f is the number of invalid or malicious nodes that the blockchain system can tolerate.

S7、通过达成Prepared状态的节点广播Commit消息,并验证Commit消息接收及执行情况,实现Client客户端交易确认。具体包括以下步骤:S7. By broadcasting the Commit message through the node that has reached the Prepared state, and verifying the reception and execution of the Commit message, the client client transaction confirmation is realized. Specifically include the following steps:

S71、通过达成Prepared状态的节点广播Commit消息;S71. Broadcast the Commit message through the nodes that have reached the Prepared state;

S72、通过已接收到2+1个节点发出的Commit消息且自身已广播Commit消息的节点,执行Commit消息,并向Client客户端发出反馈;S72, through the node that has received the Commit message sent by the 2+1 nodes and has broadcast the Commit message itself, executes the Commit message, and sends feedback to the Client;

S73、判断Client客户端在有效时间内接收到的反馈数目是否大于f,若是,则结束,若否,则跳转至步骤S74;S73, determine whether the number of feedbacks received by the Client client within the valid time is greater than f, if so, end, if not, jump to step S74;

S74、通过Client客户端向所有的节点广播m请求;S74, broadcast the m request to all nodes through the Client client;

S75、通过接收到m请求的非Primary节点向Primary主节点转发Client客户端的m请求,所述非Primary节点为区块链中除Primary主节点之外的节点;S75, forward the m request of the Client client to the Primary master node by the non-Primary node receiving the m request, where the non-Primary node is a node other than the Primary master node in the blockchain;

S76、判断已向Primary主节点转发m请求的非Primary节点是否在有效时间内收到Primary主节点的回应,若是,则跳转至步骤S3,若否,则跳转至步骤S77;S76, determine whether the non-Primary node that has forwarded the m request to the Primary main node has received the response of the Primary main node within the valid time, if so, jump to step S3, if not, then jump to step S77;

S77、在Primary主节点备选集合中主节点轮询选取下一个节点作为Primary主节点,并切换view视图,Client客户端在当前视图下重传请求m。S77 , in the primary primary node candidate set, the primary node polls and selects the next node as the primary primary node, and switches the view view, and the client retransmits the request m in the current view.

本发明通过分析和量化区块链中各节点设备在网络中的属性,设定了一套多元的且考虑权重的节点可信度量化方法,通过向量、矩阵方法得到量化数值,并依此选举Primary主节点,使得区块链Primary主节点发生故障的可能性降低,进而有效降低视图变更的频率且降低延迟,具有较高的稳定性和较大的交易吞吐量;通过在各节点相互通信响应的过程中设定了多个广播及应答机制,并在多个环节中保障正常节点均在区块链系统能够容忍的无效或者恶意节点数之上,其整体的安全性、实时性、稳定性均适用于金融等严苛场景。By analyzing and quantifying the attributes of each node device in the blockchain in the network, the present invention sets a set of multi-dimensional and weight-considering node credibility quantification methods, obtains quantified values through vector and matrix methods, and selects them accordingly. The primary master node reduces the possibility of failure of the primary master node of the blockchain, thereby effectively reducing the frequency of view changes and reducing the delay, with high stability and large transaction throughput; responds by communicating with each other at each node Several broadcast and response mechanisms are set up in the process, and in multiple links, normal nodes are guaranteed to be above the number of invalid or malicious nodes that the blockchain system can tolerate, and its overall security, real-time, and stability. Both are suitable for severe scenarios such as finance.

Claims (7)

1.一种适用于实时交易场景的区块链节点共识方法,其特征在于,包括以下步骤:1. A blockchain node consensus method applicable to real-time transaction scenarios, characterized in that, comprising the following steps: S1、选举Primary主节点;S1, elect the Primary master node; S2、通过Client客户端向Primary主节点发起m请求,并通过Primary主节点接收m请求;S2. Initiate an m request to the Primary master node through the Client client, and receive the m request through the Primary master node; S3、通过Primary主节点给m请求分配序号n,形成Pre-prepare消息,将Pre-prepare消息广播给区块链中的所有follower跟随者节点,并将Pre-prepare消息保存在Primary主节点的log日志中;S3. Assign the sequence number n to the request m through the Primary master node, form a Pre-prepare message, broadcast the Pre-prepare message to all follower nodes in the blockchain, and save the Pre-prepare message in the log of the Primary master node in the log; S4、通过所有的follower跟随者节点校验Pre-prepare消息;S4. Verify the Pre-prepare message through all follower nodes; S5、将校验后的Pre-prepare消息分别保存在所有follower跟随者节点的log日志中,并通过所有的follower跟随者节点分别广播Prepare消息;S5. Save the verified Pre-prepare messages in the log logs of all follower nodes, and broadcast the Prepare messages through all follower nodes; S6、校验各节点接收的Prepare消息,并将通过校验的节点的工作状态调整为Prepared状态;S6. Verify the Prepare message received by each node, and adjust the working state of the node that has passed the verification to the Prepared state; S7、通过达成Prepared状态的节点广播Commit消息,并验证Commit消息接收及执行情况,实现Client客户端交易确认。S7. By broadcasting the Commit message through the node that has reached the Prepared state, and verifying the reception and execution of the Commit message, the client client transaction confirmation is realized. 2.根据权利要求1所述的适用于实时交易场景的区块链节点共识方法,其特征在于,所述步骤S1包括以下步骤:2. The blockchain node consensus method suitable for a real-time transaction scenario according to claim 1, wherein the step S1 comprises the following steps: S11、根据区块链网络特征和金融数学特征,建立多元组模型,得到各节点的属性向量x={x1,x2,…xN},其中x1,x2,…xN为该节点的属性,N为属性总数,其值为不小于1的整数;S11. Establish a tuple model according to the characteristics of the blockchain network and financial mathematics, and obtain the attribute vector x={x 1 , x 2 , ... x N } of each node, where x 1 , x 2 , ... x N is the The attributes of the node, N is the total number of attributes, and its value is an integer not less than 1; S12、通过隶属度评价算法对各节点的属性向量x={x1,x2,…,xN}中各属性进行可信程度量化,得到各节点的可信程度矩阵R;S12, quantify the reliability of each attribute in the attribute vector x = {x 1 , x 2 , . S13、根据区块链节点各属性的重要程度,建立各节点的属性权重向量w={w1,w2,…,wN};S13. According to the importance of each attribute of the blockchain node, establish the attribute weight vector w={w 1 , w 2 , . . . , w N } of each node; S14、根据各节点的可信程度矩阵R和属性权重向量w,计算各节点的可信度向量v;S14, according to the credibility matrix R of each node and the attribute weight vector w, calculate the credibility vector v of each node; S15、根据各节点的可信度向量v,将区块链各节点划分为可信节点、一般节点和不可信节点,并将可信节点加入Primary主节点备选集合;S15. According to the credibility vector v of each node, each node of the blockchain is divided into trusted nodes, general nodes and untrusted nodes, and the trusted nodes are added to the primary master node candidate set; S16、将区块链每达成M个共识作为一个周期,在一个周期内,切换视图更换Primary主节点在Primary主节点备选集合中轮询选取Primary主节点。S16. Take each M consensus of the blockchain as a cycle, within a cycle, switch the view to replace the primary master node, and poll the primary master node candidate set to select the primary master node. 3.根据权利要求2所述的适用于实时交易场景的区块链节点共识方法,其特征在于,所述步骤S12中各节点的可信度矩阵
Figure FDA0002410570270000021
为N×3矩阵,其第i行元素中:ri1表示该节点属性向量x={x1,x2,…,xN}中xi属性的可信隶属度;ri2表示该节点属性向量x={x1,x2,…,xN}中xi属性的一般可信隶属度;ri3表示该节点属性向量x={x1,x2,…,xN}中xi属性的不可信隶属度,i∈[1,N]。
3. The blockchain node consensus method suitable for real-time transaction scenarios according to claim 2, wherein the reliability matrix of each node in the step S12
Figure FDA0002410570270000021
is an N×3 matrix, in the i-th row element: r i1 represents the credible membership degree of the x i attribute in the node attribute vector x={x 1 , x 2 ,..., x N }; r i2 represents the node attribute Vector x={x 1 , x 2 ,...,x N } The general credible membership degree of x i attribute; r i3 represents x i in the node attribute vector x={x 1 , x 2 ,..., x N } The untrusted membership of the attribute, i ∈ [1, N].
4.根据权利要求2所述的适用于实时交易场景的区块链节点共识方法,其特征在于,所述步骤S14的计算表达式为:4. The blockchain node consensus method suitable for a real-time transaction scenario according to claim 2, wherein the calculation expression of the step S14 is:
Figure FDA0002410570270000022
Figure FDA0002410570270000022
其中,v1为该节点的可信隶属度,v2为该节点的一般可信隶属度,v3为该节点的不可信隶属度。Among them, v 1 is the credible membership degree of the node, v 2 is the general credible membership degree of the node, and v 3 is the unreliable membership degree of the node.
5.根据权利要求1所述的适用于实时交易场景的区块链节点共识方法,其特征在于,所述步骤S4包括:对Pre-prepare消息进行签名验证;验证Pre-prepare消息是否是当前follower跟随者节点所在view视图的消息;验证当前follower跟随者节点在当前view视图下是否收到序号n以外的消息;验证Pre-prepare消息是否在当前接收窗口内。5. The blockchain node consensus method applicable to a real-time transaction scenario according to claim 1, wherein the step S4 comprises: performing signature verification on the Pre-prepare message; verifying whether the Pre-prepare message is the current follower The message of the view view where the follower node is located; verify whether the current follower node receives a message other than sequence number n in the current view view; verify whether the Pre-prepare message is in the current receiving window. 6.根据权利要求5所述的适用于实时交易场景的区块链节点共识方法,其特征在于,所述步骤S6中的校验操作包括:验证当前节点的log日志中是否存在Pre-prepare消息;验证当前节点是否接收到2f个来自其它节点Prepare消息,其中f为区块链系统能够容忍的无效或者恶意节点数。6. The blockchain node consensus method suitable for a real-time transaction scenario according to claim 5, wherein the verification operation in step S6 comprises: verifying whether there is a Pre-prepare message in the log log of the current node ; Verify whether the current node has received 2f Prepare messages from other nodes, where f is the number of invalid or malicious nodes that the blockchain system can tolerate. 7.根据权利要求6所述的适用于实时交易场景的区块链节点共识方法,其特征在于,所述步骤S7包括以下步骤:7. The blockchain node consensus method suitable for a real-time transaction scenario according to claim 6, wherein the step S7 comprises the following steps: S71、通过达成Prepared状态的节点广播Commit消息;S71. Broadcast the Commit message through the nodes that have reached the Prepared state; S72、通过已接收到2f+1个节点发出的Commit消息且自身已广播Commit消息的节点,执行Commit消息,并向Client客户端发出反馈;S72, through the node that has received the Commit message sent by the 2f+1 nodes and has broadcast the Commit message itself, executes the Commit message, and sends feedback to the Client; S73、判断Client客户端在有效时间内接收到的反馈数目是否大于f,若是,则结束,若否,则跳转至步骤S74;S73, determine whether the number of feedbacks received by the Client client within the valid time is greater than f, if so, end, if not, jump to step S74; S74、通过Client客户端向所有的节点广播m请求;S74, broadcast the m request to all nodes through the Client client; S75、通过接收到m请求的非Primary节点向Primary主节点转发Client客户端的m请求,所述非Primary节点为区块链中除Primary主节点之外的节点;S75, forward the m request of the Client client to the Primary master node by the non-Primary node that receives the m request, where the non-Primary node is a node other than the Primary master node in the blockchain; S76、判断已向Primary主节点转发m请求的非Primary节点是否在有效时间内收到Primary主节点的回应,若是,则跳转至步骤S3,若否,则跳转至步骤S77;S76, determine whether the non-Primary node that has forwarded the m request to the Primary master node has received the response of the Primary master node within the valid time, if so, jump to step S3, if not, jump to step S77; S77、在Primary主节点备选集合中主节点轮询选取下一个节点作为Primary主节点,并切换view视图,Client客户端在当前视图下重传请求m。S77 , in the primary primary node candidate set, the primary node polls and selects the next node as the primary primary node, and switches the view view, and the client retransmits the request m in the current view.
CN202010175157.3A 2020-03-13 2020-03-13 A blockchain node consensus method suitable for real-time transaction scenarios Active CN111404928B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010175157.3A CN111404928B (en) 2020-03-13 2020-03-13 A blockchain node consensus method suitable for real-time transaction scenarios

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010175157.3A CN111404928B (en) 2020-03-13 2020-03-13 A blockchain node consensus method suitable for real-time transaction scenarios

Publications (2)

Publication Number Publication Date
CN111404928A true CN111404928A (en) 2020-07-10
CN111404928B CN111404928B (en) 2021-07-06

Family

ID=71430860

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010175157.3A Active CN111404928B (en) 2020-03-13 2020-03-13 A blockchain node consensus method suitable for real-time transaction scenarios

Country Status (1)

Country Link
CN (1) CN111404928B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119449259A (en) * 2023-07-28 2025-02-14 中国科学院计算技术研究所 Blockchain system transaction processing method and device

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107103098A (en) * 2017-05-12 2017-08-29 曾建伟 A blockchain network database including smart contracts and its working method
US20180219893A1 (en) * 2017-01-27 2018-08-02 International Business Machines Corporation Secured event monitoring leveraging blockchain
CN109819022A (en) * 2019-01-11 2019-05-28 华侨大学 A blockchain consensus method based on credit evaluation
CN110460536A (en) * 2019-08-26 2019-11-15 中国工商银行股份有限公司 For the data processing method and device of block chain, medium and electronic equipment
CN110727731A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method for adding node in block chain network and block chain system
CN110730204A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method and blockchain system for deleting nodes in blockchain network
CN110796547A (en) * 2019-10-30 2020-02-14 桂林电子科技大学 Improved practical Byzantine fault-tolerant system based on alliance block chain

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180219893A1 (en) * 2017-01-27 2018-08-02 International Business Machines Corporation Secured event monitoring leveraging blockchain
CN107103098A (en) * 2017-05-12 2017-08-29 曾建伟 A blockchain network database including smart contracts and its working method
CN109819022A (en) * 2019-01-11 2019-05-28 华侨大学 A blockchain consensus method based on credit evaluation
CN110460536A (en) * 2019-08-26 2019-11-15 中国工商银行股份有限公司 For the data processing method and device of block chain, medium and electronic equipment
CN110727731A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method for adding node in block chain network and block chain system
CN110730204A (en) * 2019-09-05 2020-01-24 阿里巴巴集团控股有限公司 Method and blockchain system for deleting nodes in blockchain network
CN110796547A (en) * 2019-10-30 2020-02-14 桂林电子科技大学 Improved practical Byzantine fault-tolerant system based on alliance block chain

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
QIUYUN LYU,ET.AL: "《SBAC: A secure blockchain-based access control framework for information-centric networking》", 《JOURNAL OF NETWORK AND COMPUTER APPLICATIONS》 *
WEI TONG,ET.AL: "《Trust-PBFT: a PeerTrust-based Practical Byzantine Consensus Algorithm》", 《2019 INTERNATIONAL CONFERENCE ON NETWORKING AND NETWORK APPLICATIONS (NANA)》 *
贺新征等: "《基于SBAC共享拜占庭自动提交协议的研究》", 《河南广播电视大学学报》 *
陈玎乐: "《区块链共识算法的比较研究》", 《计算机电子与软件》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN119449259A (en) * 2023-07-28 2025-02-14 中国科学院计算技术研究所 Blockchain system transaction processing method and device

Also Published As

Publication number Publication date
CN111404928B (en) 2021-07-06

Similar Documents

Publication Publication Date Title
CN112261155A (en) Internet of things access control method with dynamic consensus based on block chains of alliances
CN107493334A (en) A kind of cloud and mist calculating network framework and the method for strengthening cloud and mist network architecture reliability
Xiao et al. CE-PBFT: A high availability consensus algorithm for large-scale consortium blockchain
Zhang et al. Qpbft: Practical byzantine fault tolerance consensus algorithm based on quantified-role
CN115378788A (en) Block chain performance self-adaptive optimization method based on hierarchical consensus and reinforcement learning
Tang et al. TP-PBFT: A scalable PBFT based on threshold proxy signature for IoT-blockchain applications
Wu et al. A solution to data accessibility across heterogeneous blockchains
CN115293256B (en) A blockchain-assisted federated learning wireless network model
CN115022022A (en) Method for improving Raft consensus mechanism based on node past behavior analysis
CN116962426A (en) Block chain consensus mechanism performance optimization method based on CPE-BFT algorithm
Chen et al. Anomaly detection on dynamic bipartite graph with burstiness
CN114978650A (en) Improved practical Byzantine fault-tolerant algorithm based on credit value and verifiable random function
CN108462737B (en) Batch processing and pipeline-based hierarchical data consistency protocol optimization method
CN111404928A (en) A blockchain node consensus method suitable for real-time transaction scenarios
Zheng et al. Adaptive clustering hierarchical pbft algorithm for secure and efficient blockchain-based iot edge computing
Bai et al. A two-layer-consensus based blockchain architecture for IoT
CN116366673A (en) A data analysis and sharing method for power grid information computer room management
WO2018032817A1 (en) Method for accumulating and co-assembling uniform data
CN115580538A (en) A Method for Optimizing Hierarchical Blockchain Network Structure Based on Algebraic Connectivity
CN115987858A (en) Stress testing method and related equipment for block chain network
CN116546499B (en) A mobile terminal identity authentication method based on lightweight Byzantine fault tolerance
CN111510983A (en) Wireless sensor network cluster head election method combining trust
Huang et al. LWSBFT: Leaderless weakly synchronous BFT protocol
CN115276999A (en) An efficient fault-tolerant consensus method for adaptive switching based on trust model
Alaslani et al. Synopsis: A scalable byzantine distributed ledger for IoT networks

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant