TW202145116A - Consensus method, device and equipment of blockchain system and medium - Google Patents

Consensus method, device and equipment of blockchain system and medium Download PDF

Info

Publication number
TW202145116A
TW202145116A TW110117064A TW110117064A TW202145116A TW 202145116 A TW202145116 A TW 202145116A TW 110117064 A TW110117064 A TW 110117064A TW 110117064 A TW110117064 A TW 110117064A TW 202145116 A TW202145116 A TW 202145116A
Authority
TW
Taiwan
Prior art keywords
cluster
consensus
target
node
information
Prior art date
Application number
TW110117064A
Other languages
Chinese (zh)
Other versions
TWI790611B (en
Inventor
黄彦
周钰
胡慶林
劉為懷
朱濤
胡景秀
劉蘇林
許玉壯
王賀賀
Original Assignee
大陸商中國銀聯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 大陸商中國銀聯股份有限公司 filed Critical 大陸商中國銀聯股份有限公司
Publication of TW202145116A publication Critical patent/TW202145116A/en
Application granted granted Critical
Publication of TWI790611B publication Critical patent/TWI790611B/en

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
    • H04L63/0823Network architectures or network communication protocols for network security for authentication of entities using certificates
    • 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)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Supplying Of Containers To The Packaging Station (AREA)
  • Adornments (AREA)
  • Meat, Egg Or Seafood Products (AREA)

Abstract

The invention discloses a consensus method, device and equipment of a blockchain system, and a medium. The consensus method of the blockchain system comprises the following steps: receiving a consensus cluster routing request sent by a target peer node; analyzing the consensus cluster routing request to obtain routing request information, wherein the routing request information comprises a node position of the target peer node; determining the target consensus cluster in the at least one available consensus cluster according to the node position, wherein the available consensus cluster is a consensus cluster in a normal working state in the blockchain system; and sending the target cluster address of the target consensus cluster to the target peer node. According to the embodiment of the invention, the problem that a conventional consensus mechanism is not enough to meet the requirement of the blockchain system on high throughput can be solved.

Description

區塊鏈系統的共識方法、裝置、設備及介質 Consensus method, device, equipment and medium for blockchain system

本發明屬於區塊鏈技術領域,尤其涉及一種區塊鏈系統的共識方法、裝置、設備及介質。 The invention belongs to the technical field of blockchain, and in particular relates to a consensus method, device, equipment and medium of a blockchain system.

共識機制是區塊鏈系統中的各個節點就區塊資訊達成全網一致共識的機制,可以保證最新區塊被準確添加至區塊鏈以及各個節點所存儲的區塊鏈資訊一致不分叉,甚至還可以抵禦惡意攻擊。 The consensus mechanism is a mechanism for each node in the blockchain system to reach a consensus of the entire network on block information, which can ensure that the latest block is accurately added to the blockchain and the blockchain information stored by each node is consistent and does not fork. It can even defend against malicious attacks.

隨著區塊鏈系統中節點數量的不斷增加,已有的共識機制已經不足以滿足區塊鏈系統對高輸送量的需求。 With the continuous increase of the number of nodes in the blockchain system, the existing consensus mechanism is no longer sufficient to meet the demand for high throughput of the blockchain system.

本發明實施例提供一種區塊鏈系統的共識方法、裝置、設備及介質,能夠解決已有的共識機制已經不足以滿足區塊鏈系統對高輸送量的需求的問題。 The embodiments of the present invention provide a consensus method, device, equipment and medium for a blockchain system, which can solve the problem that the existing consensus mechanism is insufficient to meet the demand for high throughput of the blockchain system.

第一方面,本發明實施例提供了一種區塊鏈系統的共識方法,包括: In a first aspect, an embodiment of the present invention provides a consensus method for a blockchain system, including:

接收目標對等節點發送的共識集群路由請求; Receive the consensus cluster routing request sent by the target peer node;

解析共識集群路由請求,得到路由請求資訊;其中,路由請求資訊包括目標對等節點的節點位置; Parse the consensus cluster routing request to obtain routing request information; wherein, the routing request information includes the node location of the target peer node;

根據節點位置,在至少一個可用共識集群中,確定目標共識集群;其中,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; According to the node location, in at least one available consensus cluster, determine the target consensus cluster; wherein, the available consensus cluster is the consensus cluster in the normal working state in the blockchain system;

向目標對等節點發送目標共識集群的目標集群位址。 Send the target cluster address of the target consensus cluster to the target peer.

第二方面,本發明實施例提供了一種區塊鏈系統的共識方法,包括: In a second aspect, an embodiment of the present invention provides a consensus method for a blockchain system, including:

接收目標對等節點發送的交易請求;其中,目標對等節點基於目標集群位址發送交易請求,目標集群位址根據目標對等節點的節點位置在至少一個可用共識集群中確定,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; Receive the transaction request sent by the target peer node; wherein, the target peer node sends the transaction request based on the target cluster address, and the target cluster address is determined in at least one available consensus cluster according to the node position of the target peer node, and the available consensus cluster is A consensus cluster in a normal working state in the blockchain system;

解析交易請求,得到交易請求資訊;其中,交易請求資訊包括交易資訊; Parse the transaction request to obtain transaction request information; wherein, the transaction request information includes transaction information;

針對交易資訊發起共識; Initiate consensus on transaction information;

在共識成功的情況下,執行交易資訊對應的交易。 In the case of a successful consensus, the transaction corresponding to the transaction information is executed.

協力廠商面,本發明實施例提供了一種區塊鏈系統的共識方法,包括: In terms of third-party manufacturers, the embodiments of the present invention provide a consensus method for a blockchain system, including:

接收目標共識集群發送的位址查詢請求;其中,位址查詢請求根據目標共識集群所接收的交易請求所攜帶的目標通道資訊生成; Receive the address query request sent by the target consensus cluster; wherein, the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster;

解析位址查詢請求,得到位址查詢請求資訊;其中,位址查詢請求資訊包括目標通道資訊; Parse the address query request to obtain address query request information; wherein, the address query request information includes target channel information;

在分散式資料庫中,查詢目標通道資訊對應的集群位址; In the distributed database, query the cluster address corresponding to the target channel information;

在位址查詢請求資訊還包括節點位址的情況下,向節點位址對應的對等節點發送目標通道資訊對應的集群位址。 When the address query request information further includes the node address, the cluster address corresponding to the target channel information is sent to the peer node corresponding to the node address.

第四方面,本發明實施例提供了一種區塊鏈系統的共識方法,包括: In a fourth aspect, an embodiment of the present invention provides a consensus method for a blockchain system, including:

向集群調度節點發送共識集群路由請求,使集群調度節點回應于共識集群路由請求,根據共識集群路由請求的路由請求資訊中包括的節點位置,在至少一個可用共識集群中確定目標共識集群,並回饋目標共識集群對應的目標集群位址;其中,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; Send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, and determines the target consensus cluster in at least one available consensus cluster according to the node location included in the routing request information of the consensus cluster routing request, and gives back The target cluster address corresponding to the target consensus cluster; among them, the available consensus cluster is the consensus cluster in the normal working state in the blockchain system;

接收集群調度節點回饋的目標集群位址; Receive the target cluster address returned by the cluster scheduling node;

基於目標集群位址,向目標共識集群發送交易請求。 Based on the target cluster address, send a transaction request to the target consensus cluster.

第五方面,本發明實施例提供了一種區塊鏈系統的共識裝置,包括: In a fifth aspect, an embodiment of the present invention provides a consensus device for a blockchain system, including:

第一接收模組,用於接收目標對等節點發送的共識集群路由請求; The first receiving module is used to receive the consensus cluster routing request sent by the target peer node;

第一解析模組,用於解析共識集群路由請求,得到路由請求資訊;其中,路由請求資訊包括目標對等節點的節點位置; The first parsing module is used for parsing the consensus cluster routing request to obtain routing request information; wherein, the routing request information includes the node location of the target peer node;

第一確定模組,用於根據節點位置,在至少一個可用共識集群中,確定目標共識集群;其中,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; The first determination module is used to determine a target consensus cluster in at least one available consensus cluster according to the node position; wherein, the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;

第一發送模組,用於向目標對等節點發送目標共識集群的目標集群位址。 The first sending module is used for sending the target cluster address of the target consensus cluster to the target peer node.

第六方面,本發明實施例提供了一種區塊鏈系統的共識裝置,包括: In a sixth aspect, an embodiment of the present invention provides a consensus device for a blockchain system, including:

第二接收模組,用於接收目標對等節點發送的交易請求;其中,目標對等節點基於目標集群位址發送交易請求,目標集群位址根據目標對等節點的節點位置在至少一個可用共識集群中確定,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; The second receiving module is used to receive the transaction request sent by the target peer node; wherein, the target peer node sends the transaction request based on the target cluster address, and the target cluster address is based on the node position of the target peer node in at least one available consensus Determined in the cluster, the available consensus cluster is the consensus cluster in the normal working state in the blockchain system;

第二解析模組,用於解析交易請求,得到交易請求資訊;其中,交易請求資訊包括交易資訊; The second parsing module is used for parsing the transaction request to obtain transaction request information; wherein, the transaction request information includes transaction information;

資訊共識模組,用於針對交易資訊發起共識; Information consensus module, used to initiate consensus on transaction information;

交易執行模組,用於在共識成功的情況下,執行交易資訊對應的交易。 The transaction execution module is used to execute the transaction corresponding to the transaction information when the consensus is successful.

第七方面,本發明實施例提供了一種區塊鏈系統的共識裝置,包括: In a seventh aspect, an embodiment of the present invention provides a consensus device for a blockchain system, including:

第三接收模組,用於接收目標共識集群發送的位址查詢 請求;其中,位址查詢請求根據目標共識集群所接收的交易請求所攜帶的目標通道資訊生成; The third receiving module is used to receive the address query sent by the target consensus cluster request; wherein, the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster;

第三解析模組,用於解析位址查詢請求,得到位址查詢請求資訊;其中,位址查詢請求資訊包括目標通道資訊; The third parsing module is used for parsing the address query request to obtain address query request information; wherein, the address query request information includes target channel information;

位址查詢模組,用於在分散式資料庫中,查詢目標通道資訊對應的集群位址; The address query module is used to query the cluster address corresponding to the target channel information in the distributed database;

第二發送模組,用於在位址查詢請求資訊還包括節點位址的情況下,向節點位址對應的對等節點發送目標通道資訊對應的集群位址。 The second sending module is configured to send the cluster address corresponding to the target channel information to the peer node corresponding to the node address when the address query request information further includes the node address.

第八方面,本發明實施例提供了一種區塊鏈系統的共識裝置,包括: In an eighth aspect, an embodiment of the present invention provides a consensus device for a blockchain system, including:

第三發送模組,用於向集群調度節點發送共識集群路由請求,使集群調度節點回應于共識集群路由請求,根據共識集群路由請求的路由請求資訊中包括的節點位置,在至少一個可用共識集群中確定目標共識集群,並回饋目標共識集群對應的目標集群位址;其中,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; The third sending module is used to send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, according to the node position included in the routing request information of the consensus cluster routing request, in at least one available consensus cluster Determine the target consensus cluster and return the target cluster address corresponding to the target consensus cluster; among them, the available consensus cluster is the consensus cluster in the normal working state in the blockchain system;

第四接收模組,用於接收集群調度節點回饋的目標集群位址; The fourth receiving module is used for receiving the target cluster address fed back by the cluster scheduling node;

第四發送模組,用於基於目標集群位址,向目標共識集群發送交易請求。 The fourth sending module is used to send a transaction request to the target consensus cluster based on the target cluster address.

第九方面,本發明實施例提供了一種區塊鏈系統的共識設備,該設備包括:處理器以及存儲有電腦程式指令的記憶體; In a ninth aspect, an embodiment of the present invention provides a consensus device for a blockchain system, the device comprising: a processor and a memory storing computer program instructions;

處理器執行電腦程式指令時實現如第一方面、第二方面、協力廠商面或第四方面所述的區塊鏈系統的共識方法。 When the processor executes the computer program instructions, the consensus method of the blockchain system as described in the first aspect, the second aspect, the third party aspect or the fourth aspect is implemented.

第十方面,本發明實施例提供了一種電腦可讀存儲介質,該電腦可讀存儲介質上存儲有電腦程式指令,電腦程式指令被處理器執行時實現如第一方面、第二方面、協力廠商面或第四方面所述的區塊鏈 系統的共識方法。 In a tenth aspect, an embodiment of the present invention provides a computer-readable storage medium, where computer program instructions are stored on the computer-readable storage medium, and when the computer program instructions are executed by a processor, the first aspect, the second aspect, the third-party manufacturer blockchain as described in aspect or fourth aspect The consensus method of the system.

本發明實施例的區塊鏈系統的共識方法、裝置、設備及介質,能夠基於目標對等節點發送的共識集群路由請求所攜帶的目標對等節點的節點位置,為在區塊鏈系統的至少一個處於正常工作狀態的可用共識集群中,為目標對等節點分配目標共識集群,並且向目標對應節點發送目標共識集群的目標集群位址,以通過節點位置實現對等節點的分流,使不同的對等節點可以基於其節點位置匹配不同的共識集群,從而可以利用多個共識集群並行對大量的對等節點進行共識,提高了區塊鏈系統的輸送量,進而能夠滿足區塊鏈系統對高輸送量的需求。 The consensus method, device, device, and medium of the blockchain system according to the embodiments of the present invention can be based on the node position of the target peer node carried in the consensus cluster routing request sent by the target peer node, which is at least one in the blockchain system. In an available consensus cluster that is in normal working state, assign the target consensus cluster to the target peer node, and send the target cluster address of the target consensus cluster to the target corresponding node, so as to realize the shunting of the peer nodes by the node location, so that different Peer nodes can match different consensus clusters based on their node positions, so that multiple consensus clusters can be used to perform consensus on a large number of peer nodes in parallel, which improves the transmission capacity of the blockchain system and can meet the high demand of the blockchain system. delivery volume requirements.

OC,OC-1,OC-2,OC-3:共識集群 OC, OC-1, OC-2, OC-3: Consensus Cluster

PC1,PC2:對等集群 PC1, PC2: peer-to-peer cluster

CC:用戶集群 CC: User Cluster

201,301:憑證授權(Certificate Authority,CA)層 201,301: Certificate Authority (CA) layer

202:共識層 202: Consensus Layer

203,305:對等層 203,305: Peer Layer

302:通道協同層 302: Channel coordination layer

303:共識集群層 303: Consensus cluster layer

304:集群調度層 304: Cluster scheduling layer

A,C:地區 A, C: Region

B:生產企業 B: Manufacturing company

D:經銷企業 D: Distributors

O1:共識集群 O1: Consensus cluster

E:通道 E: channel

910:第一接收模組 910: The first receiving module

920:第一解析模組 920: The first analysis module

930:第一確定模組 930: The first confirmed module

940:第一發送模組 940: The first sending module

1010:第二接收模組 1010: Second receiving module

1020:第二解析模組 1020: Second Analysis Module

1030:資訊共識模組 1030: Information Consensus Module

1040:交易執行模組 1040: Transaction Execution Module

1110:第三接收模組 1110: The third receiving module

1120:第三解析模組 1120: The third parsing module

1130:位址查詢模組 1130: Address query module

1140:第二發送模組 1140: The second sending module

1210:第三發送模組 1210: The third sending module

1220:第四接收模組 1220: Fourth receiving module

1230:第四發送模組 1230: Fourth sending module

1300:共識設備 1300: Consensus Device

1301:輸入裝置 1301: Input Device

1302:輸入介面 1302: Input interface

1303:中央處理器 1303: CPU

1304:記憶體 1304: Memory

1305:輸出介面 1305: Output interface

1306:輸出設備 1306: Output device

1310:匯流排 1310: Busbar

BC-1,BC-2,BC-3,BC-4,BC-5,BC-6:區塊鏈帳本 BC-1, BC-2, BC-3, BC-4, BC-5, BC-6: Blockchain Ledger

S510,S520,S530,S540,S610,S620,S630,S640,S710,S720,S730,S740,S810,S820,S830:流程 S510, S520, S530, S540, S610, S620, S630, S640, S710, S720, S730, S740, S810, S820, S830: Process

為了更清楚地說明本發明實施例的技術方案,下面將對本發明實施例中所需要使用的附圖作簡單的介紹,對於本領域普通技術人員來講,在不付出創造性勞動的前提下,還可以根據這些附圖獲得其他的附圖。 In order to illustrate the technical solutions of the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings that need to be used in the embodiments of the present invention. For those of ordinary skill in the art, without creative work, the Additional drawings can be obtained from these drawings.

圖1是現有技術中的一種區塊鏈系統的結構示意圖; 1 is a schematic structural diagram of a blockchain system in the prior art;

圖2是圖1中的區塊鏈系統的系統架構圖; Fig. 2 is a system architecture diagram of the blockchain system in Fig. 1;

圖3是本發明一個實施例提供的區塊鏈系統的系統架構圖; 3 is a system architecture diagram of a blockchain system provided by an embodiment of the present invention;

圖4是圖3所示系統架構下的一種區塊鏈系統的結構示意圖; FIG. 4 is a schematic structural diagram of a blockchain system under the system architecture shown in FIG. 3;

圖5是本發明一個實施例提供的區塊鏈系統的共識方法的流程示意圖; 5 is a schematic flowchart of a consensus method of a blockchain system provided by an embodiment of the present invention;

圖6是本發明另一個實施例提供的區塊鏈系統的共識方法的流程示意圖; 6 is a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention;

圖7是本發明又一個實施例提供的區塊鏈系統的共識方法的流程示意圖; 7 is a schematic flowchart of a consensus method for a blockchain system provided by another embodiment of the present invention;

圖8是本發明再一個實施例提供的區塊鏈系統的共識方法的流程示意圖; 8 is a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention;

圖9是本發明一個實施例提供的區塊鏈系統的共識裝置的結構示意 圖; FIG. 9 is a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention picture;

圖10是本發明另一個實施例提供的區塊鏈系統的共識裝置的結構示意圖; 10 is a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention;

圖11是本發明又一個實施例提供的區塊鏈系統的共識裝置的結構示意圖; 11 is a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention;

圖12是本發明再一個實施例提供的區塊鏈系統的共識裝置的結構示意圖; 12 is a schematic structural diagram of a consensus device of a blockchain system provided by another embodiment of the present invention;

圖13是本發明一個實施例提供的區塊鏈系統的共識設備的結構示意圖。 FIG. 13 is a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention.

下面將詳細描述本發明的各個方面的特徵和示例性實施例,為了使本發明的目的、技術方案及優點更加清楚明白,以下結合附圖及具體實施例,對本發明進行進一步詳細描述。應理解,此處所描述的具體實施例僅被配置為解釋本發明,並不被配置為限定本發明。對於本領域技術人員來說,本發明可以在不需要這些具體細節中的一些細節的情況下實施。下面對實施例的描述僅僅是為了通過示出本發明的示例來提供對本發明更好的理解。 The features and exemplary embodiments of various aspects of the present invention will be described in detail below. In order to make the objectives, technical solutions and advantages of the present invention more clear, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments. It should be understood that the specific embodiments described herein are only configured to explain the present invention, and are not configured to limit the present invention. It will be apparent to those skilled in the art that the present invention may be practiced without some of these specific details. The following description of the embodiments is only intended to provide a better understanding of the present invention by illustrating examples of the invention.

需要說明的是,在本文中,諸如第一和第二等之類的關係術語僅僅用來將一個實體或者操作與另一個實體或操作區分開來,而不一定要求或者暗示這些實體或操作之間存在任何這種實際的關係或者順序。而且,術語“包括”、“包含”或者其任何其他變體意在涵蓋非排他性的包含,從而使得包括一系列要素的過程、方法、物品或者設備不僅包括那些要素,而且還包括沒有明確列出的其他要素,或者是還包括為這種過程、方法、物品或者設備所固有的要素。在沒有更多限制的情況下,由語句“包括......”限定的要素,並不排除在包括所述要素的過程、方法、物品或者設備中還存在另外的相同要素。 It should be noted that, in this document, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any relationship between these entities or operations. any such actual relationship or sequence exists. Moreover, the terms "comprising", "comprising" or any other variation thereof are intended to encompass a non-exclusive inclusion such that a process, method, article or device that includes a list of elements includes not only those elements, but also includes not explicitly listed or other elements inherent to such a process, method, article or apparatus. Without further limitation, an element defined by the phrase "comprising..." does not preclude the presence of additional identical elements in a process, method, article, or device that includes the element.

共識機制是區塊鏈系統中的各個節點就區塊資訊達成全 網一致共識的機制,可以保證最新區塊被準確添加至區塊鏈以及各個節點所存儲的區塊鏈資訊一致不分叉,甚至還可以抵禦惡意攻擊。 The consensus mechanism is that each node in the blockchain system reaches a consensus on the block information. The consensus mechanism of the network can ensure that the latest block is accurately added to the blockchain and the blockchain information stored by each node is consistent and non-forked, and it can even resist malicious attacks.

圖1示出了現有技術中的一種區塊鏈系統的結構示意圖。 FIG. 1 shows a schematic structural diagram of a blockchain system in the prior art.

如圖1所示,該區塊鏈系統包括共識集群OC、對等集群PC1、對等集群PC2和用戶集群CC。其中,共識集群OC包括至少一個共識節點。對等集群PC1和對等集群PC2分別包括至少一個對等節點,對等節點可以根據節點位置被劃分至不同的對等集群。區塊鏈帳本BC-1,BC-2,BC-3,BC-4,BC-5,BC-6分別為共識集群OC與不同對等節點所形成的不同通道(例如子區塊鏈)對應的區塊鏈帳本。用戶集群CC包括至少一個用戶節點。 As shown in Figure 1, the blockchain system includes a consensus cluster OC, a peer-to-peer cluster PC1, a peer-to-peer cluster PC2, and a user cluster CC. The consensus cluster OC includes at least one consensus node. The peer-to-peer cluster PC1 and the peer-to-peer cluster PC2 respectively include at least one peer node, and the peer nodes can be divided into different peer clusters according to node positions. The blockchain ledger BC-1, BC-2, BC-3, BC-4, BC-5, and BC-6 are the different channels (such as sub-blockchains) formed by the consensus cluster OC and different peer nodes, respectively. The corresponding blockchain ledger. The user cluster CC includes at least one user node.

圖2示出了圖1中的區塊鏈系統的系統架構圖。 FIG. 2 shows a system architecture diagram of the blockchain system in FIG. 1 .

如圖2所示,該區塊鏈系統為超級帳本(Hyperledger Fabric)架構,Hyperledger Fabric架構包括憑證授權(Certificate Authority,CA)層201、共識層202和對等層203。其中,CA層201包括CA管理節點,負責所有層級節點的證書分發、吊銷以及其他與區塊鏈交易相關的許可權控制操作。共識層202包括圖1所示的共識集群OC,對等層203包括圖1所示的對等集群PC1和對等集群PC2。 As shown in FIG. 2 , the blockchain system is a Hyperledger Fabric architecture, and the Hyperledger Fabric architecture includes a Certificate Authority (CA) layer 201 , a consensus layer 202 and a peer layer 203 . Among them, the CA layer 201 includes a CA management node, which is responsible for certificate distribution, revocation and other permission control operations related to blockchain transactions for all level nodes. The consensus layer 202 includes the consensus cluster OC shown in FIG. 1 , and the peer layer 203 includes the peer cluster PC1 and the peer cluster PC2 shown in FIG. 1 .

在圖1和圖2所示的區塊鏈系統中,每個使用者節點可以與對應的對等集群中的對等節點通信,向對等節點發送服務請求或者接收對等節點回饋的請求結果。每個對等節點也可以與共識集群OC通信,基於所接收到的服務請求向共識集群OC發送交易請求或者接收共識集群OC回饋的請求結果。 In the blockchain systems shown in Figures 1 and 2, each user node can communicate with peer nodes in the corresponding peer-to-peer cluster, send service requests to peer nodes or receive request results returned by peer nodes . Each peer node can also communicate with the consensus cluster OC, send transaction requests to the consensus cluster OC based on the received service request, or receive the request results returned by the consensus cluster OC.

但是,隨著區塊鏈系統中節點數量的不斷增加,尤其是對等節點數量的不斷增加,已有的共識機制已經不足以滿足區塊鏈系統對高輸送量的需求。 However, with the continuous increase in the number of nodes in the blockchain system, especially the number of peer nodes, the existing consensus mechanism is no longer sufficient to meet the blockchain system's demand for high throughput.

已有的提高區塊鏈系統的輸送量的方法一般為在不改變 區塊鏈系統的系統架構的情況下,對共識集群的共識演算法進行改進,來提高區塊鏈系統的輸送量。 The existing methods for increasing the throughput of the blockchain system are generally not changing In the case of the system architecture of the blockchain system, the consensus algorithm of the consensus cluster is improved to increase the throughput of the blockchain system.

但是,申請人發現,隨著接入的用戶節點的增多,用戶側每秒能被處理的交易量會迅速下降,僅依靠對共識演算法的改進來滿足區塊鏈系統對高輸送量的需求的難度較大,致使區塊鏈系統的輸送量依然較低。 However, the applicant found that with the increase in the number of connected user nodes, the transaction volume that can be processed per second on the user side will drop rapidly, and only relying on the improvement of the consensus algorithm to meet the high transmission volume demand of the blockchain system The difficulty of the blockchain system is relatively high, resulting in a still low transmission volume of the blockchain system.

為了解決上述的問題,本發明實施例一種新的應用于區塊鏈系統的系統架構以及該系統架構對應的區塊鏈系統。 In order to solve the above problems, an embodiment of the present invention provides a new system architecture applied to a blockchain system and a blockchain system corresponding to the system architecture.

圖3示出了本發明一個實施例提供的區塊鏈系統的系統架構圖。 FIG. 3 shows a system architecture diagram of a blockchain system provided by an embodiment of the present invention.

如圖3所示,該系統架構圖包括CA層301、通道協同層302、共識集群層303、集群調度層304和對等層305。其中,CA層301包括CA管理節點,負責所有層級節點的證書分發、吊銷以及其他與區塊鏈交易相關的許可權控制操作。共識集群層303可以包括一個或一個以上共識集群,用於基於交易請求進行共識,實現對區塊鏈交易的統一排序。通道協同層302包括通道協同節點,用於對跨共識集群的交易請求進行通道協同路由,以提升系統跨區域服務能力。對等層305包括至少一個對等集群,用於向共識集群層發起交易請求。集群調度層304包括集群調度節點,用於為對等集群中的每個對等節點分配共識集群,以實現對共識集群的動態分配。 As shown in FIG. 3 , the system architecture diagram includes a CA layer 301 , a channel coordination layer 302 , a consensus cluster layer 303 , a cluster scheduling layer 304 and a peer layer 305 . Among them, the CA layer 301 includes a CA management node, which is responsible for certificate distribution, revocation and other permission control operations related to blockchain transactions for all level nodes. The consensus cluster layer 303 may include one or more consensus clusters, which are used to perform consensus based on transaction requests and realize a unified ordering of blockchain transactions. The channel coordination layer 302 includes channel coordination nodes, which are used for channel coordination routing for transaction requests across consensus clusters, so as to improve the system's cross-regional service capability. The peer layer 305 includes at least one peer cluster for initiating transaction requests to the consensus cluster layer. The cluster scheduling layer 304 includes a cluster scheduling node for allocating consensus clusters to each peer node in the peer-to-peer cluster to achieve dynamic allocation of consensus clusters.

在本發明一些實施例中,該系統架構可以為Hyperledger Fabric架構。在本發明另一些實施例中,該系統架構還可以為其他與Hyperledger Fabric架構相似的架構。 In some embodiments of the present invention, the system architecture may be a Hyperledger Fabric architecture. In other embodiments of the present invention, the system architecture may also be other architectures similar to the Hyperledger Fabric architecture.

圖4示出了圖3所示系統架構下的一種區塊鏈系統的結構示意圖。 FIG. 4 shows a schematic structural diagram of a blockchain system under the system architecture shown in FIG. 3 .

如圖4所示,該區塊鏈系統包括通道協同層、共識集群OC-1、共識集群OC-2、共識集群OC-3、對等集群PC1、集群調度層、對 等集群PC2和用戶集群CC。其中,通道協同層包括分別位於每個共識集群內的通道協同節點。共識集群OC-1、共識集群OC-2和共識集群OC-3分別包括至少一個共識節點,不同的共識集群對應不同的位置區域。對等集群PC1和對等集群PC2分別包括至少一個對等節點,對等節點可以根據節點位置被劃分至不同的對等集群。集群調度層包括至少一個集群調度節點。區塊鏈帳本BC-1,BC-2,BC-3,BC-4分別為不同共識集群為不同對等節點所建立的不同通道(例如子區塊鏈)對應的區塊鏈帳本。用戶集群CC包括至少一個用戶節點。 As shown in Figure 4, the blockchain system includes a channel coordination layer, a consensus cluster OC-1, a consensus cluster OC-2, a consensus cluster OC-3, a peer-to-peer cluster PC1, a cluster scheduling layer, and a peer-to-peer cluster. etc. Cluster PC2 and User Cluster CC. The channel coordination layer includes channel coordination nodes located in each consensus cluster. The consensus cluster OC-1, the consensus cluster OC-2 and the consensus cluster OC-3 respectively include at least one consensus node, and different consensus clusters correspond to different location areas. The peer-to-peer cluster PC1 and the peer-to-peer cluster PC2 respectively include at least one peer node, and the peer nodes can be divided into different peer clusters according to node positions. The cluster scheduling layer includes at least one cluster scheduling node. The blockchain ledgers BC-1, BC-2, BC-3, and BC-4 are the blockchain ledgers corresponding to different channels (such as sub-blockchains) established by different consensus clusters for different peer nodes. The user cluster CC includes at least one user node.

在圖3和圖4所示的區塊鏈系統中,每個使用者節點可以與對應的對等集群中的對等節點通信,向對等節點發送服務請求或者接收對等節點回饋的請求結果。每個對等節點也可以與集群調度節點通信,基於所接收到的服務請求向集群調度節點發送共識集群路由請求,使集群調度節點基於共識集群路由請求所攜帶的對等節點的節點位置為該對等節點分配共識集群。每個對等節點也可以與集群調度節點為其分配的共識集群通信,基於所接收到的服務請求向共識集群發送交易請求或者接收共識集群回饋的請求結果。在共識集群接收到跨共識集群的交易請求的情況下,還可以通過通道協同節點為該交易請求進行通道協同路由,查找該交易請求對應的通道所屬的共識集群,以使發送該交易請求的對等節點能夠重新向交易請求交易請求對應的通道所屬的共識集群發送該交易請求。 In the blockchain systems shown in Figures 3 and 4, each user node can communicate with peer nodes in the corresponding peer-to-peer cluster, send service requests to peer nodes or receive request results returned by peer nodes . Each peer node can also communicate with the cluster scheduling node, and send a consensus cluster routing request to the cluster scheduling node based on the received service request, so that the cluster scheduling node is based on the node location of the peer node carried by the consensus cluster routing request. Peer nodes assign consensus clusters. Each peer node can also communicate with the consensus cluster assigned by the cluster scheduling node, send transaction requests to the consensus cluster based on the received service request or receive the request result returned by the consensus cluster. When the consensus cluster receives a transaction request across consensus clusters, it can also perform channel coordination routing for the transaction request through the channel coordination node, and find the consensus cluster to which the channel corresponding to the transaction request belongs, so that the pair that sends the transaction request belongs to the consensus cluster. The other node can re-send the transaction request to the consensus cluster to which the channel corresponding to the transaction request belongs.

由此,本發明實施例提供的區塊鏈系統,能夠通過節點位置實現對等節點的分流,使不同的對等節點可以基於其節點位置匹配不同的共識集群,從而可以利用多個共識集群並行對大量的對等節點進行共識,提高了區塊鏈系統的輸送量,進而能夠滿足區塊鏈系統對高輸送量的需求,並且能夠適應高效、安全的業務需求。 Therefore, the blockchain system provided by the embodiment of the present invention can realize the distribution of peer nodes according to the node position, so that different peer nodes can match different consensus clusters based on their node positions, so that multiple consensus clusters can be used in parallel Consensus on a large number of peer nodes improves the transmission volume of the blockchain system, which in turn can meet the demand for high transmission volume of the blockchain system, and can adapt to the needs of efficient and secure business.

需要說明的是,在圖4所示的區塊鏈系統中,通道協同節點分別內嵌於對應的共識集群中。在另一些實施例中,通道協同節點也可以與對應的共識集群分離設置,在此不做限制。 It should be noted that, in the blockchain system shown in Figure 4, the channel coordination nodes are respectively embedded in the corresponding consensus clusters. In other embodiments, the channel coordination node may also be set separately from the corresponding consensus cluster, which is not limited here.

基於本發明實施例提供的區塊鏈系統,本發明實施例提供了一種區塊鏈系統的共識方法、裝置、設備及介質。下面首先對本發明實施例所提供的區塊鏈系統的共識方法進行介紹。 Based on the blockchain system provided by the embodiments of the present invention, the embodiments of the present invention provide a consensus method, apparatus, device, and medium for a blockchain system. The following first introduces the consensus method of the blockchain system provided by the embodiment of the present invention.

圖5示出了本發明一個實施例提供的區塊鏈系統的共識方法的流程示意圖。 FIG. 5 shows a schematic flowchart of a consensus method of a blockchain system provided by an embodiment of the present invention.

在本發明一些實施例中,圖5所示的方法可以由圖4所示的集群調度節點執行。其中,集群調度節點可以為伺服器或者伺服器集群。 In some embodiments of the present invention, the method shown in FIG. 5 may be executed by the cluster scheduling node shown in FIG. 4 . The cluster scheduling node may be a server or a server cluster.

如圖5所示,該區塊鏈系統的共識方法可以包括: As shown in Figure 5, the consensus method of the blockchain system can include:

S510、接收目標對等節點發送的共識集群路由請求。 S510. Receive a consensus cluster routing request sent by the target peer node.

在本發明一些實施例中,目標對等節點可以為區塊鏈系統中的任意對等節點。例如,目標對等節點可以為圖4所示的區塊鏈系統中的任一個對等節點。 In some embodiments of the present invention, the target peer node may be any peer node in the blockchain system. For example, the target peer node can be any peer node in the blockchain system shown in FIG. 4 .

在本發明一些實施例中,集群調度節點所接收的共識集群路由請求的路由請求類型可以包括第一路由類型和第二路由類型。其中,第一路由類型可以用於表徵該路由請求為對等節點在首次建立通道時所發送的共識集群路由請求,第二路由類型可以用於表徵該路由請求為對等節點在加入已有通道時所發送的共識集群路由請求。 In some embodiments of the present invention, the routing request type of the consensus cluster routing request received by the cluster scheduling node may include a first routing type and a second routing type. The first routing type can be used to represent that the routing request is a consensus cluster routing request sent by the peer node when the channel is first established, and the second routing type can be used to represent that the routing request is the peer node joining the existing channel. Consensus cluster routing request sent when .

在本發明一些實施例中,一個通道可以為一個子區塊鏈。 In some embodiments of the present invention, a channel may be a sub-blockchain.

S520、解析共識集群路由請求,得到路由請求資訊;其中,路由請求資訊包括目標對等節點的節點位置。 S520. Parse the consensus cluster routing request to obtain routing request information, wherein the routing request information includes the node location of the target peer node.

在本發明一些實施例中,集群調度節點可以對所接收的共識集群路由請求進行請求解析處理,得到共識集群路由請求中所包含的路由請求資訊。 In some embodiments of the present invention, the cluster scheduling node may perform request analysis processing on the received consensus cluster routing request to obtain routing request information contained in the consensus cluster routing request.

在一些實施例中,路由請求資訊可以包括目標對等節點的節點位置,其中,節點位置包括目標對等節點的地理位置。在另一些實 施例中,路由請求信息還可以包括路由請求類型。在又一些實施例中,路由請求資訊也可以包括節點驗證資訊,其中,節點驗證資訊包括用於驗證目標對等節點的證書合法性的資訊。在再一些實施例中,路由請求資訊還可以包括目標對等節點的節點位址,其中,節點位址包括目標對等節點的節點互聯網協議(Internet Protocol,IP)地址。 In some embodiments, the routing request information may include the node location of the target peer node, wherein the node location includes the geographic location of the target peer node. in other real In an embodiment, the routing request information may further include a routing request type. In still other embodiments, the routing request information may also include node verification information, wherein the node verification information includes information for verifying the validity of the certificate of the target peer node. In still other embodiments, the routing request information may further include a node address of the target peer node, wherein the node address includes a node Internet Protocol (IP) address of the target peer node.

需要說明的是,路由請求資訊中還可以包括其他用於輔助集群調度節點為目標對等節點分配目標共識集群的資訊,在此不做限制。 It should be noted that the routing request information may also include other information for assisting the cluster scheduling node to allocate the target consensus cluster to the target peer node, which is not limited here.

S530、根據節點位置,在至少一個可用共識集群中,確定目標共識集群;其中,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群。 S530: Determine a target consensus cluster in at least one available consensus cluster according to the position of the node; wherein, the available consensus cluster is a consensus cluster in a normal working state in the blockchain system.

在本發明一些實施例中,集群調度節點可以基於最短時間原則,根據節點位置和每個可用共識集群的集群位置,為目標對等節點分配目標共識集群。 In some embodiments of the present invention, the cluster scheduling node may allocate the target consensus cluster to the target peer node based on the shortest time principle and according to the node location and the cluster location of each available consensus cluster.

具體地,集群調度節點可以持續監聽共識集群層中的各個共識集群的心跳,並計算各個共識集群的回應時間,在接收到共識集群路由請求之後,可以基於共識集群路由請求所攜帶的目標對等節點的節點位置,在多個共識集群中選取位於該節點位置對應的預設距離範圍內的共識集群,並在所選取的共識集群中選取回應時間最短的共識集群,作為目標共識集群,以基於最短時間原則為目標對等節點分配目標共識集群。 Specifically, the cluster scheduling node can continuously monitor the heartbeat of each consensus cluster in the consensus cluster layer, and calculate the response time of each consensus cluster. After receiving the consensus cluster routing request, it can be based on the target peer carried in the consensus cluster routing request. The node position of the node, select the consensus cluster located within the preset distance range corresponding to the node position from multiple consensus clusters, and select the consensus cluster with the shortest response time among the selected consensus clusters as the target consensus cluster. The shortest time principle assigns target consensus clusters to target peers.

其中,預設距離範圍可以根據需要設置,在此不做限制。 The preset distance range can be set as required, and is not limited here.

由此,在本發明實施例中,集群調度節點可以為目標對等節點分配響應時間最短的目標共識集群,進而提高交易處理的效率,提高用戶的使用體驗。 Therefore, in the embodiment of the present invention, the cluster scheduling node can allocate the target consensus cluster with the shortest response time to the target peer node, thereby improving the efficiency of transaction processing and improving the user experience.

在本發明另一些實施例中,集群調度節點還可以基於最短距離原則,根據節點位置和每個可用共識集群的集群位置,為目標對等 節點分配目標共識集群。 In other embodiments of the present invention, the cluster scheduling node may also be based on the shortest distance principle, according to the node location and the cluster location of each available consensus cluster, as the target peer Nodes assign target consensus clusters.

其中,集群位置可以包括共識集群的地理位置。 The cluster location may include the geographic location of the consensus cluster.

具體地,集群調度節點在接收到共識集群路由請求之後,可以基於共識集群路由請求所攜帶的目標對等節點的節點位置,在多個共識集群中選取集群位置與該節點位置的距離最近的共識集群,作為目標共識集群,以基於最短距離原則為目標對等節點分配目標共識集群。 Specifically, after receiving the consensus cluster routing request, the cluster scheduling node may select a consensus among multiple consensus clusters with the closest distance between the cluster location and the node location based on the node location of the target peer node carried in the consensus cluster routing request The cluster, as the target consensus cluster, assigns the target consensus cluster to the target peer nodes based on the shortest distance principle.

由此,在本發明實施例中,集群調度節點可以為目標對等節點分配距離最近的目標共識集群,進而提高交易處理的效率,提高用戶的使用體驗。 Therefore, in the embodiment of the present invention, the cluster scheduling node can allocate the target consensus cluster with the closest distance to the target peer node, thereby improving the efficiency of transaction processing and improving the user experience.

在本發明一些實施例中,每個共識集群可以包括至少一個共識節點,共識節點可以為伺服器或者伺服器集群。 In some embodiments of the present invention, each consensus cluster may include at least one consensus node, and the consensus node may be a server or a server cluster.

在本發明一些實施例中,正常工作狀態為正常運行的工作狀態。 In some embodiments of the present invention, the normal working state is a working state of normal operation.

S540、向目標對等節點發送目標共識集群的目標集群位址。 S540. Send the target cluster address of the target consensus cluster to the target peer node.

在本發明一些實施例中,集群調度節點在確定了目標共識集群之後,可以查詢該目標共識集群的目標集群位址,並且向目標對等節點發送目標共識集群的目標集群位址。 In some embodiments of the present invention, after determining the target consensus cluster, the cluster scheduling node may query the target cluster address of the target consensus cluster, and send the target cluster address of the target consensus cluster to the target peer node.

在本發明一些實施例中,路由請求資訊可以包括目標對等節點的節點位址,集群調度節點可以通過節點位址向目標對等節點發送目標共識集群的目標集群位址。 In some embodiments of the present invention, the routing request information may include the node address of the target peer node, and the cluster scheduling node may send the target cluster address of the target consensus cluster to the target peer node through the node address.

在本發明實施例中,能夠基於目標對等節點發送的共識集群路由請求所攜帶的目標對等節點的節點位置,為在區塊鏈系統的至少一個處於正常工作狀態的可用共識集群中,為目標對等節點分配目標共識集群,並且向目標對應節點發送目標共識集群的目標集群位址,以通過節點位置實現對等節點的分流,使不同的對等節點可以基於其節點位置匹配不同的共識集群,從而可以利用多個共識集群並行對大量的對等節點進行 共識,提高了區塊鏈系統的輸送量,進而能夠滿足區塊鏈系統對高輸送量的需求。 In the embodiment of the present invention, the node location of the target peer node carried in the consensus cluster routing request sent by the target peer node is in at least one available consensus cluster in the normal working state of the blockchain system, and is The target peer node assigns the target consensus cluster, and sends the target cluster address of the target consensus cluster to the target corresponding node, so as to realize the shunting of the peer nodes through the node location, so that different peer nodes can match different consensus based on their node location. cluster, so that multiple consensus clusters can be used in parallel on a large number of peer nodes Consensus increases the transmission volume of the blockchain system, which in turn can meet the demand for high transmission volume of the blockchain system.

下面將詳細介紹S530的具體實現方式。 The specific implementation of the S530 will be described in detail below.

在本發明一些實施例中,為了提高區塊鏈系統的安全性,路由請求資訊中還可以包括節點驗證資訊; In some embodiments of the present invention, in order to improve the security of the blockchain system, the routing request information may also include node verification information;

在集群調度節點執行S530之前,還可以對節點驗證資訊進行驗證。 Before the cluster scheduling node executes S530, the node verification information may also be verified.

相應地,S530的具體方法可以包括: Correspondingly, the specific method of S530 may include:

在節點驗證資訊通過驗證的情況下,根據節點位置,在至少一個可用共識集群中,確定目標共識集群。 In the case that the node verification information is verified, according to the node location, in at least one available consensus cluster, determine the target consensus cluster.

在一些實施例中,節點驗證資訊可以由目標對等節點根據憑證授權節點為其分發的證書生成。例如,憑證授權節點可以為圖3所示的CA層301中的節點。節點驗證資訊可以用於驗證目標對等節點的證書合法性,以使集群調度節點確定目標對等節點是否為區塊鏈系統的合法節點。 In some embodiments, the node authentication information may be generated by the target peer node based on a certificate issued to it by the credential authority node. For example, the credential authorization node may be a node in the CA layer 301 shown in FIG. 3 . The node verification information can be used to verify the validity of the certificate of the target peer node, so that the cluster scheduling node can determine whether the target peer node is a legal node of the blockchain system.

在這些實施例中,若節點驗證資訊通過驗證,則說明目標對等節點是區塊鏈系統的合法節點,集群調度節點可以根據節點位置,在至少一個可用共識集群中,確定目標共識集群;若節點驗證資訊未通過驗證,則說明目標對等節點不是區塊鏈系統的合法節點,集群調度節點停止回應共識集群路由請求,不為目標對等節點分配任何的共識集群。 In these embodiments, if the node verification information passes the verification, it means that the target peer node is a legitimate node of the blockchain system, and the cluster scheduling node can determine the target consensus cluster in at least one available consensus cluster according to the node location; if If the node verification information fails to pass the verification, it means that the target peer node is not a legal node of the blockchain system, and the cluster scheduling node stops responding to the consensus cluster routing request and does not allocate any consensus cluster to the target peer node.

由此,在本發明實施例中,集群調度節點可以首先驗證目標對等節點的節點驗證資訊的合法性,並且在節點驗證資訊通過驗證的情況下,為目標對等節點分配目標共識集群,進而提高區塊鏈系統的安全性。 Therefore, in the embodiment of the present invention, the cluster scheduling node can first verify the legitimacy of the node verification information of the target peer node, and in the case that the node verification information passes the verification, assign the target consensus cluster to the target peer node, and then Improve the security of the blockchain system.

在本發明一些實施例中,為了提高區塊鏈系統的可靠性,在S530之前,該區塊鏈系統的共識方法還可以包括: In some embodiments of the present invention, in order to improve the reliability of the blockchain system, before S530, the consensus method of the blockchain system may further include:

接收共識集群發送的集群註冊請求; Receive the cluster registration request sent by the consensus cluster;

解析集群註冊請求,得到集群註冊請求資訊;其中,所述集群註冊請求資訊包括集群驗證資訊; Parse the cluster registration request to obtain cluster registration request information; wherein, the cluster registration request information includes cluster verification information;

在集群驗證資訊通過驗證的情況下,監聽共識集群; If the cluster verification information is verified, monitor the consensus cluster;

在監聽到共識集群處於正常工作狀態的情況下,將共識集群作為可用共識集群。 In the case of monitoring that the consensus cluster is in a normal working state, the consensus cluster is used as the available consensus cluster.

具體地,每個共識集群在初次啟動時,均會向集群調度節點發送集群註冊請求,以在集群註冊請求中進行註冊。集群調度節點在接收到共識集群發送的集群註冊請求之後,可以解析集群註冊請求,得到集群驗證資訊,然後基於集群驗證資訊驗證該共識集群的合法性,並且在集群驗證資訊通過驗證的情況下,該共識集群註冊成功,集群調度節點可以持續監聽該共識集群。如果監聽到共識集群處於正常工作狀態,則將該共識集群作為可用共識集群,加入共識集群動態網路地圖;如果監聽到共識集群未處於正常工作狀態,則將該共識集群作為不可用共識集群,並且將該共識集群從共識集群動態網路地圖中移除。 Specifically, when each consensus cluster is first started, it will send a cluster registration request to the cluster scheduling node to register in the cluster registration request. After receiving the cluster registration request sent by the consensus cluster, the cluster scheduling node can parse the cluster registration request, obtain the cluster verification information, and then verify the legitimacy of the consensus cluster based on the cluster verification information. The consensus cluster is successfully registered, and the cluster scheduling node can continue to monitor the consensus cluster. If it is monitored that the consensus cluster is in a normal working state, the consensus cluster is regarded as an available consensus cluster and added to the dynamic network map of the consensus cluster; if it is monitored that the consensus cluster is not in a normal working state, the consensus cluster is regarded as an unavailable consensus cluster. And remove the consensus cluster from the consensus cluster dynamic network map.

其中,集群驗證資訊包括用於驗證共識集群的證書合法性的資訊。集群驗證資訊可以由共識集群根據憑證授權節點為其分發的證書生成。例如,憑證授權節點可以為圖3所示的CA層301中的節點。集群驗證資訊可以用於驗證共識集群的證書合法性,以使集群調度節點確定共識集群是否為區塊鏈系統的合法集群。 The cluster verification information includes information for verifying the validity of the certificate of the consensus cluster. The cluster verification information can be generated by the consensus cluster according to the certificate issued by the certificate authority node. For example, the credential authorization node may be a node in the CA layer 301 shown in FIG. 3 . The cluster verification information can be used to verify the validity of the certificate of the consensus cluster, so that the cluster scheduling node can determine whether the consensus cluster is a legitimate cluster of the blockchain system.

在本發明一些實施例中,共識集群在註冊成功之後,可以向集群調度節點發送共識集群的心跳,集群調度節點可以基於共識集群的心跳,對共識集群進行監聽,以確定共識集群是否處於正常工作狀態。 In some embodiments of the present invention, after the consensus cluster is successfully registered, it may send the heartbeat of the consensus cluster to the cluster scheduling node, and the cluster scheduling node may monitor the consensus cluster based on the heartbeat of the consensus cluster to determine whether the consensus cluster is working normally state.

在這些實施例中,可選地,S530的具體方法可以包括: In these embodiments, optionally, the specific method of S530 may include:

根據節點位置,在共識集群動態網路地圖中的至少一個可用共識集群中,確定目標共識集群。 According to the node location, among at least one available consensus cluster in the dynamic network map of consensus clusters, the target consensus cluster is determined.

由於共識集群動態網路地圖中的可用共識集群是基於各個共識集群的工作狀態動態變化的,因此,集群調度節點可以為目標對等 節點動態地分配處於正常工作狀態的目標共識集群,以提高區塊鏈系統的可靠性。 Since the available consensus clusters in the dynamic network map of consensus clusters change dynamically based on the working status of each consensus cluster, the cluster scheduling node can be the target peer Nodes dynamically allocate target consensus clusters that are in normal working state to improve the reliability of the blockchain system.

在本發明另一些實施例中,集群註冊請求資訊還可以包括集群配置資訊。其中,集群配置資訊可以包括共識集群的集群標識(Identity document,ID)、集群IP位址和集群位置等於共識集群的配置相關的資訊。 In other embodiments of the present invention, the cluster registration request information may further include cluster configuration information. The cluster configuration information may include a cluster identification (Identity document, ID) of the consensus cluster, the cluster IP address, and the cluster location equal to the information related to the configuration of the consensus cluster.

在這些實施例中,可選地,在S540之前,該區塊鏈系統的共識方法還可以包括: In these embodiments, optionally, before S540, the consensus method of the blockchain system may further include:

查詢目標共識集群對應的目標集群配置資訊; Query the target cluster configuration information corresponding to the target consensus cluster;

在目標集群配置資訊中,提取目標集群位址。 In the target cluster configuration information, extract the target cluster address.

具體地,集群調度節點可以在各個已經註冊的共識集群的集群配置資訊中,基於目標共識集群的目標集群ID,查詢目標共識集群對應的目標集群配置資訊,並且在目標集群配置資訊中,提取目標集群位址,以向目標對等節點發送為其分配的目標共識集群的目標集群位址。 Specifically, the cluster scheduling node can query the target cluster configuration information corresponding to the target consensus cluster based on the target cluster ID of the target consensus cluster in the cluster configuration information of each registered consensus cluster, and extract the target cluster configuration information from the target cluster configuration information. The cluster address to send the target peer node's assigned target consensus cluster's target cluster address.

在本發明一些實施例中,為了提高區塊鏈系統的交易處理效率,在將回應時間最短的可用共識集群作為目標共識集群之前,該區塊鏈系統的共識方法還可以包括: In some embodiments of the present invention, in order to improve the transaction processing efficiency of the blockchain system, before using the available consensus cluster with the shortest response time as the target consensus cluster, the consensus method of the blockchain system may further include:

判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件。 Determine whether the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition.

其中,集群性能參數可以包括共識集群的輸送量和交易平均延時等參數。交易平均延時可以從與該共識集群通信的對等節點獲取,對等節點在向該共識集群發送交易請求後,可以每隔一定時間向集群調度節點發送與其通信的共識集群通信的交易平均延時。 Among them, the cluster performance parameters can include parameters such as the transmission volume of the consensus cluster and the average transaction delay. The average transaction delay can be obtained from the peer node that communicates with the consensus cluster. After the peer node sends a transaction request to the consensus cluster, it can send the average transaction delay of the consensus cluster communication to the cluster scheduling node at regular intervals.

在這些實施例中,可選地,將回應時間最短的可用共識集群作為目標共識集群的具體方法可以包括: In these embodiments, optionally, the specific method for using the available consensus cluster with the shortest response time as the target consensus cluster may include:

在集群性能參數不滿足第一預設條件的情況下,將回應時間最短的可用共識集群作為目標共識集。 In the case that the cluster performance parameter does not meet the first preset condition, the available consensus cluster with the shortest response time is used as the target consensus set.

具體地,集群調度節點可以在確定了對目標對等節點的回應時間最短的可用共識集群之後,判斷該可用共識集群的集群性能參數是否滿足第一預設條件,確定該可用共識集群是否達到了飽和狀態。如果確定集群性能參數不滿足第一預設條件,即該可用共識集群未達到飽和狀態,則可以將回應時間最短的可用共識集群作為目標共識集群。 Specifically, after determining the available consensus cluster with the shortest response time to the target peer node, the cluster scheduling node can determine whether the cluster performance parameter of the available consensus cluster satisfies the first preset condition, and determine whether the available consensus cluster has reached the saturated state. If it is determined that the cluster performance parameter does not meet the first preset condition, that is, the available consensus cluster has not reached the saturation state, the available consensus cluster with the shortest response time may be used as the target consensus cluster.

在另一些實施例中,在判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件之後,該區塊鏈系統的共識方法還可以包括: In other embodiments, after judging whether the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition, the consensus method of the blockchain system may further include:

在集群性能參數滿足第一預設條件的情況下,將回應時間次最短的可用共識集群作為目標共識集群。 When the cluster performance parameter satisfies the first preset condition, the available consensus cluster with the second shortest response time is used as the target consensus cluster.

具體地,集群調度節點還可以在判斷該可用共識集群的集群性能參數是否滿足第一預設條件之後,如果確定集群性能參數滿足第一預設條件,即該可用共識集群達到飽和狀態,則可以將回應時間次最短的可用共識集群作為目標共識集群。 Specifically, after judging whether the cluster performance parameter of the available consensus cluster satisfies the first preset condition, the cluster scheduling node can also determine that the cluster performance parameter satisfies the first preset condition, that is, the available consensus cluster has reached the saturation state, then Use the available consensus cluster with the second shortest response time as the target consensus cluster.

由此,在本發明實施例中,可以進一步基於可用共識集群的飽和情況和回應時間進行綜合判斷,以為目標對等節點動態地分配處於正常工作狀態的目標共識集群,進一步提高區塊鏈系統的可靠性。 Therefore, in the embodiment of the present invention, a comprehensive judgment can be further made based on the saturation of the available consensus clusters and the response time, so as to dynamically allocate the target consensus cluster in a normal working state for the target peer node, and further improve the blockchain system's performance. reliability.

在本發明一些實施例中,還可以對回應時間次最短的可用共識集群進行飽和情況的判斷,並且確定是否將回應時間次最短的可用共識集群作為目標共識集群。 In some embodiments of the present invention, it is also possible to judge the saturation situation of the available consensus cluster with the second shortest response time, and determine whether to use the available consensus cluster with the second shortest response time as the target consensus cluster.

需要說明的是,對回應時間次最短的可用共識集群進行飽和情況的判斷的方法與對回應時間最短的可用共識集群進行飽和情況的判斷的方法相似,確定是否將回應時間次最短的可用共識集群作為目標共識集群的方法與確定是否將回應時間最短的可用共識集群作為目標共識集群的方法相似,在此不做贅述。 It should be noted that the method of judging the saturation situation of the available consensus cluster with the shortest response time is similar to the method of judging the saturation situation of the available consensus cluster with the shortest response time. The method of serving as the target consensus cluster is similar to the method of determining whether to use the available consensus cluster with the shortest response time as the target consensus cluster, and will not be repeated here.

在本發明一些實施例中,為了進一步提高區塊鏈系統的交易處理效率,路由請求資訊還可以包括路由請求類型; In some embodiments of the present invention, in order to further improve the transaction processing efficiency of the blockchain system, the routing request information may further include a routing request type;

在這些實施例中,判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件的具體方法還可以包括: In these embodiments, the specific method for judging whether the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition may further include:

在路由請求類型為第一路由類型的情況下,判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件。 When the route request type is the first route type, it is determined whether the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition.

具體地,在判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件之前,還可以判斷共識集群路由請求的路由請求類型。如果路由請求類型為第一路由類型,即路由請求類型為對等節點在首次建立通道時所發送的共識集群路由請求,則判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件,並且不再考慮已經為飽和狀態的共識集群。如果路由請求類型為第二路由類型,即路由請求類型為對等節點在加入已有通道時所發送的共識集群路由請求,則無需判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件,仍可考慮已經為飽和狀態的共識集群。 Specifically, before determining whether the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition, the routing request type of the routing request of the consensus cluster may also be determined. If the routing request type is the first routing type, that is, the routing request type is the consensus cluster routing request sent by the peer node when the channel is first established, then determine whether the cluster performance parameters of the available consensus cluster with the shortest response time satisfy the first preset condition, and no longer consider a consensus cluster that is already saturated. If the routing request type is the second routing type, that is, the routing request type is the consensus cluster routing request sent by the peer node when joining the existing channel, it is not necessary to judge whether the cluster performance parameters of the available consensus cluster with the shortest response time meet the first requirement. Pre-set conditions, consensus clusters that are already saturated can still be considered.

在本發明一些實施例中,第一預設條件可以包括下列中的至少一項: In some embodiments of the present invention, the first preset condition may include at least one of the following:

集群性能參數中的輸送量大於或等於預設輸送量閾值; The delivery volume in the cluster performance parameter is greater than or equal to the preset delivery volume threshold;

輸送量大於或等於預設輸送量閾值的第一時長大於或等於第一預設時長; The first duration of the delivery volume greater than or equal to the preset delivery volume threshold is greater than or equal to the first preset duration;

集群性能參數中的交易平均延時大於或等於預設延時閾值; The average transaction delay in the cluster performance parameters is greater than or equal to the preset delay threshold;

交易平均延時大於或等於預設延時閾值的第二時長大於或等於第二預設時長。 The second time period when the average transaction delay is greater than or equal to the preset delay threshold is greater than or equal to the second preset time period.

具體地,預設輸送量閾值可以對應基準技術指標臨界水準,例如,預設輸送量閾值可以為90%,也可以為根據需要設置的其他閾值。交易平均延時也可以對應基準技術指標臨界水準,例如,預設延時閾值可以為10%,也可以為根據需要設置的其他閾值。第一預設時長和第二預設時長可以分別為根據需要設置的時長,在此不做限制。 Specifically, the preset delivery volume threshold may correspond to the critical level of the reference technical index, for example, the preset delivery volume threshold may be 90%, or may be other thresholds set as required. The average transaction delay can also correspond to the critical level of the benchmark technical indicators. For example, the preset delay threshold can be 10%, or it can be other thresholds set according to needs. The first preset duration and the second preset duration may respectively be durations set as required, which are not limited herein.

在一些實施例中,交易平均延時大於或等於預設延時閾 值可以為共識集群中的全部共識節點的交易平均延時大於或等於預設延時閾值。在另一些實施例中,交易平均延時大於或等於預設延時閾值可以為共識集群中的預定數量的共識節點的交易平均延時大於或等於預設延時閾值。 In some embodiments, the average transaction delay is greater than or equal to a preset delay threshold The value can be that the average transaction delay of all consensus nodes in the consensus cluster is greater than or equal to the preset delay threshold. In other embodiments, the average transaction delay greater than or equal to the preset delay threshold may be that the average transaction delay of a predetermined number of consensus nodes in the consensus cluster is greater than or equal to the preset delay threshold.

其中,預定數量可以為共識集群中共識節點總數的10%,也可以為根據需要設置的其他數量。 Among them, the predetermined number can be 10% of the total number of consensus nodes in the consensus cluster, or can be other numbers set as required.

在本發明一些實施例中,集群調度節點可以直接基於集群性能參數來判斷該可用共識集群的集群性能參數是否滿足第一預設條件。 In some embodiments of the present invention, the cluster scheduling node may directly determine whether the cluster performance parameter of the available consensus cluster satisfies the first preset condition based on the cluster performance parameter.

在另一些實施例中,為了減少集群調度節點的資料處理量,判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件的具體方法還包括: In other embodiments, in order to reduce the data processing amount of the cluster scheduling node, the specific method for judging whether the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition further includes:

檢測回應時間最短的可用共識集群是否具有飽和狀態標記; Detect whether the available consensus cluster with the shortest response time has a saturation status flag;

在檢測到具有飽和狀態標記的情況下,確定回應時間最短的可用共識集群的集群性能參數滿足第一預設條件; In the case of detecting the saturation state flag, determine that the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition;

在檢測到不具有飽和狀態標記的情況下,確定回應時間最短的可用共識集群的集群性能參數不滿足第一預設條件。 In the case that it is detected that there is no saturation state flag, it is determined that the cluster performance parameter of the available consensus cluster with the shortest response time does not satisfy the first preset condition.

具體地,集群調度節點可以每隔一定時間判斷每個可用共識集群的集群性能參數是否滿足第一預設條件,並為集群性能參數滿足第一預設條件的可用共識集群添加飽和狀態標記。 Specifically, the cluster scheduling node may determine whether the cluster performance parameter of each available consensus cluster meets the first preset condition at regular intervals, and add a saturation status flag to the available consensus cluster whose cluster performance parameter meets the first preset condition.

在集群調度節點獲取了回應時間最短的可用共識集群之後,既可以通過飽和狀態標記判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件,進而可以減少集群調度節點的資料處理量,提高資料處理效率。 After the cluster scheduling node obtains the available consensus cluster with the shortest response time, it can judge whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition through the saturation status flag, thereby reducing the data processing of the cluster scheduling node to improve data processing efficiency.

在本發明一些實施例中,一個共識集群可以對應一個位置區域(即地理區域),一個位置區域可以對應至少一個共識集群,集群調度節點可以基於不同位置區域間由於經濟發展程度不同而可能導致所關 聯區塊鏈業務在活躍程度上的差異,實現負載均衡機制,為每個對等節點合理分配共識集群,從而實現將對等節點進行區域劃分,以解決單一共識集群的共識演算法性能限制而使該位置區域的交易共識處理能力飽和的情況。 In some embodiments of the present invention, one consensus cluster may correspond to one location area (ie, geographic area), one location area may correspond to at least one consensus cluster, and the cluster scheduling nodes may be based on different location areas due to different degrees of economic development. close Connect the differences in the activity level of the blockchain business, realize the load balancing mechanism, and reasonably allocate the consensus cluster for each peer node, so as to realize the regional division of the peer node, so as to solve the performance limitation of the consensus algorithm of a single consensus cluster. A situation that saturates the transaction consensus processing capacity of the location area.

圖6示出了本發明另一個實施例提供的區塊鏈系統的共識方法的流程示意圖。 FIG. 6 shows a schematic flowchart of a consensus method for a blockchain system provided by another embodiment of the present invention.

在本發明一些實施例中,圖6所示的方法可以由圖4所示的任一個共識集群執行。其中,共識集群可以包括至少一個共識節點,共識節點可以為伺服器或者伺服器集群。 In some embodiments of the present invention, the method shown in FIG. 6 may be performed by any one of the consensus clusters shown in FIG. 4 . The consensus cluster may include at least one consensus node, and the consensus node may be a server or a server cluster.

如圖6所示,該區塊鏈系統的共識方法可以包括: As shown in Figure 6, the consensus method of the blockchain system can include:

S610、接收目標對等節點發送的交易請求;其中,目標對等節點基於目標集群位址發送交易請求,目標集群位址根據目標對等節點的節點位置在至少一個可用共識集群中確定,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; S610. Receive a transaction request sent by the target peer node; wherein, the target peer node sends the transaction request based on the target cluster address, and the target cluster address is determined in at least one available consensus cluster according to the node location of the target peer node, and the available consensus The cluster is a consensus cluster in a normal working state in the blockchain system;

在本發明一些實施例中,目標對等節點可以為區塊鏈系統中的任意對等節點。例如,目標對等節點可以為圖4所示的區塊鏈系統中的任一個對等節點。 In some embodiments of the present invention, the target peer node may be any peer node in the blockchain system. For example, the target peer node can be any peer node in the blockchain system shown in FIG. 4 .

在本發明一些實施例中,共識集群所接收的交易請求的交易請求類型可以包括第一交易類型、第二交易類型和第三交易類型。其中,第一交易類型可以用於表徵交易請求為建立通道的交易請求,第二交易類型可以用於表徵交易請求為加入已有通道的交易請求,第三交易類型可以用於表徵交易請求為發起已有通道內的交易的交易請求。 In some embodiments of the present invention, the transaction request types of the transaction requests received by the consensus cluster may include a first transaction type, a second transaction type, and a third transaction type. The first transaction type can be used to represent that the transaction request is a channel establishment transaction request, the second transaction type can be used to represent that the transaction request is a transaction request to join an existing channel, and the third transaction type can be used to represent that the transaction request is an initiation A transaction request for a transaction in an existing channel.

S620、解析交易請求,得到交易請求資訊;其中,交易請求資訊包括交易資訊; S620, parse the transaction request, and obtain transaction request information; wherein, the transaction request information includes transaction information;

在本發明一些實施例中,共識集群可以對所接收的交易請求進行請求解析處理,得到交易請求所包含的交易請求資訊。 In some embodiments of the present invention, the consensus cluster may perform request analysis processing on the received transaction request to obtain transaction request information included in the transaction request.

在一些實施例中,交易請求資訊可以包括交易資訊,其 中,交易資訊為用於發起共識的資訊。在另一些實施例中,交易請求資訊可以包括交易請求類型。在又一些實施例中,交易請求資訊也可以包括目標通道資訊。在再一些實施例中,交易請求資訊還可以包括目標對等節點的節點位址,其中,節點位址包括目標對等節點的節點IP地址。在再一些實施例中,交易請求資訊還可以包括節點驗證資訊,其中,節點驗證資訊包括用於驗證目標對等節點的證書合法性的資訊。 In some embodiments, the transaction request information may include transaction information, which , transaction information is the information used to initiate consensus. In other embodiments, the transaction request information may include the transaction request type. In still other embodiments, the transaction request information may also include target channel information. In still other embodiments, the transaction request information may further include the node address of the target peer node, wherein the node address includes the node IP address of the target peer node. In still other embodiments, the transaction request information may further include node verification information, wherein the node verification information includes information for verifying the validity of the certificate of the target peer node.

需要說明的是,交易請求資訊中還可以包括其他用於輔助共識集群為目標對等節點進行交易共識的資訊,在此不做限制。 It should be noted that the transaction request information may also include other information used to assist the consensus cluster to conduct transaction consensus for the target peer node, which is not limited here.

S630、針對交易資訊發起共識; S630. Initiate a consensus on transaction information;

在本發明一些實施例中,共識集群可以基於單一的zookeeper共識演算法針對交易資訊發起共識。在本發明另一些實施例中,共識集群也可以基於支援的raft共識演算法針對交易資訊發起共識。在本發明其他實施例中,共識集群也可以基於其他共識演算法針對交易資訊發起共識,在此不做限制。 In some embodiments of the present invention, the consensus cluster may initiate consensus on transaction information based on a single zookeeper consensus algorithm. In other embodiments of the present invention, the consensus cluster can also initiate consensus on transaction information based on a supported raft consensus algorithm. In other embodiments of the present invention, the consensus cluster may also initiate consensus on transaction information based on other consensus algorithms, which is not limited herein.

S640、在共識成功的情況下,執行交易資訊對應的交易。 S640. In the case that the consensus is successful, execute the transaction corresponding to the transaction information.

在本發明實施例中,共識集群能夠接收基於節點位置分配的目標對等節點發送的交易請求,以通過節點位置實現對等節點的分流,使不同的對等節點可以基於其節點位置匹配不同的共識集群,從而可以利用多個共識集群並行對大量的對等節點進行共識,提高了區塊鏈系統的輸送量,進而能夠滿足大量節點接入時區塊鏈系統對高輸送量的需求。 同時,即使參與節點增多,區塊鏈系統的擴展性能也可以繼續保持。 In the embodiment of the present invention, the consensus cluster can receive transaction requests sent by target peer nodes based on node location allocation, so as to realize the distribution of peer nodes based on node locations, so that different peer nodes can match different peer nodes based on their node locations. Consensus clustering, so that multiple consensus clusters can be used to achieve consensus on a large number of peer nodes in parallel, which improves the transmission capacity of the blockchain system, and thus can meet the demand for high transmission capacity of the blockchain system when a large number of nodes are connected. At the same time, even if the number of participating nodes increases, the scalability of the blockchain system can continue to be maintained.

下面將詳細介紹S630的具體實現方式。 The specific implementation of the S630 will be described in detail below.

本發明一些實施例中,為了提高共識集群的資料處理效率,交易請求資訊還可以包括交易請求類型。 In some embodiments of the present invention, in order to improve the data processing efficiency of the consensus cluster, the transaction request information may further include a transaction request type.

在這些實施例中,可選地,針對交易資訊發起共識的具體方法可以包括: In these embodiments, optionally, a specific method for initiating consensus on transaction information may include:

在交易請求類型為第一交易類型的情況下,針對交易資訊發起共識。 When the transaction request type is the first transaction type, a consensus is initiated for transaction information.

具體地,在針對交易資訊發起共識之前,可以首先判斷交易請求的交易請求類型,如果交易請求類型為第一交易類型,即交易請求可以為表徵建立通道的交易請求,則可以直接針對交易資訊發起共識,進而提高共識集群的資料處理效率。 Specifically, before initiating a consensus on the transaction information, the transaction request type of the transaction request can be determined first. If the transaction request type is the first transaction type, that is, the transaction request can be a transaction request representing the establishment of a channel, it can be directly initiated on the transaction information. consensus, thereby improving the data processing efficiency of the consensus cluster.

在本發明另一些實施例中,為了提高共識集群的可靠性,交易請求資訊還可以包括目標通道資訊。 In other embodiments of the present invention, in order to improve the reliability of the consensus cluster, the transaction request information may further include target channel information.

在這些實施例中,可選地,解析交易請求得到交易請求資訊之後,該區塊鏈系統的共識方法還可以包括: In these embodiments, optionally, after parsing the transaction request to obtain the transaction request information, the consensus method of the blockchain system may further include:

在交易請求類型不是第一交易類型的情況下,獲取目標通道資訊; If the transaction request type is not the first transaction type, obtain the target channel information;

在目標通道清單中查詢目標通道資訊;其中,目標通道清單為本機存放區的通道清單,目標通道清單中可以包括多個第一通道資訊,每個第一通道資訊可以根據一個本地建立的通道的屬性資訊生成。 Query the target channel information in the target channel list; wherein, the target channel list is the channel list in the local storage area, the target channel list can include multiple first channel information, and each first channel information can be based on a locally established channel. Attribute information is generated.

在這些實施例中,可選地,針對所述交易資訊發起共識的具體方法可以包括: In these embodiments, optionally, a specific method for initiating consensus on the transaction information may include:

在查詢到目標通道資訊的情況下,針對交易資訊發起共識。 When the target channel information is queried, a consensus is initiated for the transaction information.

具體地,在針對交易資訊發起共識之前,在解析交易請求得到交易請求資訊之後,可以首先判斷交易請求的交易請求類型,如果交易請求類型不是第一交易類型,而是第二交易類型或第三交易類型,即交易請求為加入已有通道的交易請求或發起已有通道內的交易的交易請求,則需要進一步在本機存放區的目標通道清單中的多個根據本地建立的通道的屬性資訊生成的第一通道資訊中查詢目標通道資訊,如果在目標通道清單中的多個第一通道資訊中查詢到目標通道資訊,則可以針對交易資訊發起共識,進而可以避免共識集群處理其他共識集群對應的交易請求,提高共識集群的可靠性。 Specifically, before initiating a consensus on the transaction information, after parsing the transaction request to obtain the transaction request information, the transaction request type of the transaction request can be determined first. If the transaction request type is not the first transaction type, but the second transaction type or the third transaction type The transaction type, that is, the transaction request is a transaction request for joining an existing channel or a transaction request for initiating a transaction in an existing channel, then further attribute information of multiple locally established channels in the target channel list in the local storage area is required. Query the target channel information in the generated first channel information. If the target channel information is queried from multiple first channel information in the target channel list, a consensus can be initiated on the transaction information, thereby preventing the consensus cluster from processing other consensus clusters. transaction requests, improving the reliability of the consensus cluster.

在這些實施例中,本機存放區的通道清單指的是目標集 群位址對應的共識集群中所存儲的通道清單,本地建立的通道指的是目標集群位址對應的共識集群所建立的通道。當目標對等節點想要加入一個已有通道或者發起已有通道內的交易時,僅能通過建立該已有通道的共識集群發起共識,因此,交易請求類型不是第一交易類型,而是第二交易類型或第三交易類型,則需要通過交易請求資訊中的目標通道資訊確定目標對等節點所針對的已有通道是否為該共識集群所建立的通道,由於目標通道資訊中僅會存儲該共識集群所建立的通道對應的通道資訊,如果在目標通道清單中查詢目標通道資訊,則說明目標對等節點所針對的已有通道為該共識集群所建立的通道,則可以針對交易資訊發起共識。 In these embodiments, the local repository's channel list refers to the target set The list of channels stored in the consensus cluster corresponding to the group address. The locally established channel refers to the channel established by the consensus cluster corresponding to the target cluster address. When the target peer node wants to join an existing channel or initiate a transaction in the existing channel, it can only initiate consensus through the consensus cluster that established the existing channel. Therefore, the transaction request type is not the first transaction type, but the first transaction type. For the second transaction type or the third transaction type, it is necessary to determine whether the existing channel targeted by the target peer node is the channel established by the consensus cluster through the target channel information in the transaction request information, because the target channel information will only store the channel. Channel information corresponding to the channel established by the consensus cluster. If the target channel information is queried in the target channel list, it means that the existing channel targeted by the target peer node is the channel established by the consensus cluster, and a consensus can be initiated for transaction information. .

在另一些實施例中,在目標通道清單中查詢目標通道資訊之後,該區塊鏈系統的共識方法還可以包括: In other embodiments, after querying the target channel information in the target channel list, the consensus method of the blockchain system may further include:

在未查詢到目標通道資訊的情況下,根據目標通道資訊,生成位址查詢請求; If the target channel information is not queried, generate an address query request according to the target channel information;

向通道協同節點發送位址查詢請求;其中,位址查詢請求用於使通道協同節點查詢目標通道資訊對應的集群位址。 Send an address query request to the channel coordination node; wherein, the address query request is used to enable the channel coordination node to query the cluster address corresponding to the target channel information.

具體地,共識集群在預設通道清單中查詢目標通道資訊之後,如果在預設通道清單中未查詢到目標通道資訊,則可以確定該交易請求為其他共識集群對應的交易請求,則可以生成該目標通道資訊對應的位址查詢請求,並且向通道協同節點發送位址查詢請求,使通道協同節點回應於位址查詢請求查詢目標通道資訊對應的集群位址。 Specifically, after the consensus cluster queries the target channel information in the preset channel list, if the target channel information is not queried in the preset channel list, it can be determined that the transaction request is a transaction request corresponding to other consensus clusters, and the transaction request can be generated. The address query request corresponding to the target channel information is sent to the channel coordination node, so that the channel coordination node queries the cluster address corresponding to the target channel information in response to the address query request.

在本發明一些實施例中,在向通道協同節點發送位址查詢請求之後,該區塊鏈系統的共識方法還可以包括: In some embodiments of the present invention, after sending the address query request to the channel coordination node, the consensus method of the blockchain system may further include:

接收通道協同節點回饋的目標通道資訊對應的集群位址; Receive the cluster address corresponding to the target channel information returned by the channel coordination node;

向目標對等節點發送目標通道資訊對應的集群位址。 Send the cluster address corresponding to the target channel information to the target peer node.

在這些實施例中,通道協同節點可以在查詢到目標通道資訊對應的集群位址之後,向發送該位址查詢請求的共識集群回饋目標通道資訊對應的集群位址。共識集群接收到通道協同節點回饋的目標通道資 訊對應的集群位址之後,可以將目標通道資訊對應的集群位址發送給目標對等節點,使目標對等節點基於目標通道資訊對應的集群位址向正確的共識集群重新發送交易請求,進而保證區塊鏈系統的可靠性。 In these embodiments, after querying the cluster address corresponding to the target channel information, the channel coordination node may return the cluster address corresponding to the target channel information to the consensus cluster that sent the address query request. The consensus cluster receives the target channel information returned by the channel coordination node. After the cluster address corresponding to the target channel information, the cluster address corresponding to the target channel information can be sent to the target peer node, so that the target peer node can resend the transaction request to the correct consensus cluster based on the cluster address corresponding to the target channel information, and then Ensure the reliability of the blockchain system.

在本發明另一些實施例中,位址查詢請求還可以攜帶有目標對等節點的節點位址,通道協同節點可以在查詢到目標通道資訊對應的集群位址之後,可以直接基於節點位址,向目標對等節點回饋的目標通道資訊對應的集群位址,進而減少資訊轉發次數,提高對目標對等節點的交易請求的回應速度。 In other embodiments of the present invention, the address query request may also carry the node address of the target peer node, and the channel coordination node may directly base on the node address after querying the cluster address corresponding to the target channel information. The cluster address corresponding to the target channel information returned to the target peer node, thereby reducing the number of information forwarding and improving the response speed to the transaction request of the target peer node.

需要說明的是,通道協同節點回應於位址查詢請求回饋目標通道資訊對應的集群位址的具體方法將在下文詳細說明,在此不做贅述。 It should be noted that the specific method for the channel coordination node to return the cluster address corresponding to the target channel information in response to the address query request will be described in detail below, and will not be repeated here.

在這些實施例中,由於目標通道資訊中僅會存儲該共識集群所建立的通道對應的通道資訊,如果在目標通道清單中未查詢目標通道資訊,則說明目標對等節點所針對的已有通道不是該共識集群所建立的通道,則需要通過通道協同節點為其查找建立該已有通道的共識集群的集群地址。 In these embodiments, since only the channel information corresponding to the channel established by the consensus cluster is stored in the target channel information, if the target channel information is not queried in the target channel list, it indicates the existing channel targeted by the target peer node If it is not the channel established by the consensus cluster, the channel coordination node needs to find the cluster address of the consensus cluster that established the existing channel for it.

在本發明一些實施例中,目標通道資訊為目標雜湊值,目標雜湊值根據交易請求對應的目標通道的屬性資訊生成;目標通道清單為目標雜湊表,目標雜湊表包括多個第一雜湊值,每個第一雜湊值根據一個本地建立的通道的屬性資訊生成。 In some embodiments of the present invention, the target channel information is a target hash value, and the target hash value is generated according to attribute information of the target channel corresponding to the transaction request; the target channel list is a target hash table, and the target hash table includes a plurality of first hash values, Each first hash value is generated based on attribute information of a locally established channel.

具體地,在共識集群每創建一個通道時,該共識集群可以將所創建的通道的屬性資訊通過預設雜湊演算法轉換為唯一的雜湊值,並作為第一雜湊值存儲在該共識集群的目標雜湊表中。 Specifically, each time the consensus cluster creates a channel, the consensus cluster can convert the attribute information of the created channel into a unique hash value through a preset hash algorithm, and store it as the first hash value in the target of the consensus cluster in the hash table.

在共識集群針對交易資訊發起共識之前,在解析交易請求得到交易請求資訊之後,如果交易請求類型不是第一交易類型,則需要進一步在目標雜湊表的多個第一雜湊值中查詢目標雜湊值。如果查詢到目標雜湊值,則可以針對交易資訊發起共識;如果未查詢到目標雜湊值,則 可以確定該交易請求為其他共識集群對應的交易請求。 Before the consensus cluster initiates a consensus on the transaction information, after parsing the transaction request to obtain the transaction request information, if the transaction request type is not the first transaction type, it is necessary to further query the target hash value among the multiple first hash values in the target hash table. If the target hash value is queried, a consensus can be initiated for transaction information; if the target hash value is not queried, then It can be determined that the transaction request is a transaction request corresponding to other consensus clusters.

由此,在本發明實施例中,每個通道對應的通道資訊可以對應一個雜湊值,可以提高利用通道資訊的安全性,進而提高區塊鏈系統的安全性。 Therefore, in the embodiment of the present invention, the channel information corresponding to each channel may correspond to a hash value, which can improve the security of using the channel information, thereby improving the security of the blockchain system.

在本發明一些實施例中,屬性資訊包括下列中的至少一項: In some embodiments of the present invention, the attribute information includes at least one of the following:

通道名稱、通道創建者、通道創建時間。 Channel name, channel creator, channel creation time.

在一些實施例中,屬性資訊可以包括通道名稱、通道創建者和通道創建時間中的任意一個。在另一些實施例中,屬性資訊還可以包括通道名稱、通道創建者和通道創建時間中的任意兩個。在又一些實施例中,屬性資訊也可以包括通道名稱、通道創建者和通道創建時間。 In some embodiments, the attribute information may include any one of channel name, channel creator, and channel creation time. In other embodiments, the attribute information may further include any two of channel name, channel creator and channel creation time. In still other embodiments, the attribute information may also include channel name, channel creator and channel creation time.

在一些實施例中,通道創建者可以通過請求創建通道的對等節點的節點IP位址表示。在另一些實施例中,通道創建者也可以通過請求創建通道的的對等節點的公開金鑰表示,在此不做限制。 In some embodiments, the channel creator may be represented by the node IP address of the peer node requesting to create the channel. In other embodiments, the channel creator may also request the public key representation of the peer node that creates the channel, which is not limited herein.

在一些實施例中,通道創建時間可以為通道創建的時間戳記。 In some embodiments, the channel creation time may be the timestamp of the channel creation.

圖7示出了本發明又一個實施例提供的區塊鏈系統的共識方法的流程示意圖。 FIG. 7 shows a schematic flowchart of a consensus method of a blockchain system provided by another embodiment of the present invention.

在本發明一些實施例中,圖7所示的方法可以由圖4所示的任一個通道協同節點執行。其中,通道協同節點可以為伺服器或者伺服器集群。 In some embodiments of the present invention, the method shown in FIG. 7 may be executed by any one of the channel coordination nodes shown in FIG. 4 . The channel coordination node may be a server or a server cluster.

如圖7所示,該區塊鏈系統的共識方法可以包括: As shown in Figure 7, the consensus method of the blockchain system can include:

S710、接收目標共識集群發送的位址查詢請求;其中,位址查詢請求根據目標共識集群所接收的交易請求所攜帶的目標通道資訊生成。 S710. Receive an address query request sent by the target consensus cluster; wherein, the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster.

在本發明一些實施例中,目標共識集群可以為區塊鏈系統中的任意共識集群。例如,目標共識集群可以為圖4所示的區塊鏈系統 中的任一個共識集群。 In some embodiments of the present invention, the target consensus cluster may be any consensus cluster in the blockchain system. For example, the target consensus cluster can be the blockchain system shown in Figure 4 Any of the consensus clusters in the .

S720、解析位址查詢請求,得到位址查詢請求資訊;其中,位址查詢請求資訊包括目標通道資訊。 S720. Parse the address query request to obtain address query request information, wherein the address query request information includes target channel information.

在一些實施例中,位址查詢請求資訊可以包括目標通道資訊。在另一些實施例中,位址查詢請求資訊還可以包括節點位址,其中,節點位址可以為向目標共識集群發送交易請求的對等節點的節點位址,節點位址可以包括對等節點的節點IP位址。在又一些實施例中,位址查詢請求資訊還可以包括目標共識集群的集群位址,其中,目標共識集群的集群位址可以包括目標共識集群的集群IP位址。 In some embodiments, the address query request information may include target channel information. In other embodiments, the address query request information may further include a node address, where the node address may be the node address of the peer node that sends the transaction request to the target consensus cluster, and the node address may include the peer node the node IP address. In still other embodiments, the address query request information may further include the cluster address of the target consensus cluster, wherein the cluster address of the target consensus cluster may include the cluster IP address of the target consensus cluster.

需要說明的是,位址查詢請求資訊中還可以包括其他用於次要通道協同節點為查詢集群位址的資訊,在此不做限制。 It should be noted that, the address query request information may also include other information for the secondary channel cooperating node to query the cluster address, which is not limited here.

S730、在分散式資料庫中,查詢目標通道資訊對應的集群位址; S730. In the distributed database, query the cluster address corresponding to the target channel information;

在本發明一些實施例中,分散式資料庫中可以存儲有區塊鏈系統中的至少一個第二通道資訊,分散式資料庫中的每個子資料庫存儲于一個共識集群對應的預設通道協同節點中,使得各個預設通道協同節點可以基於分散式資料庫的協定在分散式資料庫中,查詢存儲有目標通道資訊的目標通道協同節點,並將目標通道協同節點對應的共識集群的集群位址作為目標通道資訊對應的集群位址。 In some embodiments of the present invention, the distributed database may store at least one second channel information in the blockchain system, and each sub-database in the distributed database is stored in a preset channel corresponding to a consensus cluster for coordination In the node, each preset channel coordination node can query the target channel coordination node storing the target channel information in the distributed database based on the agreement of the distributed database, and set the cluster bit of the consensus cluster corresponding to the target channel coordination node. address as the cluster address corresponding to the target channel information.

其中,一個第二通道資訊對應區塊鏈系統中的一個已有通道。預設通道協同節點為區塊鏈系統中用於維護分散式資料庫的節點,一個預設通道協同節點對應一個共識集群。 Among them, a second channel information corresponds to an existing channel in the blockchain system. A preset channel coordination node is a node in the blockchain system for maintaining a distributed database, and a preset channel coordination node corresponds to a consensus cluster.

需要說明的是,每個共識集群建立新的通道以後,會將該通道的路由資訊發送給該共識集群對應的預設通道協同節點,每個預設通道協同節點中可以存儲分散式資料庫中屬於該預設通道協同節點的子資料庫,各個預設通道協同節點基於分散式資料庫查找存儲有目標通道資訊的目標通道協同節點的方法可以利用已有的分散式資料庫的查詢方法實 現,即在相鄰的共識集群對應的預設通道協同節點之間轉發位址查詢請求,以使接收到位址查詢請求的預設通道協同節點在本機存放區的子資料庫中查詢該目標通道資訊,以實現對目標通道協同節點的查詢,在此不做贅述。 It should be noted that after each consensus cluster establishes a new channel, the routing information of the channel will be sent to the preset channel coordination node corresponding to the consensus cluster, and each preset channel coordination node can be stored in a distributed database. Belonging to the sub-database of the preset channel coordination node, the method for each preset channel coordination node to search for the target channel coordination node storing the target channel information based on the distributed database can be realized by using the query method of the existing distributed database. Now, the address query request is forwarded between the preset channel cooperating nodes corresponding to the adjacent consensus clusters, so that the preset channel cooperating node that receives the address query request can query the target in the sub-database of the local storage area. Channel information, in order to realize the query of the target channel cooperative node, which will not be repeated here.

S740、在位址查詢請求資訊還包括節點位址的情況下,向節點位址對應的對等節點發送目標通道資訊對應的集群位址。 S740. If the address query request information further includes the node address, send the cluster address corresponding to the target channel information to the peer node corresponding to the node address.

具體地,位址查詢請求還可以根據節點位址生成,使位址查詢請求攜帶有節點位址,進而使位址查詢請求資訊包括節點位址。此時,通道協同節點在查詢到目標通道資訊對應的集群位址之後,可以直接基於節點位址,向節點位址對應的對等節點發送目標通道資訊對應的集群位址,進而使該對等節點基於目標通道資訊對應的集群位址向正確的共識集群重新發送交易請求。 Specifically, the address query request may also be generated according to the node address, so that the address query request carries the node address, and then the address query request information includes the node address. At this time, after querying the cluster address corresponding to the target channel information, the channel coordination node can directly send the cluster address corresponding to the target channel information to the peer node corresponding to the node address based on the node address, so as to make the peer The node resends the transaction request to the correct consensus cluster based on the cluster address corresponding to the target channel information.

由此,通道協同節點可以直接向對等節點發送目標通道資訊對應的集群位址,提高對對等節點的回應速度。 Therefore, the channel coordination node can directly send the cluster address corresponding to the target channel information to the peer node, thereby improving the response speed to the peer node.

在本發明實施例中,對於跨共識集群的交易請求,可以通過通道協同節點查詢交易請求對應的共識集群的集群位址,從而保障跨共識集群的交易請求的有序進行,提高區塊鏈系統的可靠性。 In the embodiment of the present invention, for a transaction request across consensus clusters, the cluster address of the consensus cluster corresponding to the transaction request can be inquired through the channel coordination node, thereby ensuring the orderly progress of transaction requests across consensus clusters and improving the blockchain system. reliability.

下面將詳細介紹S730的具體實現方式。 The specific implementation of the S730 will be described in detail below.

在本發明一些實施例中,目標通道資訊為目標雜湊值,目標雜湊值根據交易請求對應的目標通道的屬性資訊生成;分散式資料庫包括分散式雜湊表,分散式雜湊表包括多個第二雜湊值,每個第二雜湊值根據區塊鏈系統中的一個通道的屬性資訊生成。 In some embodiments of the present invention, the target channel information is a target hash value, and the target hash value is generated according to attribute information of the target channel corresponding to the transaction request; the distributed database includes a distributed hash table, and the distributed hash table includes a plurality of second Hash value, each second hash value is generated according to the attribute information of a channel in the blockchain system.

在這些實施例中,可選地,S730的具體方法可以包括: In these embodiments, optionally, the specific method of S730 may include:

基於分散式雜湊表,在多個預設通道協同節點中,查詢存儲有目標雜湊值的目標通道協同節點;其中,預設通道協同節點為區塊鏈系統中用於維護分散式雜湊表的節點,一個預設通道協同節點對應一個共識集群; Based on the distributed hash table, among multiple preset channel coordination nodes, query the target channel coordination node that stores the target hash value; wherein, the preset channel coordination node is a node used to maintain the distributed hash table in the blockchain system , a preset channel coordination node corresponds to a consensus cluster;

將目標通道協同節點對應的共識集群的集群位址,作為目標通道資訊對應的集群位址。 Use the cluster address of the consensus cluster corresponding to the target channel coordination node as the cluster address corresponding to the target channel information.

具體地,一個第二雜湊值對應一個通道,每個共識集群建立新的通道以後,可以利用該通道的屬性資訊生成該通道對應的雜湊值,然後將該通道對應的雜湊值發送給該共識集群對應的預設通道協同節點,預設通道協同節點會將接收到的雜湊值作為第二雜湊值存儲在分散式雜湊表中。 Specifically, a second hash value corresponds to a channel. After each consensus cluster establishes a new channel, it can use the attribute information of the channel to generate the hash value corresponding to the channel, and then send the hash value corresponding to the channel to the consensus cluster. The corresponding preset channel coordination node, the preset channel coordination node will store the received hash value as the second hash value in the distributed hash table.

每個預設通道協同節點中可以存儲分散式雜湊表中屬於該預設通道協同節點的雜湊子表,各個預設通道協同節點基於分散式雜湊表查找存儲有目標通道資訊的目標通道協同節點的方法可以利用已有的分散式雜湊表的查詢方法實現,即由於目標共識集群相對應的通道協同節點開始,在相鄰的共識集群對應的預設通道協同節點之間轉發位址查詢請求,以使接收到位址查詢請求的預設通道協同節點解析位址查詢請求中的目標雜湊值後,然後將解析得到的目標雜湊值與在本機存放區的雜湊子表中的各個第二雜湊值進行對比,進而確定目標雜湊值是否存在於本機存放區的雜湊子表中,如果存在於本機存放區的雜湊子表中,則該預設通道協同節點可以確定其為目標通道協同節點,並將其對應的共識集群的集群位址回饋給向其發送位址查詢請求的通道協同節點,最終返回至需要查詢目標通道資訊對應的集群位址的通道協同節點,即與目標共識集群相對應的通道協同節點。當與目標共識集群相對應的通道協同節點接收到目標通道協同節點對應的共識集群的集群位址後,可以將其作為目標通道資訊對應的集群位址。 Each preset channel coordination node can store a hash sub-table belonging to the preset channel coordination node in the distributed hash table, and each preset channel coordination node searches for the target channel coordination node that stores the target channel information based on the distributed hash table. The method can be implemented by using the existing distributed hash table query method, that is, since the channel coordination node corresponding to the target consensus cluster starts, the address query request is forwarded between the preset channel coordination nodes corresponding to the adjacent consensus clusters, so as to After the preset channel cooperating node that receives the address query request parses the target hash value in the address query request, the target hash value obtained by parsing is compared with each second hash value in the hash sub-table in the local storage area. Compare, and then determine whether the target hash value exists in the hash sub-table of the local storage area, and if it exists in the hash sub-table of the local storage area, the preset channel coordination node can determine that it is the target channel coordination node, and The cluster address of the corresponding consensus cluster is fed back to the channel coordination node that sent the address query request to it, and finally returned to the channel coordination node that needs to query the cluster address corresponding to the target channel information, that is, the channel coordination node corresponding to the target consensus cluster. Channel cooperating node. After the channel coordination node corresponding to the target consensus cluster receives the cluster address of the consensus cluster corresponding to the target channel coordination node, it can be used as the cluster address corresponding to the target channel information.

在本發明實施例中,分散式雜湊表可以為基於Kademlia協議的分散式雜湊表,也可以為基於其他協議的分散式雜湊表,在此不做限制。 In this embodiment of the present invention, the distributed hash table may be a distributed hash table based on the Kademlia protocol, or may be a distributed hash table based on other protocols, which is not limited herein.

在本發明一些實施例中,屬性資訊包括下列中的至少一項: In some embodiments of the present invention, the attribute information includes at least one of the following:

通道名稱、通道創建者、通道創建時間。 Channel name, channel creator, channel creation time.

其中,屬性資訊已在上文說明,在此不做贅述。以上為S730的具體實現方式。 The attribute information has been described above and will not be repeated here. The above is the specific implementation manner of the S730.

在本發明一些實施例中,在S730之後,該區塊鏈系統的共識方法還可以包括: In some embodiments of the present invention, after S730, the consensus method of the blockchain system may further include:

在位址查詢請求資訊不包括節點位址的情況下,向目標共識集群發送目標通道資訊對應的集群位址。 If the address query request information does not include the node address, send the cluster address corresponding to the target channel information to the target consensus cluster.

具體地,位址查詢請求還可以不根據節點位址生成,使位址查詢請求不攜帶節點位址,進而使位址查詢請求資訊不包括節點位址。此時,通道協同節點在查詢到目標通道資訊對應的集群位址之後,可以基於目標共識集群的集群位址,向目標共識集群發送目標通道資訊對應的集群位址,以使目標共識集群將目標通道資訊對應的集群位址轉發至發送該攜帶有目標通道資訊的交易請求的對等節點,進而使該對等節點基於目標通道資訊對應的集群位址向正確的共識集群重新發送交易請求。 Specifically, the address query request may not be generated according to the node address, so that the address query request does not carry the node address, and thus the address query request information does not include the node address. At this time, after querying the cluster address corresponding to the target channel information, the channel coordination node can send the cluster address corresponding to the target channel information to the target consensus cluster based on the cluster address of the target consensus cluster, so that the target consensus cluster can transfer the target channel information to the target consensus cluster. The cluster address corresponding to the channel information is forwarded to the peer node that sent the transaction request carrying the target channel information, so that the peer node resends the transaction request to the correct consensus cluster based on the cluster address corresponding to the target channel information.

由此,通道協同節點可以通過目標共識集群向對等節點轉發目標通道資訊對應的集群位址,以減少位址查詢請求所攜帶的資料量。 Therefore, the channel coordination node can forward the cluster address corresponding to the target channel information to the peer node through the target consensus cluster, so as to reduce the amount of data carried by the address query request.

以基於區塊鏈系統的供應鏈溯源場景為例,假設地區A的生產企業B需要將所生產產品分銷至地區C的經銷企業D,並需要在區塊鏈上對貨物進行追蹤。為不失一般性,假設生產企業A所分配的共識集群為共識集群O1,並通過共識集群O1首先建立通道E。此後,經銷企業B向集群調度節點所分配的共識集群O2發起加入該通道E的交易請求。由於共識集群O2不含有通道E相關資訊,無法處理該交易請求,因此,向通道協同節點發送位址查詢請求。通道協同節點在通道協同層的各個通道協同節點之間轉發位址查詢請求(最終至共識集群O1)並查找到該通道對應的共識集群O1的集群位址,最終返回對應集群位址給經銷企業B,B更新通道E所對應的集群位址。此後,生產企業A與經銷企業B可以基於通 道E對應的集群位址正常溝通創建符合雙方業務需求和利益的具體智慧合約,協同開展供應鏈溯源業務。 Taking the supply chain traceability scenario based on the blockchain system as an example, suppose that the production company B in region A needs to distribute the produced products to the distribution company D in region C, and the goods need to be tracked on the blockchain. Without loss of generality, it is assumed that the consensus cluster allocated by production enterprise A is consensus cluster O1, and channel E is first established through consensus cluster O1. Thereafter, the distribution enterprise B initiates a transaction request to join the channel E to the consensus cluster O2 allocated by the cluster scheduling node. Since the consensus cluster O2 does not contain information related to channel E, it cannot process the transaction request. Therefore, an address query request is sent to the channel cooperating node. The channel coordination node forwards the address query request (finally to the consensus cluster O1) between the channel coordination nodes of the channel coordination layer, finds the cluster address of the consensus cluster O1 corresponding to the channel, and finally returns the corresponding cluster address to the distribution company. B, B updates the cluster address corresponding to channel E. After that, production enterprise A and distribution enterprise B can The cluster address corresponding to Road E communicates normally to create a specific smart contract that meets the business needs and interests of both parties, and collaborates to carry out the supply chain traceability business.

綜上所述,通道協同節點可以實現面向通道的共識集群動態切換機制,能夠在多共識集群調度基礎上保障區塊鏈交易在全域任一可用共識集群中的存續與流轉,並最終上鏈,保證區塊鏈系統的安全性與完備性。 To sum up, the channel coordination node can realize a channel-oriented consensus cluster dynamic switching mechanism, which can ensure the existence and circulation of blockchain transactions in any available consensus cluster in the whole domain on the basis of multi-consensus cluster scheduling, and finally go to the chain. Ensure the security and completeness of the blockchain system.

圖8示出了本發明再一個實施例提供的區塊鏈系統的共識方法的流程示意圖。 FIG. 8 shows a schematic flowchart of a consensus method for a blockchain system provided by yet another embodiment of the present invention.

在本發明一些實施例中,圖8所示的方法可以由圖4所示的任一個對等節點執行。其中,對等節點可以為伺服器或者伺服器集群。 In some embodiments of the present invention, the method shown in FIG. 8 may be performed by any of the peer nodes shown in FIG. 4 . The peer node may be a server or a server cluster.

如圖8所示,該區塊鏈系統的共識方法可以包括: As shown in Figure 8, the consensus method of the blockchain system can include:

S810、向集群調度節點發送共識集群路由請求,使集群調度節點回應于共識集群路由請求,根據共識集群路由請求的路由請求資訊中包括的節點位置,在至少一個可用共識集群中確定目標共識集群,並回饋目標共識集群對應的目標集群位址;其中,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; S810. Send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, and determines the target consensus cluster in at least one available consensus cluster according to the node location included in the routing request information of the consensus cluster routing request, And return the target cluster address corresponding to the target consensus cluster; among them, the available consensus cluster is the consensus cluster in the normal working state in the blockchain system;

S820、接收集群調度節點回饋的目標集群位址; S820. Receive the target cluster address returned by the cluster scheduling node;

S830、基於目標集群位址,向目標共識集群發送交易請求。 S830. Based on the target cluster address, send a transaction request to the target consensus cluster.

在本發明實施例中,能夠通過節點位置實現對等節點的分流,使不同的對等節點可以基於其節點位置匹配不同的共識集群,從而可以利用多個共識集群並行對大量的對等節點進行共識,提高了區塊鏈系統的輸送量,進而能夠滿足區塊鏈系統對高輸送量的需求。 In the embodiment of the present invention, the distribution of peer nodes can be realized by the node location, so that different peer nodes can match different consensus clusters based on their node locations, so that a large number of peer nodes can be processed in parallel by using multiple consensus clusters. Consensus increases the transmission volume of the blockchain system, which in turn can meet the demand for high transmission volume of the blockchain system.

在本發明一些實施例中,在交易請求的交易請求類型是第一交易類型的情況下,目標共識集群可以直接基於交易請求發起共識。 In some embodiments of the present invention, when the transaction request type of the transaction request is the first transaction type, the target consensus cluster may initiate consensus directly based on the transaction request.

在本發明另一些實施例中,交易請求中可以攜帶有該交易請求對應的目標通道的目標通道資訊,在S830之後,該區塊鏈系統的共 識方法還可以包括: In other embodiments of the present invention, the transaction request may carry the target channel information of the target channel corresponding to the transaction request. After S830, the total number of the blockchain system Recognition methods can also include:

在交易請求的交易請求類型不是第一交易類型的情況下,接收目標共識集群或通道協同節點回饋的目標通道資訊對應的集群位址; If the transaction request type of the transaction request is not the first transaction type, receive the cluster address corresponding to the target channel information returned by the target consensus cluster or channel coordination node;

基於目標通道資訊對應的集群位址,向交易請求對應的目標通道所屬的共識集群發送交易請求。 Based on the cluster address corresponding to the target channel information, a transaction request is sent to the consensus cluster to which the target channel corresponding to the transaction request belongs.

綜上所述,本發明實施例能夠滿足大量區塊鏈節點接入時對區塊鏈系統的高輸送量需求,通過多共識集群的共識架構和共識調度機制,使得區塊鏈系統性能得到並行的提升,輸送量大大提高。 To sum up, the embodiment of the present invention can meet the high throughput demand of the blockchain system when a large number of blockchain nodes are connected, and the performance of the blockchain system can be parallelized through the consensus architecture and consensus scheduling mechanism of the multi-consensus cluster. The improvement of the conveying capacity is greatly improved.

圖9示出了本發明一個實施例提供的區塊鏈系統的共識裝置的結構示意圖。 FIG. 9 shows a schematic structural diagram of a consensus apparatus of a blockchain system provided by an embodiment of the present invention.

在本發明一些實施例中,圖9所示的裝置可以設置於圖4所示的集群調度節點內。其中,集群調度節點可以為伺服器或者伺服器集群。 In some embodiments of the present invention, the apparatus shown in FIG. 9 may be set in the cluster scheduling node shown in FIG. 4 . The cluster scheduling node may be a server or a server cluster.

如圖9所示,該區塊鏈系統的共識裝置可以包括: As shown in Figure 9, the consensus device of the blockchain system may include:

第一接收模組910,用於接收目標對等節點發送的共識集群路由請求; The first receiving module 910 is configured to receive the consensus cluster routing request sent by the target peer node;

第一解析模組920,用於解析共識集群路由請求,得到路由請求資訊;其中,路由請求資訊包括目標對等節點的節點位置; The first parsing module 920 is used for parsing the consensus cluster routing request to obtain routing request information; wherein, the routing request information includes the node location of the target peer node;

第一確定模組930,用於根據節點位置,在至少一個可用共識集群中,確定目標共識集群;其中,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; The first determination module 930 is used for determining a target consensus cluster in at least one available consensus cluster according to the position of the node; wherein, the available consensus cluster is a consensus cluster in a normal working state in the blockchain system;

第一發送模組940,用於向目標對等節點發送目標共識集群的目標集群位址。 The first sending module 940 is configured to send the target cluster address of the target consensus cluster to the target peer node.

在本發明實施例中,能夠基於目標對等節點發送的共識集群路由請求所攜帶的目標對等節點的節點位置,為在區塊鏈系統的至少一個處於正常工作狀態的可用共識集群中,為目標對等節點分配目標共識 集群,並且向目標對應節點發送目標共識集群的目標集群位址,以通過節點位置實現對等節點的分流,使不同的對等節點可以基於其節點位置匹配不同的共識集群,從而可以利用多個共識集群並行對大量的對等節點進行共識,提高了區塊鏈系統的輸送量,進而能夠滿足區塊鏈系統對高輸送量的需求。 In the embodiment of the present invention, the node location of the target peer node carried in the consensus cluster routing request sent by the target peer node is in at least one available consensus cluster in the normal working state of the blockchain system, and is Target peers assign target consensus cluster, and send the target cluster address of the target consensus cluster to the target corresponding node, so as to realize the shunting of peer nodes by node location, so that different peer nodes can match different consensus clusters based on their node locations, so that multiple The consensus cluster performs consensus on a large number of peer nodes in parallel, which improves the transmission capacity of the blockchain system, which in turn can meet the demand for high transmission capacity of the blockchain system.

在本發明一些實施例中,第一確定模組930具體用於: In some embodiments of the present invention, the first determination module 930 is specifically used for:

獲取每個可用共識集群的集群位置; Get the cluster location of each available consensus cluster;

根據節點位置和所述集群位置,確定每個可用共識集群對目標對等節點的回應時間; Determine the response time of each available consensus cluster to the target peer node according to the node location and the cluster location;

將回應時間最短的可用共識集群作為目標共識集群。 Use the available consensus cluster with the shortest response time as the target consensus cluster.

在本發明一些實施例中,該區塊鏈系統的共識裝置還可以包括: In some embodiments of the present invention, the consensus device of the blockchain system may further include:

第一判斷模組,用於判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件; a first judging module for judging whether the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition;

其中,第一確定模組930進一步用於: Wherein, the first determination module 930 is further used for:

在集群性能參數不滿足第一預設條件的情況下,將回應時間最短的可用共識集群作為目標共識集。 In the case that the cluster performance parameter does not meet the first preset condition, the available consensus cluster with the shortest response time is used as the target consensus set.

在本發明一些實施例中,第一確定模組930還進一步用於: In some embodiments of the present invention, the first determining module 930 is further configured to:

在集群性能參數滿足第一預設條件的情況下,將回應時間次最短的可用共識集群作為目標共識集群。 When the cluster performance parameter satisfies the first preset condition, the available consensus cluster with the second shortest response time is used as the target consensus cluster.

在本發明一些實施例中,路由請求資訊還包括路由請求類型; In some embodiments of the present invention, the routing request information further includes a routing request type;

其中,第一判斷模組具體用於: Among them, the first judgment module is specifically used for:

在路由請求類型為第一路由類型的情況下,判斷回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件。 When the route request type is the first route type, it is determined whether the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition.

在本發明一些實施例中,第一判斷模組進一步用於: In some embodiments of the present invention, the first judgment module is further used for:

檢測回應時間最短的可用共識集群是否具有飽和狀態標記; Detect whether the available consensus cluster with the shortest response time has a saturation status flag;

在檢測到具有飽和狀態標記的情況下,確定回應時間最短的可用共識集群的集群性能參數滿足第一預設條件; In the case of detecting the saturation state flag, determine that the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition;

在檢測到不具有飽和狀態標記的情況下,確定回應時間最短的可用共識集群的集群性能參數不滿足第一預設條件。 In the case that it is detected that there is no saturation state flag, it is determined that the cluster performance parameter of the available consensus cluster with the shortest response time does not satisfy the first preset condition.

在本發明一些實施例中,第一預設條件包括下列中的至少一項: In some embodiments of the present invention, the first preset condition includes at least one of the following:

集群性能參數中的輸送量大於或等於預設輸送量閾值; The delivery volume in the cluster performance parameter is greater than or equal to the preset delivery volume threshold;

輸送量大於或等於預設輸送量閾值的第一時長大於或等於第一預設時長; The first duration of the delivery volume greater than or equal to the preset delivery volume threshold is greater than or equal to the first preset duration;

集群性能參數中的交易平均延時大於或等於預設延時閾值; The average transaction delay in the cluster performance parameters is greater than or equal to the preset delay threshold;

交易平均延時大於或等於預設延時閾值的第二時長大於或等於第二預設時長。 The second time period when the average transaction delay is greater than or equal to the preset delay threshold is greater than or equal to the second preset time period.

在本發明一些實施例中,該區塊鏈系統的共識裝置還可以包括: In some embodiments of the present invention, the consensus device of the blockchain system may further include:

第五接收模組,用於接收共識集群發送的集群註冊請求; The fifth receiving module is used to receive the cluster registration request sent by the consensus cluster;

第四解析模組,用於解析集群註冊請求,得到集群註冊請求資訊;其中,集群註冊請求資訊包括集群驗證資訊; a fourth parsing module, used for parsing the cluster registration request to obtain cluster registration request information; wherein the cluster registration request information includes cluster verification information;

集群監聽模組,用於在集群驗證資訊通過驗證的情況下,監聽共識集群; The cluster monitoring module is used to monitor the consensus cluster when the cluster verification information passes the verification;

第一處理模組,用於在監聽到共識集群處於正常工作狀態的情況下,將共識集群作為可用共識集群。 The first processing module is used to use the consensus cluster as an available consensus cluster when monitoring that the consensus cluster is in a normal working state.

在本發明一些實施例中,集群註冊請求資訊還包括集群配置資訊; In some embodiments of the present invention, the cluster registration request information further includes cluster configuration information;

其中,所述向所述目標對等節點發送所述目標共識集群的目標集群位址之前,該區塊鏈系統的共識裝置還可以包括: Wherein, before the sending the target cluster address of the target consensus cluster to the target peer node, the consensus device of the blockchain system may further include:

資訊查詢模組,用於查詢目標共識集群對應的目標集群 配置資訊; Information query module, used to query the target cluster corresponding to the target consensus cluster configuration information;

位址提取模組,用於在目標集群配置資訊中,提取目標集群位址。 The address extraction module is used to extract the target cluster address from the target cluster configuration information.

在本發明一些實施例中,路由請求資訊還包括節點驗證資訊; In some embodiments of the present invention, the routing request information further includes node verification information;

其中,第一確定模組930還具體用於: Wherein, the first determination module 930 is also specifically used for:

在節點驗證資訊通過驗證的情況下,根據節點位置,在至少一個可用共識集群中,確定目標共識集群。 In the case that the node verification information is verified, according to the node location, in at least one available consensus cluster, determine the target consensus cluster.

圖10示出了本發明另一個實施例提供的區塊鏈系統的共識裝置的結構示意圖。 FIG. 10 shows a schematic structural diagram of a consensus apparatus of a blockchain system provided by another embodiment of the present invention.

在本發明一些實施例中,圖10所示的裝置可以設置於圖4所示的任一個共識集群內。其中,共識集群可以包括至少一個共識節點,共識節點可以為伺服器或者伺服器集群。 In some embodiments of the present invention, the apparatus shown in FIG. 10 may be set in any consensus cluster shown in FIG. 4 . The consensus cluster may include at least one consensus node, and the consensus node may be a server or a server cluster.

3如圖10所示,該區塊鏈系統的共識裝置可以包括: 3 As shown in Figure 10, the consensus device of the blockchain system may include:

第二接收模組1010,用於接收目標對等節點發送的交易請求;其中,目標對等節點基於目標集群位址發送交易請求,目標集群位址根據目標對等節點的節點位置在至少一個可用共識集群中確定,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; The second receiving module 1010 is configured to receive the transaction request sent by the target peer node; wherein, the target peer node sends the transaction request based on the target cluster address, and the target cluster address is at least one available according to the node position of the target peer node. Determined in the consensus cluster, the available consensus cluster is the consensus cluster in the normal working state in the blockchain system;

第二解析模組1020,用於解析易請求,得到交易請求資訊;其中,交易請求資訊包括交易資訊; The second parsing module 1020 is used for parsing the transaction request to obtain transaction request information, wherein the transaction request information includes transaction information;

資訊共識模組1030,用於針對交易資訊發起共識; The information consensus module 1030 is used to initiate consensus on transaction information;

交易執行模組1040,用於在共識成功的情況下,執行交易資訊對應的交易。 The transaction execution module 1040 is configured to execute the transaction corresponding to the transaction information when the consensus is successful.

在本發明實施例中,共識集群能夠接收基於節點位置分配的目標對等節點發送的交易請求,以通過節點位置實現對等節點的分流,使不同的對等節點可以基於其節點位置匹配不同的共識集群,從而可以利用多個共識集群並行對大量的對等節點進行共識,提高了區塊鏈系統 的輸送量,進而能夠滿足大量節點接入時區塊鏈系統對高輸送量的需求。同時,即使參與節點增多,區塊鏈系統的擴展性能也可以繼續保持。 In the embodiment of the present invention, the consensus cluster can receive transaction requests sent by target peer nodes based on node location allocation, so as to realize the distribution of peer nodes based on node locations, so that different peer nodes can match different peer nodes based on their node locations. Consensus cluster, so that multiple consensus clusters can be used to perform consensus on a large number of peer nodes in parallel, which improves the blockchain system It can meet the demand for high transmission volume of the blockchain system when a large number of nodes are connected. At the same time, even if the number of participating nodes increases, the scalability of the blockchain system can continue to be maintained.

在本發明一些實施例中,交易請求資訊還包括交易請求類型; In some embodiments of the present invention, the transaction request information further includes a transaction request type;

其中,資訊共識模組1030具體用於: Among them, the information consensus module 1030 is specifically used for:

在交易請求類型為第一交易類型的情況下,針對交易資訊發起共識。 When the transaction request type is the first transaction type, a consensus is initiated for transaction information.

在本發明一些實施例中,交易請求資訊還包括目標通道資訊; In some embodiments of the present invention, the transaction request information further includes target channel information;

其中,在本發明一些實施例中,該區塊鏈系統的共識裝置還可以包括: Wherein, in some embodiments of the present invention, the consensus device of the blockchain system may further include:

第一獲取模組,用於在交易請求類型不是第一交易類型的情況下,獲取目標通道資訊; The first acquisition module is used to acquire target channel information when the transaction request type is not the first transaction type;

通道查詢模組,用於在目標通道清單中查詢目標通道資訊;其中,目標通道清單為本機存放區的通道列表; The channel query module is used to query the target channel information in the target channel list; wherein, the target channel list is the channel list in the local storage area;

其中,資訊共識模組1030進一步用於: Among them, the information consensus module 1030 is further used for:

在查詢到目標通道資訊的情況下,針對交易資訊發起共識。 When the target channel information is queried, a consensus is initiated for the transaction information.

在本發明一些實施例中,該區塊鏈系統的共識裝置還可以包括: In some embodiments of the present invention, the consensus device of the blockchain system may further include:

第一生成模組,用於在未查詢到目標通道資訊的情況下,根據目標通道資訊,生成位址查詢請求; The first generation module is used to generate an address query request according to the target channel information without querying the target channel information;

第五發送模組,用於向通道協同節點發送位址查詢請求;其中,位址查詢請求用於使通道協同節點查詢目標通道資訊對應的集群位址。 The fifth sending module is used for sending an address query request to the channel coordination node; wherein, the address query request is used for the channel coordination node to query the cluster address corresponding to the target channel information.

在本發明一些實施例中,該區塊鏈系統的共識裝置還可以包括: In some embodiments of the present invention, the consensus device of the blockchain system may further include:

第六接收模組,用於接收通道協同節點回饋的目標通道資訊對應的集群位址; The sixth receiving module is used for receiving the cluster address corresponding to the target channel information fed back by the channel coordination node;

第六發送模組,用於向目標對等節點發送目標通道資訊對應的集群位 址。 The sixth sending module is used to send the cluster bit corresponding to the target channel information to the target peer node site.

在本發明一些實施例中,目標通道資訊為目標雜湊值,目標雜湊值根據交易請求對應的目標通道的屬性資訊生成;目標通道清單為目標雜湊表,目標雜湊表包括多個第一雜湊值,每個第一雜湊值根據一個本地建立的通道的屬性資訊生成。 In some embodiments of the present invention, the target channel information is a target hash value, and the target hash value is generated according to attribute information of the target channel corresponding to the transaction request; the target channel list is a target hash table, and the target hash table includes a plurality of first hash values, Each first hash value is generated based on attribute information of a locally established channel.

在本發明一些實施例中,屬性資訊包括下列中的至少一項: In some embodiments of the present invention, the attribute information includes at least one of the following:

通道名稱、通道創建者、通道創建時間。 Channel name, channel creator, channel creation time.

圖11示出了本發明又一個實施例提供的區塊鏈系統的共識裝置的結構示意圖。3 FIG. 11 shows a schematic structural diagram of a consensus apparatus of a blockchain system provided by another embodiment of the present invention. 3

在本發明一些實施例中,圖11所示的裝置可以設置於圖4所示的任一個通道協同節點內。其中,通道協同節點可以為伺服器或者伺服器集群。 In some embodiments of the present invention, the apparatus shown in FIG. 11 may be set in any one of the channel coordination nodes shown in FIG. 4 . The channel coordination node may be a server or a server cluster.

如圖11所示,該區塊鏈系統的共識裝置可以包括: As shown in Figure 11, the consensus device of the blockchain system may include:

第三接收模組1110,用於接收目標共識集群發送的位址查詢請求;其中,位址查詢請求根據目標共識集群所接收的交易請求所攜帶的目標通道資訊生成; The third receiving module 1110 is configured to receive the address query request sent by the target consensus cluster; wherein, the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster;

第三解析模組1120,用於解析位址查詢請求,得到位址查詢請求資訊;其中,位址查詢請求資訊包括目標通道資訊; The third parsing module 1120 is used for parsing the address query request to obtain address query request information; wherein, the address query request information includes target channel information;

位址查詢模組1130,用於在分散式資料庫中,查詢目標通道資訊對應的集群位址; The address query module 1130 is used to query the cluster address corresponding to the target channel information in the distributed database;

第二發送模組1140,用於在位址查詢請求資訊還包括節點位址的情況下,向節點位址對應的對等節點發送目標通道資訊對應的集群位址。 The second sending module 1140 is configured to send the cluster address corresponding to the target channel information to the peer node corresponding to the node address when the address query request information further includes the node address.

在本發明實施例中,對於跨共識集群的交易請求,可以通過通道協同節點查詢交易請求對應的共識集群的集群位址,從而保障跨共識集群的交易請求的有序進行,提高區塊鏈系統的可靠性。 In the embodiment of the present invention, for a transaction request across consensus clusters, the cluster address of the consensus cluster corresponding to the transaction request can be inquired through the channel coordination node, thereby ensuring the orderly progress of transaction requests across consensus clusters and improving the blockchain system. reliability.

在本發明一些實施例中,目標通道資訊為目標雜湊值, 目標雜湊值根據交易請求對應的目標通道的屬性資訊生成;分散式資料庫包括分散式雜湊表,分散式雜湊表包括多個第二雜湊值,每個第二雜湊值根據區塊鏈系統中的一個通道的屬性資訊生成; In some embodiments of the present invention, the target channel information is a target hash value, The target hash value is generated according to the attribute information of the target channel corresponding to the transaction request; the distributed database includes a distributed hash table, and the distributed hash table includes a plurality of second hash values, and each second hash value is based on the block chain system. The attribute information of a channel is generated;

其中,位址查詢模組1130具體用於: Among them, the address query module 1130 is specifically used for:

基於分散式雜湊表,在多個預設通道協同節點中,查詢存儲有目標雜湊值的目標通道協同節點;其中,預設通道協同節點為區塊鏈系統中用於維護分散式雜湊表的節點,一個預設通道協同節點對應一個共識集群; Based on the distributed hash table, among multiple preset channel coordination nodes, query the target channel coordination node that stores the target hash value; wherein, the preset channel coordination node is a node used to maintain the distributed hash table in the blockchain system , a preset channel coordination node corresponds to a consensus cluster;

將目標通道協同節點對應的共識集群的集群位址,作為目標通道資訊對應的集群位址。 Use the cluster address of the consensus cluster corresponding to the target channel coordination node as the cluster address corresponding to the target channel information.

在本發明一些實施例中,屬性資訊包括下列中的至少一項: In some embodiments of the present invention, the attribute information includes at least one of the following:

通道名稱、通道創建者、通道創建時間。 Channel name, channel creator, channel creation time.

在本發明一些實施例中,該區塊鏈系統的共識裝置還可以包括: In some embodiments of the present invention, the consensus device of the blockchain system may further include:

第七發送模組,用於在位址查詢請求資訊不包括節點位址的情況下,向目標共識集群發送目標通道資訊對應的集群位址。 The seventh sending module is configured to send the cluster address corresponding to the target channel information to the target consensus cluster when the address query request information does not include the node address.

圖12示出了本發明再一個實施例提供的區塊鏈系統的共識裝置的結構示意圖。 FIG. 12 shows a schematic structural diagram of a consensus apparatus of a blockchain system provided by yet another embodiment of the present invention.

在本發明一些實施例中,圖12所示的裝置可以設置於圖4所示的任一個對等節點內。其中,對等節點可以為伺服器或者伺服器集群。 In some embodiments of the present invention, the apparatus shown in FIG. 12 may be set in any of the peer nodes shown in FIG. 4 . The peer node may be a server or a server cluster.

如圖12所示,該區塊鏈系統的共識裝置可以包括: As shown in Figure 12, the consensus device of the blockchain system may include:

第三發送模組1210,用於向集群調度節點發送共識集群路由請求,使集群調度節點回應于共識集群路由請求,根據共識集群路由請求的路由請求資訊中包括的節點位置,在至少一個可用共識集群中確定目標共識集群,並回饋目標共識集群對應的目標集群位址;其中,可用共識集群為區塊鏈系統中處於正常工作狀態的共識集群; The third sending module 1210 is configured to send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, according to the node position included in the routing request information of the consensus cluster routing request, at least one available consensus The target consensus cluster is determined in the cluster, and the target cluster address corresponding to the target consensus cluster is returned; among them, the available consensus cluster is the consensus cluster in the normal working state in the blockchain system;

第四接收模組1220,用於接收集群調度節點回饋的目標集群位址; The fourth receiving module 1220 is used for receiving the target cluster address fed back by the cluster scheduling node;

第四發送模組1230,用於基於目標集群位址,向目標共識集群發送交易請求。 The fourth sending module 1230 is configured to send a transaction request to the target consensus cluster based on the target cluster address.

在本發明實施例中,能夠通過節點位置實現對等節點的分流,使不同的對等節點可以基於其節點位置匹配不同的共識集群,從而可以利用多個共識集群並行對大量的對等節點進行共識,提高了區塊鏈系統的輸送量,進而能夠滿足區塊鏈系統對高輸送量的需求。 In the embodiment of the present invention, the distribution of peer nodes can be realized by the node location, so that different peer nodes can match different consensus clusters based on their node locations, so that a large number of peer nodes can be processed in parallel by using multiple consensus clusters. Consensus increases the transmission volume of the blockchain system, which in turn can meet the demand for high transmission volume of the blockchain system.

在本發明一些實施例中,交易請求攜帶有目標通道資訊; In some embodiments of the present invention, the transaction request carries target channel information;

其中,該區塊鏈系統的共識裝置還可以包括: Wherein, the consensus device of the blockchain system may also include:

第七接收模組,用於在交易請求的交易請求類型不是第一交易類型的情況下,接收目標共識集群或通道協同節點回饋的目標通道資訊對應的集群位址; The seventh receiving module is used to receive the cluster address corresponding to the target channel information returned by the target consensus cluster or channel coordination node when the transaction request type of the transaction request is not the first transaction type;

第八發送模組,用於基於目標通道資訊對應的集群位址,向交易請求對應的目標通道所屬的共識集群發送交易請求。 The eighth sending module is configured to send a transaction request to the consensus cluster to which the target channel corresponding to the transaction request belongs, based on the cluster address corresponding to the target channel information.

圖13示出了本發明一個實施例提供的區塊鏈系統的共識設備的結構示意圖。 FIG. 13 shows a schematic structural diagram of a consensus device of a blockchain system provided by an embodiment of the present invention.

如圖13所示,區塊鏈系統的共識設備1300包括輸入裝置1301、輸入介面1302、中央處理器1303、記憶體1304、輸出介面1305、以及輸出設備1306。其中,輸入介面1302、中央處理器1303、記憶體1304、以及輸出介面1305通過匯流排1310相互連接,輸入裝置1301和輸出設備1306分別通過輸入介面1302和輸出介面1305與匯流排1310連接,進而與區塊鏈系統的共識設備1300的其他元件連接。 As shown in FIG. 13 , the consensus device 1300 of the blockchain system includes an input device 1301 , an input interface 1302 , a central processing unit 1303 , a memory 1304 , an output interface 1305 , and an output device 1306 . The input interface 1302, the central processing unit 1303, the memory 1304, and the output interface 1305 are connected to each other through the bus bar 1310, and the input device 1301 and the output device 1306 are respectively connected to the bus bar 1310 through the input interface 1302 and the output interface 1305, and then to the bus bar 1310. Other elements of the consensus device 1300 of the blockchain system are connected.

具體地,輸入裝置1301接收來自外部的輸入資訊,並通過輸入介面1302將輸入資訊傳送到中央處理器1303;中央處理器1303基於記憶體1304中存儲的電腦可執行指令對輸入資訊進行處理以生成輸出資訊,將輸出資訊臨時或者永久地存儲在記憶體1304中,然後通過輸出介面 1305將輸出資訊傳送到輸出設備1306;輸出設備1306將輸出資訊輸出到區塊鏈系統的共識設備1300的外部供使用者使用。 Specifically, the input device 1301 receives input information from the outside, and transmits the input information to the central processing unit 1303 through the input interface 1302 ; the central processing unit 1303 processes the input information based on the computer-executable instructions stored in the memory 1304 to generate Output information, temporarily or permanently store the output information in the memory 1304, and then pass the output interface 1305 transmits the output information to the output device 1306; the output device 1306 outputs the output information to the outside of the consensus device 1300 of the blockchain system for the user to use.

也就是說,圖13所示的區塊鏈系統的共識設備也可以被實現為包括:存儲有電腦可執行指令的記憶體;以及處理器,該處理器在執行電腦可執行指令時可以實現本發明實施例描述的區塊鏈系統的共識方法和裝置。 That is to say, the consensus device of the blockchain system shown in FIG. 13 can also be implemented to include: a memory storing computer-executable instructions; and a processor, which can implement the present invention when executing the computer-executable instructions. The consensus method and device of the blockchain system described in the embodiments of the invention.

本發明實施例還提供一種電腦可讀存儲介質,該電腦可讀存儲介質上存儲有電腦程式指令;該電腦程式指令被處理器執行時實現本發明實施例提供的區塊鏈系統的共識方法。 Embodiments of the present invention further provide a computer-readable storage medium, where computer program instructions are stored thereon; when the computer program instructions are executed by a processor, the consensus method of the blockchain system provided by the embodiments of the present invention is implemented.

以上的結構框圖中所示的功能塊可以實現為硬體、軟體、固件或者它們的組合。當以硬體方式實現時,其可以例如是電子電路、專用積體電路(Application Specific Integrated Circuit,ASIC)、適當的固件、外掛程式、功能卡等等。當以軟體方式實現時,本發明的元素是被用於執行所需任務的程式或者程式碼片段。程式或者程式碼片段可以存儲在機器可讀介質中,或者通過載波中攜帶的資料信號在傳輸介質或者通信鏈路上傳送。“機器可讀介質”可以包括能夠存儲或傳輸資訊的任何介質。機器可讀介質的例子包括電子電路、半導體記憶體設備、ROM、快閃記憶體、可擦除ROM(Erasable Read-Only Memory,EROM)、軟碟、CD-ROM、光碟、硬碟、光纖介質、射頻(Radio Frequency,RF)鏈路,等等。程式碼片段可以經由諸如網際網路、內聯網等的電腦網路被下載。 The functional blocks shown in the above structural block diagrams can be implemented as hardware, software, firmware, or a combination thereof. When implemented in hardware, it can be, for example, electronic circuits, application specific integrated circuits (ASICs), suitable firmware, plug-ins, function cards, and the like. When implemented in software, elements of the invention are programs or code segments that are used to perform the required tasks. The program, or segments of program code, can be stored on a machine-readable medium or transmitted over a transmission medium or communication link by a data signal carried in a carrier wave. A "machine-readable medium" may include any medium that can store or transmit information. Examples of machine-readable media include electronic circuits, semiconductor memory devices, ROM, flash memory, Erasable Read-Only Memory (EROM), floppy disks, CD-ROMs, optical disks, hard disks, and optical fiber media , Radio Frequency (RF) link, and so on. The code snippets may be downloaded via a computer network such as the Internet, an intranet, or the like.

還需要說明的是,上述對本發明特定實施例進行了描述。其它實施例在所附請求項的範圍內。在一些情況下,在請求項書中記載的動作或步驟可以按照不同實施例中的順序來執行並且仍然可以實現期望的結果。另外,在附圖中描繪的過程不一定要求示出的特定順序或連續順序才能實現期望的結果。在某些實施方式中,多工處理和並行處理也是可以的或者可能是有利的。 It should also be noted that the above describes specific embodiments of the present invention. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims can be performed in the order in which they are described and still achieve desirable results. Additionally, the processes depicted in the figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multiplexing and parallel processing are also possible or may be advantageous.

以上所述,僅為本發明的具體實施方式,所屬領域的技 術人員可以清楚地瞭解到,為了描述的方便和簡潔,上述描述的系統、模組和單元的具體工作過程,可以參考前述方法實施例中的對應過程,在此不再贅述。應理解,本發明的保護範圍並不局限於此,任何熟悉本技術領域的技術人員在本發明揭露的技術範圍內,可輕易想到各種等效的修改或替換,這些修改或替換都應涵蓋在本發明的保護範圍之內。 The above descriptions are only specific implementations of the present invention, and those skilled in the art Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system, module and unit described above can be referred to the corresponding process in the foregoing method embodiments, which will not be repeated here. It should be understood that the protection scope of the present invention is not limited to this. Any person skilled in the art can easily think of various equivalent modifications or replacements within the technical scope disclosed by the present invention, and these modifications or replacements should be covered in within the protection scope of the present invention.

S510,S520,S530,S540:流程 S510, S520, S530, S540: Process

Claims (29)

一種區塊鏈系統的共識方法,包括: A consensus method for a blockchain system, including: 接收目標對等節點發送的共識集群路由請求; Receive the consensus cluster routing request sent by the target peer node; 解析所述共識集群路由請求,得到路由請求資訊;其中,所述路由請求資訊包括所述目標對等節點的節點位置; Parsing the consensus cluster routing request to obtain routing request information; wherein the routing request information includes the node location of the target peer node; 根據所述節點位置,在至少一個可用共識集群中,確定目標共識集群;其中,所述可用共識集群為所述區塊鏈系統中處於正常工作狀態的共識集群; According to the position of the node, in at least one available consensus cluster, a target consensus cluster is determined; wherein, the available consensus cluster is a consensus cluster in a normal working state in the blockchain system; 向所述目標對等節點發送所述目標共識集群的目標集群位址。 The target cluster address of the target consensus cluster is sent to the target peer node. 根據請求項1所述的方法,其中,所述根據所述節點位置,在至少一個可用共識集群中,確定目標共識集群,包括: The method according to claim 1, wherein the determining a target consensus cluster in at least one available consensus cluster according to the node position includes: 獲取每個所述可用共識集群的集群位置; Get the cluster location of each of the available consensus clusters; 根據所述節點位置和所述集群位置,確定每個所述可用共識集群對所述目標對等節點的響應時間; determining the response time of each of the available consensus clusters to the target peer node according to the node location and the cluster location; 將回應時間最短的可用共識集群作為所述目標共識集群。 The available consensus cluster with the shortest response time is taken as the target consensus cluster. 根據請求項2所述的方法,其中,所述將回應時間最短的可用共識集群作為所述目標共識集群之前,所述方法還包括: The method according to claim 2, wherein, before the available consensus cluster with the shortest response time is used as the target consensus cluster, the method further comprises: 判斷所述回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件; Determine whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition; 其中,所述將回應時間最短的可用共識集群作為所述目標共識集群,包括: Wherein, the available consensus cluster with the shortest response time is used as the target consensus cluster, including: 在所述集群性能參數不滿足所述第一預設條件的情況下,將所述回應時間最短的可用共識集群作為所述目標共識集。 In the case that the cluster performance parameter does not meet the first preset condition, the available consensus cluster with the shortest response time is used as the target consensus set. 根據請求項3所述的方法,其中,所述判斷所述回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件之後,所述方法還包括: The method according to claim 3, wherein after judging whether the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition, the method further includes: 在所述集群性能參數滿足所述第一預設條件的情況下,將回應時間次 最短的可用共識集群作為所述目標共識集群。 In the case that the cluster performance parameter satisfies the first preset condition, the response time will be The shortest available consensus cluster is used as the target consensus cluster. 根據請求項3所述的方法,其中,所述路由請求資訊還包括路由請求類型; The method according to claim 3, wherein the routing request information further includes a routing request type; 其中,所述判斷所述回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件,包括: Wherein, determining whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition includes: 在所述路由請求類型為第一路由類型的情況下,判斷所述回應時間最短的可用共識集群的集群性能參數是否滿足所述第一預設條件。 In the case that the route request type is the first route type, it is judged whether the cluster performance parameter of the available consensus cluster with the shortest response time meets the first preset condition. 根據請求項3-5中任一項所述的方法,其中,所述判斷所述回應時間最短的可用共識集群的集群性能參數是否滿足第一預設條件,包括: The method according to any one of request items 3-5, wherein the judging whether the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition includes: 檢測所述回應時間最短的可用共識集群是否具有飽和狀態標記; Detecting whether the available consensus cluster with the shortest response time has a saturation status flag; 在檢測到具有所述飽和狀態標記的情況下,確定所述回應時間最短的可用共識集群的集群性能參數滿足所述第一預設條件; In the case of detecting the saturation state flag, determining that the cluster performance parameter of the available consensus cluster with the shortest response time satisfies the first preset condition; 在檢測到不具有所述飽和狀態標記的情況下,確定所述回應時間最短的可用共識集群的集群性能參數不滿足所述第一預設條件。 In the case of detecting that it does not have the saturation state flag, it is determined that the cluster performance parameter of the available consensus cluster with the shortest response time does not meet the first preset condition. 根據請求項3-5中任一項所述的方法,其中,所述第一預設條件包括下列中的至少一項: The method according to any one of claims 3-5, wherein the first preset condition includes at least one of the following: 所述集群性能參數中的輸送量大於或等於預設輸送量閾值; The delivery volume in the cluster performance parameter is greater than or equal to the preset delivery volume threshold; 所述輸送量大於或等於所述預設輸送量閾值的第一時長大於或等於第一預設時長; The first duration of the delivery volume greater than or equal to the preset delivery volume threshold is greater than or equal to the first preset duration; 所述集群性能參數中的交易平均延時大於或等於預設延時閾值; The average transaction delay in the cluster performance parameter is greater than or equal to the preset delay threshold; 所述交易平均延時大於或等於所述預設延時閾值的第二時長大於或等於第二預設時長。 The second time period in which the average transaction delay is greater than or equal to the preset delay threshold is greater than or equal to a second preset time period. 根據請求項1所述的方法,其中,所述根據所述節點位置,在至少一個可用共識集群中,確定目標共識集群之前,所述方法還包括: The method according to claim 1, wherein, before the target consensus cluster is determined in at least one available consensus cluster according to the node position, the method further comprises: 接收所述共識集群發送的集群註冊請求; receiving a cluster registration request sent by the consensus cluster; 解析所述集群註冊請求,得到集群註冊請求資訊;其中,所述集群註冊請求資訊包括集群驗證資訊; Parsing the cluster registration request to obtain cluster registration request information; wherein the cluster registration request information includes cluster verification information; 在所述集群驗證資訊通過驗證的情況下,監聽所述共識集群; In the case that the cluster verification information is verified, monitor the consensus cluster; 在監聽到所述共識集群處於正常工作狀態的情況下,將所述共識集群作為所述可用共識集群。 In the case of monitoring that the consensus cluster is in a normal working state, the consensus cluster is used as the available consensus cluster. 根據請求項8所述的方法,其中,所述集群註冊請求資訊還包括集群配置資訊; The method according to claim 8, wherein the cluster registration request information further includes cluster configuration information; 其中,所述向所述目標對等節點發送所述目標共識集群的目標集群位址之前,所述方法還包括: Wherein, before the sending the target cluster address of the target consensus cluster to the target peer node, the method further includes: 查詢所述目標共識集群對應的目標集群配置資訊; query the target cluster configuration information corresponding to the target consensus cluster; 在所述目標集群配置資訊中,提取所述目標集群位址。 In the target cluster configuration information, the target cluster address is extracted. 根據請求項1所述的方法,其中,所述路由請求資訊還包括節點驗證資訊; The method according to claim 1, wherein the routing request information further includes node verification information; 其中,所述根據所述節點位置,在至少一個可用共識集群中,確定目標共識集群,包括: Wherein, determining a target consensus cluster in at least one available consensus cluster according to the node location includes: 在所述節點驗證資訊通過驗證的情況下,根據所述節點位置,在至少一個所述可用共識集群中,確定所述目標共識集群。 In the case that the node verification information is verified, the target consensus cluster is determined in at least one of the available consensus clusters according to the node position. 一種區塊鏈系統的共識方法,包括: A consensus method for a blockchain system, including: 接收目標對等節點發送的交易請求;其中,所述目標對等節點基於目標集群位址發送所述交易請求,所述目標集群位址根據所述目標對等節點的節點位置在至少一個可用共識集群中確定,所述可用共識集群為所述區塊鏈系統中處於正常工作狀態的共識集群; Receive a transaction request sent by a target peer node; wherein, the target peer node sends the transaction request based on a target cluster address, and the target cluster address is in at least one available consensus according to the node location of the target peer node It is determined in the cluster that the available consensus cluster is the consensus cluster in the normal working state in the blockchain system; 解析所述交易請求,得到交易請求資訊;其中,所述交易請求資訊包括交易資訊; Parse the transaction request to obtain transaction request information; wherein, the transaction request information includes transaction information; 針對所述交易資訊發起共識; Initiate a consensus on the transaction information; 在共識成功的情況下,執行所述交易資訊對應的交易。 If the consensus is successful, the transaction corresponding to the transaction information is executed. 根據請求項11所述的方法,其中,所述交易請求資訊還包括交易請求類型; The method according to claim 11, wherein the transaction request information further includes a transaction request type; 其中,所述針對所述交易資訊發起共識,包括: Wherein, the initiating a consensus on the transaction information includes: 在所述交易請求類型為第一交易類型的情況下,針對所述交易資訊發起共識。 When the transaction request type is the first transaction type, a consensus is initiated for the transaction information. 根據請求項12所述的方法,其中,所述交易請求資訊還包括目標通道資訊; The method according to claim 12, wherein the transaction request information further includes target channel information; 其中,所述解析所述交易請求,得到交易請求資訊之後,所述方法還包括: Wherein, after parsing the transaction request to obtain transaction request information, the method further includes: 在所述交易請求類型不是所述第一交易類型的情況下,獲取所述目標通道資訊; In the case that the transaction request type is not the first transaction type, obtain the target channel information; 在目標通道清單中查詢所述目標通道資訊;其中,所述目標通道清單為本機存放區的通道列表; Query the target channel information in the target channel list; wherein, the target channel list is the channel list of the local storage area; 其中,所述針對所述交易資訊發起共識,包括: Wherein, the initiating a consensus on the transaction information includes: 在查詢到所述目標通道資訊的情況下,針對所述交易資訊發起共識。 When the target channel information is queried, a consensus is initiated for the transaction information. 根據請求項13所述的方法,其中,所述在目標通道清單中查詢所述目標通道資訊之後,所述方法還包括: The method according to claim 13, wherein after querying the target channel information in the target channel list, the method further comprises: 在未查詢到所述目標通道資訊的情況下,根據所述目標通道資訊,生成位址查詢請求; In the case that the target channel information is not queried, generate an address query request according to the target channel information; 向通道協同節點發送所述位址查詢請求;其中,所述位址查詢請求用於使所述通道協同節點查詢所述目標通道資訊對應的集群位址。 The address query request is sent to the channel coordination node, wherein the address query request is used to enable the channel coordination node to query the cluster address corresponding to the target channel information. 根據請求項14所述的方法,其中,所述向通道協同節點發送所述位址查詢請求之後,所述方法還包括: The method according to claim 14, wherein after the address query request is sent to the channel coordination node, the method further includes: 接收所述通道協同節點回饋的所述目標通道資訊對應的集群位址; receiving the cluster address corresponding to the target channel information returned by the channel coordination node; 向所述目標對等節點發送所述目標通道資訊對應的集群位址。 Send the cluster address corresponding to the target channel information to the target peer node. 根據請求項13-15任一項所述的方法,其中,所述目標通道資訊為目標雜湊值,所述目標雜湊值根據所述交易請求對應的目標通道的屬性資訊生成;所述目標通道清單為目標雜湊表,所述目標雜湊表包括多個第一雜湊值,每個所述第一雜湊值根據一個本地建立的通道的屬性資訊生成。 The method according to any one of request items 13-15, wherein the target channel information is a target hash value, and the target hash value is generated according to attribute information of the target channel corresponding to the transaction request; the target channel list It is a target hash table, the target hash table includes a plurality of first hash values, and each of the first hash values is generated according to attribute information of a locally established channel. 根據請求項16所述的方法,其中,所述屬性資訊包括下列中的至少一項: The method according to claim 16, wherein the attribute information includes at least one of the following: 通道名稱、通道創建者、通道創建時間。 Channel name, channel creator, channel creation time. 一種區塊鏈系統的共識方法,包括: A consensus method for a blockchain system, including: 接收目標共識集群發送的位址查詢請求;其中,所述位址查詢請求根據所述目標共識集群所接收的交易請求所攜帶的目標通道資訊生成; Receive an address query request sent by the target consensus cluster; wherein, the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster; 解析所述位址查詢請求,得到位址查詢請求資訊;其中,所述位址查詢請求資訊包括所述目標通道資訊; Parsing the address query request to obtain address query request information; wherein the address query request information includes the target channel information; 在分散式資料庫中,查詢所述目標通道資訊對應的集群位址; In the distributed database, query the cluster address corresponding to the target channel information; 在所述位址查詢請求資訊還包括節點位址的情況下,向所述節點位址對應的對等節點發送所述目標通道資訊對應的集群位址。 When the address query request information further includes a node address, the cluster address corresponding to the target channel information is sent to the peer node corresponding to the node address. 根據請求項18所述的方法,其中,所述目標通道資訊為目標雜湊值,所述目標雜湊值根據所述交易請求對應的目標通道的屬性資訊生成;所述分散式資料庫包括分散式雜湊表,所述分散式雜湊表包括多個第二雜湊值,每個所述第二雜湊值根據所述區塊鏈系統中的一個通道的屬性資訊生成; The method according to claim 18, wherein the target channel information is a target hash value, and the target hash value is generated according to attribute information of the target channel corresponding to the transaction request; the distributed database includes a distributed hash value table, the distributed hash table includes a plurality of second hash values, each of which is generated according to attribute information of a channel in the blockchain system; 其中,所述在分散式資料庫中,查詢所述目標通道資訊對應的集群位址,包括: Wherein, querying the cluster address corresponding to the target channel information in the distributed database includes: 基於所述分散式雜湊表,在多個預設通道協同節點中,查詢存儲有所述目標雜湊值的目標通道協同節點;其中,所述預設通道協同節點為所述區塊鏈系統中用於維護所述分散式雜湊表的節點,一個所述預設通道協同節點對應一個共識集群; Based on the distributed hash table, among a plurality of preset channel coordination nodes, query the target channel coordination node that stores the target hash value; wherein, the preset channel coordination node is used in the blockchain system. For the node maintaining the distributed hash table, one of the preset channel coordination nodes corresponds to one consensus cluster; 將所述目標通道協同節點對應的共識集群的集群位址,作為所述目標通道資訊對應的集群位址。 The cluster address of the consensus cluster corresponding to the target channel coordination node is used as the cluster address corresponding to the target channel information. 根據請求項19所述的方法,其中,所述屬性資訊包括下列中的至少一項: The method according to claim 19, wherein the attribute information includes at least one of the following: 通道名稱、通道創建者、通道創建時間。 Channel name, channel creator, channel creation time. 根據請求項18所述的方法,其中,所述在分散式資料庫中,查詢所述目標通道資訊對應的集群位址之後,所述方法還包括: The method according to claim 18, wherein after querying the cluster address corresponding to the target channel information in the distributed database, the method further comprises: 在所述位址查詢請求資訊不包括所述節點位址的情況下,向所述目標共識集群發送所述目標通道資訊對應的集群位址。 In the case that the address query request information does not include the node address, the cluster address corresponding to the target channel information is sent to the target consensus cluster. 一種區塊鏈系統的共識方法,包括: A consensus method for a blockchain system, including: 向集群調度節點發送共識集群路由請求,使所述集群調度節點回應于所述共識集群路由請求,根據所述共識集群路由請求的路由請求資訊中包括的節點位置,在至少一個可用共識集群中確定目標共識集群,並回饋所述目標共識集群對應的目標集群位址;其中,所述可用共識集群為所述區塊鏈系統中處於正常工作狀態的共識集群; Send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, and determines in at least one available consensus cluster according to the node location included in the routing request information of the consensus cluster routing request target consensus cluster, and return the target cluster address corresponding to the target consensus cluster; wherein, the available consensus cluster is the consensus cluster in the normal working state in the blockchain system; 接收所述集群調度節點回饋的所述目標集群位址; receiving the target cluster address returned by the cluster scheduling node; 基於所述目標集群位址,向所述目標共識集群發送交易請求。 Based on the target cluster address, a transaction request is sent to the target consensus cluster. 根據請求項22所述的方法,其中,所述交易請求攜帶有目標通道資訊; The method according to claim 22, wherein the transaction request carries target channel information; 其中,所述基於所述目標集群位址,向所述目標共識集群發送交易請求之後,所述方法還包括: Wherein, after the transaction request is sent to the target consensus cluster based on the target cluster address, the method further includes: 在所述交易請求的交易請求類型不是第一交易類型的情況下,接收所述目標共識集群或通道協同節點回饋的所述目標通道資訊對應的集群位址; If the transaction request type of the transaction request is not the first transaction type, receive the cluster address corresponding to the target channel information returned by the target consensus cluster or channel coordination node; 基於所述目標通道資訊對應的集群位址,向所述交易請求對應的目標通道所屬的共識集群發送所述交易請求。 Based on the cluster address corresponding to the target channel information, the transaction request is sent to the consensus cluster to which the target channel corresponding to the transaction request belongs. 一種區塊鏈系統的共識裝置,包括: A consensus device for a blockchain system, including: 第一接收模組,用於接收目標對等節點發送的共識集群路由請求; The first receiving module is used to receive the consensus cluster routing request sent by the target peer node; 第一解析模組,用於解析所述共識集群路由請求,得到路由請求資訊;其中,所述路由請求資訊包括所述目標對等節點的節點位置; a first parsing module for parsing the consensus cluster routing request to obtain routing request information; wherein the routing request information includes the node location of the target peer node; 第一確定模組,用於根據所述節點位置,在至少一個可用共識集群中,確定目標共識集群;其中,所述可用共識集群為所述區塊鏈系統中處 於正常工作狀態的共識集群; A first determination module is used to determine a target consensus cluster in at least one available consensus cluster according to the node position; wherein, the available consensus cluster is a location in the blockchain system. Consensus cluster in normal working state; 第一發送模組,用於向所述目標對等節點發送所述目標共識集群的目標集群位址。 The first sending module is configured to send the target cluster address of the target consensus cluster to the target peer node. 一種區塊鏈系統的共識裝置,包括: A consensus device for a blockchain system, including: 第二接收模組,用於接收目標對等節點發送的交易請求;其中,所述目標對等節點基於目標集群位址發送所述交易請求,所述目標集群位址根據所述目標對等節點的節點位置在至少一個可用共識集群中確定,所述可用共識集群為所述區塊鏈系統中處於正常工作狀態的共識集群; The second receiving module is configured to receive the transaction request sent by the target peer node; wherein, the target peer node sends the transaction request based on the target cluster address, and the target cluster address is based on the target peer node. The position of the node is determined in at least one available consensus cluster, and the available consensus cluster is the consensus cluster in the normal working state in the blockchain system; 第二解析模組,用於解析所述交易請求,得到交易請求資訊;其中,所述交易請求資訊包括交易資訊; The second parsing module is used for parsing the transaction request to obtain transaction request information; wherein, the transaction request information includes transaction information; 資訊共識模組,用於針對所述交易資訊發起共識; An information consensus module for initiating consensus on the transaction information; 交易執行模組,用於在共識成功的情況下,執行所述交易資訊對應的交易。 The transaction execution module is used to execute the transaction corresponding to the transaction information when the consensus is successful. 一種區塊鏈系統的共識裝置,包括: A consensus device for a blockchain system, including: 第三接收模組,用於接收目標共識集群發送的位址查詢請求;其中,所述位址查詢請求根據所述目標共識集群所接收的交易請求所攜帶的目標通道資訊生成; The third receiving module is configured to receive the address query request sent by the target consensus cluster; wherein, the address query request is generated according to the target channel information carried in the transaction request received by the target consensus cluster; 第三解析模組,用於解析所述位址查詢請求,得到位址查詢請求資訊;其中,所述位址查詢請求資訊包括所述目標通道資訊; a third parsing module for parsing the address query request to obtain address query request information; wherein the address query request information includes the target channel information; 位址查詢模組,用於在分散式資料庫中,查詢所述目標通道資訊對應的集群位址; The address query module is used to query the cluster address corresponding to the target channel information in the distributed database; 第二發送模組,用於在所述位址查詢請求資訊還包括節點位址的情況下,向所述節點位址對應的對等節點發送所述目標通道資訊對應的集群位址。 The second sending module is configured to send the cluster address corresponding to the target channel information to the peer node corresponding to the node address when the address query request information further includes a node address. 一種區塊鏈系統的共識裝置,包括: A consensus device for a blockchain system, including: 第三發送模組,用於向集群調度節點發送共識集群路由請求,使所述集群調度節點回應于所述共識集群路由請求,根據所述共識集群路由請求 的路由請求資訊中包括的節點位置,在至少一個可用共識集群中確定目標共識集群,並回饋所述目標共識集群對應的目標集群位址;其中,所述可用共識集群為所述區塊鏈系統中處於正常工作狀態的共識集群; The third sending module is used to send a consensus cluster routing request to the cluster scheduling node, so that the cluster scheduling node responds to the consensus cluster routing request, according to the consensus cluster routing request The node location included in the routing request information, determine the target consensus cluster in at least one available consensus cluster, and return the target cluster address corresponding to the target consensus cluster; wherein, the available consensus cluster is the blockchain system A consensus cluster in normal working state; 第四接收模組,用於接收所述集群調度節點回饋的所述目標集群位址; a fourth receiving module, configured to receive the target cluster address fed back by the cluster scheduling node; 第四發送模組,用於基於所述目標集群位址,向所述目標共識集群發送交易請求。 The fourth sending module is configured to send a transaction request to the target consensus cluster based on the target cluster address. 一種區塊鏈系統的共識設備,其特徵在於,所述設備包括:處理器以及存儲有電腦程式指令的記憶體; A consensus device for a blockchain system, characterized in that the device comprises: a processor and a memory storing computer program instructions; 所述處理器執行所述電腦程式指令時實現如請求項1-10、請求項11-17、請求項18-21或請求項22-23中任意一項所述的區塊鏈系統的共識方法。 When the processor executes the computer program instructions, the consensus method of the blockchain system described in any one of claim items 1-10, claim items 11-17, claim items 18-21 or claim items 22-23 is implemented . 一種電腦可讀存儲介質,其特徵在於,所述電腦可讀存儲介質上存儲有電腦程式指令,所述電腦程式指令被處理器執行時實現如請求項1-10、請求項11-17、請求項18-21或請求項22-23中任意一項所述的區塊鏈系統的共識方法。 A computer-readable storage medium, characterized in that, computer program instructions are stored on the computer-readable storage medium, and when the computer program instructions are executed by a processor, requirements such as request items 1-10, request items 11-17, request items 1-10, request items 11-17, and A consensus method for a blockchain system as described in any of items 18-21 or claim items 22-23.
TW110117064A 2020-05-29 2021-05-12 Consensus method, device, equipment and medium of blockchain system TWI790611B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010478177.8A CN111786952B (en) 2020-05-29 2020-05-29 Consensus method, apparatus, device, and medium for block chain system
CN202010478177.8 2020-05-29

Publications (2)

Publication Number Publication Date
TW202145116A true TW202145116A (en) 2021-12-01
TWI790611B TWI790611B (en) 2023-01-21

Family

ID=72754441

Family Applications (1)

Application Number Title Priority Date Filing Date
TW110117064A TWI790611B (en) 2020-05-29 2021-05-12 Consensus method, device, equipment and medium of blockchain system

Country Status (3)

Country Link
CN (1) CN111786952B (en)
TW (1) TWI790611B (en)
WO (1) WO2021238298A1 (en)

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111786952B (en) * 2020-05-29 2023-03-17 中国银联股份有限公司 Consensus method, apparatus, device, and medium for block chain system
CN113242286B (en) * 2021-05-06 2022-05-24 杭州复杂美科技有限公司 Method, equipment and storage medium for flexibly improving transaction throughput
CN114281888A (en) * 2021-10-30 2022-04-05 中国银联股份有限公司 Block chain consensus method, device, equipment and storage medium
CN114338677B (en) * 2021-12-30 2022-10-21 中山大学 Block generation method and related device in block chain system
CN114710492B (en) * 2022-03-31 2023-12-22 蚂蚁区块链科技(上海)有限公司 Method and device for establishing direct connection channel, electronic equipment and storage medium
CN114884962B (en) * 2022-04-29 2024-03-26 蚂蚁区块链科技(上海)有限公司 Load balancing method and device and electronic equipment
CN114979166B (en) * 2022-06-09 2023-05-16 中国联合网络通信集团有限公司 Method, device and storage medium for determining consensus node
CN115883315B (en) * 2023-03-01 2023-07-28 中国信息通信研究院 Node joining method, device, electronic equipment and storage medium in blockchain network

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9172750B2 (en) * 2011-04-26 2015-10-27 Brian J. Bulkowski Cluster-node load balancing in a distributed database system
US10360191B2 (en) * 2016-10-07 2019-07-23 International Business Machines Corporation Establishing overlay trust consensus for blockchain trust validation system
CN107196989B (en) * 2017-03-21 2019-08-09 阿里巴巴集团控股有限公司 A kind of processing method and processing device of service request
CN113766035B (en) * 2017-03-28 2023-05-23 创新先进技术有限公司 Service acceptance and consensus method and device
CN107623686B (en) * 2017-09-12 2019-09-17 深圳先进技术研究院 Block chain common recognition reaches method, apparatus
CN108154367B (en) * 2017-12-26 2021-07-02 成都质数斯达克科技有限公司 Block chain service checking method and device
CN108256999B (en) * 2018-01-19 2020-08-14 阿里巴巴集团控股有限公司 Capital transfer method and device and electronic equipment
CN108805404B (en) * 2018-05-02 2020-10-09 大国创新智能科技(东莞)有限公司 Robot scheduling method and system based on block chain
CN110046036A (en) * 2018-12-25 2019-07-23 阿里巴巴集团控股有限公司 A kind of operation requests distribution method, device and equipment
CN110113388B (en) * 2019-04-17 2020-01-14 四川大学 Improved clustering algorithm-based block chain system consensus method and device
CN110601849B (en) * 2019-08-21 2021-05-11 腾讯科技(深圳)有限公司 Trusted timestamp adding method and device and storage medium
CN110647559A (en) * 2019-09-24 2020-01-03 腾讯科技(深圳)有限公司 Data processing method, related node and system
CN111786952B (en) * 2020-05-29 2023-03-17 中国银联股份有限公司 Consensus method, apparatus, device, and medium for block chain system

Also Published As

Publication number Publication date
WO2021238298A1 (en) 2021-12-02
TWI790611B (en) 2023-01-21
CN111786952B (en) 2023-03-17
CN111786952A (en) 2020-10-16

Similar Documents

Publication Publication Date Title
TWI790611B (en) Consensus method, device, equipment and medium of blockchain system
US10616243B2 (en) Route updating method, communication system, and relevant devices
EP2380324B1 (en) Secure node identifier assignment in a distributed hash table for peer-to-peer networks
US11206127B2 (en) Blockchain-based verifiable inter-domain routing validation method
EP2230802B1 (en) A method and apparatus for maintaining route information
CN110135194B (en) Block chain-based industrial internet digital object management method
US11546173B2 (en) Methods, application server, IoT device and media for implementing IoT services
CA2424067A1 (en) Peer-to-peer name resolution protocol (pnrp) security infrastructure and method
CN113824563A (en) Cross-domain identity authentication method based on block chain certificate
WO2023116028A1 (en) Cross-domain access method on blockchain and server
CN108933804B (en) Peer-to-peer network construction method and device
Boshrooyeh et al. Guard: Secure routing in skip graph
CN116208344A (en) Consensus method, consensus network, electronic device, and readable storage medium
Sridhara et al. Global distributed secure mapping of network addresses
CN114255020A (en) Block chain transaction processing method, device, equipment and storage medium based on multiple chains
WO2011150741A1 (en) Point to point (p2p) overlay network, data resources operation method and new node join method thereof
US20160269280A1 (en) Method, Apparatus and System for Discovering Path Computation Element
Aktypi et al. SeCaS: Secure capability sharing framework for IoT devices in a structured P2P network
CN114500001B (en) Communication method and device
CN114531234B (en) Distributed system and equipment registration and verification method thereof
CN117240900B (en) Block chain node discovery and networking method and device based on software defined network
Xiang et al. Network and trust model for dynamic federation
WO2023050966A1 (en) Blockchain data verification
Khakpour et al. WATCHMAN: An overlay distributed AAA architecture for mobile ad hoc networks
Sasitharagai et al. Trust based communication in unstructured P2P networks using reputation management and self certification mechanism