WO2020233051A1 - Cross-network-segment interconnected blockchain network implementation method and apparatus, and system and medium - Google Patents

Cross-network-segment interconnected blockchain network implementation method and apparatus, and system and medium Download PDF

Info

Publication number
WO2020233051A1
WO2020233051A1 PCT/CN2019/120792 CN2019120792W WO2020233051A1 WO 2020233051 A1 WO2020233051 A1 WO 2020233051A1 CN 2019120792 W CN2019120792 W CN 2019120792W WO 2020233051 A1 WO2020233051 A1 WO 2020233051A1
Authority
WO
WIPO (PCT)
Prior art keywords
blockchain node
type
node
type blockchain
blockchain
Prior art date
Application number
PCT/CN2019/120792
Other languages
French (fr)
Chinese (zh)
Inventor
褚镇飞
Original Assignee
深圳壹账通智能科技有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 深圳壹账通智能科技有限公司 filed Critical 深圳壹账通智能科技有限公司
Publication of WO2020233051A1 publication Critical patent/WO2020233051A1/en

Links

Images

Classifications

    • 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
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles

Definitions

  • This application relates to the field of blockchain technology, and in particular to a method, device, system and computer-readable storage medium for implementing a blockchain network interconnected across network segments.
  • Blockchain can be understood as a distributed ledger, or as a distributed computing and storage system.
  • a blockchain system can include multiple/kind of blockchain nodes, and the address information of a number of predetermined blockchain nodes (such as blockchain consensus nodes) can be recorded in the genesis block, and other blockchain nodes Establish a connection with the predetermined blockchain node according to the address information and perform information exchange.
  • predetermined blockchain nodes such as blockchain consensus nodes
  • each blockchain node may be located in a different network segment, and blockchain nodes that are not in the same network segment cannot access the corresponding predetermined block according to the same address information.
  • the address information recorded in the genesis block cannot be modified or expanded, and cannot meet actual business needs.
  • the purpose of this application is to provide a method, device, system, and computer-readable storage medium for implementing a blockchain network interconnected across network segments to solve the problems in the prior art.
  • the block chain node of the network segment cannot access the corresponding block chain node according to the same address information, which is also convenient for the expansion and change of the block chain system.
  • this application provides a method for implementing a blockchain network interconnected across network segments, which is applied to a blockchain system, and the method includes:
  • Configuration steps add the address information of at least one second-type blockchain node to the configuration file of each first-type blockchain node;
  • Connection step the first type blockchain node establishes a connection with the corresponding second type blockchain node according to the address information in its configuration file;
  • Data request step the first-type blockchain node sends a data acquisition request to the second-type blockchain node with which it is connected;
  • Data transmission step the first type blockchain node receives the data returned by the second type blockchain node.
  • the configuration step includes:
  • the configuration step includes:
  • the address information and the corresponding mapping relationship of mapping the second type blockchain node to the network segment where the first type blockchain node is located are written into the configuration file of the first type blockchain node.
  • the address information includes IP address and port number information, or includes IP address and Mac address.
  • the data request step specifically includes:
  • the data transmission step specifically includes:
  • the first type blockchain node receives the blockchain ledger and/or neighbor node list returned by the second type blockchain node.
  • the method further includes:
  • the first-type blockchain node sends the third request information requesting to obtain the blockchain ledger to the neighbor node at intervals of a preset time threshold according to the order of the neighbor nodes in the neighbor node list;
  • the first type blockchain node receives the blockchain ledger returned by the neighbor node.
  • the method further includes:
  • the corresponding first-type blockchain node suspends the current task, dynamically updates the configuration file, and establishes a connection with the corresponding second-type blockchain node according to the new configuration information in the configuration file.
  • This application also provides a device for implementing a blockchain network interconnected across network segments, the device including:
  • the configuration module is used to add the address information of at least one second-type blockchain node to the configuration file of each first-type blockchain node;
  • connection module is configured to establish a connection with the corresponding second type blockchain node according to the address information in the configuration file
  • a data request module for sending a data acquisition request to the second type blockchain node
  • the receiving module is used to receive the data returned by the second-type blockchain node.
  • the present application also provides a blockchain system.
  • the blockchain system includes a plurality of first type blockchain nodes and a plurality of second type blockchain nodes.
  • the first type blockchain node and the second type blockchain node implements the following steps at runtime:
  • Configuration steps add the address information of at least one second-type blockchain node to the configuration file of each first-type blockchain node;
  • Connection step the first type blockchain node establishes a connection with the corresponding second type blockchain node according to the address information in its configuration file;
  • Data request step the first-type blockchain node sends a data acquisition request to the second-type blockchain node with which it is connected;
  • Data transmission step the first type blockchain node receives the data returned by the second type blockchain node.
  • the configuration step includes:
  • the address information and the corresponding mapping relationship of mapping the second type blockchain node to the network segment where the first type blockchain node is located are written into the configuration file of the first type blockchain node.
  • This application also provides a computer-readable storage medium that includes a first-type blockchain node implementation program and a configuration file, and when the first-type blockchain node implementation program is executed by a processor Implement the following steps:
  • Configuration step acquiring address information of at least one second-type blockchain node, and writing the address information into the configuration file;
  • Connection request step sending a connection establishment request to the corresponding second type blockchain node according to the address information in the configuration file;
  • Data request step after the first type blockchain node and the second type blockchain node establish a connection, the first type blockchain node sends a data acquisition request to the second type blockchain node;
  • Receiving step the first type blockchain node receives the data returned by the second type blockchain node.
  • the implementation method, system, and computer-readable storage medium of a blockchain network interconnected across network segments provided in this application writes the address information of the second type of blockchain node into the configuration file of the first type of blockchain node , And then the first-type blockchain node establishes a connection with the corresponding second-type blockchain node according to the address information in its configuration file. In this way, the first-type blockchain node can send a data acquisition request to the second-type blockchain node with which it is connected and receive data returned by the second-type blockchain node.
  • Each first type blockchain node can use the configuration information in its local configuration file to establish a connection with the corresponding second type blockchain node, thereby realizing data synchronization and connecting with other nodes, because of the configuration information in the local configuration file Flexible settings and changes can be made according to specific needs. Therefore, with this application, the blockchain system can be expanded and changed, and blockchain nodes located in different network segments can also be interconnected and information exchanged, that is, across network segments Interconnected blockchain network.
  • Figure 1 is a schematic diagram of an embodiment of the blockchain system of this application.
  • FIG. 2 is a schematic diagram of an embodiment of any first type blockchain node in FIG. 1;
  • FIG. 3 is a program module diagram of an embodiment of the program for implementing the first type blockchain node in FIG. 2;
  • FIG. 4 is a schematic flowchart of an embodiment of a method for implementing a blockchain network interconnected across network segments according to this application;
  • FIG. 1 it is a schematic diagram of an embodiment of the blockchain system 1 of this application.
  • the blockchain system 1 includes multiple first-type blockchain nodes and multiple second-type blockchain nodes.
  • first-type blockchain nodes For ease of description, only two first-type blockchain nodes are shown in FIG. 1 , Respectively are the first type blockchain node 2 and the first type blockchain node 3, the multiple second type blockchain nodes are marked as the second type blockchain node group 4 in FIG.
  • the first type of blockchain node may be a data node used to maintain a complete blockchain ledger, or may be a new node newly added to the blockchain system 1, and the second type of blockchain node may be The complete blockchain ledger and the consensus node responsible for generating new blocks. Multiple consensus nodes are connected to each other and operate in collaboration.
  • the first type blockchain node and the second type blockchain node may be terminal devices with storage and computing functions such as servers, smart phones, tablet computers, portable computers, desktop computers, and the like.
  • the server when the data node or the consensus node is a server, the server may be one or more of a rack server, a blade server, a tower server, or a cabinet server.
  • the first type blockchain node includes a memory 21, a processor 22, and a network interface 23.
  • the memory 21 includes at least one type of readable storage medium.
  • the at least one type of readable storage medium may be a non-volatile storage medium such as flash memory, hard disk, multimedia card, card-type memory, and the like.
  • the readable storage medium may be an internal storage unit of the first type of blockchain node, such as a hard disk of the first type of blockchain node.
  • the readable storage medium may also be an external memory of the first type of blockchain node, such as a plug-in hard disk equipped on the first type of blockchain node, and a smart memory card (Smart Memory Card). Media Card, SMC), Secure Digital (SD) card, Flash Card, etc.
  • Smart Memory Card Smart Memory Card
  • the readable storage medium of the memory 21 is used to store the first type blockchain node implementation program 30, configuration files, blockchain ledger, and the first type blockchain node and the second type area.
  • the memory 21 can also be used to temporarily store data that has been output or will be output.
  • the processor 22 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or processing data stored in the memory 21, for example to execute the first type of blockchain Node implementation program 30.
  • CPU central processing unit
  • microprocessor or other data processing chip
  • the network interface 23 may include a standard wired interface and a wireless interface (such as a Wi-Fi interface). It is usually used to establish a communication connection between the first-type blockchain node and other electronic devices, for example, to establish a communication connection with the second-type blockchain node and other first-type blockchain nodes.
  • a wireless interface such as a Wi-Fi interface
  • Figure 2 only shows the first type of blockchain node with components 21-23 and the first type of blockchain node implementation program 30, but it should be understood that it is not required to implement all the illustrated components, and can be substituted Implement more or fewer components.
  • the first type of blockchain node node may also include an input unit such as a keyboard (Keyboard), a voice input device such as a microphone (Microphone), a radio frequency (RF) circuit, a display, a sensor, an audio circuit, One or more of wired interface and wireless interface, etc., will not be repeated here.
  • an input unit such as a keyboard (Keyboard), a voice input device such as a microphone (Microphone), a radio frequency (RF) circuit, a display, a sensor, an audio circuit, One or more of wired interface and wireless interface, etc., will not be repeated here.
  • the processor 22 can implement the following steps when executing the first type blockchain node implementation program 30 stored in the memory 21:
  • Configuration step acquiring address information of at least one second type blockchain node, and writing the address information into a local configuration file;
  • Connection request step sending a connection establishment request to the corresponding second type blockchain node according to the address information in the configuration file;
  • Data request step after the first type blockchain node and the second type blockchain node establish a connection, the first type blockchain node sends a data acquisition request to the second type blockchain node;
  • Receiving step the first type blockchain node receives the data returned by the second type blockchain node.
  • This application also provides a device for implementing a blockchain network interconnected across network segments.
  • the first-type blockchain node implementation program 30 may be divided into multiple modules, and the multiple modules are stored in the memory 22 and executed by the processor 23 to complete the application.
  • the module referred to in this application refers to a series of computer program instruction segments that can complete specific functions.
  • FIG. 3 it is a program module diagram of an embodiment of the first-type blockchain node implementation program 30 in FIG. 2.
  • the first-type blockchain node implementation program 30 can be divided into: a configuration module 310, a connection module 320, a data request module 330, and a receiving module 340.
  • the configuration module 310 is used to obtain address information of at least one second-type blockchain node and write it into a local configuration file.
  • the blockchain system 1 can disclose the address information of one or more second-type blockchain nodes, such as IP address and port number information, to all blockchain nodes.
  • the configuration module 310 directly writes the IP address and port number information of the second type of blockchain node into the configuration file of the first type of blockchain node; suppose If there is no second-type blockchain node in the same network segment as the first-type blockchain node, the configuration module 310 can map the address of a certain second-type blockchain node to The virtual address of the network segment where the first-type blockchain node is located, and the virtual address and the corresponding mapping relationship are written into the configuration file of the first-type blockchain node as address information.
  • the connection module 320 is configured to send a request for establishing a communication connection to the corresponding second-type blockchain node according to the address information in the configuration file, and upon receiving the second-type blockchain node After confirming the response, establish a communication connection with it.
  • the first-type blockchain node may establish a connection with the second-type blockchain node through a transport layer security (Transport Layer Security, TLS).
  • TLS Transport Layer Security
  • the first-type blockchain node and the second-type blockchain node may establish a connection through multiple handshake (Handshake) and TLS mutual authentication.
  • the connection module 320 may also verify the legitimacy of the second-type blockchain node.
  • the first-type blockchain node and the second-type node can obtain a digital certificate proving the identity of the node from a corresponding certificate authority (Certificate Authority, CA), and the first-type blockchain node is in contact with the After the second-type blockchain node establishes a connection, the second-type blockchain node can obtain a digital certificate proving the identity of the node, and verify the legality of the digital certificate through a corresponding trusted CA.
  • CA Certificate Authority
  • connection module 320 may send the result of the legality verification to the data request module 330; if the verification result is that the identity of the second-type blockchain node is illegal, the connection module 320 will actively disconnect the communication connection with the second-type blockchain node and record relevant information.
  • the data request module 330 is used to send data acquisition requests to other blockchain nodes.
  • the data request module 330 may send the first request information for obtaining the blockchain ledger to the second-type blockchain node that establishes a communication connection with the first-type blockchain node, and may also send and obtain the neighbor node list.
  • the second request information may include state information of the blockchain stored by the first-type blockchain node, such as a message digest (hash value) of the block with the highest height.
  • the neighbor nodes in the neighbor node list are sorted by priority, and the priority is determined according to the network segment where the IP address of the neighbor node is located and the network segment where the IP address of the first type blockchain node is located .
  • a neighbor node that is in the same network segment as the IP address of the first type of blockchain node has a higher priority.
  • the neighbor node may be a second-type blockchain node or other first-type blockchain nodes.
  • the neighbor node list includes identification information of each neighbor node, and the first-type blockchain node may establish a communication connection with a corresponding neighbor node according to the identification information.
  • the data request module 330 may send a request for obtaining a blockchain ledger to the corresponding neighbor node in the order of the neighbor nodes in the neighbor node list.
  • the first-type blockchain node sends a request for obtaining a blockchain ledger to the first neighbor node in the neighbor node list, if the first-type blockchain node is after a preset time threshold (for example, 30s) If the blockchain node does not receive the blockchain ledger returned by the first neighbor node, the first type of blockchain node sends to the second neighbor node in the neighbor node list to obtain the blockchain ledger If the first-type blockchain node does not receive the blockchain ledger returned by the second neighboring node after the preset time threshold, the first-type blockchain node will report to the neighbor The third neighbor node in the node list sends a request to obtain the blockchain ledger, and so on, so I won’t repeat it.
  • a preset time threshold for example, 30s
  • the receiving module 340 is used to receive data returned by other blockchain nodes.
  • the receiving module 340 may receive the blockchain ledger returned by the second-type blockchain node, and may also receive the neighbor node list returned by the second-type blockchain node, and further, may also receive Blockchain ledger data returned by neighbor nodes.
  • configuration module 310 is also used for:
  • the address information of the second type blockchain node in the network segment is written into the first type blockchain In the node's configuration file
  • configuration module 310 is also used for:
  • the address information includes IP address and port number information, or includes IP address and Mac address.
  • data request module 330 is also used for:
  • the receiving module 340 is also used for:
  • the device further includes:
  • a sending module configured to send to the neighbor node the third request information for obtaining the blockchain ledger at intervals of a preset time threshold according to the order of the neighbor nodes in the neighbor node list;
  • the receiving module 340 is further configured to receive the blockchain ledger returned by the neighbor node.
  • this application also provides a method for implementing a blockchain network interconnected across network segments.
  • FIG. 4 it is a schematic flowchart of an embodiment of a method for implementing a blockchain network interconnected across network segments according to this application. The steps of the method are as follows:
  • the configuration module 310 writes the address information of at least one second-type blockchain node into the configuration file of the first-type blockchain node.
  • the address information is the IP address and port number of the second type blockchain node in this network segment Information; if the second-type blockchain node and the first-type blockchain node are not in the same network segment, the address information is that the second-type blockchain node is mapped to the first-type blockchain node
  • the IP address and port number information of the network segment It is understandable that the mapping addresses of the same second type blockchain node in different network segments may be the same or different. In other embodiments, replacing the port number information with the Mac address can also achieve similar technical effects.
  • a first-type blockchain node is in the first network segment
  • a second-type blockchain node is in the second network segment.
  • the first network segment and the second network segment are In different network segments, the address of the first type of blockchain node is denoted as a, and the address of the second type of blockchain node is denoted as b, where a belongs to the first network segment, b belongs to the second network segment, and a and There is no direct access between b, that is, the first type of blockchain node in the first network segment and the second type of blockchain node in the second network segment cannot directly communicate, it can be the first type of blockchain node A first virtual address c is allocated in the first network segment, and a second virtual address d is allocated in the second network segment for the second-type blockchain node, between b and c and between a and d A mapping relationship is established between them, and the virtual address and the mapping relationship are written into the configuration file of the first-type blockchain node.
  • the second virtual address d is used as the source address and b is used as the destination address for access, that is, a must access b, according to the difference between b and c
  • the mapping relationship becomes a to c, and according to the mapping relationship between a and d, it becomes d to b.
  • the establishment of the mapping relationship can be achieved through a hash function.
  • the construction of the hash function needs to consider both the first type of blockchain node and the second type of blockchain node. IP address, Mac address and port number information.
  • Step S420 The connection module 320 sends a request to establish a communication connection to the corresponding second-type blockchain node according to the address information in the configuration file, and upon receiving the second-type blockchain node After confirming the response, establish a communication connection with it.
  • the first type blockchain node can establish a connection with the second type blockchain node through TLS.
  • the first-type blockchain node and the second-type blockchain node may pass multiple handshake and pass TLS mutual authentication to establish a connection.
  • the first-type blockchain node after the first-type blockchain node establishes a connection with the second-type blockchain node, it can obtain a digital certificate for the second-type blockchain node to prove the identity of the node, and pass The corresponding trusted CA verifies the legality of the digital certificate. Assuming that the legality verification is passed, the connection is maintained and data interaction is allowed. If the verification fails, the connection is automatically disconnected. It is understandable that the second type of blockchain node may also verify the identity of the first type of blockchain node through a corresponding CA, which will not be repeated here.
  • Step S430 The data request module 330 sends a data acquisition request to other blockchain nodes that have established connections with the first type of blockchain node where it is located.
  • the first type of blockchain node After the first type of blockchain node establishes a connection with the corresponding second type of blockchain node according to the address information in its configuration file, it can send to the second type of blockchain node to obtain neighbor nodes List request.
  • the neighbor nodes in the neighbor node list are sorted by priority, and the priority is determined according to the network segment where the IP address of the neighbor node is located and the network segment where the IP address of the first type blockchain node is located . For example, a neighbor node that is in the same network segment as the IP address of the first type of blockchain node has a higher priority.
  • the neighbor node may be a second-type blockchain node or other first-type blockchain nodes.
  • the first-type blockchain node may send a request to obtain the blockchain ledger to the first neighbor node in the neighbor node list, if it is after a preset time threshold (for example, 30s) If the first type blockchain node does not receive the blockchain ledger returned by the first neighbor node, then the first type blockchain node sends to the second neighbor node in the neighbor node list A request to obtain a blockchain ledger, if the first type of blockchain node does not receive the blockchain ledger returned by the second neighbor node after the preset time threshold, the first type of blockchain The node sends a request for obtaining a blockchain ledger to the third neighbor node in the neighbor node list, and so on, and will not be repeated.
  • a preset time threshold for example, 30s
  • the first type of blockchain node can also directly send a request to obtain a blockchain ledger to a second type of blockchain node that has established a connection based on the address information in its configuration file.
  • This embodiment chooses to obtain neighbors first.
  • the node list then sends a request to obtain the blockchain ledger to neighbor nodes only to reduce the network delay when synchronizing blocks, so as to improve the performance of the blockchain system as a whole, and is not a limitation on the content of the invention, and will not be repeated here.
  • Step S440 The receiving module 340 receives data returned from other blockchain nodes.
  • the other blockchain nodes may be second-type blockchain nodes corresponding to the address information in the local configuration file, and may be other second-type blocks corresponding to the neighbor node list obtained from the second-type blockchain node Chain node or first type blockchain node.
  • the returned data can be a blockchain ledger, a neighbor node list, or other data information.
  • the request may include the request sender, that is, the state information of the blockchain stored in the first type blockchain node,
  • the request recipient that is, the other blockchain nodes, can determine the blockchain ledger required by the first type of blockchain node based on the status information, generate a blockchain ledger data packet, and return it to the all Describe the first type of blockchain node.
  • the receiving module 340 can receive a blockchain ledger data packet containing blocks 69-89.
  • the address information of the second-type blockchain node is written into the configuration file of each first-type blockchain node.
  • the type of blockchain node can establish a connection with the corresponding second type of blockchain node according to the address information in its configuration file and complete information interaction, thereby overcoming the inability of blockchain nodes located in different network segments to communicate directly Technical issues to realize a blockchain network interconnected across network segments.
  • the configuration information in the local configuration file of each of the first-type blockchain nodes is easier to add, delete, and modify flexibly. Therefore, using this blockchain network implementation method is also convenient for block
  • the chain system is expanded and changed.
  • the method may further include:
  • the corresponding first-type blockchain node suspends the current task, dynamically updates the configuration file, and establishes a connection with the corresponding second-type blockchain node according to the new configuration information in the configuration file.
  • the present application also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium.
  • the computer-readable storage medium can be a hard disk, multimedia card, SD card, flash memory card, SMC, read only memory (ROM), erasable programmable read only memory (EPROM), portable compact disk read only memory (CD- ROM), USB memory, etc. include any one or any combination of several of the above.
  • the computer-readable storage medium includes a first-type blockchain node implementation program 30, and when the first-type blockchain node implementation program 30 is executed by the processor 23, the following operations are implemented:
  • Configuration step acquiring address information of at least one second-type blockchain node, and writing the address information into the configuration file;
  • Connection request step sending a connection establishment request to the corresponding second type blockchain node according to the address information in the configuration file;
  • Data request step after the first type blockchain node and the second type blockchain node establish a connection, the first type blockchain node sends a data acquisition request to the second type blockchain node;
  • Receiving step the first type blockchain node receives the data returned by the second type blockchain node.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The present application relates to blockchain technology. Provided are a cross-network segment interconnected blockchain network implementation method and apparatus, and a system, and a computer-readable storage medium. The method comprises: adding address information of at least one second-type blockchain node into a configuration file of each first-type blockchain node; the first-type blockchain node establishing, according to the address information in the configuration file thereof, a connection with a corresponding second-type blockchain node; the first-type blockchain node sending a data acquisition request to the second-type blockchain node between which and the first-type blockchain node the connection is established; and the first-type blockchain node receiving data returned by the second-type blockchain node. By means of the present application, a cross-network-segment interconnected blockchain network can be realized.

Description

跨网段互连的区块链网络实现方法、装置、***及介质Method, device, system and medium for implementing blockchain network interconnected across network segments
本申请要求于2019年5月20日提交中国专利局、申请号为201910419860.1、发明名称为“跨网段互连的区块链网络实现方法、***及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims the priority of a Chinese patent application filed with the Chinese Patent Office on May 20, 2019, the application number is 201910419860.1, and the invention title is "A method, system and storage medium for implementing a blockchain network interconnected across network segments". The entire content is incorporated into the application by reference.
技术领域Technical field
本申请涉及区块链技术领域,尤其涉及一种跨网段互连的区块链网络实现方法、装置、***及计算机可读存储介质。This application relates to the field of blockchain technology, and in particular to a method, device, system and computer-readable storage medium for implementing a blockchain network interconnected across network segments.
背景技术Background technique
区块链可以被理解为一个分布式的账本,也可以被看作是一个分布式计算和存储***。一个区块链***可以包括多个/种区块链节点,预先确定的若干区块链节点(例如区块链共识节点)的地址信息可以被记录在创世区块中,其他区块链节点根据所述地址信息与所述预先确定的区块链节点建立连接并进行信息交互。然而,发明人意识到在实际的应用场景中,各个区块链节点可能位于不同网段,不在同一网段的区块链节点根据相同的地址信息无法访问到对应的所述预先确定的区块链节点,而且,记录在创世区块中的地址信息无法被修改或扩展,无法满足实际的业务需求。Blockchain can be understood as a distributed ledger, or as a distributed computing and storage system. A blockchain system can include multiple/kind of blockchain nodes, and the address information of a number of predetermined blockchain nodes (such as blockchain consensus nodes) can be recorded in the genesis block, and other blockchain nodes Establish a connection with the predetermined blockchain node according to the address information and perform information exchange. However, the inventor realizes that in actual application scenarios, each blockchain node may be located in a different network segment, and blockchain nodes that are not in the same network segment cannot access the corresponding predetermined block according to the same address information. Moreover, the address information recorded in the genesis block cannot be modified or expanded, and cannot meet actual business needs.
发明内容Summary of the invention
鉴于以上所述现有技术的缺点,本申请的目的在于提供一种跨网段互连的区块链网络实现方法、装置、***及计算机可读存储介质,用来解决现有技术中不在同一网段的区块链节点根据相同的地址信息无法访问到对应的区块链节点的问题,也便于对区块链***进行扩展和变更。In view of the above-mentioned shortcomings of the prior art, the purpose of this application is to provide a method, device, system, and computer-readable storage medium for implementing a blockchain network interconnected across network segments to solve the problems in the prior art. The block chain node of the network segment cannot access the corresponding block chain node according to the same address information, which is also convenient for the expansion and change of the block chain system.
为实现上述目的,本申请提供一种跨网段互连的区块链网络实现方法,应用于区块链***,该方法包括:In order to achieve the above objective, this application provides a method for implementing a blockchain network interconnected across network segments, which is applied to a blockchain system, and the method includes:
配置步骤:在每个第一类型区块链节点的配置文件中添加至少一个第二类型区块链节点的地址信息;Configuration steps: add the address information of at least one second-type blockchain node to the configuration file of each first-type blockchain node;
连接步骤:所述第一类型区块链节点根据其配置文件中的所述地址信息与对应的所述第二类型区块链节点建立连接;Connection step: the first type blockchain node establishes a connection with the corresponding second type blockchain node according to the address information in its configuration file;
数据请求步骤:所述第一类型区块链节点向与其建立连接的所述第二类型区块链节点发送数据获取请求;及Data request step: the first-type blockchain node sends a data acquisition request to the second-type blockchain node with which it is connected; and
数据传输步骤:所述第一类型区块链节点接收所述第二类型区块链节点返回的数据。Data transmission step: the first type blockchain node receives the data returned by the second type blockchain node.
可选地,当所述第一类型区块链节点与第二类型区块链节点在同一网段时,所述配置步骤包括:Optionally, when the first type blockchain node and the second type blockchain node are in the same network segment, the configuration step includes:
将该第二类型区块链节点在该网段中的地址信息写入该第一类型区块链节点的配置文件中。Write the address information of the second type blockchain node in the network segment into the configuration file of the first type blockchain node.
可选地,当所述第一类型区块链节点与第二类型区块链节点不在同一网段时,所述配置步骤包括:Optionally, when the first type blockchain node and the second type blockchain node are not in the same network segment, the configuration step includes:
将该第二类型区块链节点映射到该第一类型区块链节点所在网段的地址信息以及对应的映射关系写入该第一类型区块链节点的配置文件中。The address information and the corresponding mapping relationship of mapping the second type blockchain node to the network segment where the first type blockchain node is located are written into the configuration file of the first type blockchain node.
可选地,所述地址信息包括IP地址和端口号信息,或者包括IP地址和Mac地址。Optionally, the address information includes IP address and port number information, or includes IP address and Mac address.
可选地,所述数据请求步骤具体包括:Optionally, the data request step specifically includes:
所述第一类型区块链节点向与其建立连接的所述第二类型区块链节点发送请求获取区块链账本的第一请求信息和/或请求获取邻居节点列表的第二请求信息;Sending, by the first-type blockchain node, to the second-type blockchain node with which the connection is established, first request information for obtaining a blockchain ledger and/or second request information for requesting a neighbor node list;
所述数据传输步骤具体包括:The data transmission step specifically includes:
所述第一类型区块链节点接收所述第二类型区块链节点返回的区块链账本和/或邻居节点列表。The first type blockchain node receives the blockchain ledger and/or neighbor node list returned by the second type blockchain node.
可选地,该方法还包括:Optionally, the method further includes:
所述第一类型区块链节点根据所述邻居节点列表中邻居节点的顺序,以预设时间阈值为间隔,向所述邻居节点发送请求获取区块链账本的第三请求信息;The first-type blockchain node sends the third request information requesting to obtain the blockchain ledger to the neighbor node at intervals of a preset time threshold according to the order of the neighbor nodes in the neighbor node list;
所述第一类型区块链节点接收所述邻居节点返回的区块链账本。The first type blockchain node receives the blockchain ledger returned by the neighbor node.
可选地,该方法还包括:Optionally, the method further includes:
当所述第二类型区块链节点发生变更时,将变更信息广播至所有区块链节点;When the second type of blockchain node is changed, broadcast the change information to all the blockchain nodes;
对应的第一类型区块链节点在接收到所述变更信息后,暂停当前任务,动态更新配置文件,并根据配置文件中新的配置信息与对应的第二类型区块链节点建立连接。After receiving the change information, the corresponding first-type blockchain node suspends the current task, dynamically updates the configuration file, and establishes a connection with the corresponding second-type blockchain node according to the new configuration information in the configuration file.
本申请还提供一种跨网段互连的区块链网络实现装置,所述装置包括:This application also provides a device for implementing a blockchain network interconnected across network segments, the device including:
配置模块,用于在每个第一类型区块链节点的配置文件中添加至少一个第二类型区块链节点的地址信息;The configuration module is used to add the address information of at least one second-type blockchain node to the configuration file of each first-type blockchain node;
连接模块,用于根据所述配置文件中的所述地址信息与对应的所述第二类型区块链节点建立连接;The connection module is configured to establish a connection with the corresponding second type blockchain node according to the address information in the configuration file;
数据请求模块,用于向所述第二类型区块链节点发送数据获取请求;及A data request module for sending a data acquisition request to the second type blockchain node; and
接收模块,用于接收所述第二类型区块链节点返回的数据。The receiving module is used to receive the data returned by the second-type blockchain node.
本申请还提供一种区块链***,所述区块链***包括多个第一类型区块链节点和多个第二类型区块链节点,所述第一类型区块链节点和第二类型区块链节点在运行时实现如下步骤:The present application also provides a blockchain system. The blockchain system includes a plurality of first type blockchain nodes and a plurality of second type blockchain nodes. The first type blockchain node and the second type blockchain node The type blockchain node implements the following steps at runtime:
配置步骤:在每个第一类型区块链节点的配置文件中添加至少一个第二类型区块链节点的地址信息;Configuration steps: add the address information of at least one second-type blockchain node to the configuration file of each first-type blockchain node;
连接步骤:所述第一类型区块链节点根据其配置文件中的所述地址信息与对应的所述第二类型区块链节点建立连接;Connection step: the first type blockchain node establishes a connection with the corresponding second type blockchain node according to the address information in its configuration file;
数据请求步骤:所述第一类型区块链节点向与其建立连接的所述第二类型区块链节点发送数据获取请求;及Data request step: the first-type blockchain node sends a data acquisition request to the second-type blockchain node with which it is connected; and
数据传输步骤:所述第一类型区块链节点接收所述第二类型区块链节点返回的数据。Data transmission step: the first type blockchain node receives the data returned by the second type blockchain node.
可选地,当所述第一类型区块链节点与第二类型区块链节点不在同一网段时,所述配置步骤包括:Optionally, when the first type blockchain node and the second type blockchain node are not in the same network segment, the configuration step includes:
将该第二类型区块链节点映射到该第一类型区块链节点所在网段的地址信息以及对应的映射关系写入该第一类型区块链节点的配置文件中。The address information and the corresponding mapping relationship of mapping the second type blockchain node to the network segment where the first type blockchain node is located are written into the configuration file of the first type blockchain node.
本申请还提供一种计算机可读存储介质,所述计算机可读存储介质中包括第一类型区块链节点实现程序和配置文件,所述第一类型区块链节点实现程序被处理器执行时实现如下步骤:This application also provides a computer-readable storage medium that includes a first-type blockchain node implementation program and a configuration file, and when the first-type blockchain node implementation program is executed by a processor Implement the following steps:
配置步骤:获取至少一个第二类型区块链节点的地址信息,将所述地址信息写入所述配置文件中;Configuration step: acquiring address information of at least one second-type blockchain node, and writing the address information into the configuration file;
连接请求步骤:根据所述配置文件中的所述地址信息向对应的所述第二类型区块链节点发送建立连接的请求;Connection request step: sending a connection establishment request to the corresponding second type blockchain node according to the address information in the configuration file;
数据请求步骤:在所述第一类型区块链节点与第二类型区块链节点建立连接后,所述第一类型区块链节点向该第二类型区块链节点发送数据获取请求;及Data request step: after the first type blockchain node and the second type blockchain node establish a connection, the first type blockchain node sends a data acquisition request to the second type blockchain node; and
接收步骤:所述第一类型区块链节点接收该第二类型区块链节点返回的数据。Receiving step: the first type blockchain node receives the data returned by the second type blockchain node.
本申请提供的跨网段互连的区块链网络实现方法、***及计算机可读存储介质,通过将第二类型区块链节点的地址信息写入第一类型区块链节点的配置文件中,然后由所述第一类型区块链节点根据其配置文件中的所述地址信息与对应的所述第二类型区块链节点建立连接。这样所述第一类型区块链节点就可以向与其建立连接的所述第二类型区块链节点发送数据获取请求并接收所述第二类型区块链节点返回的数据。各个第一类型区块链节点可以利用其本地配置文件中的配置信息与对应的第二类型区块链节点建立连接,进而实现数据同步以及与其他节点的连接,因为本地配置文件中的配置信息可以视具体需要进行灵活设置和变更,所以利用本申请,可以实现对区块链***的扩展和变更,还可以实现位于不同网段的区块链节点的相互连接和信息交互,即跨网段互联的区块链网络。The implementation method, system, and computer-readable storage medium of a blockchain network interconnected across network segments provided in this application writes the address information of the second type of blockchain node into the configuration file of the first type of blockchain node , And then the first-type blockchain node establishes a connection with the corresponding second-type blockchain node according to the address information in its configuration file. In this way, the first-type blockchain node can send a data acquisition request to the second-type blockchain node with which it is connected and receive data returned by the second-type blockchain node. Each first type blockchain node can use the configuration information in its local configuration file to establish a connection with the corresponding second type blockchain node, thereby realizing data synchronization and connecting with other nodes, because of the configuration information in the local configuration file Flexible settings and changes can be made according to specific needs. Therefore, with this application, the blockchain system can be expanded and changed, and blockchain nodes located in different network segments can also be interconnected and information exchanged, that is, across network segments Interconnected blockchain network.
附图说明Description of the drawings
图1为本申请区块链***一实施例的示意图;Figure 1 is a schematic diagram of an embodiment of the blockchain system of this application;
图2位图1中任一第一类型区块链节点的实施例的示意图;FIG. 2 is a schematic diagram of an embodiment of any first type blockchain node in FIG. 1;
图3为图2中第一类型区块链节点实现程序一实施例的程序模块图;FIG. 3 is a program module diagram of an embodiment of the program for implementing the first type blockchain node in FIG. 2;
图4为本申请跨网段互连的区块链网络实现方法一实施例的流程示意图;4 is a schematic flowchart of an embodiment of a method for implementing a blockchain network interconnected across network segments according to this application;
具体实施方式Detailed ways
为了使本申请的目的、技术方案和优点更加清楚明白,下面将结合若干附图及实施例,对本申请进行进一步的详细说明。应当理解的是,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本申请保护的范围。In order to make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below in conjunction with several drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the application, and not used to limit the application. Based on the embodiments in this application, all other embodiments obtained by those of ordinary skill in the art without creative work shall fall within the protection scope of this application.
需要说明的是,本申请中的术语“第一”、“第二”、“第三”等仅用于区分描述不同对象,而不能理解为指示或暗示顺序关系、相对重要性或者隐含指明所指示的技术特征的数量。It should be noted that the terms "first", "second", "third", etc. in this application are only used to distinguish and describe different objects, and cannot be understood as indicating or implying order relationship, relative importance or implicitly indicating The number of technical features indicated.
本申请提供一种区块链***。参照图1所示,为本申请区块链***1一实施例的示意图。在该实施例中,区块链***1包括多个第一类型区块链节点和多个第二类型区块链节点,为了便于描述,图1中仅标示两个第一类型区块链节点,分别是第一类型区块链节点2和第一类型区块链节点3,所述多个第二类型区块链节点在图1中被标示为第二类型区块链节点群4。所述第一类型区块链节点可以是用于维护完整区块链账本的数据节点,也 可以是新加入区块链***1的新节点,所述第二类型区块链节点可以是保存有完整区块链账本并负责生成新区块的共识节点,多个共识节点相互连接,协作运行。This application provides a blockchain system. Referring to FIG. 1, it is a schematic diagram of an embodiment of the blockchain system 1 of this application. In this embodiment, the blockchain system 1 includes multiple first-type blockchain nodes and multiple second-type blockchain nodes. For ease of description, only two first-type blockchain nodes are shown in FIG. 1 , Respectively are the first type blockchain node 2 and the first type blockchain node 3, the multiple second type blockchain nodes are marked as the second type blockchain node group 4 in FIG. The first type of blockchain node may be a data node used to maintain a complete blockchain ledger, or may be a new node newly added to the blockchain system 1, and the second type of blockchain node may be The complete blockchain ledger and the consensus node responsible for generating new blocks. Multiple consensus nodes are connected to each other and operate in collaboration.
所述第一类型区块链节点和第二类型区块链节点可以是服务器、智能手机、平板电脑、便携计算机、桌上型计算机等具有存储和运算功能的终端设备。在一个实施例中,当所述数据节点或共识节点为服务器时,该服务器可以是机架式服务器、刀片式服务器、塔式服务器或机柜式服务器等的一种或几种。The first type blockchain node and the second type blockchain node may be terminal devices with storage and computing functions such as servers, smart phones, tablet computers, portable computers, desktop computers, and the like. In an embodiment, when the data node or the consensus node is a server, the server may be one or more of a rack server, a blade server, a tower server, or a cabinet server.
参照图2所示,为图1中任一第一类型区块链节点的实施例的示意图。所述第一类型区块链节点包括存储器21、处理器22以及网络接口23。Refer to FIG. 2, which is a schematic diagram of an embodiment of any first type blockchain node in FIG. 1. The first type blockchain node includes a memory 21, a processor 22, and a network interface 23.
其中,存储器21包括至少一种类型的可读存储介质。所述至少一种类型的可读存储介质可为如闪存、硬盘、多媒体卡、卡型存储器等的非易失性存储介质。在一些实施例中,所述可读存储介质可以是所述第一类型区块链节点的内部存储单元,例如该第一类型区块链节点的硬盘。在另一些实施例中,所述可读存储介质也可以是该第一类型区块链节点的外部存储器,例如该第一类型区块链节点上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。The memory 21 includes at least one type of readable storage medium. The at least one type of readable storage medium may be a non-volatile storage medium such as flash memory, hard disk, multimedia card, card-type memory, and the like. In some embodiments, the readable storage medium may be an internal storage unit of the first type of blockchain node, such as a hard disk of the first type of blockchain node. In other embodiments, the readable storage medium may also be an external memory of the first type of blockchain node, such as a plug-in hard disk equipped on the first type of blockchain node, and a smart memory card (Smart Memory Card). Media Card, SMC), Secure Digital (SD) card, Flash Card, etc.
在本实施例中,所述存储器21的可读存储介质用于存储第一类型区块链节点实现程序30、配置文件、区块链账本以及该第一类型区块链节点与第二类型区块链节点以及其他第一类型区块链节点进行信息交互过程中产生的数据,例如邻居节点列表等。所述存储器21还可以用于暂时地存储已经输出或者将要输出的数据。In this embodiment, the readable storage medium of the memory 21 is used to store the first type blockchain node implementation program 30, configuration files, blockchain ledger, and the first type blockchain node and the second type area. The data generated during the process of information exchange between blockchain nodes and other first-type blockchain nodes, such as a list of neighbor nodes. The memory 21 can also be used to temporarily store data that has been output or will be output.
处理器22可以是一中央处理器(Central Processing Unit,CPU),微处理器或其他数据处理芯片,用于运行存储器21中存储的程序代码或处理数据,例如执行所述第一类型区块链节点实现程序30。The processor 22 may be a central processing unit (CPU), a microprocessor or other data processing chip, used to run the program code or processing data stored in the memory 21, for example to execute the first type of blockchain Node implementation program 30.
网络接口23可以包括标准的有线接口、无线接口(如WI-FI接口)。通常用于在该第一类型区块链节点与其他电子设备之间建立通信连接,例如与第二类型区块链节点以及其他第一类型区块链节点等建立通信连接。The network interface 23 may include a standard wired interface and a wireless interface (such as a Wi-Fi interface). It is usually used to establish a communication connection between the first-type blockchain node and other electronic devices, for example, to establish a communication connection with the second-type blockchain node and other first-type blockchain nodes.
图2仅示出了具有组件21-23以及第一类型区块链节点实现程序30的第一类型区块链节点,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。Figure 2 only shows the first type of blockchain node with components 21-23 and the first type of blockchain node implementation program 30, but it should be understood that it is not required to implement all the illustrated components, and can be substituted Implement more or fewer components.
可选地,所述第一类型区块链节点节点还可以包括输入单元比如键盘(Keyboard),语音输入装置比如麦克风(Microphone),射频(Radio Frequency,RF)电路、显示器、传 感器、音频电路、有线接口和无线接口等的一种或多种,在此不再赘述。Optionally, the first type of blockchain node node may also include an input unit such as a keyboard (Keyboard), a voice input device such as a microphone (Microphone), a radio frequency (RF) circuit, a display, a sensor, an audio circuit, One or more of wired interface and wireless interface, etc., will not be repeated here.
在上述实施例中,处理器22执行存储器21中存储的第一类型区块链节点实现程序30时可以实现如下步骤:In the above embodiment, the processor 22 can implement the following steps when executing the first type blockchain node implementation program 30 stored in the memory 21:
配置步骤:获取至少一个第二类型区块链节点的地址信息,将所述地址信息写入本地配置文件中;Configuration step: acquiring address information of at least one second type blockchain node, and writing the address information into a local configuration file;
连接请求步骤:根据所述配置文件中的所述地址信息向对应的所述第二类型区块链节点发送建立连接的请求;Connection request step: sending a connection establishment request to the corresponding second type blockchain node according to the address information in the configuration file;
数据请求步骤:在所述第一类型区块链节点与第二类型区块链节点建立连接后,所述第一类型区块链节点向该第二类型区块链节点发送数据获取请求;及Data request step: after the first type blockchain node and the second type blockchain node establish a connection, the first type blockchain node sends a data acquisition request to the second type blockchain node; and
接收步骤:所述第一类型区块链节点接收该第二类型区块链节点返回的数据。Receiving step: the first type blockchain node receives the data returned by the second type blockchain node.
关于上述步骤的详细介绍,请参照下述图3关于第一类型区块链节点实现程序30一实施例的程序模块图以及图4关于跨网段互连的区块链网络实现方法实施例的流程图的说明。For a detailed description of the above steps, please refer to the following Figure 3 for the program module diagram of an embodiment of the first type of blockchain node implementation program 30 and Figure 4 for the implementation method of a blockchain network interconnected across network segments Description of the flowchart.
本申请还提供了一种跨网段互连的区块链网络实现装置。This application also provides a device for implementing a blockchain network interconnected across network segments.
在其他实施例中,第一类型区块链节点实现程序30可以被分割为多个模块,该多个模块被存储于存储器22中,并由处理器23执行,以完成本申请。本申请所称的模块是指能够完成特定功能的一系列计算机程序指令段。In other embodiments, the first-type blockchain node implementation program 30 may be divided into multiple modules, and the multiple modules are stored in the memory 22 and executed by the processor 23 to complete the application. The module referred to in this application refers to a series of computer program instruction segments that can complete specific functions.
参照图3所示,为图2中第一类型区块链节点实现程序30一实施例的程序模块图。在本实施例中,所述第一类型区块链节点实现程序30可以被分割为:配置模块310、连接模块320、数据请求模块330和接收模块340。Referring to FIG. 3, it is a program module diagram of an embodiment of the first-type blockchain node implementation program 30 in FIG. 2. In this embodiment, the first-type blockchain node implementation program 30 can be divided into: a configuration module 310, a connection module 320, a data request module 330, and a receiving module 340.
所述配置模块310,用于获取至少一个第二类型区块链节点的地址信息,并将其写入本地配置文件中。例如,区块链***1可以向所有区块链节点公开一个或多个第二类型区块链节点的地址信息,例如IP地址和端口号信息,假设存在与第一类型区块链节点在同一网段的第二类型区块链节点,则所述配置模块310直接将该第二类型区块链节点的IP地址和端口号信息写入该第一类型区块链节点的配置文件中;假设不存在与所述第一类型区块链节点在同一网段的第二类型区块链节点,则所述配置模块310可以通过端口映射,将某个第二类型区块链节点的地址映射到所述第一类型区块链节点所在网段的虚拟地址,并将该虚拟地址和对应的映射关系作为地址信息写入所述第一类型区块链节点的配置文件中。The configuration module 310 is used to obtain address information of at least one second-type blockchain node and write it into a local configuration file. For example, the blockchain system 1 can disclose the address information of one or more second-type blockchain nodes, such as IP address and port number information, to all blockchain nodes. If the second type of blockchain node is in the network segment, the configuration module 310 directly writes the IP address and port number information of the second type of blockchain node into the configuration file of the first type of blockchain node; suppose If there is no second-type blockchain node in the same network segment as the first-type blockchain node, the configuration module 310 can map the address of a certain second-type blockchain node to The virtual address of the network segment where the first-type blockchain node is located, and the virtual address and the corresponding mapping relationship are written into the configuration file of the first-type blockchain node as address information.
所述连接模块320,用于根据所述配置文件中的所述地址信息向对应的第二类型区块链节点发送建立通信连接的请求,并在收到所述第二类型区块链节点的确认回应后,与其建立通信连接。例如,所述第一类型区块链节点可以通过安全传输层协议(Transport Layer Security,TLS)与所述第二类型区块链节点建立连接。为了保障通信安全,所述第一类型区块链节点与所述第二类型区块链节点可以通过多次握手(Handshake),通过TLS双向认证,从而建立连接。The connection module 320 is configured to send a request for establishing a communication connection to the corresponding second-type blockchain node according to the address information in the configuration file, and upon receiving the second-type blockchain node After confirming the response, establish a communication connection with it. For example, the first-type blockchain node may establish a connection with the second-type blockchain node through a transport layer security (Transport Layer Security, TLS). In order to ensure communication security, the first-type blockchain node and the second-type blockchain node may establish a connection through multiple handshake (Handshake) and TLS mutual authentication.
在一个实施例中,所述连接模块320还可以对所述第二类型区块链节点的合法性进行验证。具体地,所述第一类型区块链节点和第二类型节点可以从对应的证书授权中心(Certificate Authority,CA)获取证明节点身份的数字证书,所述第一类型区块链节点在与所述第二类型区块链节点建立连接后,可以获取所述第二类型区块链节点证明节点身份的数字证书,并通过对应的可信CA验证数字证书合法性。假设通过合法性验证,则所述连接模块320可以将合法性验证结果发送给所述数据请求模块330;假设验证结果为所述第二类型区块链节点的身份不合法,则所述连接模块320将主动断开与所述第二类型区块链节点的通信连接,并记录相关信息。In an embodiment, the connection module 320 may also verify the legitimacy of the second-type blockchain node. Specifically, the first-type blockchain node and the second-type node can obtain a digital certificate proving the identity of the node from a corresponding certificate authority (Certificate Authority, CA), and the first-type blockchain node is in contact with the After the second-type blockchain node establishes a connection, the second-type blockchain node can obtain a digital certificate proving the identity of the node, and verify the legality of the digital certificate through a corresponding trusted CA. Assuming that the legality verification is passed, the connection module 320 may send the result of the legality verification to the data request module 330; if the verification result is that the identity of the second-type blockchain node is illegal, the connection module 320 will actively disconnect the communication connection with the second-type blockchain node and record relevant information.
所述数据请求模块330,用于向其他区块链节点发送数据获取请求。例如,所述数据请求模块330可以向与所在第一类型区块链节点建立通信连接的第二类型区块链节点发送请求获取区块链账本的第一请求信息,还可以发送获取邻居节点列表的第二请求信息。其中,所述第一请求信息可以包括所述第一类型区块链节点存储的区块链的状态信息,例如高度最高的区块的消息摘要(哈希值)。所述邻居节点列表中的邻居节点按照优先级排序,所述优先级是根据所述邻居节点的IP地址所在的网段和所述第一类型区块链节点的IP地址所在的网段确定的。例如,与所述第一类型区块链节点的IP地址在同一个网段的邻居节点的优先级较高。所述邻居节点可以是第二类型区块链节点,也可以是其他第一类型区块链节点。所述邻居节点列表中包括各个邻居节点的标识信息,所述第一类型区块链节点可以根据所述标识信息与对应的邻居节点建立通信连接。所述数据请求模块330可以按照所述邻居节点列表中邻居节点的顺序向对应的邻居节点发送获取区块链账本的请求。具体地,所述第一类型区块链节点向所述邻居节点列表中的第一个邻居节点发送获取区块链账本的请求,如果在预设时间阈值(例如30s)之后所述第一类型区块链节点没有接收到所述第一个邻居节点返回的区块链账本,则所述第一类型区块链节点向所述邻居节点列表中的第二个邻居节点发送获取区块链账本的请求,如果在预设时间阈值之后所述第一类型区块链节点没有接收到所述第二个邻居节点返回的区块链账本,则所述第一类型区块链节点 向所述邻居节点列表中的第三个邻居节点发送获取区块链账本的请求,以此类推,不再赘述。The data request module 330 is used to send data acquisition requests to other blockchain nodes. For example, the data request module 330 may send the first request information for obtaining the blockchain ledger to the second-type blockchain node that establishes a communication connection with the first-type blockchain node, and may also send and obtain the neighbor node list. The second request information. Wherein, the first request information may include state information of the blockchain stored by the first-type blockchain node, such as a message digest (hash value) of the block with the highest height. The neighbor nodes in the neighbor node list are sorted by priority, and the priority is determined according to the network segment where the IP address of the neighbor node is located and the network segment where the IP address of the first type blockchain node is located . For example, a neighbor node that is in the same network segment as the IP address of the first type of blockchain node has a higher priority. The neighbor node may be a second-type blockchain node or other first-type blockchain nodes. The neighbor node list includes identification information of each neighbor node, and the first-type blockchain node may establish a communication connection with a corresponding neighbor node according to the identification information. The data request module 330 may send a request for obtaining a blockchain ledger to the corresponding neighbor node in the order of the neighbor nodes in the neighbor node list. Specifically, the first-type blockchain node sends a request for obtaining a blockchain ledger to the first neighbor node in the neighbor node list, if the first-type blockchain node is after a preset time threshold (for example, 30s) If the blockchain node does not receive the blockchain ledger returned by the first neighbor node, the first type of blockchain node sends to the second neighbor node in the neighbor node list to obtain the blockchain ledger If the first-type blockchain node does not receive the blockchain ledger returned by the second neighboring node after the preset time threshold, the first-type blockchain node will report to the neighbor The third neighbor node in the node list sends a request to obtain the blockchain ledger, and so on, so I won’t repeat it.
所述接收模块340,用于接收其他区块链节点返回的数据。例如,所述接收模块340可以接收第二类型区块链节点返回的区块链账本,还可以接收所述第二类型区块链节点返回的邻居节点列表,进一步的,还可以接收从所述邻居节点返回的区块链账本数据。The receiving module 340 is used to receive data returned by other blockchain nodes. For example, the receiving module 340 may receive the blockchain ledger returned by the second-type blockchain node, and may also receive the neighbor node list returned by the second-type blockchain node, and further, may also receive Blockchain ledger data returned by neighbor nodes.
进一步地,所述配置模块310还用于:Further, the configuration module 310 is also used for:
当所述第一类型区块链节点与第二类型区块链节点在同一网段时,将该第二类型区块链节点在该网段中的地址信息写入该第一类型区块链节点的配置文件中;When the first type blockchain node and the second type blockchain node are in the same network segment, the address information of the second type blockchain node in the network segment is written into the first type blockchain In the node's configuration file;
进一步地,所述配置模块310还用于:Further, the configuration module 310 is also used for:
当所述第一类型区块链节点与第二类型区块链节点不在同一网段时,将该第二类型区块链节点映射到该第一类型区块链节点所在网段的地址信息以及对应的映射关系写入该第一类型区块链节点的配置文件中。When the first type blockchain node and the second type blockchain node are not in the same network segment, map the second type blockchain node to the address information of the network segment where the first type blockchain node is located, and The corresponding mapping relationship is written into the configuration file of the first type of blockchain node.
进一步地,所述地址信息包括IP地址和端口号信息,或者包括IP地址和Mac地址。Further, the address information includes IP address and port number information, or includes IP address and Mac address.
进一步地,所述数据请求模块330还用于:Further, the data request module 330 is also used for:
向所述第二类型区块链节点发送请求获取区块链账本的第一请求信息和/或请求获取邻居节点列表的第二请求信息;Sending to the second-type blockchain node the first request information requesting to obtain the blockchain ledger and/or the second request information requesting to obtain the neighbor node list;
所述接收模块340还用于:The receiving module 340 is also used for:
接收所述第二类型区块链节点返回的区块链账本和/或邻居节点列表。Receive the blockchain ledger and/or neighbor node list returned by the second type of blockchain node.
进一步地,所述装置还包括:Further, the device further includes:
发送模块,用于根据所述邻居节点列表中邻居节点的顺序,以预设时间阈值为间隔,向所述邻居节点发送请求获取区块链账本的第三请求信息;A sending module, configured to send to the neighbor node the third request information for obtaining the blockchain ledger at intervals of a preset time threshold according to the order of the neighbor nodes in the neighbor node list;
所述接收模块340还用于接收所述邻居节点返回的区块链账本。The receiving module 340 is further configured to receive the blockchain ledger returned by the neighbor node.
基于与下述跨网段互连的区块链网络实现方法相同的实施例说明内容,本实施例对跨网段互连的区块链网络实现装置的实施例内容不做过多赘述。Based on the descriptions of the embodiments that are the same as the implementation method of the blockchain network interconnected across network segments, the content of the embodiment of the device for implementing the blockchain network interconnected across network segments will not be described in detail in this embodiment.
此外,本申请还提供一种跨网段互连的区块链网络实现方法。参照图4所示,为本申请跨网段互连的区块链网络实现方法一实施例的流程示意图。该方法的如下步骤:In addition, this application also provides a method for implementing a blockchain network interconnected across network segments. Referring to FIG. 4, it is a schematic flowchart of an embodiment of a method for implementing a blockchain network interconnected across network segments according to this application. The steps of the method are as follows:
步骤S410,所述配置模块310将至少一个第二类型区块链节点的地址信息写入第一类型区块链节点的配置文件中。其中,若所述第二类型区块链节点和第一类型区块链节点在同一网段中,则所述地址信息为该第二类型区块链节点在本网段的IP地址和端口号信息; 若所述第二类型区块链节点和第一类型区块链节点不在同一网段中,则所述地址信息为该第二类型区块链节点映射到该第一类型区块链节点所在网段的IP地址和端口号信息。可以理解的是,同一个第二类型区块链节点在不同网段的映射地址可能相同也可能不同。在其他实施例中,以Mac地址代替端口号信息,也能实现类似的技术效果。In step S410, the configuration module 310 writes the address information of at least one second-type blockchain node into the configuration file of the first-type blockchain node. Wherein, if the second type blockchain node and the first type blockchain node are in the same network segment, the address information is the IP address and port number of the second type blockchain node in this network segment Information; if the second-type blockchain node and the first-type blockchain node are not in the same network segment, the address information is that the second-type blockchain node is mapped to the first-type blockchain node The IP address and port number information of the network segment. It is understandable that the mapping addresses of the same second type blockchain node in different network segments may be the same or different. In other embodiments, replacing the port number information with the Mac address can also achieve similar technical effects.
具体地,在本实施例中,假设一个第一类型区块链节点在第一网段,一个第二类型区块链节点在第二网段,所述第一网段和第二网段为不同网段,将该第一类型区块链节点的地址表示为a,该第二类型区块链节点的地址表示为b,其中a属于第一网段,b属于第二网段,a与b之间不能直接访问,即第一网段中的第一类型区块链节点和第二网段中的第二类型区块链节点无法直接通信,则可以为该第一类型区块链节点在所述第一网段中分配第一虚拟地址c,为该第二类型区块链节点在所述第二网段中分配第二虚拟地址d,在b和c之间以及a和d之间建立映射关系,将所述虚拟地址以及映射关系写入该第一类型区块链节点的配置文件中。当该第一类型区块链节点访问该第二类型区块链节点时,以第二虚拟地址d作为源地址,b作为目的地址进行访问,即,a要访问b,根据b和c之间的映射关系,变为a访问c,有根据a和d之间的映射关系,变为d访问b。在实际操作中,所述映射关系的建立可以通过哈希函数实现,为保证映射关系的唯一性,构造哈希函数时需同时考虑第一类型区块链节点以及第二类型区块链节点的IP地址、Mac地址和端口号信息。只考虑第一类型区块链节点以及第二类型区块链节点的Mac地址及IP地址,或只考虑第一类型区块链节点以及第二类型区块链节点的IP地址及端口号信息都可以实现类似的功能。本实施例仅以处在不同网段的一个第一类型区块链节点和一个第二类型区块链节点为例,介绍第一类型区块链节点配置信息的相关情况,其他第一类型区块链节点与该第二类型区块链节点和或其他第二类型区块链节点在配置文件的处理问题上可参照上述介绍,在此不再赘述。Specifically, in this embodiment, it is assumed that a first-type blockchain node is in the first network segment, and a second-type blockchain node is in the second network segment. The first network segment and the second network segment are In different network segments, the address of the first type of blockchain node is denoted as a, and the address of the second type of blockchain node is denoted as b, where a belongs to the first network segment, b belongs to the second network segment, and a and There is no direct access between b, that is, the first type of blockchain node in the first network segment and the second type of blockchain node in the second network segment cannot directly communicate, it can be the first type of blockchain node A first virtual address c is allocated in the first network segment, and a second virtual address d is allocated in the second network segment for the second-type blockchain node, between b and c and between a and d A mapping relationship is established between them, and the virtual address and the mapping relationship are written into the configuration file of the first-type blockchain node. When the first type of blockchain node visits the second type of blockchain node, the second virtual address d is used as the source address and b is used as the destination address for access, that is, a must access b, according to the difference between b and c The mapping relationship becomes a to c, and according to the mapping relationship between a and d, it becomes d to b. In actual operation, the establishment of the mapping relationship can be achieved through a hash function. To ensure the uniqueness of the mapping relationship, the construction of the hash function needs to consider both the first type of blockchain node and the second type of blockchain node. IP address, Mac address and port number information. Only consider the Mac address and IP address of the first type of blockchain node and the second type of blockchain node, or only consider the IP address and port number information of the first type of blockchain node and the second type of blockchain node Similar functions can be achieved. This embodiment only takes a first-type blockchain node and a second-type blockchain node in different network segments as an example to introduce the configuration information of the first-type blockchain node, and other first-type areas The block chain node and the second type block chain node and or other second type block chain nodes can refer to the above introduction on the processing of the configuration file, and will not be repeated here.
步骤S420,所述连接模块320根据所述配置文件中的所述地址信息向对应的第二类型区块链节点发送建立通信连接的请求,并在收到所述第二类型区块链节点的确认回应后,与其建立通信连接。依上述例子,所述第一类型区块链节点可以通过TLS与所述第二类型区块链节点建立连接。为了保障通信安全,所述第一类型区块链节点与所述第二类型区块链节点可以通过多次握手,通过TLS双向认证,从而建立连接。在其他实施例中,所述第一类型区块链节点在与所述第二类型区块链节点建立连接后,可以获取所述第二类型区块链节点证明节点身份的数字证书,并通过对应的可信CA验证数字证书合法性。假设通过合法性验证,则保持连接,允许数据交互,假设验证失败,则自动断开连接。可以理解的 是,所述第二类型区块链节点也可以通过对应的CA对所述第一类型区块链节点的身份进行验证,在此不再赘述。Step S420: The connection module 320 sends a request to establish a communication connection to the corresponding second-type blockchain node according to the address information in the configuration file, and upon receiving the second-type blockchain node After confirming the response, establish a communication connection with it. According to the above example, the first type blockchain node can establish a connection with the second type blockchain node through TLS. In order to ensure communication security, the first-type blockchain node and the second-type blockchain node may pass multiple handshake and pass TLS mutual authentication to establish a connection. In other embodiments, after the first-type blockchain node establishes a connection with the second-type blockchain node, it can obtain a digital certificate for the second-type blockchain node to prove the identity of the node, and pass The corresponding trusted CA verifies the legality of the digital certificate. Assuming that the legality verification is passed, the connection is maintained and data interaction is allowed. If the verification fails, the connection is automatically disconnected. It is understandable that the second type of blockchain node may also verify the identity of the first type of blockchain node through a corresponding CA, which will not be repeated here.
步骤S430,所述数据请求模块330向与其所在第一类型区块链节点建立连接的其他区块链节点发送数据获取请求。在本实施例中,第一类型区块链节点在根据其配置文件中的地址信息与对应的第二类型区块链节点建立连接之后,可以向该第二类型区块链节点发送获取邻居节点列表的请求。所述邻居节点列表中的邻居节点按照优先级排序,所述优先级是根据所述邻居节点的IP地址所在的网段和所述第一类型区块链节点的IP地址所在的网段确定的。例如,与所述第一类型区块链节点的IP地址在同一个网段的邻居节点的优先级较高。所述邻居节点可以是第二类型区块链节点,也可以是其他第一类型区块链节点。在得到邻居节点列表后,所述第一类型区块链节点可以向所述邻居节点列表中的第一个邻居节点发送获取区块链账本的请求,如果在预设时间阈值(例如30s)之后所述第一类型区块链节点没有接收到所述第一个邻居节点返回的区块链账本,则所述第一类型区块链节点向所述邻居节点列表中的第二个邻居节点发送获取区块链账本的请求,如果在预设时间阈值之后所述第一类型区块链节点没有接收到所述第二个邻居节点返回的区块链账本,则所述第一类型区块链节点向所述邻居节点列表中的第三个邻居节点发送获取区块链账本的请求,以此类推,不再赘述。当然,所述第一类型区块链节点也可以直接向根据其配置文件中的地址信息建立起连接的第二类型区块链节点发送获取区块链账本的请求,本实施例选择先获取邻居节点列表再向邻居节点发送获取区块链账本的请求仅为减少同步区块时的网络延迟,以从整体上提高区块链***性能,并非对发明内容进行限定,在此不再赘述。Step S430: The data request module 330 sends a data acquisition request to other blockchain nodes that have established connections with the first type of blockchain node where it is located. In this embodiment, after the first type of blockchain node establishes a connection with the corresponding second type of blockchain node according to the address information in its configuration file, it can send to the second type of blockchain node to obtain neighbor nodes List request. The neighbor nodes in the neighbor node list are sorted by priority, and the priority is determined according to the network segment where the IP address of the neighbor node is located and the network segment where the IP address of the first type blockchain node is located . For example, a neighbor node that is in the same network segment as the IP address of the first type of blockchain node has a higher priority. The neighbor node may be a second-type blockchain node or other first-type blockchain nodes. After obtaining the neighbor node list, the first-type blockchain node may send a request to obtain the blockchain ledger to the first neighbor node in the neighbor node list, if it is after a preset time threshold (for example, 30s) If the first type blockchain node does not receive the blockchain ledger returned by the first neighbor node, then the first type blockchain node sends to the second neighbor node in the neighbor node list A request to obtain a blockchain ledger, if the first type of blockchain node does not receive the blockchain ledger returned by the second neighbor node after the preset time threshold, the first type of blockchain The node sends a request for obtaining a blockchain ledger to the third neighbor node in the neighbor node list, and so on, and will not be repeated. Of course, the first type of blockchain node can also directly send a request to obtain a blockchain ledger to a second type of blockchain node that has established a connection based on the address information in its configuration file. This embodiment chooses to obtain neighbors first. The node list then sends a request to obtain the blockchain ledger to neighbor nodes only to reduce the network delay when synchronizing blocks, so as to improve the performance of the blockchain system as a whole, and is not a limitation on the content of the invention, and will not be repeated here.
步骤S440,所述接收模块340接收从其他区块链节点返回的数据。所述其他区块链节点可以是本地配置文件中的地址信息对应的第二类型区块链节点,可以是从该第二类型区块链节点获取的邻居节点列表对应的其他第二类型区块链节点或第一类型区块链节点。返回的数据可以是区块链账本,可以是邻居节点列表,也可以是其他数据信息。在本实施例中,假设所述数据获取请求为区块链账本获取请求,则该请求中可以包括请求发送方,即所述第一类型区块链节点中所存储区块链的状态信息,请求接收方,即所述其他区块链节点,可根据所述状态信息,确定所述第一类型区块链节点需要的区块链账本,生成区块链账本数据包,将其返回给所述第一类型区块链节点。例如,假设根据所述第一类型区块链节点发送的请求中的区块链的状态信息确定所述第一类型区块链节点存储的区块链中高度最高的区块为第68区块,而所述其他区块链节点存储的区块链中高度最高的区块为第89区块,则所述第一类型区块链节点需要的区块链账本为第69-89区块,所述接收模块340 可以接收到包含第69-89区块的区块链账本数据包。Step S440: The receiving module 340 receives data returned from other blockchain nodes. The other blockchain nodes may be second-type blockchain nodes corresponding to the address information in the local configuration file, and may be other second-type blocks corresponding to the neighbor node list obtained from the second-type blockchain node Chain node or first type blockchain node. The returned data can be a blockchain ledger, a neighbor node list, or other data information. In this embodiment, assuming that the data acquisition request is a blockchain ledger acquisition request, the request may include the request sender, that is, the state information of the blockchain stored in the first type blockchain node, The request recipient, that is, the other blockchain nodes, can determine the blockchain ledger required by the first type of blockchain node based on the status information, generate a blockchain ledger data packet, and return it to the all Describe the first type of blockchain node. For example, suppose it is determined that the block with the highest height in the blockchain stored by the first type blockchain node is the 68th block according to the state information of the blockchain in the request sent by the first type blockchain node , And the block with the highest height among the blockchains stored by the other blockchain nodes is the 89th block, then the blockchain ledger required by the first type of blockchain node is the 69-89th block, The receiving module 340 can receive a blockchain ledger data packet containing blocks 69-89.
本实施例提出的跨网段互连的区块链网络实现方法,通过将第二类型区块链节点的地址信息写入各个第一类型区块链节点的配置文件中,各个所述第一类型区块链节点可以根据其配置文件中的所述地址信息与对应的所述第二类型区块链节点建立连接并完成信息交互,从而克服位于不同网段的区块链节点无法直接通信的技术问题,实现跨网段互联的区块链网络。相对创世区块中的信息,各个所述第一类型区块链节点的本地配置文件中的配置信息更易于进行灵活增删和修改,因此利用该区块链网络实现方法,还便于对区块链***进行扩展和变更。例如,在其他实施例中,该方法还可以包括:In the implementation method of a blockchain network interconnected across network segments proposed in this embodiment, the address information of the second-type blockchain node is written into the configuration file of each first-type blockchain node. The type of blockchain node can establish a connection with the corresponding second type of blockchain node according to the address information in its configuration file and complete information interaction, thereby overcoming the inability of blockchain nodes located in different network segments to communicate directly Technical issues to realize a blockchain network interconnected across network segments. Compared with the information in the genesis block, the configuration information in the local configuration file of each of the first-type blockchain nodes is easier to add, delete, and modify flexibly. Therefore, using this blockchain network implementation method is also convenient for block The chain system is expanded and changed. For example, in other embodiments, the method may further include:
当所述第二类型区块链节点发生变更时,将变更信息广播至所有区块链节点;When the second type of blockchain node is changed, broadcast the change information to all the blockchain nodes;
对应的第一类型区块链节点在接收到所述变更信息后,暂停当前任务,动态更新配置文件,并根据配置文件中新的配置信息与对应的第二类型区块链节点建立连接。After receiving the change information, the corresponding first-type blockchain node suspends the current task, dynamically updates the configuration file, and establishes a connection with the corresponding second-type blockchain node according to the new configuration information in the configuration file.
此外,本申请还提供一种计算机可读存储介质,该计算机可读存储介质可以为非易失性计算机可读存储介质,也可以为易失性计算机可读存储介质。该计算机可读存储介质可以是硬盘、多媒体卡、SD卡、闪存卡、SMC、只读存储器(ROM)、可擦除可编程只读存储器(EPROM)、便携式紧致盘只读存储器(CD-ROM)、USB存储器等等中包括所述的任意一种或者几种的任意组合。所述计算机可读存储介质中包括第一类型区块链节点实现程序30,所述第一类型区块链节点实现程序30被所述处理器23执行时实现如下操作:In addition, the present application also provides a computer-readable storage medium, which may be a non-volatile computer-readable storage medium or a volatile computer-readable storage medium. The computer-readable storage medium can be a hard disk, multimedia card, SD card, flash memory card, SMC, read only memory (ROM), erasable programmable read only memory (EPROM), portable compact disk read only memory (CD- ROM), USB memory, etc. include any one or any combination of several of the above. The computer-readable storage medium includes a first-type blockchain node implementation program 30, and when the first-type blockchain node implementation program 30 is executed by the processor 23, the following operations are implemented:
配置步骤:获取至少一个第二类型区块链节点的地址信息,将所述地址信息写入所述配置文件中;Configuration step: acquiring address information of at least one second-type blockchain node, and writing the address information into the configuration file;
连接请求步骤:根据所述配置文件中的所述地址信息向对应的所述第二类型区块链节点发送建立连接的请求;Connection request step: sending a connection establishment request to the corresponding second type blockchain node according to the address information in the configuration file;
数据请求步骤:在所述第一类型区块链节点与第二类型区块链节点建立连接后,所述第一类型区块链节点向该第二类型区块链节点发送数据获取请求;及Data request step: after the first type blockchain node and the second type blockchain node establish a connection, the first type blockchain node sends a data acquisition request to the second type blockchain node; and
接收步骤:所述第一类型区块链节点接收该第二类型区块链节点返回的数据。Receiving step: the first type blockchain node receives the data returned by the second type blockchain node.
本申请之计算机可读存储介质的具体实施方式可参照上述图3关于第一类型区块链节点实现程序一实施例的程序模块图以及图4关于跨网段互连的区块链网络实现方法一实施例的流程图的详细介绍,在此不再赘述。For the specific implementation of the computer-readable storage medium of the present application, please refer to the program module diagram of an embodiment of the first-type blockchain node implementation program in Figure 3 and Figure 4 on the implementation method of the blockchain network interconnected across network segments. The detailed introduction of the flowchart of an embodiment will not be repeated here.
需要说明的是,在本文中,术语“包括”、“包含”或者其任何其他变体意在涵盖非排 他性的包含,从而使得包括一系列要素的过程、装置、物品或者方法不仅包括那些要素,而且还包括没有明确列出的其他要素,或者是还包括为这种过程、装置、物品或者方法所固有的要素。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。It should be noted that in this article, the terms "including", "including" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements not only includes those elements, It also includes other elements that are not explicitly listed, or elements inherent to the process, device, article, or method. In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on what can be achieved by a person of ordinary skill in the art. When the combination of technical solutions is contradictory or cannot be achieved, it should be considered that such a combination of technical solutions does not exist. , Not within the scope of protection required by this application.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在如上所述的一个存储介质中,包括若干指令用以使得电子装置执行本申请各个实施例所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiments can be implemented by means of software plus the necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is better.的实施方式。 Based on this understanding, the technical solution of the present application essentially or the part that contributes to the prior art can be embodied in the form of a software product. The computer software product is stored in a storage medium as described above and includes several instructions. It is used to make the electronic device execute the method described in each embodiment of the present application.
以上仅为本申请的优选实施例,并非因此限制本申请的专利范围,凡是利用本申请说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本申请的专利保护范围内。The above are only preferred embodiments of this application, and do not limit the scope of this application. Any equivalent structure or equivalent process transformation made using the content of the description and drawings of this application, or directly or indirectly used in other related technical fields , The same reason is included in the scope of patent protection of this application.

Claims (20)

  1. 一种跨网段互连的区块链网络实现方法,应用于区块链***,该方法包括:A method for implementing a blockchain network interconnected across network segments is applied to a blockchain system, and the method includes:
    配置步骤:在每个第一类型区块链节点的配置文件中添加至少一个第二类型区块链节点的地址信息;Configuration steps: add the address information of at least one second-type blockchain node to the configuration file of each first-type blockchain node;
    连接步骤:所述第一类型区块链节点根据其配置文件中的所述地址信息与对应的所述第二类型区块链节点建立连接;Connection step: the first type blockchain node establishes a connection with the corresponding second type blockchain node according to the address information in its configuration file;
    数据请求步骤:所述第一类型区块链节点向与其建立连接的所述第二类型区块链节点发送数据获取请求;及Data request step: the first-type blockchain node sends a data acquisition request to the second-type blockchain node with which it is connected; and
    数据传输步骤:所述第一类型区块链节点接收所述第二类型区块链节点返回的数据。Data transmission step: the first type blockchain node receives the data returned by the second type blockchain node.
  2. 如权利要求1所述的跨网段互连的区块链网络实现方法,当所述第一类型区块链节点与第二类型区块链节点在同一网段时,所述配置步骤包括:According to the method for implementing a blockchain network interconnected across network segments according to claim 1, when the first type blockchain node and the second type blockchain node are in the same network segment, the configuration step includes:
    将该第二类型区块链节点在该网段中的地址信息写入该第一类型区块链节点的配置文件中。Write the address information of the second type blockchain node in the network segment into the configuration file of the first type blockchain node.
  3. 如权利要求1所述的跨网段互连的区块链网络实现方法,当所述第一类型区块链节点与第二类型区块链节点不在同一网段时,所述配置步骤包括:According to the method for implementing a blockchain network interconnected across network segments according to claim 1, when the first type blockchain node and the second type blockchain node are not in the same network segment, the configuration step includes:
    将该第二类型区块链节点映射到该第一类型区块链节点所在网段的地址信息以及对应的映射关系写入该第一类型区块链节点的配置文件中。The address information and the corresponding mapping relationship of mapping the second type blockchain node to the network segment where the first type blockchain node is located are written into the configuration file of the first type blockchain node.
  4. 如权利要求1至3中任意一项所述的跨网段互连的区块链网络实现方法,所述地址信息包括IP地址和端口号信息,或者包括IP地址和Mac地址。According to the method for implementing a blockchain network interconnected across network segments according to any one of claims 1 to 3, the address information includes IP address and port number information, or includes IP address and Mac address.
  5. 如权利要求1所述的跨网段互连的区块链网络实现方法,所述数据请求步骤具体包括:According to the method for implementing a blockchain network interconnected across network segments according to claim 1, the data request step specifically includes:
    所述第一类型区块链节点向与其建立连接的所述第二类型区块链节点发送请求获取区块链账本的第一请求信息和/或请求获取邻居节点列表的第二请求信息;Sending, by the first-type blockchain node, to the second-type blockchain node with which the connection is established, first request information for obtaining a blockchain ledger and/or second request information for requesting a neighbor node list;
    所述数据传输步骤具体包括:The data transmission step specifically includes:
    所述第一类型区块链节点接收所述第二类型区块链节点返回的区块链账本和/或邻居节点列表。The first type blockchain node receives the blockchain ledger and/or neighbor node list returned by the second type blockchain node.
  6. 如权利要求5所述的跨网段互连的区块链网络实现方法,该方法还包括:The method for implementing a blockchain network interconnected across network segments according to claim 5, the method further comprising:
    所述第一类型区块链节点根据所述邻居节点列表中邻居节点的顺序,以预设时间阈值为间隔,向所述邻居节点发送请求获取区块链账本的第三请求信息;The first-type blockchain node sends the third request information requesting to obtain the blockchain ledger to the neighbor node at intervals of a preset time threshold according to the order of the neighbor nodes in the neighbor node list;
    所述第一类型区块链节点接收所述邻居节点返回的区块链账本。The first type blockchain node receives the blockchain ledger returned by the neighbor node.
  7. 如权利要求1所述的跨网段互连的区块链网络实现方法,该方法还包括:The method for implementing a blockchain network interconnected across network segments according to claim 1, the method further comprising:
    当所述第二类型区块链节点发生变更时,将变更信息广播至所有区块链节点;When the second type of blockchain node is changed, broadcast the change information to all the blockchain nodes;
    对应的第一类型区块链节点在接收到所述变更信息后,暂停当前任务,动态更新配置文件,并根据配置文件中新的配置信息与对应的第二类型区块链节点建立连接。After receiving the change information, the corresponding first-type blockchain node suspends the current task, dynamically updates the configuration file, and establishes a connection with the corresponding second-type blockchain node according to the new configuration information in the configuration file.
  8. 一种跨网段互连的区块链网络实现装置,所述装置包括:A device for implementing a blockchain network interconnected across network segments, the device comprising:
    配置模块,用于在每个第一类型区块链节点的配置文件中添加至少一个第二类型区块链节点的地址信息;The configuration module is used to add the address information of at least one second-type blockchain node to the configuration file of each first-type blockchain node;
    连接模块,用于根据所述配置文件中的所述地址信息与对应的所述第二类型区块链节点建立连接;The connection module is configured to establish a connection with the corresponding second type blockchain node according to the address information in the configuration file;
    数据请求模块,用于向所述第二类型区块链节点发送数据获取请求;及A data request module for sending a data acquisition request to the second type blockchain node; and
    接收模块,用于接收所述第二类型区块链节点返回的数据。The receiving module is used to receive the data returned by the second-type blockchain node.
  9. 如权利要求8所述的跨网段互连的区块链网络实现装置,所述配置模块还用于:According to the device for implementing a blockchain network interconnected across network segments according to claim 8, the configuration module is further configured to:
    当所述第一类型区块链节点与第二类型区块链节点在同一网段时,将该第二类型区块链节点在该网段中的地址信息写入该第一类型区块链节点的配置文件中。When the first type blockchain node and the second type blockchain node are in the same network segment, write the address information of the second type blockchain node in the network segment into the first type blockchain In the node's configuration file.
  10. 如权利要求8所述的跨网段互连的区块链网络实现装置,所述配置模块还用于:According to the device for implementing a blockchain network interconnected across network segments according to claim 8, the configuration module is further configured to:
    当所述第一类型区块链节点与第二类型区块链节点不在同一网段时,将该第二类型区块链节点映射到该第一类型区块链节点所在网段的地址信息以及对应的映射关系写入该第一类型区块链节点的配置文件中。When the first type blockchain node and the second type blockchain node are not in the same network segment, map the second type blockchain node to the address information of the network segment where the first type blockchain node is located, and The corresponding mapping relationship is written into the configuration file of the first type of blockchain node.
  11. 如权利要求8至10中任意一项所述的跨网段互连的区块链网络实现装置,所述地址信息包括IP地址和端口号信息,或者包括IP地址和Mac地址。According to the device for implementing a blockchain network interconnected across network segments according to any one of claims 8 to 10, the address information includes IP address and port number information, or includes IP address and Mac address.
  12. 如权利要求8所述的跨网段互连的区块链网络实现装置,所述数据请求模块还用于:According to the device for implementing a blockchain network interconnected across network segments according to claim 8, the data request module is further configured to:
    向所述第二类型区块链节点发送请求获取区块链账本的第一请求信息和/或请求获取邻居节点列表的第二请求信息;Sending to the second-type blockchain node the first request information requesting to obtain the blockchain ledger and/or the second request information requesting to obtain the neighbor node list;
    所述接收模块还用于:The receiving module is also used for:
    接收所述第二类型区块链节点返回的区块链账本和/或邻居节点列表。Receive the blockchain ledger and/or neighbor node list returned by the second type of blockchain node.
  13. 如权利要求12所述的跨网段互连的区块链网络实现装置,所述装置还包括:The device for implementing a blockchain network interconnected across network segments according to claim 12, the device further comprising:
    发送模块,用于根据所述邻居节点列表中邻居节点的顺序,以预设时间阈值为间隔,向所述邻居节点发送请求获取区块链账本的第三请求信息;A sending module, configured to send to the neighbor node the third request information for obtaining the blockchain ledger at intervals of a preset time threshold according to the order of the neighbor nodes in the neighbor node list;
    所述接收模块还用于接收所述邻居节点返回的区块链账本。The receiving module is also used to receive the blockchain ledger returned by the neighbor node.
  14. 如权利要求8所述的跨网段互连的区块链网络实现装置,所述装置还包括:The device for implementing a blockchain network interconnected across network segments according to claim 8, the device further comprising:
    更新模块,用于在接收到所述第二类型区块链节点广播的变更信息后,暂停当前任务,动态更新配置文件,并根据配置文件中新的配置信息与对应的第二类型区块链节点建立连接。The update module is used to suspend the current task after receiving the change information broadcast by the second type blockchain node, dynamically update the configuration file, and according to the new configuration information in the configuration file and the corresponding second type blockchain The node establishes a connection.
  15. 一种区块链***,所述区块链***包括多个第一类型区块链节点和多个第二类型区块链节点,所述第一类型区块链节点和第二类型区块链节点在运行时实现如下步骤:A block chain system, the block chain system includes a plurality of first type block chain nodes and a plurality of second type block chain nodes, the first type block chain node and the second type block chain The node implements the following steps at runtime:
    配置步骤:在每个第一类型区块链节点的配置文件中添加至少一个第二类型区块链节点的地址信息;Configuration steps: add the address information of at least one second-type blockchain node to the configuration file of each first-type blockchain node;
    连接步骤:所述第一类型区块链节点根据其配置文件中的所述地址信息与对应的所述第二类型区块链节点建立连接;Connection step: the first type blockchain node establishes a connection with the corresponding second type blockchain node according to the address information in its configuration file;
    数据请求步骤:所述第一类型区块链节点向与其建立连接的所述第二类型区块链节点发送数据获取请求;及Data request step: the first-type blockchain node sends a data acquisition request to the second-type blockchain node with which it is connected; and
    数据传输步骤:所述第一类型区块链节点接收所述第二类型区块链节点返回的数据。Data transmission step: the first type blockchain node receives the data returned by the second type blockchain node.
  16. 如权利要求15所述的区块链***,当所述第一类型区块链节点与第二类型区块链节点在同一网段时,所述配置步骤包括:15. The blockchain system according to claim 15, when the first type blockchain node and the second type blockchain node are in the same network segment, the configuration step includes:
    将该第二类型区块链节点在该网段中的地址信息写入该第一类型区块链节点的配置文件中。Write the address information of the second type blockchain node in the network segment into the configuration file of the first type blockchain node.
  17. 如权利要求15所述的区块链***,当所述第一类型区块链节点与第二类型区块链节点不在同一网段时,所述配置步骤包括:15. The blockchain system according to claim 15, when the first type blockchain node and the second type blockchain node are not in the same network segment, the configuration step includes:
    将该第二类型区块链节点映射到该第一类型区块链节点所在网段的地址信息以及对应的映射关系写入该第一类型区块链节点的配置文件中。The address information and the corresponding mapping relationship of mapping the second type blockchain node to the network segment where the first type blockchain node is located are written into the configuration file of the first type blockchain node.
  18. 如权利要求15至17中任意一项所述的区块链***,所述地址信息包括IP地址和端口号信息,或者包括IP地址和Mac地址。The blockchain system according to any one of claims 15 to 17, wherein the address information includes IP address and port number information, or includes IP address and Mac address.
  19. 如权利要求15所述的区块链***,所述数据请求步骤具体包括:The blockchain system of claim 15, wherein the data request step specifically includes:
    所述第一类型区块链节点向与其建立连接的所述第二类型区块链节点发送请求获取区块链账本的第一请求信息和/或请求获取邻居节点列表的第二请求信息;Sending, by the first-type blockchain node, to the second-type blockchain node with which the connection is established, first request information for obtaining a blockchain ledger and/or second request information for requesting a neighbor node list;
    所述数据传输步骤具体包括:The data transmission step specifically includes:
    所述第一类型区块链节点接收所述第二类型区块链节点返回的区块链账本和/或邻居节点列表。The first type blockchain node receives the blockchain ledger and/or neighbor node list returned by the second type blockchain node.
  20. 一种计算机可读存储介质,所述计算机可读存储介质中包括第一类型区块链节点实现程序和配置文件,所述第一类型区块链节点实现程序被处理器执行时实现如下步骤:A computer-readable storage medium, the computer-readable storage medium includes a first-type blockchain node implementation program and a configuration file, and when the first-type blockchain node implementation program is executed by a processor, the following steps are implemented:
    配置步骤:获取至少一个第二类型区块链节点的地址信息,将所述地址信息写入所述配置文件中;Configuration step: acquiring address information of at least one second-type blockchain node, and writing the address information into the configuration file;
    连接请求步骤:根据所述配置文件中的所述地址信息向对应的所述第二类型区块链节点发送建立连接的请求;Connection request step: sending a connection establishment request to the corresponding second type blockchain node according to the address information in the configuration file;
    数据请求步骤:在所述第一类型区块链节点与第二类型区块链节点建立连接后,所述第一类型区块链节点向该第二类型区块链节点发送数据获取请求;及Data request step: after the first type blockchain node and the second type blockchain node establish a connection, the first type blockchain node sends a data acquisition request to the second type blockchain node; and
    接收步骤:所述第一类型区块链节点接收该第二类型区块链节点返回的数据。Receiving step: the first type blockchain node receives the data returned by the second type blockchain node.
PCT/CN2019/120792 2019-05-20 2019-11-26 Cross-network-segment interconnected blockchain network implementation method and apparatus, and system and medium WO2020233051A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910419860.1 2019-05-20
CN201910419860.1A CN110266763B (en) 2019-05-20 2019-05-20 Method, system and storage medium for implementing block chain network interconnected across network segments

Publications (1)

Publication Number Publication Date
WO2020233051A1 true WO2020233051A1 (en) 2020-11-26

Family

ID=67914771

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/120792 WO2020233051A1 (en) 2019-05-20 2019-11-26 Cross-network-segment interconnected blockchain network implementation method and apparatus, and system and medium

Country Status (2)

Country Link
CN (1) CN110266763B (en)
WO (1) WO2020233051A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112804299A (en) * 2020-12-30 2021-05-14 成都知道创宇信息技术有限公司 Node mapping method, node mapping device, mapping equipment and readable storage medium

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110266763B (en) * 2019-05-20 2022-04-12 深圳壹账通智能科技有限公司 Method, system and storage medium for implementing block chain network interconnected across network segments
CN112104662B (en) * 2020-09-27 2022-10-14 平安普惠企业管理有限公司 Far-end data read-write method, device, equipment and computer readable storage medium
CN113992434B (en) * 2021-12-24 2022-04-01 杭州趣链科技有限公司 Communication method, system, electronic device and readable storage medium
CN114679483B (en) * 2022-03-01 2023-07-25 南京巨鲨显示科技有限公司 Communication method, system and storage medium for distributed service communication system
CN115277864B (en) * 2022-07-27 2024-01-26 海通证券股份有限公司 Route determining method and device, computer readable storage medium and terminal
CN115550307A (en) * 2022-09-20 2022-12-30 中国银行股份有限公司 Service processing method, service end, user end and system based on block chain

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180048461A1 (en) * 2016-08-10 2018-02-15 Peer Ledger Inc. Apparatus, system, and methods for a blockchain identity translator
CN107911421A (en) * 2017-10-30 2018-04-13 上海点融信息科技有限责任公司 For configuring the method for internetwork communication, equipment and computer-readable storage medium in block chain
CN109462505A (en) * 2018-11-12 2019-03-12 上海点融信息科技有限责任公司 Realize the method and apparatus across chain communication between multiple block chain networks
CN110266763A (en) * 2019-05-20 2019-09-20 深圳壹账通智能科技有限公司 Block chain network implementation method, system and the storage medium of cross-network segment interconnection

Family Cites Families (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
GB2461955A (en) * 2008-07-25 2010-01-27 Gnodal Ltd Ethernet bridge or router employing a distributed MAC address table
CN102932498B (en) * 2012-10-24 2016-08-03 广州杰赛科技股份有限公司 A kind of virtual machine IP method for managing resource of cloud computing platform
CN106330649B (en) * 2015-06-18 2019-08-02 新华三技术有限公司 A kind of data message forwarding method and device across software defined network
CN105162896A (en) * 2015-08-31 2015-12-16 上海斐讯数据通信技术有限公司 Method and system of cross-segment device communication
EP3386157B1 (en) * 2015-12-30 2020-03-04 Huawei Technologies Co., Ltd. Packet transmission method, device and system
CN107770115B (en) * 2016-08-15 2021-01-05 华为技术有限公司 Method and system for distributing digital content in a peer-to-peer network
CN106570074B (en) * 2016-10-14 2020-07-10 深圳前海微众银行股份有限公司 Distributed database system and implementation method thereof
CN107231239B (en) * 2017-06-27 2019-06-25 中国联合网络通信集团有限公司 Create generation block method for anti-counterfeit and device
CN107592292B (en) * 2017-07-26 2019-08-09 阿里巴巴集团控股有限公司 A kind of block chain communication method between nodes and device
CN107579848B (en) * 2017-08-30 2020-08-25 上海保险交易所股份有限公司 Method for dynamically changing consensus node in practical Byzantine fault-tolerant consensus mechanism
CN107992356B (en) * 2017-12-13 2021-09-14 深圳壹账通智能科技有限公司 Block chain transaction block processing method, electronic device and readable storage medium
CN108416589A (en) * 2018-03-08 2018-08-17 深圳前海微众银行股份有限公司 Connection method, system and the computer readable storage medium of block chain node
CN108964982B (en) * 2018-06-13 2021-07-09 众安信息技术服务有限公司 Method, apparatus and storage medium for enabling deployment of multiple nodes of a blockchain
CN108810157A (en) * 2018-06-20 2018-11-13 泰链(厦门)科技有限公司 The connection method of block chain network, medium, apparatus and system
CN109189853B (en) * 2018-08-08 2021-05-28 众安信息技术服务有限公司 Method and device for synchronizing data between block chains
CN109189751B (en) * 2018-09-18 2023-05-26 平安科技(深圳)有限公司 Data synchronization method based on block chain and terminal equipment
CN109327528B (en) * 2018-10-31 2020-10-20 创新先进技术有限公司 Node management method and device based on block chain
CN109684408A (en) * 2018-12-07 2019-04-26 深圳市智税链科技有限公司 Data managing method, device, medium and the electronic equipment of block catenary system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180048461A1 (en) * 2016-08-10 2018-02-15 Peer Ledger Inc. Apparatus, system, and methods for a blockchain identity translator
CN107911421A (en) * 2017-10-30 2018-04-13 上海点融信息科技有限责任公司 For configuring the method for internetwork communication, equipment and computer-readable storage medium in block chain
CN109462505A (en) * 2018-11-12 2019-03-12 上海点融信息科技有限责任公司 Realize the method and apparatus across chain communication between multiple block chain networks
CN110266763A (en) * 2019-05-20 2019-09-20 深圳壹账通智能科技有限公司 Block chain network implementation method, system and the storage medium of cross-network segment interconnection

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112804299A (en) * 2020-12-30 2021-05-14 成都知道创宇信息技术有限公司 Node mapping method, node mapping device, mapping equipment and readable storage medium
CN112804299B (en) * 2020-12-30 2023-02-28 成都知道创宇信息技术有限公司 Node mapping method, node mapping device, mapping equipment and readable storage medium

Also Published As

Publication number Publication date
CN110266763B (en) 2022-04-12
CN110266763A (en) 2019-09-20

Similar Documents

Publication Publication Date Title
WO2020233051A1 (en) Cross-network-segment interconnected blockchain network implementation method and apparatus, and system and medium
US11461773B2 (en) Blockchain-based node management methods and apparatuses
WO2018112940A1 (en) Service execution method and device for blockchain node, and node device
WO2020207233A1 (en) Permission control method and apparatus for blockchain
TWI727467B (en) Trustworthiness verification method, system, device and equipment of alliance chain
US8898735B2 (en) Network apparatus based on content name, method of generating and authenticating content name
KR102566892B1 (en) Blockchain consensus method, device and system
CN111556120B (en) Data processing method and device based on block chain, storage medium and equipment
CN110147684B (en) Method and device for realizing privacy protection of blockchain data
CN111460458B (en) Data processing method, related device and computer storage medium
WO2022121538A1 (en) Data synchronization method and system based on blockchain, and related device
CN110855777B (en) Node management method and device based on block chain
WO2020238248A1 (en) Data storage method, apparatus and device
TWI712972B (en) Trustworthiness verification method, system, device and equipment of alliance chain
CN109347839B (en) Centralized password management method and device, electronic equipment and computer storage medium
US20210158353A1 (en) Methods, systems, apparatuses, and devices for processing request in consortium blockchain
CN111489256A (en) Cross-chain processing method, equipment and system for multi-chain block chain system
WO2022068356A1 (en) Blockchain-based information encryption method and apparatus, device and medium
CN102073733B (en) Method and device for managing Hash table
TW202036441A (en) Data reading method based on a plurality of block chain networks and system
EP4357950A1 (en) Device management method, system and apparatus
CN111064786B (en) Account identifier management method and device
US20230325521A1 (en) Data processing method and apparatus based on blockchain network, device, and storage medium
CN113949632B (en) Dynamic node configuration method and device for block chain
WO2019214071A1 (en) Communication method for users on blockchain, device, terminal device, and storage medium

Legal Events

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

Ref document number: 19929658

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19929658

Country of ref document: EP

Kind code of ref document: A1

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 18/03/2022)

122 Ep: pct application non-entry in european phase

Ref document number: 19929658

Country of ref document: EP

Kind code of ref document: A1