CN111314427A - Method, equipment and storage medium for acquiring all node information of block chain - Google Patents

Method, equipment and storage medium for acquiring all node information of block chain Download PDF

Info

Publication number
CN111314427A
CN111314427A CN202010058019.7A CN202010058019A CN111314427A CN 111314427 A CN111314427 A CN 111314427A CN 202010058019 A CN202010058019 A CN 202010058019A CN 111314427 A CN111314427 A CN 111314427A
Authority
CN
China
Prior art keywords
node
information
nodes
block chain
acquiring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010058019.7A
Other languages
Chinese (zh)
Inventor
蔡亮
李伟
邱炜伟
匡立中
陈寿长
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202010058019.7A priority Critical patent/CN111314427A/en
Publication of CN111314427A publication Critical patent/CN111314427A/en
Pending legal-status Critical Current

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/104Peer-to-peer [P2P] networks
    • H04L67/1042Peer-to-peer [P2P] networks using topology management mechanisms
    • 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/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • H04L67/1048Departure or maintenance mechanisms
    • 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/104Peer-to-peer [P2P] networks
    • H04L67/1061Peer-to-peer [P2P] networks using node-based peer discovery mechanisms
    • H04L67/1072Discovery involving ranked list compilation of candidate peers

Abstract

The invention provides a method, equipment and a storage medium for acquiring all node information of a block chain, wherein the method comprises the following steps: acquiring a prepared IP address information set of a plurality of first nodes through a block chain network; acquiring a plurality of pieces of second node information associated with each first node; and compiling codes and decoders according to the structure and the specification of a block chain point-to-point network protocol, and determining all effective node information in the final block chain network after normal communication between nodes is carried out. The invention sends friend circle request information through a certain credible node to obtain a plurality of second node information, and then each second node information is used as an originating node to obtain the friend circle information of the second node information until all the node information of the whole block chain is obtained.

Description

Method, equipment and storage medium for acquiring all node information of block chain
Technical Field
The present application relates to the field of blockchain communication technologies, and in particular, to a method, a device, and a storage medium for acquiring information of all nodes of a blockchain.
Background
The current block chain is mainly divided into 3 types of public chain, private chain and alliance chain, wherein the public chain refers to the block chain which can be used by anyone to read data, send confirmable transactions and compete for accounting at any time in the system. Since the public chain achieves a completely decentralized distributed accounting method, supervision of all nodes in the public chain is difficult to achieve in the situation.
Disclosure of Invention
In view of the above-mentioned drawbacks and deficiencies of the prior art, it is desirable to provide a method, device and storage medium for conveniently and accurately acquiring information of all nodes in a blockchain.
In a first aspect, a method for acquiring information of all nodes in a blockchain, where the method defines a data structure by using a blockchain peer-to-peer network protocol, includes:
acquiring a prepared IP address information set of a plurality of first nodes through a block chain network;
acquiring a plurality of pieces of second node information associated with each first node;
and compiling codes and decoders according to the structure and the specification of a block chain point-to-point network protocol, and determining all effective node information in the final block chain network after normal communication between nodes is carried out.
Further, obtaining a plurality of second node information associated with each first node further comprises:
judging whether the information of each second node is repeated:
if yes, only one node is saved, and the duplicate second node is deleted.
Further, the method also includes: and checking the validity of all nodes regularly.
Further, setting a state identifier, wherein the state identifier comprises a failure identifier or a valid identifier, and regularly checking the validity of all nodes comprises:
sending a normal communication request to the node, and judging whether feedback information is received within a set first time threshold: if yes, marking an effective identifier on the node; otherwise, determining the node as a failure node, and marking the node with a failure identifier.
Further, the infrastructure includes P2P messages, findnodes, neighborirs, and acquiring a plurality of second node information associated with each first node includes:
sending node information request information to each first node, after verifying the validity of the node information, each first node returns the friend circle information of each first node, namely second node information, according to a findNode request and a neighbor request, and if the first node does not have an associated second node, returning to null;
the P2P Message is used to establish a basic communication connection service with the first node, the findNode is used to search each first node that the node has prepared, and the Neighbors are used to search the second node associated with the circle of friends of each first node.
Further, the state identifier continuously records according to the time of the timing check and generates a record table, and the times that a certain node is an effective node/a failure node are obtained according to the record table so as to obtain a node state information set.
And further, the node with the failure mark is placed in a list to be confirmed.
In a second aspect, the present invention also provides an apparatus comprising one or more processors and a memory, wherein the memory contains instructions executable by the one or more processors to cause the one or more processors to perform the method for obtaining information of all nodes of a blockchain provided according to the embodiments of the present invention.
In a third aspect, the present invention further provides a storage medium storing a computer program, where the computer program makes a computer execute the method for acquiring information of all nodes in a block chain according to the embodiments of the present invention.
In the method, the device, and the storage medium for acquiring all node information of a block chain according to embodiments of the present invention, a certain trusted node sends a circle of friends request information to acquire a plurality of pieces of second node information, and then each piece of second node information is used as an originating node to acquire their circle of friends information from the originating node until all node information of the entire block chain is acquired.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
fig. 1 is a flowchart of a method for acquiring information of all nodes of a block chain according to an embodiment of the present invention.
Fig. 2 is a schematic view of a preferred embodiment of the method shown in fig. 1.
Fig. 3 is a schematic view of another preferred embodiment of the method shown in fig. 1.
Fig. 4 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the present invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 is a flowchart of a method for acquiring information of all nodes of a block chain according to an embodiment of the present invention.
As shown in fig. 1, in this embodiment, the present invention provides a method for acquiring information of all nodes in a blockchain, where the method defines a data structure by using a blockchain peer-to-peer network protocol, and includes:
s11, acquiring IP address information sets of a plurality of prepared first nodes through a block chain network;
s12, acquiring a plurality of pieces of second node information associated with each first node;
and S13, compiling codes and decodes according to the structure and the specification of the block chain point-to-point network protocol, and determining all effective node information in the final block chain network after normal communication between the nodes is carried out.
Specifically, taking the scenario shown in fig. 2 as an example, the first machine may obtain all nodes in a certain blockchain system, obtain a first node a node that is already provided in the first organization, where the node is a trusted node of the first organization, send request information to the first node to obtain a plurality of second nodes (e.g., K, B, and C nodes) in a friend circle of the node a, after obtaining the K, B, and C nodes, send normal communication information to the nodes, and if there is feedback, determine that the node is a valid node, and finally obtain node information of the valid node. And then, taking the effective node as an originating node, and circulating the steps until all node information is acquired.
The method disclosed by the invention can be applied to the situation that the information transmission of a certain public chain needs to be supervised by a state department, and the information authority can be set for all nodes of the public chain after all node information is acquired. The block chain monitoring method can be applied to national organs in certain fair and fair occasions to supervise the information transmission behaviors of all nodes and ensure that the external transmission of all nodes of the block chain is transparent.
In further embodiments, obtaining the number of second node information associated with each first node further comprises: judging whether the information of each second node is repeated: if yes, only one node is saved, and the duplicate second node is deleted.
Specifically, still taking the scenario shown in fig. 2 as an example, when nodes K, B, and C are used as originating nodes to perform friend circle query, nodes K- (a, B, E), B- (a, K, E, C), and C- (a, B, D, E) associated with the nodes K- (a, B, E), and B- (a, K, E, C, and C, respectively, are obtained, so that it can be seen that, in the obtained associated nodes, a, B, C, E, and K all have duplicates, at this time, after a new second node is obtained, it is necessary to determine whether the node already exists in the currently obtained nodes, and if so, the duplicated nodes are deleted, and it is ensured that each node only needs. The deleting method and rule are not limited in this embodiment.
In further embodiments, the method further comprises: and checking the validity of all nodes regularly.
Specifically, still taking the scenario shown in fig. 2 as an example, because the nodes in the blockchain are not necessarily on-line for a long time, some nodes cannot normally communicate due to a network problem, some nodes may exit the blockchain system at a certain time, and similarly, new nodes may be added at any time if the blockchain system is provided, and therefore all nodes need to be checked at regular time, so as to ensure the validity of the nodes to ensure the accuracy of the node information.
In a preferred embodiment, setting a status flag, wherein the status flag includes a failure or valid flag, and the periodically checking the validity of all nodes includes:
sending a normal communication request to the node, and judging whether feedback information is received within a set first time threshold: if yes, marking an effective identifier on the node; otherwise, determining the node as a failure node, and marking the node with a failure identifier.
Specifically, as shown in fig. 3, taking one node B as an example, the first time threshold is set to be 3 minutes, that is, the validity of the obtained node is checked every 3 minutes, that is, the communication request information is sent to the node B, if there is feedback, the node is determined to be a valid node, and if there is no feedback, the node is determined to be an invalid node.
Preferably, the state identifier continuously records according to the time of the timing check and generates a record table, and the number of times that a certain node is an effective node/a failure node is obtained according to the record table so as to obtain a node state information set.
The above embodiment can be applied to acquiring the state information sets according to the valid or invalid times of a certain node when a state authority supervises each node of the blockchain system, and performing big data analysis according to the sets to provide data analysis support for the subsequent project or policy or the analysis of the node.
In further embodiments, besides generating the record table according to the check time continuous record, a mode of placing the node with the failure identifier into a list to be confirmed may be adopted. If a failed node can normally communicate again in the next check, the node is removed from the list to be confirmed, and if the node is in the list to be confirmed for a long time, the node can be judged to have exited the block chain system.
In another preferred embodiment, the infrastructure includes P2P messages, findnodes, Neighbors, and obtaining a number of second node information associated with each first node includes:
sending node information request information to each first node, after verifying the validity of the node information, each first node returns the friend circle information of each first node, namely second node information, according to a findNode request and a neighbor request, and if the first node does not have an associated second node, returning to null;
the P2P Message is used to establish a basic communication connection service with the first node, the findNode is used to search each first node that the node has prepared, and the Neighbors are used to search the second node associated with the circle of friends of each first node.
Specifically, when the first mechanism sends the request information, the first mechanism sends a request for establishing a P2P Message to the first node, where the data structure includes a version number and a blockchain code and handshakes, and then sends a HelloMessage Message (hexadecimal code is 0x00) to the first node, where the Message data structure includes a communication protocol name, a client ID, P2P Message data structure information, a monitoring port number, a node ID, and whether to permit establishment. And after the confirmation of the two parties is finished, the establishment of the handshake successful communication connection service is successful. The first mechanism sends ping (hexadecimal code is 0x02) request data structure format and Hello Message to the first node to replace the hexadecimal code, waits for the first node PONG to return (hexadecimal code is 0x03), confirms the available active node of the node bit after receiving the response of the PONG for the first time, and sends Neighbors, GET _ PERS (hexadecimal code is 0x04) to the first node to obtain the neighbor node information of the first node.
Fig. 4 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
As shown in fig. 4, as another aspect, the present application also provides an apparatus 400 including one or more Central Processing Units (CPUs) 401 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)402 or a program loaded from a storage section 408 into a Random Access Memory (RAM) 403. In the RAM403, various programs and data necessary for the operation of the device 400 are also stored. The CPU401, ROM402, and RAM403 are connected to each other via a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
The following components are connected to the I/O interface 405: an input section 406 including a keyboard, a mouse, and the like; an output section 407 including a display device such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 408 including a hard disk and the like; and a communication section 409 including a network interface card such as a LAN card, a modem, or the like. The communication section 409 performs communication processing via a network such as the internet. A driver 410 is also connected to the I/O interface 405 as needed. A removable medium 411 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 410 as necessary, so that a computer program read out therefrom is mounted into the storage section 408 as necessary.
In particular, according to an embodiment of the present disclosure, the acquisition method of all nodes of the blockchain described in any of the above embodiments may be implemented as a computer software program. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program containing program code for performing an acquisition method for all nodes of a blockchain. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 409, and/or installed from the removable medium 411.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be the computer-readable storage medium included in the apparatus of the above-described embodiment; or it may be a separate computer readable storage medium not incorporated into the device. The computer-readable storage medium stores one or more programs for use by one or more processors in performing the acquisition method described in the present application for all nodes of a blockchain.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software or hardware. The described units or modules may also be provided in a processor, for example, each of the described units may be a software program provided in a computer or a mobile intelligent device, or may be a separately configured hardware device. Wherein the designation of a unit or module does not in some way constitute a limitation of the unit or module itself.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the present application. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (9)

1. A method for acquiring information of all nodes of a block chain is characterized in that the method defines a data structure through a block chain point-to-point network protocol, and comprises the following steps:
acquiring a prepared IP address information set of a plurality of first nodes through a block chain network;
acquiring a plurality of pieces of second node information associated with each first node;
and compiling an encoding and decoding according to the data structure and the specification of a block chain point-to-point network protocol, and determining all effective node information in the final block chain network after normal communication between nodes is carried out.
2. The method of claim 1, wherein obtaining second node information associated with each of the first nodes further comprises:
judging whether the information of each second node is repeated:
if yes, only one node is saved, and the duplicate second node is deleted.
3. The method of claim 1, further comprising: and checking the validity of all nodes regularly.
4. The method of claim 3, wherein setting a status flag, wherein the status flag comprises a failure or valid flag, and wherein the periodically checking the validity of all nodes comprises:
sending a normal communication request to the node, and judging whether feedback information is received within a set first time threshold: if yes, marking an effective identifier on the node; otherwise, determining the node as a failure node, and marking the node with a failure identifier.
5. The method of any of claims 1-4, the data structure comprising P2P messages, findNodes, Neighbors, the obtaining a number of second node information associated with each of the first nodes comprising:
sending node information request information to each first node, after verifying the validity of the node information, each first node returns the friend circle information of each first node, namely second node information, according to a findNode request and a neighbor request, and if the first node does not have an associated second node, returning to null;
the P2P Message is used to establish a basic communication connection service with the first node, the findNode is used to search each first node that the node has prepared, and the Neighbors are used to search the second node associated with the circle of friends of each first node.
6. The method according to claim 4, wherein the state identifier is continuously recorded according to the time of the timing check and generates a record table, and the number of times that a certain node is a valid node/invalid node is obtained according to the record table so as to obtain the node state information set.
7. Method according to claim 4 or 6, characterized in that the node marked with the failure flag is placed on the list to be confirmed.
8. An apparatus, characterized in that the apparatus comprises:
one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method recited in any of claims 1-7.
9. A storage medium storing a computer program, characterized in that the program, when executed by a processor, implements the method according to any one of claims 1-7.
CN202010058019.7A 2020-01-16 2020-01-16 Method, equipment and storage medium for acquiring all node information of block chain Pending CN111314427A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010058019.7A CN111314427A (en) 2020-01-16 2020-01-16 Method, equipment and storage medium for acquiring all node information of block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010058019.7A CN111314427A (en) 2020-01-16 2020-01-16 Method, equipment and storage medium for acquiring all node information of block chain

Publications (1)

Publication Number Publication Date
CN111314427A true CN111314427A (en) 2020-06-19

Family

ID=71161407

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010058019.7A Pending CN111314427A (en) 2020-01-16 2020-01-16 Method, equipment and storage medium for acquiring all node information of block chain

Country Status (1)

Country Link
CN (1) CN111314427A (en)

Cited By (2)

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

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506203A (en) * 2016-10-25 2017-03-15 杭州云象网络技术有限公司 A kind of monitoring nodes system for being applied to block chain
CN109189751A (en) * 2018-09-18 2019-01-11 平安科技(深圳)有限公司 Method of data synchronization and terminal device based on block chain
CN109327548A (en) * 2018-11-27 2019-02-12 北京瑞卓喜投科技发展有限公司 A kind of block chain update method and block chain more new system
CN109617994A (en) * 2018-12-30 2019-04-12 于涛 A kind of method and system positioning block chain interior joint position

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106506203A (en) * 2016-10-25 2017-03-15 杭州云象网络技术有限公司 A kind of monitoring nodes system for being applied to block chain
CN109189751A (en) * 2018-09-18 2019-01-11 平安科技(深圳)有限公司 Method of data synchronization and terminal device based on block chain
CN109327548A (en) * 2018-11-27 2019-02-12 北京瑞卓喜投科技发展有限公司 A kind of block chain update method and block chain more new system
CN109617994A (en) * 2018-12-30 2019-04-12 于涛 A kind of method and system positioning block chain interior joint position

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
JECTION: ""以太坊源码1-节点发现协议"", 《简书》 *
华章出版社: ""带你读《深入理解以太坊》之三:技术架构"", 《阿里云》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112055067A (en) * 2020-08-28 2020-12-08 杭州复杂美科技有限公司 Node connection method, device and storage medium
WO2022042296A1 (en) * 2020-08-28 2022-03-03 杭州复杂美科技有限公司 Node connection method and device and storage medium
CN112055067B (en) * 2020-08-28 2023-04-18 杭州复杂美科技有限公司 Node connection method, device and storage medium
CN112804299A (en) * 2020-12-30 2021-05-14 成都知道创宇信息技术有限公司 Node mapping method, node mapping device, mapping equipment and readable storage medium

Similar Documents

Publication Publication Date Title
CN111741114B (en) Chain-of-block-based supervision cross-chain interaction system, method and equipment
CN107395767B (en) Message pushing system and method based on long connection
US20210036907A1 (en) Methods and apparatuses for pushing a message
CN108881354B (en) Push information storage method and device, server and computer storage medium
CN111698315B (en) Data processing method and device for block and computer equipment
CN111314427A (en) Method, equipment and storage medium for acquiring all node information of block chain
CN111431931A (en) Node consensus method and device
CN110233774B (en) Detection method, distributed detection method and system for Socks proxy server
CN114448686A (en) Cross-network communication device and method based on micro-service
CN113242317B (en) Addressing route synchronization method and related device for alliance chain supervision system
US20200412603A1 (en) Method and system for managing transmission of probe messages for detection of failure
CN110708383B (en) Network connection method of block chain node and related equipment
RU2008121872A (en) NEAREST NODE FOR CONNECTIONS OF DISTRIBUTED SERVICES
CN115604160A (en) Network detection processing method and device, electronic equipment and storage medium
CN113794620B (en) Message sending method, device, equipment, system and storage medium
CN112769863B (en) Method and device for processing service request message data, electronic equipment and readable storage medium
CN113064906A (en) Binlog log data adaptive migration method and system
CN114866595B (en) Connection method, terminal station data collector and management platform
US20200192736A1 (en) Collecting repeated diagnostics data from across users participating in a document collaboration session
US20230360046A1 (en) Blockchain-based block processing method and apparatus, device, storage medium, and program product
TWI748653B (en) System and method for determining operation status of device by updating execution status
KR20210130640A (en) Method and apparatus for checking liveness in machine to machine system
Tsiridis et al. Adding an unusual transport to the serval project
CN114760594B (en) Close contact person tracking method and system based on decentralized network
CN115022341A (en) Parameter modification method and device based on block chain, electronic equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20200619