CN111464395B - Method and device for creating blockchain and readable storage medium - Google Patents

Method and device for creating blockchain and readable storage medium Download PDF

Info

Publication number
CN111464395B
CN111464395B CN202010249539.6A CN202010249539A CN111464395B CN 111464395 B CN111464395 B CN 111464395B CN 202010249539 A CN202010249539 A CN 202010249539A CN 111464395 B CN111464395 B CN 111464395B
Authority
CN
China
Prior art keywords
port
target
blockchain
ports
node
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.)
Active
Application number
CN202010249539.6A
Other languages
Chinese (zh)
Other versions
CN111464395A (en
Inventor
冯士乘
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202010249539.6A priority Critical patent/CN111464395B/en
Publication of CN111464395A publication Critical patent/CN111464395A/en
Application granted granted Critical
Publication of CN111464395B publication Critical patent/CN111464395B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/08Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters
    • H04L43/0805Monitoring or testing based on specific metrics, e.g. QoS, energy consumption or environmental parameters by checking availability
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Signal Processing (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Environmental & Geological Engineering (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a method, a device and a readable storage medium for creating a blockchain, wherein the method comprises the following steps: receiving a port detection instruction which is sent by the blockchain management platform when receiving a creation instruction of a target blockchain, wherein the port detection instruction carries port segment information; detecting the state of each port in the plurality of ports corresponding to the port segment information according to the port segment information; determining a target port set in an idle state in a plurality of ports according to the states of the ports; the method comprises the steps of sending a target port set to a blockchain management platform, enabling the blockchain management platform to generate configuration parameters for creating a blockchain according to the target port set, and receiving the configuration parameters corresponding to target nodes sent by the blockchain management platform; the configuration parameters are used to create a target blockchain. With this embodiment, it is possible to detect whether a port is available and create a blockchain using the available ports in an idle state to increase the effectiveness of the created blockchain.

Description

Method and device for creating blockchain and readable storage medium
Technical Field
The present disclosure relates to the field of computer technology, and in particular, to a method and apparatus for creating a blockchain, and a readable storage medium.
Background
Currently, multiple process instances of the underlying blockchain may be started on the same machine, where different process instances in the blockchains correspond to different ports. However, when a user remotely creates a blockchain and starts the blockchain, the user does not know whether a port corresponding to a process instance of the blockchain is available, so that an unavailable port may exist in the created blockchain, and the effectiveness of the blockchain is affected. Therefore, how to efficiently determine whether ports for creating blockchains are available is a challenge.
Disclosure of Invention
The embodiment of the invention provides a method, a device and a readable storage medium for creating a blockchain, which can ensure that ports for creating the blockchain are available so as to improve the effectiveness of the created blockchain.
In a first aspect, an embodiment of the present invention provides a method for creating a blockchain, applied to a target node of a blockchain network, the method including:
receiving a port detection instruction sent by a blockchain management platform when receiving a creation instruction of a target blockchain, wherein the port detection instruction carries port segment information, the port detection instruction is sent to each node related to the target blockchain by the blockchain management platform, and the target node is any one of the nodes;
Detecting the state of each port in a plurality of ports corresponding to the port segment information according to the port segment information, wherein the state comprises an idle state or an occupied state;
determining a target port set in an idle state in the plurality of ports according to the states of the ports, wherein the target port set comprises a specified number of ports, and the types of the ports comprise a data read-write port, a database port, a consensus port and a data synchronization port;
sending the target port set to the blockchain management platform so that the blockchain management platform generates configuration parameters for creating a blockchain according to the target port set;
receiving configuration parameters corresponding to the target node, which are sent by the blockchain management platform, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in an idle state on other nodes in each node, and the specified type comprises a consensus port and a data synchronization port;
and creating the target blockchain by using the configuration parameters.
In a second aspect, an embodiment of the present invention provides another method for creating a blockchain, applied to a blockchain management platform, the method including:
Receiving a creation instruction of a target blockchain submitted by a user, wherein the creation instruction comprises node identifications of all nodes related to the target blockchain;
transmitting a port detection instruction to each node according to the node identification of each node, wherein the port detection instruction carries port segment information, the port detection instruction is used for indicating each node to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, the target port set comprises a specified number of ports, and the types of the ports comprise a data read-write port, a database port, a consensus port and a data synchronization port;
receiving the target port set sent by each node, and generating configuration parameters for creating a blockchain corresponding to each node according to the target port set;
and sending configuration parameters corresponding to the target node, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in an idle state on other nodes in each node, the specified type comprises a common identification port and a data synchronization port, so that the target node creates the target blockchain by using the configuration parameters, and the target node is any one of the nodes.
In a third aspect, an embodiment of the present invention provides a device for creating a blockchain, configured to be disposed in a target node of a blockchain network, where the device includes:
the first receiving module is used for receiving a port detection instruction sent by the blockchain management platform when receiving a creation instruction of a target blockchain, wherein the port detection instruction carries port segment information, the port detection instruction is sent to each node related to the target blockchain by the blockchain management platform, and the target node is any one of the nodes;
the detection module is used for detecting the state of each port in the plurality of ports corresponding to the port segment information according to the port segment information, wherein the state comprises an idle state or an occupied state;
the determining module is used for determining a target port set in an idle state in the plurality of ports according to the states of the ports, wherein the target port set comprises a specified number of ports, and the types of the ports comprise a data read-write port, a database port, a common identification port and a data synchronization port;
the first sending module is used for sending the target port set to the blockchain management platform so that the blockchain management platform generates configuration parameters for creating a blockchain according to the target port set;
The second receiving module is used for receiving configuration parameters corresponding to the target node, which are sent by the blockchain management platform, wherein the configuration parameters comprise the identifiers of the specified number of ports on the target node and the identifiers of the ports of the specified type in an idle state on other nodes in each node, and the specified type comprises a consensus port and a data synchronization port;
and the creation module is used for creating the target blockchain by using the configuration parameters.
In a fourth aspect, an embodiment of the present invention provides another apparatus for creating a blockchain, provided in a blockchain management platform, the apparatus including:
the third receiving module is used for receiving a creation instruction of a target blockchain submitted by a user, wherein the creation instruction comprises node identifications of all nodes related to the target blockchain;
the second sending module is used for sending port detection instructions to the nodes according to the node identifiers of the nodes, the port detection instructions carry port segment information, the port detection instructions are used for indicating the nodes to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, the target port set comprises a specified number of ports, and the types of the ports comprise data read-write ports, database ports, consensus ports and data synchronization ports;
The generating module is used for receiving the target port set sent by each node and generating configuration parameters for creating a blockchain corresponding to each node according to the target port set;
and the third sending module is used for sending configuration parameters corresponding to the target node, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in the idle state on other nodes in each node, the specified type comprises a consensus port and a data synchronization port, so that the target node creates the target blockchain by using the configuration parameters, and the target node is any one of the nodes.
In a fifth aspect, an embodiment of the present invention provides a node, including: a processor and a memory, the processor to perform:
receiving a port detection instruction sent by a blockchain management platform when receiving a creation instruction of a target blockchain, wherein the port detection instruction carries port segment information, the port detection instruction is sent to each node related to the target blockchain by the blockchain management platform, and the target node is any one of the nodes;
Detecting the state of each port in a plurality of ports corresponding to the port segment information according to the port segment information, wherein the state comprises an idle state or an occupied state;
determining a target port set in an idle state in the plurality of ports according to the states of the ports, wherein the target port set comprises a specified number of ports, and the types of the ports comprise a data read-write port, a database port, a consensus port and a data synchronization port;
sending the target port set to the blockchain management platform so that the blockchain management platform generates configuration parameters for creating a blockchain according to the target port set;
receiving configuration parameters corresponding to the target node, which are sent by the blockchain management platform, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in an idle state on other nodes in each node, and the specified type comprises a consensus port and a data synchronization port;
and creating the target blockchain by using the configuration parameters.
In a sixth aspect, an embodiment of the present invention provides a blockchain management platform, including: a processor and a memory, the processor to perform:
Receiving a creation instruction of a target blockchain submitted by a user, wherein the creation instruction comprises node identifications of all nodes related to the target blockchain;
transmitting a port detection instruction to each node according to the node identification of each node, wherein the port detection instruction carries port segment information, the port detection instruction is used for indicating each node to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, the target port set comprises a specified number of ports, and the types of the ports comprise a data read-write port, a database port, a consensus port and a data synchronization port;
receiving the target port set sent by each node, and generating configuration parameters for creating a blockchain corresponding to each node according to the target port set;
and sending configuration parameters corresponding to the target node, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in an idle state on other nodes in each node, the specified type comprises a common identification port and a data synchronization port, so that the target node creates the target blockchain by using the configuration parameters, and the target node is any one of the nodes.
In a seventh aspect, an embodiment of the present invention further provides a computer readable storage medium, where program instructions are stored, the program instructions being configured to implement the method according to the first or second aspect.
According to the embodiment of the invention, when a node receives a creation instruction of a target blockchain, a port detection instruction is sent by a blockchain management platform, states of all ports in a plurality of ports corresponding to port section information are detected according to port section information carried by the port detection instruction, the states comprise idle states or occupied states, a target port set in the idle states in the plurality of ports is determined according to the states of all the ports, the target port set comprises a specified number of ports, and therefore the target port set is sent to the blockchain management platform, so that the blockchain management platform generates configuration parameters for creating the blockchain according to the target port set, and the configuration parameters corresponding to the target node sent by the blockchain management platform are received, wherein the configuration parameters comprise identifiers of the specified number of ports on the target node and identifiers of ports in the idle states in other nodes so as to create the target blockchain by using the configuration parameters. With this embodiment, whether a port for creating a blockchain is available can be detected by the blockchain management platform, and the blockchain is created using the available port, thereby improving the effectiveness of the created blockchain.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are required in the embodiments or the description of the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention, and that other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1a is a schematic diagram of a port detection system according to an embodiment of the present invention;
FIG. 1b is a block chain architecture diagram according to an embodiment of the present invention;
FIG. 1c is a schematic diagram illustrating a process of generating a new block according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of creating a blockchain provided by an embodiment of the present invention;
FIG. 3 is a flow chart of another method of creating a blockchain provided by an embodiment of the present invention;
FIG. 4a is a schematic diagram of a start block chain management platform according to an embodiment of the present invention;
FIG. 4b is an interface diagram of a blockchain management platform according to an embodiment of the present invention;
FIG. 5 is a schematic diagram of a block chain creation apparatus according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of another block chain creation apparatus according to an embodiment of the present invention;
FIG. 7 is a schematic diagram of a node according to an embodiment of the present invention;
fig. 8 is a schematic structural diagram of a blockchain management platform according to an embodiment of the present invention.
Detailed Description
The technical solutions of the embodiments of the present invention will be clearly described below with reference to the drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only some embodiments of the present invention, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
Some embodiments of the present invention are described in detail below with reference to the accompanying drawings. The following embodiments and features of the embodiments may be combined with each other without conflict.
The method for creating the blockchain can be applied to a port detection system, wherein the port detection system comprises a blockchain network and a blockchain management platform. In some embodiments, the blockchain network and the blockchain management platform establish a communication connection with each other. In some embodiments, the manner of communication connection may include, but is not limited to, wi-Fi, bluetooth, near field communication (Near Field Communication, NFC), and the like.
The embodiment of the invention provides a method for creating a blockchain, which can detect whether a port for creating the blockchain is available through a blockchain management platform and create the blockchain by using the available port so as to improve the effectiveness of the created blockchain.
The port detection system according to the embodiment of the present invention is schematically described below with reference to fig. 1a and 1 b.
Referring to fig. 1a, fig. 1a is a schematic structural diagram of a port detection system according to an embodiment of the present invention. The port detection system includes: a blockchain network 11, a blockchain management platform 12 and a terminal device 13. The blockchain network 11, the blockchain management platform 12 and the terminal device 13 can establish communication connection with each other through a wireless communication connection mode. In some scenarios, the blockchain network 11, the blockchain management platform 12, and the terminal device 13 may also establish communication connection through a wired communication connection manner. In some embodiments, the blockchain management platform 12 may include, but is not limited to, a mass platform. In some embodiments, the terminal device 13 includes, but is not limited to, a mobile phone, a computer, etc.
In one embodiment, the terminal device 13 is configured to send a create blockchain instruction to the blockchain management platform 12 by a user, such that the blockchain management platform 12 sends a port probing instruction to the blockchain network 11 upon receiving the create blockchain instruction.
In one embodiment, the blockchain network 11 refers to a network for sharing data between nodes, and a plurality of nodes 111 may be included in the blockchain network. Each node 111 may receive input information during normal operation and maintain shared data (i.e., blockchains) within the blockchain network based on the received input information. In order To ensure information intercommunication in the blockchain network, information connection can exist between every two nodes, point-To-point (P2P) communication can be realized between any two nodes, and particularly P2P communication can be performed through a wired communication link or a wireless communication link. For example, when any node in the blockchain network receives input information, other nodes acquire the input information according to a consensus algorithm, and store the input information as data in shared data, so that the data stored on all nodes in the blockchain network are consistent.
The blockchain management platform 12 may access the blockchain network 11 and may communicate with nodes in the blockchain network 11, e.g., send port probing instructions to the nodes, etc.
It should be noted that the number of nodes shown in fig. 1a is merely illustrative, and any number of nodes may be deployed according to actual needs, and the blockchain management platform 12 may communicate with the same node in the blockchain network 11, or may communicate with different nodes in the blockchain network 11 respectively.
Each node in the blockchain network 11 has a node identifier corresponding to the node identifier, and each node in the blockchain network 11 may store the node identifiers of other nodes in the blockchain network, so that the generated block may be broadcast to other nodes in the blockchain network according to the node identifiers of other nodes. Each node can maintain a node identification list shown in the following table, and the node names and the node identifications are correspondingly stored in the node identification list. The node identifier may be an internet protocol (Internet Protocol, IP) address, and any other information that can be used to identify the node, and the IP address is only illustrated in table 1.
TABLE 1
Figure SMS_1
Wherein each node in the blockchain network stores one and the same blockchain. The blockchain is composed of a plurality of blocks, referring to fig. 1b, fig. 1b is a schematic diagram of a blockchain structure according to an embodiment of the present invention. The block chain consists of a plurality of blocks, the starting block comprises a block head and a block main body, the block head stores an input information characteristic value, a version number, a time stamp and a difficulty value, and the block main body stores input information; the next block of the starting block takes the starting block as a father block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the block head characteristic value of the father block, the version number, the timestamp and the difficulty value, and the like, so that the block data stored in each block in the block chain are associated with the block data stored in the father block, and the safety of the input information in the block is ensured.
In generating each block in the blockchain, referring to fig. 1c, fig. 1c is a schematic diagram of a process for generating a new block according to an embodiment of the present invention. When receiving input information, a node where the blockchain is located checks the input information, stores the input information into a memory pool after the check is completed, and updates a hash tree used for recording the input information; then, updating the update time stamp to the time of receiving the input information, trying different random numbers, and calculating the characteristic value for a plurality of times, so that the calculated characteristic value can meet the following formula:
Figure SMS_2
wherein, the liquid crystal display device comprises a liquid crystal display device,SHA256a eigenvalue algorithm used for calculating eigenvalues;version(version number) is version information of the related block protocol in the block chain;prev_hasha block header characteristic value of a parent block of the current block;merkle_rootis a characteristic value of the input information;ntimeupdate time for the update timestamp;nbitsthe current difficulty is a fixed value in a period of time, and is determined again after exceeding a fixed period of time;xis a random number;TARGETis a characteristic value threshold value, which can be based onnbitsAnd determining to obtain the product.
Thus, when the random number meeting the formula is calculated, the information can be correspondingly stored to generate the block head and the block main body, and the current block is obtained. And then, the node where the blockchain is located sends the newly generated blocks to other nodes in the blockchain network where the newly generated blocks are located according to the node identifications of other nodes in the blockchain network, the other nodes verify the newly generated blocks, and the newly generated blocks are added into the blockchain stored in the newly generated blocks after the verification is completed.
In some possible embodiments, a node 111 of the blockchain network 11 may receive a port detection instruction sent by the blockchain management platform 12 when receiving a blockchain creation instruction, where the port detection instruction carries port segment information, and detects a state of each of a plurality of ports corresponding to the port segment information according to the port segment information, so as to determine a target port set in an idle state in the plurality of ports according to the state of each port, so as to send the target port set to the blockchain management platform 12, so that the blockchain management platform generates configuration parameters for creating a blockchain according to the target port set. Whether the port for creating the blockchain is available or not can be detected through the blockchain management platform 12, and the availability of the port for creating the blockchain is utilized, so that the effectiveness of the created blockchain is improved.
The method for creating a blockchain provided by the embodiment of the invention is schematically described below with reference to the accompanying drawings.
Referring specifically to fig. 2, fig. 2 is a flowchart of a method for creating a blockchain according to an embodiment of the present invention, where the method for creating a blockchain may be performed by a blockchain creating device, where the creating blockchain device is disposed in a node of a blockchain network in a port detection system, and the specific explanation of the port detection system is as described above. Specifically, the method of the embodiment of the invention comprises the following steps.
S201: and receiving a port detection instruction which is sent by the blockchain management platform when receiving a creation instruction of a target blockchain, wherein the port detection instruction carries port segment information.
In the embodiment of the invention, the node can receive a port detection instruction sent by the blockchain management platform when receiving a target blockchain creation instruction, the port detection instruction carries port segment information, and in some embodiments, the port detection instruction is sent by the blockchain management platform to each node related to the target blockchain, and the target node is any one of the nodes. In certain embodiments, the port segment information includes, but is not limited to, information of one or more port segments; for example, the port segment information carried by the port detection command is 16000-17000; in some embodiments, a plurality of ports are included in one port segment. In certain embodiments, the blockchain management platform includes, but is not limited to, a mass platform.
S202: and detecting the state of each port in the plurality of ports corresponding to the port segment information according to the port segment information.
In the embodiment of the invention, the node can detect the state of each port in the plurality of ports corresponding to the port segment information according to the port segment information. In certain embodiments, the plurality of ports includes, but is not limited to, greater than or equal to 4 ports.
In one embodiment, when detecting the state of each of the plurality of ports corresponding to the port segment information according to the port segment information, a node may send a detection command to each of the plurality of ports corresponding to the port segment information through a proxy process of the blockchain management platform, so that each port responds to the detection command to detect the respective state, and acquire the respective state returned by each port. In no embodiment, the probe command includes, but is not limited to, an lsof command. In some embodiments, the order in which the proxy process of the blockchain management platform sends the probe command to each of the plurality of ports corresponding to the port segment information is not specifically limited.
In one embodiment, when detecting that the state of a first port of the plurality of ports is an occupied state, the node may send the probe command to a next port of the first port through the proxy process when sending the probe command to each port of the plurality of ports corresponding to the port segment information through the proxy process of the blockchain management platform, so that the next port responds to the probe command to probe its own state. In some embodiments, the proxy process includes, but is not limited to, an a process.
In one example, assuming that the first port is a port with port number 16000, when detecting that the state of port 16000 is an occupied state, a node may send an lsof command to the next port 16001 of the port 16000 through a proxy process to cause the next port 16001 to probe 16001 for its own state in response to the lsof instruction.
In one embodiment, when detecting that the state of the first port is an idle state, the node may record the port number of the first port into a target port set, acquire the number of port numbers recorded in the target port set, and determine whether to send the probe command to the next port of the first port according to the number of port numbers recorded in the target port set. By the implementation mode, the ports in the target port set can be ensured to be available ports in an idle state, the effectiveness of the ports in the target port set is improved, and the effectiveness of a blockchain created by using the ports in the target port set is improved.
In one example, assuming that the first port is a port with port number 16000, when detecting that the state of port 16000 is an idle state, the node may record the port number 16000 of the port 16000 into a target port set, and obtain the number of port numbers recorded in the target port set.
In one embodiment, when determining whether to send the probe command to the next port of the first port according to the number of port numbers recorded in the target port set, the node may detect whether the number of port numbers recorded in the target port set is smaller than a specified number, and when the detection result is yes, send an lsof command to the next port of the first port, so that the next port of the first port responds to the probe command to probe the state of the next port of the first port, and when the detection result is no, stop sending the probe command to the next port of the first port. In certain embodiments, the specified number is 4.
In one example, assuming that a first port is a port with port number 16000, when detecting that the state of port 16000 is an idle state, a node records port number 16000 of port 16000 into a target port set and obtains the number of port numbers recorded in the target port set, and if detecting that the number of port numbers recorded in the target port set is 3 or less than a specified number 4, the lsof command may be sent to the next port 16001 of port 16000 to cause the next port 16001 of port 16000 to probe the state of the next port 16001 of port 16000 in response to the lsof command.
In one example, assuming that the first port is a port with port number 16000, when detecting that the state of port 16000 is idle, a node records port number 16000 of port 16000 into a destination port set and obtains the number of port numbers recorded in the destination port set, and if detecting that the number of port numbers recorded in the destination port set is 4 equal to the specified number 4, the node may stop sending lsof commands to the next port 16001 of port 16000.
Therefore, by the embodiment, the detection command is stopped from being sent to other ports when the ports in the idle state with the specified number are acquired, and the situation that the other ports are detected after the ports in the idle state with the specified number are detected, so that resource waste is caused is avoided.
S203: and determining a target port set in an idle state in the plurality of ports according to the states of the ports, wherein the target port set comprises a specified number of ports.
In the embodiment of the invention, the node can determine the target port set in the idle state in the plurality of ports according to the states of the ports. In some embodiments, the set of destination ports includes a specified number of ports; in some embodiments, the types of ports include a data read-write port, a database port, a consensus port, and a data synchronization port, in some embodiments, the specified number is 4; in some embodiments, the target port set includes a port number of a data read/write port in an idle state, a port number of a database port, a port number of a common identification port, and a port number of a data synchronization port.
In certain embodiments, the data read-write ports include, but are not limited to, remote procedure call (Remote Procedure Call, RPC) ports, and the database ports include, but are not limited to, structured query language (Structured Query Language, SQL) ports. In some embodiments, the data read-write port is a port used to read and write data on a blockchain; in some embodiments, the database port is a port used to store a database; in some embodiments, the consensus port is a port that is commonly recognized by each node on the blockchain; in some embodiments, the data synchronization port is a port for each node on the blockchain to synchronize data.
S204: and sending the target port set to the blockchain management platform so that the blockchain management platform generates configuration parameters for creating the blockchain according to the target port set.
In the embodiment of the invention, the node can send the target port set to the blockchain management platform, so that the blockchain management platform generates configuration parameters for creating the blockchain according to the target port set.
In one embodiment, a node may send the set of target ports to the blockchain management platform so that the blockchain management platform may generate configuration parameters for creating a blockchain from ports in the set of target ports that are in an idle state.
S205: and receiving configuration parameters corresponding to the target node sent by the block chain management platform.
In the embodiment of the invention, the node can receive the configuration parameters corresponding to the target node sent by the blockchain management platform. In some embodiments, the configuration parameters include an identification of the specified number of ports on the target node and an identification of a specified type of ports on other ones of the respective nodes in an idle state, the specified type including a consensus port and a data synchronization port. In certain embodiments, the explanation of the consensus port and the data synchronization port is as described previously. In some embodiments, the identification of the port includes, but is not limited to, numerals, letters, words, etc., and illustratively, the identification of the port may be a port number.
In some embodiments, the configuration parameters include a specified number of port identifications on the target node, the identification of the specified number of ports on the target node including a data read-write port, a database port, a consensus port, and a data synchronization port.
The configuration parameters comprise the identification of the appointed number of ports on the target node, which is beneficial to the node to create the target blockchain according to the identification of the appointed number of ports on the target node; the configuration parameters also comprise the identification of the ports of the appointed type in the idle state on other nodes in each node, the appointed type comprises an consensus port and a data synchronization port, the target node is facilitated to carry out data consensus with the consensus port in the idle state in other nodes through the consensus port in the idle state, and the target node is facilitated to synchronize data with the data synchronization port in the idle state in other nodes through the data synchronization port in the idle state, and the target node is also facilitated to carry out data consensus among other nodes through the consensus port in the idle state and synchronize data through the consensus port in the idle state.
For example, if the node receives the configuration parameters corresponding to the target node 1 sent by the blockchain management platform, the configuration parameters include that the identifiers of the 4 ports on the target node 1 are the identifier 16000 of the data read-write port, the identifier 16001 of the database port, the identifier 16005 of the common identification port, the identifier 16010 of the data synchronization port, and the identifier 16030 of the port of the common identification port in the idle state and the identifier 16060 of the data synchronization port in the idle state on the node 2, respectively, which is helpful for the target node 1 to create a target blockchain according to the identifier 16000 of the data read-write port, the identifier 16001 of the database port, the identifier 16005 of the common identification port, and the identifier 16010 of the data synchronization port, and for the target node 1 to perform data consensus with the common identification port 16030 in the idle state in the node 2 through the common identification port 16005, and for the target node 1 to synchronize data with the data synchronization port 16060 in the idle state through the data synchronization port 16010.
S206: and creating the target blockchain by using the configuration parameters.
In the embodiment of the invention, the node can create the target blockchain by using the configuration parameters corresponding to the target node.
In one embodiment, a node, upon creating the target blockchain using the configuration parameters, may determine a plurality of ports for creating the target blockchain based on the configuration parameters and initiate a blockchain process, and run the target blockchain using the blockchain process and the plurality of ports.
For example, assuming that the configuration parameters include 4 port numbers, namely, a port number 16000 of a data read/write port, a port number 16010 of a database port, a port number 16080 of a common port, and a port number 16120 of a data synchronization port, a node may determine 4 ports for creating a blockchain according to the port numbers 16000, 16010, 16080, 16120 carried in the configuration parameters, and start a blockchain process, and operate the blockchain using the blockchain process and the 4 ports.
In the embodiment of the invention, when a node receives a creation instruction of a target blockchain, a port detection instruction is sent by a blockchain management platform, states of all ports in a plurality of ports corresponding to port section information are detected according to port section information carried by the port detection instruction, the states comprise idle states or occupied states, a target port set in the idle states in the plurality of ports is determined according to the states of all the ports, and the target port set comprises a specified number of ports, so that the target port set is sent to the blockchain management platform, the blockchain management platform generates configuration parameters for creating the blockchain according to the target port set, and the configuration parameters corresponding to the target node sent by the blockchain management platform are received, wherein the configuration parameters comprise identifiers of the specified number of ports on the target node and identifiers of ports in the idle states in other nodes so as to create the target blockchain by using the configuration parameters. With this embodiment, whether a port for creating a blockchain is available can be detected by the blockchain management platform, and the blockchain is created using the available port, thereby improving the effectiveness of the created blockchain.
Referring specifically to fig. 3, fig. 3 is a flowchart of another method for creating a blockchain according to an embodiment of the present invention, where the method for creating a blockchain may be performed by a blockchain creating device, and the creating device is disposed in a blockchain management platform in a port detection system.
S301: a creation instruction of a target blockchain submitted by a user is received, wherein the creation instruction comprises node identifications of various nodes related to the target blockchain.
In the embodiment of the invention, the blockchain management platform can receive the creation instruction of the target blockchain submitted by the user, wherein the creation instruction comprises the node identification of each node related to the target blockchain.
In one embodiment, before receiving the creation instruction of the target blockchain submitted by the user, the blockchain management platform needs to be started to load pages, so that the user can submit the creation instruction of the target blockchain through the pages managed by the blockchain. In some embodiments, before a user submits a creation instruction of a target blockchain, a node identifier of a node for creating the target blockchain can be selected through a page managed by the blockchain, so that the blockchain network can determine the node for creating the target blockchain according to the node identifier in the creation instruction, and the efficiency of creating the target blockchain can be improved.
Specifically, an example will be described with reference to fig. 4a and fig. 4b, where fig. 4a is a schematic diagram of a start-up blockchain management platform according to an embodiment of the present invention, and fig. 4b is an interface schematic diagram of a blockchain management platform according to an embodiment of the present invention. As shown in fig. 4a and 4b, a user may perform a clicking operation on an icon 41 of a mass platform on a terminal device to load an interface as shown in fig. 4b, the user may select a node for creating a target blockchain by clicking a button 42 for selecting the node for creating the target blockchain according to user requirements, after the user determines the node for creating the target blockchain, may generate a creation instruction of the target blockchain by confirming the button 43, and send the creation instruction of the target blockchain to each node selected by the user in the blockchain network, so that each node creates the target blockchain, or may cancel the creation instruction for creating the target blockchain by canceling the button 44. By designating the node for creating the target blockchain by the user, the efficiency of creating the target blockchain is improved.
S302: and sending a port detection instruction to each node according to the node identification of each node, wherein the port detection instruction carries port segment information, the port detection instruction is used for indicating each node to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, and the target port set comprises a specified number of ports.
In the embodiment of the invention, the blockchain management platform can send the port detection instruction to each node according to the node identifier of each node, wherein the port detection instruction carries port segment information, and the port detection instruction is used for indicating each node to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, and the target port set comprises a specified number of ports. In some embodiments, the types of ports include a data read-write port, a database port, a consensus port, and a data synchronization port.
S303: and receiving the target port set sent by each node, and generating configuration parameters for creating a blockchain corresponding to each node according to the target port set.
In the embodiment of the invention, the blockchain management platform can receive the target port set sent by each node and generate the configuration parameters for creating the blockchain corresponding to each node according to the target port set.
In one embodiment, after generating the configuration parameters for creating the blockchain corresponding to the respective nodes according to the target port set, the blockchain management platform may send the respective corresponding configuration parameters to the respective nodes, so that the respective nodes create the blockchain by using the respective corresponding configuration parameters, where the configuration parameters include node identifiers and port numbers of the respective nodes.
S304: and sending configuration parameters corresponding to the target node, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in an idle state on other nodes in each node, the specified type comprises a common identification port and a data synchronization port, so that the target node creates the target blockchain by using the configuration parameters, and the target node is any one of the nodes.
In the embodiment of the invention, the blockchain management platform can send configuration parameters corresponding to the target node, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the specified type of ports in an idle state on other nodes in each node, the specified type comprises a common identification port and a data synchronization port, so that the target node creates the target blockchain by using the configuration parameters, and the target node is any one of the nodes. In some embodiments, the configuration parameters include a specified number of port identifications on the target node, the identification of the specified number of ports on the target node including a data read-write port, a database port, a consensus port, and a data synchronization port. Specific examples of the present invention are as described above, and will not be described here again.
The configuration parameters corresponding to the target node are sent to the target node through the blockchain management platform, so that the target node is facilitated to create a target blockchain according to the identification of the specified number of ports on the target node; the method is beneficial to carrying out data consensus on the target node through the consensus port in the idle state and the consensus ports in the idle state in other nodes, and is beneficial to synchronizing data on the target node through the data synchronization port in the idle state and the data synchronization ports in the idle state in other nodes, and is beneficial to carrying out data consensus on other nodes through the consensus ports in the idle state and synchronizing data through the consensus ports in the idle state.
In the embodiment of the invention, a blockchain management platform can receive a creation instruction of a target blockchain submitted by a user, the creation instruction comprises node identifications of all nodes related to the target blockchain, and sends port detection instructions to all the nodes according to the node identifications of all the nodes, the port detection instructions carry port segment information, the port detection instructions are used for indicating all the nodes to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, the target port set comprises a specified number of ports, the target port set sent by all the nodes is received, configuration parameters corresponding to all the nodes and used for creating the blockchain are generated according to the target port set, and the configuration parameters corresponding to all the target nodes are sent to the target nodes, wherein the configuration parameters comprise identifications of the specified number of ports on the target nodes and identifications of ports in the idle state in other nodes, the specified types comprise common ports and data synchronization ports, so that the target node creates the target blockchain by using the configuration parameters, and the configuration parameters are any one of the target nodes. With this embodiment, it is possible to detect whether a port for creating a blockchain is available, and create a blockchain using the detected available port, thereby improving the effectiveness of the created blockchain.
Referring to fig. 5, fig. 5 is a schematic structural diagram of a device for creating a blockchain according to an embodiment of the present invention. Specifically, the apparatus is disposed in a node in a blockchain network, and the apparatus includes: a first receiving module 501, a detecting module 502, a determining module 503, a first transmitting module 504, a second receiving module 505, and a creating module 506;
a first receiving module 501, configured to receive a port detection instruction sent by a blockchain management platform when receiving a creation instruction of a target blockchain, where the port detection instruction carries port segment information, where the port detection instruction is sent by the blockchain management platform to each node related to the target blockchain, and the target node is any one of the nodes;
the detecting module 502 is configured to detect a state of each of a plurality of ports corresponding to the port segment information according to the port segment information, where the state includes an idle state or an occupied state;
a determining module 503, configured to determine, according to the status of each port, a target port set in an idle state in the plurality of ports, where the target port set includes a specified number of ports, and types of the ports include a data read-write port, a database port, a common identification port, and a data synchronization port;
A first sending module 504, configured to send the target port set to the blockchain management platform, so that the blockchain management platform generates configuration parameters for creating a blockchain according to the target port set;
a second receiving module 505, configured to receive a configuration parameter corresponding to the target node sent by the blockchain management platform, where the configuration parameter includes an identifier of the specified number of ports on the target node and an identifier of a specified type of ports in an idle state on other nodes in the respective nodes, and the specified type includes a consensus port and a data synchronization port;
a creating module 506, configured to create the target blockchain using the configuration parameter.
Further, when the detecting module 502 detects the status of each of the plurality of ports corresponding to the port segment information according to the port segment information, the detecting module is specifically configured to:
sending a detection command to each port in a plurality of ports corresponding to the port segment information through a proxy process of the blockchain management platform so that each port responds to the detection command to detect the respective state;
and acquiring the respective states returned by the ports.
Further, the detection module 502 is further configured to:
when detecting that the state of a first port in the plurality of ports is an occupied state, sending the detection command to the next port of the first port through the proxy process so that the next port responds to the detection command to detect the state of the next port;
when the state of the first port is detected to be an idle state, recording the port number of the first port into a target port set;
acquiring the number of port numbers recorded in the target port set;
and determining whether to send the detection command to the next port of the first port according to the number of the port numbers recorded in the target port set.
Further, the probing module 502 determines, according to the number of port numbers recorded in the target port set, whether to send the probing command to the next port of the first port, where the probing module is specifically configured to:
detecting whether the number of port numbers recorded in the target port set is smaller than a specified number;
when the detection result is yes, sending the detection command to the next port of the first port, so that the next port of the first port responds to the detection command to detect the state of the next port of the first port;
And stopping sending the detection command to the next port of the first port when the detection result is negative.
Further, when the creation module 506 creates the target blockchain using the configuration parameters, the creation module is specifically configured to:
determining a plurality of ports for creating the target blockchain according to the configuration parameters;
and starting a blockchain process, and running the target blockchain by using the blockchain process and the plurality of ports.
According to the embodiment of the invention, when a node receives a creation instruction of a target blockchain, the node can receive a port detection instruction sent by a blockchain management platform, detect the state of each port in a plurality of ports corresponding to port section information according to port section information carried by the port detection instruction, wherein the state comprises an idle state or an occupied state, and determine a target port set in the idle state in the plurality of ports according to the state of each port, and the target port set comprises a specified number of ports, so that the target port set is sent to the blockchain management platform, so that the blockchain management platform generates a configuration parameter for creating the blockchain according to the target port set, and the configuration parameter corresponding to the target node sent by the blockchain management platform is received, wherein the configuration parameter comprises the identifiers of the specified number of ports on the target node and the identifiers of the ports in the idle state on other nodes so as to create the target blockchain by using the configuration parameter. With this embodiment, whether a port for creating a blockchain is available can be detected by the blockchain management platform, and the blockchain is created using the available port, thereby improving the effectiveness of the created blockchain.
Referring to fig. 6, fig. 6 is a schematic diagram of another apparatus for creating a blockchain in accordance with an embodiment of the present invention. Specifically, the device is arranged in a blockchain management platform, and the device comprises: a third receiving module 601, a second transmitting module 602, a generating module 603, and a third transmitting module 604;
a third receiving module 601, configured to receive a creation instruction of a target blockchain submitted by a user, where the creation instruction includes node identifiers of nodes related to the target blockchain;
a second sending module 602, configured to send, according to a node identifier of each node, a port detection instruction to each node, where the port detection instruction carries port segment information, where the port detection instruction is configured to instruct each node to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, where the target port set includes a specified number of ports, and types of the ports include a data read-write port, a database port, a consensus port, and a data synchronization port;
the generating module 603 is configured to receive the target port set sent by the each node, and generate, according to the target port set, configuration parameters corresponding to the each node and used for creating a blockchain;
A third sending module 604, configured to send, to a target node, a configuration parameter corresponding to the target node, where the configuration parameter includes an identifier of the specified number of ports on the target node and an identifier of a specified type of ports in an idle state on other nodes in the respective nodes, where the specified type includes a consensus port and a data synchronization port, so that the target node creates the target blockchain by using the configuration parameter, and the target node is any one of the respective nodes.
Further, after the generating module 603 generates the configuration parameters for creating the blockchain corresponding to the nodes according to the target port set, the generating module is further configured to:
and sending respective corresponding configuration parameters to the nodes so that the nodes can create a blockchain by utilizing the respective corresponding configuration parameters, wherein the configuration parameters comprise node identifications and port numbers of the nodes.
In the embodiment of the invention, a blockchain management platform can receive a creation instruction of a target blockchain submitted by a user, the creation instruction comprises node identifications of all nodes related to the target blockchain, and sends port detection instructions to all the nodes according to the node identifications of all the nodes, the port detection instructions carry port segment information, the port detection instructions are used for indicating all the nodes to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, the target port set comprises a specified number of ports, the target port set sent by all the nodes is received, configuration parameters corresponding to all the nodes and used for creating the blockchain are generated according to the target port set, and the configuration parameters corresponding to all the target nodes are sent to the target nodes, wherein the configuration parameters comprise identifications of the specified number of ports on the target nodes and identifications of ports in the idle state in other nodes, and the specified types comprise common ports and data synchronization ports, so that the target node creates the target blockchain by using the configuration parameters. With this embodiment, it is possible to detect whether a port for creating a blockchain is available, and create a blockchain using the detected available port, thereby improving the effectiveness of the created blockchain.
Referring to fig. 7, fig. 7 is a schematic structural diagram of a node according to an embodiment of the present invention. Specifically, the node includes: memory 701, processor 702.
In an embodiment, the node further comprises a data interface 703, the data interface 703 being for transferring data information between the node and other devices.
The memory 701 may include volatile memory; memory 701 may also include non-volatile memory (nonvolatile memory); memory 701 may also include a combination of the above types of memory. The processor 702 may be a central processing unit (central processing unit, CPU). The processor 702 may further comprise a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (programmable logic device, PLD), or a combination thereof. The PLD may be a complex programmable logic device (complex programmable logic device, CPLD), a field-programmable gate array (field-programmable gate array, FPGA), or any combination thereof.
The memory 701 is used for storing a program, and the processor 702 may call the program stored in the memory 701, for performing the following steps:
Receiving a port detection instruction sent by a blockchain management platform when receiving a creation instruction of a target blockchain, wherein the port detection instruction carries port segment information, the port detection instruction is sent to each node related to the target blockchain by the blockchain management platform, and the target node is any one of the nodes;
detecting the state of each port in a plurality of ports corresponding to the port segment information according to the port segment information, wherein the state comprises an idle state or an occupied state;
determining a target port set in an idle state in the plurality of ports according to the states of the ports, wherein the target port set comprises a specified number of ports, and the types of the ports comprise a data read-write port, a database port, a consensus port and a data synchronization port;
sending the target port set to the blockchain management platform so that the blockchain management platform generates configuration parameters for creating a blockchain according to the target port set;
receiving configuration parameters corresponding to the target node, which are sent by the blockchain management platform, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in an idle state on other nodes in each node, and the specified type comprises a consensus port and a data synchronization port;
And creating the target blockchain by using the configuration parameters.
Further, when the processor 702 detects the status of each of the plurality of ports corresponding to the port segment information according to the port segment information, the processor is specifically configured to:
sending a detection command to each port in a plurality of ports corresponding to the port segment information through a proxy process of the blockchain management platform so that each port responds to the detection command to detect the respective state;
and acquiring the respective states returned by the ports.
Further, the processor 702 is further configured to:
when detecting that the state of a first port in the plurality of ports is an occupied state, sending the detection command to the next port of the first port through the proxy process so that the next port responds to the detection command to detect the state of the next port;
when the state of the first port is detected to be an idle state, recording the port number of the first port into a target port set;
acquiring the number of port numbers recorded in the target port set;
and determining whether to send the detection command to the next port of the first port according to the number of the port numbers recorded in the target port set.
Further, the processor 702 is configured to determine, according to the number of port numbers recorded in the target port set, whether to send the probe command to a next port of the first port, specifically:
detecting whether the number of port numbers recorded in the target port set is smaller than a specified number;
when the detection result is yes, sending the detection command to the next port of the first port, so that the next port of the first port responds to the detection command to detect the state of the next port of the first port;
and stopping sending the detection command to the next port of the first port when the detection result is negative.
Further, when the processor 702 creates the target blockchain using the configuration parameters, the processor is specifically configured to:
determining a plurality of ports for creating the target blockchain according to the configuration parameters;
and starting a blockchain process, and running the target blockchain by using the blockchain process and the plurality of ports.
According to the embodiment of the invention, when a node receives a creation instruction of a target blockchain, a port detection instruction is sent by a blockchain management platform, states of all ports in a plurality of ports corresponding to port section information are detected according to port section information carried by the port detection instruction, the states comprise idle states or occupied states, a target port set in the idle states in the plurality of ports is determined according to the states of all the ports, the target port set comprises a specified number of ports, and therefore the target port set is sent to the blockchain management platform, so that the blockchain management platform generates configuration parameters for creating the blockchain according to the target port set, and the configuration parameters corresponding to the target node sent by the blockchain management platform are received, wherein the configuration parameters comprise identifiers of the specified number of ports on the target node and identifiers of ports in the idle states in other nodes so as to create the target blockchain by using the configuration parameters. With this embodiment, whether a port for creating a blockchain is available can be detected by the blockchain management platform, and the blockchain is created using the available port, thereby improving the effectiveness of the created blockchain.
Referring to fig. 8, fig. 8 is a schematic structural diagram of a blockchain management platform according to an embodiment of the present invention. Specifically, the blockchain management platform includes: memory 801, and processor 802.
In one embodiment, the blockchain management platform further includes a data interface 803, the data interface 803 being configured to communicate data information between the blockchain management platform and other devices.
The memory 801 may include volatile memory (volatile memory); the memory 801 may also include non-volatile memory (nonvolatile memory); the memory 801 may also include a combination of the above types of memory. The processor 802 may be a central processing unit (central processing unit, CPU). The processor 802 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (programmable logic device, PLD), or a combination thereof. The PLD may be a complex programmable logic device (complex programmable logic device, CPLD), a field-programmable gate array (field-programmable gate array, FPGA), or any combination thereof.
The memory 801 is used for storing a program, and the processor 802 may call the program stored in the memory 801 for performing the steps of:
receiving a creation instruction of a target blockchain submitted by a user, wherein the creation instruction comprises node identifications of all nodes related to the target blockchain;
transmitting a port detection instruction to each node according to the node identification of each node, wherein the port detection instruction carries port segment information, the port detection instruction is used for indicating each node to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, the target port set comprises a specified number of ports, and the types of the ports comprise a data read-write port, a database port, a consensus port and a data synchronization port;
receiving the target port set sent by each node, and generating configuration parameters for creating a blockchain corresponding to each node according to the target port set;
and sending configuration parameters corresponding to the target node, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in an idle state on other nodes in each node, the specified type comprises a common identification port and a data synchronization port, so that the target node creates the target blockchain by using the configuration parameters, and the target node is any one of the nodes.
Further, after generating the configuration parameters for creating a blockchain corresponding to the respective nodes according to the target port set, the processor 802 is further configured to:
and sending respective corresponding configuration parameters to the nodes so that the nodes can create a blockchain by utilizing the respective corresponding configuration parameters, wherein the configuration parameters comprise node identifications and port numbers of the nodes.
In the embodiment of the invention, a blockchain management platform can receive a creation instruction of a target blockchain submitted by a user, the creation instruction comprises node identifications of all nodes related to the target blockchain, and sends port detection instructions to all the nodes according to the node identifications of all the nodes, the port detection instructions carry port segment information, the port detection instructions are used for indicating all the nodes to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, the target port set comprises a specified number of ports, the target port set sent by all the nodes is received, configuration parameters corresponding to all the nodes and used for creating the blockchain are generated according to the target port set, and the configuration parameters corresponding to all the target nodes are sent to the target nodes, wherein the configuration parameters comprise identifications of the specified number of ports on the target nodes and identifications of ports in the idle state in other nodes, and the specified types comprise common ports and data synchronization ports, so that the target node creates the target blockchain by using the configuration parameters. With this embodiment, it is possible to detect whether a port for creating a blockchain is available, and create a blockchain using the detected available port, thereby improving the effectiveness of the created blockchain.
The embodiment of the present invention further provides a computer readable storage medium, where a computer program is stored, where the computer program when executed by a processor implements a method described in the embodiment corresponding to fig. 2 or fig. 3 of the present invention, and may also implement an apparatus corresponding to the embodiment corresponding to the present invention described in fig. 5 or fig. 6, which is not described herein again.
The computer readable storage medium may be an internal storage unit of the device according to any of the foregoing embodiments, for example, a hard disk or a memory of the device. The computer readable storage medium may also be an external storage device of the device, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the device. Further, the computer readable storage medium may also include both internal storage units and external storage devices of the device. The computer-readable storage medium is used to store the computer program and other programs and data required by the server. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in accordance with the embodiments may be accomplished by way of a computer program stored on a computer readable storage medium, which when executed may comprise the steps of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
The above disclosure is only a few examples of the present invention, and it is not intended to limit the scope of the present invention, but it is understood by those skilled in the art that all or a part of the above embodiments may be implemented and equivalents thereof may be modified according to the scope of the present invention.

Claims (10)

1. A method of creating a blockchain, for application to a target node of a blockchain network, the method comprising:
receiving a port detection instruction sent by a blockchain management platform when receiving a creation instruction of a target blockchain, wherein the port detection instruction carries port segment information, the port detection instruction is sent to each node related to the target blockchain by the blockchain management platform, and the target node is any one of the nodes;
Detecting the state of each port in a plurality of ports corresponding to the port segment information according to the port segment information, wherein the state comprises an idle state or an occupied state;
determining a target port set in an idle state in the plurality of ports according to the states of the ports, wherein the target port set comprises a specified number of ports, and the types of the ports comprise a data read-write port, a database port, a consensus port and a data synchronization port;
sending the target port set to the blockchain management platform so that the blockchain management platform generates configuration parameters for creating a blockchain according to the target port set;
receiving configuration parameters corresponding to the target node, which are sent by the blockchain management platform, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in an idle state on other nodes in each node, and the specified type comprises a consensus port and a data synchronization port;
and creating the target blockchain by using the configuration parameters.
2. The method according to claim 1, wherein detecting the status of each of the plurality of ports corresponding to the port segment information according to the port segment information comprises:
Sending a detection command to each port in a plurality of ports corresponding to the port segment information through a proxy process of the blockchain management platform so that each port responds to the detection command to detect the respective state;
and acquiring the respective states returned by the ports.
3. The method according to claim 2, wherein the method further comprises:
when detecting that the state of a first port in the plurality of ports is an occupied state, sending the detection command to the next port of the first port through the proxy process so that the next port responds to the detection command to detect the state of the next port;
when the state of the first port is detected to be an idle state, recording the port number of the first port into a target port set;
acquiring the number of port numbers recorded in the target port set;
and determining whether to send the detection command to the next port of the first port according to the number of the port numbers recorded in the target port set.
4. The method of claim 3, wherein the determining whether to send the probe command to a next port of the first port based on the number of port numbers recorded in the set of target ports comprises:
Detecting whether the number of port numbers recorded in the target port set is smaller than a specified number;
when the detection result is yes, sending the detection command to the next port of the first port, so that the next port of the first port responds to the detection command to detect the state of the next port of the first port;
and stopping sending the detection command to the next port of the first port when the detection result is negative.
5. The method of claim 1, wherein the creating the target blockchain using the configuration parameters comprises:
determining a plurality of ports for creating the target blockchain according to the configuration parameters;
and starting a blockchain process, and running the target blockchain by using the blockchain process and the plurality of ports.
6. A method of creating a blockchain, characterized by being applied to a blockchain management platform, the method comprising:
receiving a creation instruction of a target blockchain submitted by a user, wherein the creation instruction comprises node identifications of all nodes related to the target blockchain;
transmitting a port detection instruction to each node according to the node identification of each node, wherein the port detection instruction carries port segment information, the port detection instruction is used for indicating each node to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, the target port set comprises a specified number of ports, and the types of the ports comprise a data read-write port, a database port, a consensus port and a data synchronization port;
Receiving the target port set sent by each node, and generating configuration parameters for creating a blockchain corresponding to each node according to the target port set;
and sending configuration parameters corresponding to the target node, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in an idle state on other nodes in each node, the specified type comprises a common identification port and a data synchronization port, so that the target node creates the target blockchain by using the configuration parameters, and the target node is any one of the nodes.
7. The method of claim 6, wherein after generating configuration parameters for creating a blockchain corresponding to the respective nodes according to the set of target ports, further comprises:
and sending respective corresponding configuration parameters to the nodes so that the nodes can create a blockchain by utilizing the respective corresponding configuration parameters, wherein the configuration parameters comprise node identifications and port numbers of the nodes.
8. A device for creating a blockchain, disposed in a target node of a blockchain network, the device comprising:
The first receiving module is used for receiving a port detection instruction sent by the blockchain management platform when receiving a creation instruction of a target blockchain, wherein the port detection instruction carries port segment information, the port detection instruction is sent to each node related to the target blockchain by the blockchain management platform, and the target node is any one of the nodes;
the detection module is used for detecting the state of each port in the plurality of ports corresponding to the port segment information according to the port segment information, wherein the state comprises an idle state or an occupied state;
the determining module is used for determining a target port set in an idle state in the plurality of ports according to the states of the ports, wherein the target port set comprises a specified number of ports, and the types of the ports comprise a data read-write port, a database port, a common identification port and a data synchronization port;
the first sending module is used for sending the target port set to the blockchain management platform so that the blockchain management platform generates configuration parameters for creating a blockchain according to the target port set;
the second receiving module is used for receiving configuration parameters corresponding to the target node, which are sent by the blockchain management platform, wherein the configuration parameters comprise the identifiers of the specified number of ports on the target node and the identifiers of the ports of the specified type in an idle state on other nodes in each node, and the specified type comprises a consensus port and a data synchronization port;
And the creation module is used for creating the target blockchain by using the configuration parameters.
9. A device for creating a blockchain, disposed in a blockchain management platform, the device comprising:
the third receiving module is used for receiving a creation instruction of a target blockchain submitted by a user, wherein the creation instruction comprises node identifications of all nodes related to the target blockchain;
the second sending module is used for sending port detection instructions to the nodes according to the node identifiers of the nodes, the port detection instructions carry port segment information, the port detection instructions are used for indicating the nodes to detect a target port set in an idle state in a plurality of ports corresponding to the port segment information, the target port set comprises a specified number of ports, and the types of the ports comprise data read-write ports, database ports, consensus ports and data synchronization ports;
the generating module is used for receiving the target port set sent by each node and generating configuration parameters for creating a blockchain corresponding to each node according to the target port set;
and the third sending module is used for sending configuration parameters corresponding to the target node, wherein the configuration parameters comprise the identification of the specified number of ports on the target node and the identification of the ports of the specified type in the idle state on other nodes in each node, the specified type comprises a consensus port and a data synchronization port, so that the target node creates the target blockchain by using the configuration parameters, and the target node is any one of the nodes.
10. A computer readable storage medium, characterized in that the computer readable storage medium has stored therein program instructions, which when executed, are adapted to carry out the method according to any of claims 1-7.
CN202010249539.6A 2020-03-31 2020-03-31 Method and device for creating blockchain and readable storage medium Active CN111464395B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010249539.6A CN111464395B (en) 2020-03-31 2020-03-31 Method and device for creating blockchain and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010249539.6A CN111464395B (en) 2020-03-31 2020-03-31 Method and device for creating blockchain and readable storage medium

Publications (2)

Publication Number Publication Date
CN111464395A CN111464395A (en) 2020-07-28
CN111464395B true CN111464395B (en) 2023-06-09

Family

ID=71681166

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010249539.6A Active CN111464395B (en) 2020-03-31 2020-03-31 Method and device for creating blockchain and readable storage medium

Country Status (1)

Country Link
CN (1) CN111464395B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113923031A (en) * 2021-10-12 2022-01-11 百果园技术(新加坡)有限公司 Data transmission method, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019062304A1 (en) * 2017-09-26 2019-04-04 上海点融信息科技有限责任公司 Method, device and system for managing computing resources of block chain node
CN110474774A (en) * 2018-05-09 2019-11-19 三星Sds株式会社 Block creation method and block chain node in system based on block chain
CN110516007A (en) * 2019-08-30 2019-11-29 北京百度网讯科技有限公司 A kind of deployment control method, device, equipment and the medium of block chain network
WO2020035094A2 (en) * 2019-11-19 2020-02-20 Alipay (Hangzhou) Information Technology Co., Ltd. System and method for consensus management
CN110855791A (en) * 2019-11-18 2020-02-28 腾讯科技(深圳)有限公司 Block link point deployment method and related equipment

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10592979B2 (en) * 2017-07-26 2020-03-17 International Business Machines Corporation Managing blockchain transactions
US11334439B2 (en) * 2018-08-29 2022-05-17 International Business Machines Corporation Checkpointing for increasing efficiency of a blockchain

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019062304A1 (en) * 2017-09-26 2019-04-04 上海点融信息科技有限责任公司 Method, device and system for managing computing resources of block chain node
CN110474774A (en) * 2018-05-09 2019-11-19 三星Sds株式会社 Block creation method and block chain node in system based on block chain
CN110516007A (en) * 2019-08-30 2019-11-29 北京百度网讯科技有限公司 A kind of deployment control method, device, equipment and the medium of block chain network
CN110855791A (en) * 2019-11-18 2020-02-28 腾讯科技(深圳)有限公司 Block link point deployment method and related equipment
WO2020035094A2 (en) * 2019-11-19 2020-02-20 Alipay (Hangzhou) Information Technology Co., Ltd. System and method for consensus management

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链的安全检测模型;叶聪聪;李国强;蔡鸿明;顾永跟;;软件学报(05);全文 *

Also Published As

Publication number Publication date
CN111464395A (en) 2020-07-28

Similar Documents

Publication Publication Date Title
EP3800589A1 (en) Task processing method and apparatus
US11191111B2 (en) Bluetooth connection establishment method, device and system
CN111756674A (en) Network communication method, system, device and computer readable storage medium
CN112988317B (en) Multi-mode cloud desktop management and control method and device
EP3174318A1 (en) Method for realizing resource attribute notification, and common service entity
CN110619022B (en) Node detection method, device, equipment and storage medium based on block chain network
CN111464395B (en) Method and device for creating blockchain and readable storage medium
CN111756829A (en) Account book data synchronization method, device, equipment and storage medium
WO2020029588A1 (en) Data reading method, device, system, and distributed system
CN107609197B (en) A kind of method of data synchronization, data synchronization unit and mobile terminal
CN112600703B (en) Network equipment remote access fault positioning method and device
US20180176781A1 (en) Method and device for managing wireless access point
CN110888892A (en) Block synchronization method, device and storage medium
CN111092956A (en) Resource synchronization method, device, storage medium and equipment
CN111857985A (en) Calling method and device of browser plug-in, storage medium and terminal
CN113992739B (en) Local area network OTA firmware upgrading device, method and system
CN111314151B (en) Node management method, node management device, electronic equipment and computer readable storage medium
CN114880717A (en) Data archiving method and device
CN111324368B (en) Data sharing method and server
CN114710350A (en) Allocation method and device for callable resources
CN112306962B (en) File copying method, device and storage medium in computer cluster system
CN110597466B (en) Control method and device of block chain node, storage medium and computer equipment
CN112766486A (en) Searching method of neural network structure, terminal, server and readable storage medium
US20200065508A1 (en) Device and method to share image received from user terminal with other user terminals
JP2015072531A (en) Test support method, test support device, and program

Legal Events

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