Method, device, electronic device and storage medium for joining a blockchain network
By establishing a proxy relationship between permanent nodes and temporary nodes in the blockchain network and using proxy units to forward messages, the problems of high network maintenance costs and unstable communication caused by frequent node joining or going offline are solved, and stable network communication is achieved.
Patent Information
- Application Number
- CN202211352480.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-10-31
- Publication Date
- 2025-10-10
- Estimated Expiration
- 2042-10-31
AI Technical Summary
When the blockchain network is large, nodes frequently join or go offline, resulting in high network maintenance costs and affecting communication stability.
By establishing a proxy relationship between resident nodes and temporary nodes, temporary nodes only establish connections with resident nodes and use proxy units to forward messages, avoiding nodes from perceiving the joining and leaving of temporary nodes and reducing routing policy updates.
It reduces the cost of network maintenance, maintains the communication stability between nodes in the blockchain network, and ensures the normal communication between temporary nodes and the network.
Smart Images

Figure CN115834578B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification belong to the field of computer network technology, and in particular, relate to a method, device, electronic device, and storage medium for joining a blockchain network. Background Art
[0002] Blockchain is a novel application model for computer technologies, including distributed data storage, peer-to-peer transmission, consensus mechanisms, and encryption algorithms. In a blockchain system, data blocks are linked sequentially in chronological order to form a chain-like data structure, cryptographically guaranteeing an unalterable and unforgeable distributed ledger. Due to its decentralized, tamper-proof, and autonomous nature, blockchain is gaining increasing attention and application.
[0003] Blockchains are maintained within a blockchain network consisting of multiple nodes, which can communicate with each other based on their learned routing policies. However, when a blockchain network is large, meaning it contains a large number of nodes, and some nodes frequently disconnect or temporarily join the network, each node in the network will frequently update its routing policy when a node joins the network or goes offline. This results in significant network maintenance costs, increased pressure on the blockchain network, and disruptive communication stability between nodes within the network. Summary of the Invention
[0004] The object of the present invention is to provide a method, device, electronic device and storage medium for joining a blockchain network.
[0005] According to a first aspect of one or more embodiments of this specification, a method for joining a blockchain network is proposed, which is applied to a first resident node in the blockchain network, wherein the nodes in the blockchain network include resident nodes and temporary nodes, a routing policy set maintained by any resident node includes a routing policy for routing from the resident node to each other resident node in the blockchain network; a proxy pool maintained by any temporary node includes node information of at least one resident node connected to the temporary node, and the temporary node is not connected to any nodes in the blockchain network other than the at least one resident node; the method includes:
[0006] In response to the proxy network access request sent by the first temporary node, establishing a connection with the first temporary node;
[0007] Create an agent unit corresponding to the first temporary node, where the agent unit is used to:
[0008] receiving a first message sent by a first temporary node, changing the source address of the first message to the node address of the first resident node and marking the first message with the proxy identifier corresponding to the proxy unit, and forwarding the first message based on the destination address of the first message; and
[0009] When receiving a second message whose destination address is the node address of the first resident node and is marked with the proxy identifier, the second message is forwarded to the first temporary node.
[0010] According to a second aspect of one or more embodiments of this specification, a device for joining a blockchain network is provided, which is applied to a first resident node in the blockchain network, wherein the nodes in the blockchain network include resident nodes and temporary nodes, a routing policy set maintained by any resident node includes a routing policy for routing from the resident node to each other resident node in the blockchain network; a proxy pool maintained by any temporary node includes node information of at least one resident node connected to the temporary node, and the temporary node is not connected to any nodes in the blockchain network other than the at least one resident node; the device includes:
[0011] a connection establishing unit, configured to establish a connection with the first temporary node in response to the proxy network access request sent by the first temporary node;
[0012] An agent creation unit is configured to create an agent unit corresponding to the first temporary node, wherein the agent unit is configured to:
[0013] receiving a first message sent by a first temporary node, changing the source address of the first message to the node address of the first resident node and marking the first message with the proxy identifier corresponding to the proxy unit, and forwarding the first message based on the destination address of the first message; and
[0014] When receiving a second message whose destination address is the node address of the first resident node and is marked with the proxy identifier, the second message is forwarded to the first temporary node.
[0015] According to a third aspect of one or more embodiments of this specification, a blockchain network system is proposed, wherein the nodes in the blockchain network system include resident nodes and temporary nodes, wherein:
[0016] The routing policy set maintained by any resident node includes a routing policy for routing from the resident node to each other resident node in the blockchain network system;
[0017] The proxy pool maintained by any temporary node includes node information of at least one resident node connected to the temporary node. The temporary node is not connected to any node in the blockchain network other than the at least one resident node. The at least one resident node has a proxy unit corresponding to the temporary node created, and the proxy unit is used to:
[0018] receiving a first message sent by any temporary node, changing the source address of the first message to the node address of the at least one resident node and marking the first message with the proxy identifier corresponding to the proxy unit, and forwarding the first message based on the destination address of the first message; and
[0019] When a second message having a destination address that is the node address of the at least one resident node and marked with the proxy identifier is received, the second message is forwarded to the any temporary node.
[0020] According to a fourth aspect of one or more embodiments of this specification, an electronic device is provided, including:
[0021] processor;
[0022] a memory for storing processor-executable instructions;
[0023] The processor implements the method as described in any one of the first aspects by running the executable instructions.
[0024] According to a fifth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in any one of the first aspects are implemented.
[0025] As can be seen from the above embodiments, this specification adds the first temporary node to the blockchain network in an agent manner, that is, only establishes a connection with the first resident node with which there is an agent relationship, and does not connect with the nodes in the blockchain network that do not have an agent relationship, so that the nodes in the blockchain network that do not have an agent relationship with the first temporary node cannot perceive the addition of the first temporary node. Therefore, these nodes will not trigger the update of their own routing policies when the first temporary node joins, and naturally will not update their own routing policies when the first temporary node exits the blockchain network. That is, the routing policy set maintained by any resident node only includes the routing policy for routing from any resident node to each other resident node, and does not include the routing policy for routing from any resident node to any temporary node. The node routing strategy saves network maintenance costs, reduces the pressure on the blockchain network, and maintains the stability of communication between nodes in the blockchain network. In addition, the first resident node, as a node that can perceive the first temporary node joining the blockchain network, will also create an agent unit corresponding to the first temporary node to be responsible for proxy forwarding messages sent from the first temporary node or messages that need to be sent to the first temporary node. Therefore, when the first temporary node communicates with other nodes in the blockchain network, the other nodes in the blockchain network will think that it is communicating with the first resident node. Therefore, when other nodes cannot perceive the first temporary node, the normal communication between the first temporary node and the nodes in the blockchain network will not be affected. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0027] Figure 1 This is a system architecture diagram of a blockchain network system provided by an exemplary embodiment.
[0028] Figure 2 This is a flowchart of a method for joining a blockchain network provided by an exemplary embodiment.
[0029] Figure 3 It is a structural diagram of a device provided by an exemplary embodiment.
[0030] Figure 4 It is a block diagram of a device for joining a blockchain network provided by an exemplary embodiment. DETAILED DESCRIPTION
[0031] To help those skilled in the art better understand the technical solutions in this specification, the following will provide a clear and complete description of the technical solutions in the embodiments of this specification, in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. All other embodiments derived by those skilled in the art based on the embodiments in this specification without creative effort shall fall within the scope of protection of this specification.
[0032] Figure 1 This is a system architecture diagram of a blockchain network system provided by an exemplary embodiment. Figure 1 As shown, the nodes in the blockchain network system include resident nodes and temporary nodes, where:
[0033] The routing policy set maintained by any resident node includes a routing policy for routing from the resident node to each other resident node in the blockchain network system;
[0034] The proxy pool maintained by any temporary node includes node information of at least one resident node connected to the temporary node. The temporary node is not connected to any node in the blockchain network other than the at least one resident node. The at least one resident node has a proxy unit corresponding to the temporary node created, and the proxy unit is used to:
[0035] receiving a first message sent by any temporary node, changing the source address of the first message to the node address of the at least one resident node and marking the first message with the proxy identifier corresponding to the proxy unit, and forwarding the first message based on the destination address of the first message; and
[0036] When a second message having a destination address that is the node address of the at least one resident node and marked with the proxy identifier is received, the second message is forwarded to the any temporary node.
[0037] by Figure 1 For example, Figure 1 The blockchain network system (or blockchain network) shown includes a total of seven nodes, of which nodes a, b, and c are temporary nodes, while nodes A, B, C, and D are resident nodes. Each resident node maintains a corresponding routing policy set, allowing communication between resident nodes to be achieved through their respective routing policy sets. At the same time, the routing policy set maintained by each resident node does not include the routing policy of any temporary node.
[0038] The proxy pool maintained by node a only includes the node information of node A, that is, node a has established a proxy relationship with node A, node a is only connected to node A, and node a needs to communicate with other nodes through the proxy unit a corresponding to node a created on node A; the proxy pool maintained by node b only includes the node information of node A, that is, node b also has established a proxy relationship with node A, node b is only connected to node A, and node b communicates with other nodes through the proxy unit b corresponding to node b created on node A; the proxy pool maintained by node c includes the node information of node B and node C, that is, node c has established proxy relationships with node B and node C respectively, node c is connected to node B and node C respectively, and node c can communicate with other nodes through the proxy unit c1 corresponding to node c created on node B, and can also communicate with other nodes through the proxy unit c2 corresponding to node c created on node C.
[0039] In the blockchain network system involved in the embodiments of this specification, temporary nodes will only establish connections with resident nodes with which they have established proxy relationships, and communicate with other nodes through proxy units created on resident nodes with which they have established proxy relationships. This prevents temporary nodes from being perceived by nodes without proxy relationships. That is, the routing policy of any temporary node will not be added to the routing policy set maintained by a resident node without a proxy relationship, nor will it be added to the routing policy set maintained by a resident node with a proxy relationship. This is because the resident node with a proxy relationship does not communicate with any temporary node through the routing policy set, but instead communicates through the pre-created proxy unit corresponding to any temporary node. Therefore, whether a temporary node joins or exits the blockchain network, it will not trigger the resident node to update its own routing policy, thereby saving network maintenance costs, reducing the pressure on the blockchain network, maintaining the stability of communication between nodes in the blockchain network, and also ensuring normal communication between the temporary node and other nodes in the blockchain network.
[0040] See Figure 2 , Figure 2 This is a flowchart of a method for joining a blockchain network provided by an exemplary embodiment. The method is applied to the first resident node in the blockchain network. The nodes in the blockchain network include resident nodes and temporary nodes. The routing policy set maintained by any resident node includes the routing policy from the resident node to each other resident node in the blockchain network. The proxy pool maintained by any temporary node includes the node information of at least one resident node that has established a connection with the temporary node. The temporary node is not connected to any node in the blockchain network other than the at least one resident node. Figure 2 As shown, the method includes:
[0041] S202: In response to the proxy onboarding request sent by the first temporary node, establish a connection with the first temporary node.
[0042] In the embodiments of the present specification, any permanent node includes a node that undertakes the work of the blockchain system in the blockchain network, and any temporary node temporarily joins the blockchain network or frequently goes offline in the blockchain network. For example, the permanent node can be a consensus node, a verification node, a storage node, etc. in the blockchain network, which is usually permanently in the blockchain network and does not frequently join or exit the blockchain network; the temporary node is usually in the role of a client, such as a blockchain wallet client, a Dapp (Decentralized Application) client, a decentralized VPN (Virtual Private Network) client, etc., which only temporarily joins the blockchain network to obtain the corresponding service, and exits the blockchain network after meeting the demand.
[0043] In the embodiments of the present specification, the first temporary node which wants to join the blockchain network in a proxy manner needs to first determine the node address of the first permanent node before sending the proxy onboarding request to the first permanent node. The first temporary node can obtain the node address of the first permanent node returned by the blockchain network in response to the temporary onboarding request by sending a temporary onboarding request to the blockchain network. Specifically, the first temporary node can first send a temporary onboarding request to a seed node (an onboarding node that publicly discloses its node address to the outside world) in the blockchain network, and in the case of passing the onboarding audit of the seed node, the first temporary node receives the node address of the first permanent node returned by the seed node. In addition, the seed node can first determine the first permanent node by the following strategy before returning the node address of the first permanent node to the first temporary node: the first permanent node is the permanent node with the lowest load degree in the blockchain network, the closest geographical position to the first temporary node, or the smallest network latency between the first temporary node. For example, the temporary onboarding request sent by the first temporary node carries the geographical position corresponding to the first temporary node, and then the seed node matches the permanent node closest to the geographical position based on the geographical position corresponding to the first temporary node to serve as the first permanent node. Since the connection cost is lower and the stability is better when the geographical position is close, the first temporary node will not easily disconnect from the blockchain network due to network fluctuations after joining the blockchain network in a proxy manner (after the first temporary node establishes a connection with the first permanent node), thereby improving the overall robustness of the blockchain network.
[0044] After the first temporary node establishes a connection with the first resident node, it will write the node information of the first resident node into the proxy pool maintained by itself. If it needs to communicate with other nodes in the blockchain network in the future, it can implement proxy forwarding by sending messages to the first resident node. In this embodiment of the specification, it also includes: in response to the proxy network access request sent by the first temporary node, sending the node information of each resident node in the blockchain network to the first temporary node. After joining the blockchain network, in order to communicate with other nodes in the blockchain network, the first temporary node also needs to know the node information of other nodes in the blockchain network. Through this embodiment of the specification, the first temporary node can obtain the node information of other regular nodes in the blockchain network from the first regular node after sending the proxy network access request (for the first regular node, the node information of other regular nodes can be stored in the routing policy set maintained by it). The node information involved in the embodiment of the specification includes the node identification and / or node address of the corresponding node. Of course, the node address of any node involved in the embodiment of the specification may include the IP address, port number and / or node identification of any node.
[0045] S204: Create an agent unit corresponding to the first temporary node, where the agent unit is used to:
[0046] receiving a first message sent by a first temporary node, changing the source address of the first message to the node address of the first resident node and marking the first message with the proxy identifier corresponding to the proxy unit, and forwarding the first message based on the destination address of the first message; and
[0047] When receiving a second message whose destination address is the node address of the first resident node and is marked with the proxy identifier, the second message is forwarded to the first temporary node.
[0048] In the embodiment of this specification, the routing policy set maintained by any resident node includes the routing policy for routing from the resident node to each other resident node in the blockchain network. For example, the routing policy set maintained by any resident node can be a routing table maintained by any resident node, which maintains routing entries (routing policies) for routing to each other resident node in the blockchain network, and each routing entry maintains the node identifier of a resident node to which the node ultimately needs to go and the node identifier of the next hop node required for routing to the resident node if routing to the resident node is required. Figure 1For example, the routing table maintained on node A contains three routing entries: "Node B - Node B; Node C - Node B; Node D - Node D." The node identifier on the left of each routing entry indicates the node identifier of a resident node to which the route ultimately needs to be directed, and the node identifier on the right of each routing entry indicates the node identifier of the next-hop node required for routing to the resident node corresponding to the node identifier on the left. For example, when node A receives a message with the node address of node C as its destination, it searches the routing table and matches the routing entry "Node C - Node B," determining that the message needs to be sent to node B. It then searches its own neighbor table to obtain the node address corresponding to node B, and then sends the message to node B based on that node address.
[0049] In the embodiments of this specification, the routing policy set maintained by any resident node is determined and updated by the neighbor table of each resident node in the blockchain network. The neighbor table maintained by any resident node includes node information of other resident nodes connected to it. This means that changes to the neighbor table of any resident node in the blockchain network may trigger a large-scale update of the routing policy set maintained by each resident node in the blockchain network. This behavior mainly occurs when new nodes join the blockchain network or when nodes go offline from the blockchain network.
[0050] In an embodiment of the present specification, after the first resident node responds to the proxy network access request sent by the first temporary node, as an alternative to adding the node information of the first temporary node to the neighbor table of the first resident node, a proxy unit corresponding to the first temporary node is created for proxy forwarding messages related to the first temporary node, thereby finally completing the process of joining the first temporary node to the blockchain network. Since the first resident node does not add the first temporary node established with it to the neighbor table it maintains during this process, it will not be perceived by other resident nodes in the blockchain network through various routing protocols in the blockchain network, and will not trigger the behavior of each resident node to update the routing policy set it maintains. Since each resident node did not update the corresponding routing policy set after the first temporary node joined the blockchain network, if the first temporary node subsequently exits the blockchain network, the routing policy set will naturally not be updated accordingly.
[0051] The proxy unit involved in the embodiment of this specification specifically refers to a program instance maintained in a resident node and used to proxy forward messages related to a temporary node with which it has established a proxy relationship. Figure 1The example of node a performing proxy forwarding based on the proxy unit a created in node A is used to illustrate the basic functions of the proxy unit involved in this specification. Assuming that node a needs to send the first message to node D (the source address of the first message is the node address of node a, and the destination address is the node address of node D), node a will first search its own proxy pool and find the node information of node A with which it has established a proxy relationship, and then send the first message to node A; after node A determines that the first message received is from node a, it will deliver the first message to the proxy unit a it created for processing, and the proxy unit a will then change the source address of the first message to the node address of node A, and add a proxy identifier corresponding to the proxy unit a that can only be recognized by node A, and then forward the first message to node D based on the destination address of the first message and the routing policy set maintained by itself; after receiving the first message, node D checks and obtains the node information of the node A. If the message contains a proxy identifier, the proxy identifier will also be added to the second message returned in response to the first message, but node D will still believe that the source of the message is node A, so node D will send the second message to node A based on the routing policy set it maintains; after receiving the second message and confirming that it carries the proxy identifier corresponding to proxy unit a, node A will also deliver the second message to proxy unit a for processing. Proxy unit a will delete the proxy identifier corresponding to proxy unit a in the second message, and at the same time modify the destination address of the second message to the node address of node a, and then forward the second message to node a; after receiving the second message, node a can know that the source address of the second message is the node address of node D, that is, node a will believe that it is communicating normally with node D.
[0052] In the embodiment of this specification, the same resident node can establish proxy relationships with multiple temporary nodes at the same time, thereby creating multiple corresponding proxy units for the temporary nodes at the same time. Figure 1 For example, node A establishes a proxy relationship with both node a and node b. Node A creates proxy unit a corresponding to node a and proxy unit b corresponding to node b respectively. Since proxy unit a and proxy unit b have different proxy identifiers, when a message with the corresponding proxy identifier is received, the message can be forwarded to the correct temporary node.
[0053] In the embodiments of this specification, the same temporary node can simultaneously establish an agent relationship with one or more resident nodes in the blockchain network, thereby creating one or more agent units corresponding to the same temporary node in one or more resident nodes. When multiple agent units are created for the same temporary node, the agent identifiers corresponding to the multiple agent units can be the same or different, thereby guiding the messages that need to be ultimately sent to the same temporary node in the blockchain network to the corresponding resident nodes. Figure 1For example, node c establishes a proxy relationship with both node B and node C. Node B creates a proxy unit c1 corresponding to node c, and node C creates a proxy unit c2 corresponding to node c. The proxy identifiers corresponding to proxy units c1 and c2 can be the same or different. When the proxy identifiers corresponding to proxy units c1 and c2 are the same, messages that need to be ultimately sent to node c from the blockchain network can flexibly return to node c via node B or node C. When the proxy identifiers corresponding to proxy units c1 and c2 are different, node c can design different message routing strategies on its own, such as sending different types of messages from different resident nodes (node B or node C) with which the proxy relationship has been established to the blockchain network, so that the message returned by the blockchain network in response to a certain type of message (carrying the proxy identifier corresponding to that type) can only be returned through the corresponding resident node (the resident node that maintains the proxy unit corresponding to the proxy identifier corresponding to that type), thereby enabling a certain type of message to be sent from the same resident node into the blockchain network or received from the blockchain network and returned to node c as a temporary node.
[0054] In the embodiments of this specification, the same P2P (peer-to-peer) communication protocol is used between any temporary node and at least one resident node connected to it, and between any two resident nodes. Resident nodes in a blockchain network communicate using the P2P communication protocol. For example, by still using the same P2P communication protocol between a first temporary node and a first resident node, intrusiveness and the development cost of additional communication components can be reduced. Furthermore, compared to traditional HTTPS (Hypertext Transfer Protocol Secure), RPC (Remote Procedure Call Protocol), or WSS (Web Socket Secure), the advantages of the P2P communication protocol, such as anonymity, strong connectivity, improved anti-blocking, and P2P hole punching services, can be enjoyed.
[0055] As can be seen from the above embodiments, this specification adds the first temporary node to the blockchain network in an agent manner, that is, only establishes a connection with the first resident node with which there is an agent relationship, and does not connect with the nodes in the blockchain network that do not have an agent relationship, so that the nodes in the blockchain network that do not have an agent relationship with the first temporary node cannot perceive the addition of the first temporary node. Therefore, these nodes will not trigger the update of their own routing policies when the first temporary node joins, and naturally will not update their own routing policies when the first temporary node exits the blockchain network. That is, the routing policy set maintained by any resident node only includes the routing policy for routing from any resident node to each other resident node, and does not include the routing policy for routing from any resident node to any temporary node. The node routing strategy saves network maintenance costs, reduces the pressure on the blockchain network, and maintains the stability of communication between nodes in the blockchain network. In addition, the first resident node, as a node that can perceive the first temporary node joining the blockchain network, will also create an agent unit corresponding to the first temporary node to be responsible for proxy forwarding messages sent from the first temporary node or messages that need to be sent to the first temporary node. Therefore, when the first temporary node communicates with other nodes in the blockchain network, the other nodes in the blockchain network will think that it is communicating with the first resident node. Therefore, when other nodes cannot perceive the first temporary node, the normal communication between the first temporary node and the nodes in the blockchain network will not be affected.
[0056] Optionally, it also includes: deleting the proxy unit when it is detected that the connection established with the first temporary node is disconnected. When the first temporary node actively or passively disconnects from the first resident node, it is assumed that the first temporary node has exited the blockchain network. At this time, the first resident node can detect that the connection established with the first temporary node has been disconnected, and then the proxy unit corresponding to the locally created first temporary node can be deleted. The first resident node can detect whether the connection established with the first temporary node has been disconnected through a heartbeat mechanism. Through the above embodiment, this specification will only trigger the resident node that has established a proxy relationship with the first temporary node to delete the proxy unit corresponding to the first temporary node when the first temporary node exits the blockchain network, and will not trigger a large-scale update of the routing policy set, thereby saving network maintenance costs, reducing the pressure on the blockchain network, and maintaining the stability of communication between nodes in the blockchain network.
[0057] Figure 3 This is a schematic structural diagram of a device provided by an exemplary embodiment. Figure 3At the hardware level, the device includes a processor 302, an internal bus 304, a network interface 306, a memory 308, and a non-volatile memory 310, and can also include other hardware required by the business. One or more embodiments of the present specification can be implemented in a software manner, such as reading a corresponding computer program from the non-volatile memory 310 into the memory 308 by the processor 302 and then running. Of course, in addition to the software implementation, one or more embodiments of the present specification do not exclude other implementation manners, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or a logic device.
[0058] As shown in Figure 4 , Figure 4 is a block diagram of an apparatus for joining a blockchain network provided by an exemplary embodiment, which can be applied to a device as shown in Figure 3 to implement the technical solutions of the present specification. The apparatus is applied to a first permanent node in the blockchain network, the nodes in the blockchain network include permanent nodes and temporary nodes, and a routing policy set maintained by any permanent node includes a routing policy from the any permanent node to each permanent node in the blockchain network. The proxy pool maintained by any temporary node includes node information of at least one permanent node connected with the any temporary node, and the any temporary node is not connected with nodes in the blockchain network except the at least one permanent node; the apparatus comprises:
[0059] The connection establishing unit 401 is configured to establish a connection with the first temporary node in response to a proxy network access request sent by the first temporary node;
[0060] The proxy creating unit 402 is configured to create a proxy unit corresponding to the first temporary node, and the proxy unit is configured to:
[0061] receive a first message sent by the first temporary node, change the source address of the first message to the node address of the first permanent node, mark the proxy identification corresponding to the proxy unit for the first message, and forward the first message based on the destination address of the first message; and
[0062] When a second message with the node address of the first permanent node as the destination address and the proxy identification is marked is received, the second message is forwarded to the first temporary node.
[0063] Optionally, the first temporary node obtains the node address of the first permanent node returned by the blockchain network in response to a temporary network access request sent by the first temporary node to the blockchain network.
[0064] Optionally, the first resident node is a resident node with the lowest load in the blockchain network, which is geographically closest to the first temporary node or has the shortest network delay with the first temporary node.
[0065] Optionally, also include:
[0066] The proxy deleting unit 403 is configured to delete the proxy unit when detecting that the connection with the first temporary node is disconnected.
[0067] Optionally, also include:
[0068] The node information sending unit 404 is used to send the node information of each resident node in the blockchain network to the first temporary node in response to the proxy network access request sent by the first temporary node.
[0069] Optionally, the node information includes a node identifier and / or a node address.
[0070] Optionally, any resident node includes a node that undertakes the work of the blockchain system in the blockchain network, any temporary node that temporarily joins the blockchain network, or a node in the blockchain network that is frequently offline.
[0071] Optionally, the same P2P communication protocol is used between any temporary node and at least one resident node connected thereto, and between any two resident nodes.
[0072] The above-mentioned device embodiment corresponds to the above-mentioned method embodiment and there is no essential difference between them. The detailed description is recorded in the above-mentioned corresponding method embodiments and will not be repeated here.
[0073] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD through their own programming, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0074] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.
[0075] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a server system. Of course, the present invention does not exclude that with the future development of computer technology, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, an in-vehicle human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0076] Although the method operations of the embodiments of the present disclosure are described in a particular, sequential order, one or more of the method operations can be omitted, or the method operations can be performed in an order other than the described order. Additionally, one or more of the method operations can be performed concurrently, or with partial concurrence. Furthermore, one or more of the method operations can be performed by different entities, or over different time periods. The term "including" as used herein is intended to mean "comprising," such that the process, method, article, or apparatus that includes elements in addition to those specified. As used in this description, the term "coupled" means a direct or indirect connection, which can be physical or logical. The term "coupled" does not relate to a direct connection or wiring.
[0077] For the sake of description, the above-described apparatus is described as various modules to describe the functions of the apparatus. Of course, when implementing one or more embodiments of the present disclosure, the functions of the modules can be implemented in one or more software and / or hardware, or the modules implementing the same functions can be combined into a plurality of sub-modules or sub-units. The apparatus embodiments described above are merely illustrative, for example, the division of the units is merely a logical function division, and actual implementation can have another division manner, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or components shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, and can be electrical, mechanical or other forms.
[0078] The present disclosure is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems) and computer program products according to embodiments of the present disclosure. It should be understood that each flow and / or block in the flowcharts and / or block diagrams, and combinations of flows and / or blocks in the flowcharts and / or block diagrams can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing apparatus to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing apparatus generate a means for implementing the functions specified in the flowcharts and / or block diagrams. Figure 1 The term "coupled" is intended to mean a direct or indirect connection, which can be physical or logical. Figure 1 The term "coupled" is intended to mean a direct or indirect connection, which can be physical or logical.
[0079] These computer program instructions may also be stored in a computer readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 a process or multiple processes and / or boxes Figure 1 The function specified in one or more boxes.
[0080] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operational steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing the instructions executed on the computer or other programmable device for implementing the process. Figure 1 a process or multiple processes and / or boxes Figure 1 A step that specifies a function in one or more boxes.
[0081] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0082] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0083] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0084] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as a method, system, or computer program product. Thus, one or more embodiments of this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0085] One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In distributed computing environments, program modules may be located in local and remote computer storage media, including storage devices.
[0086] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between the various embodiments can be referenced across them. Each embodiment focuses on the differences from the other embodiments. In particular, since the system embodiments are generally similar to the method embodiments, their description is relatively simple. For relevant parts, reference can be made to the description of the method embodiments. Throughout this specification, reference to the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and integrate the different embodiments or examples, and features of different embodiments or examples, described in this specification, without conflict.
[0087] The foregoing is merely an example of one or more embodiments of this specification and is not intended to limit the one or more embodiments of this specification. It will be apparent to those skilled in the art that various modifications and variations may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this specification shall be included within the scope of the claims.
Claims
1. A method for joining a blockchain network, applied to a first resident node in the blockchain network, wherein the nodes in the blockchain network include resident nodes and temporary nodes, a routing policy set maintained by any resident node includes a routing policy for routing from the resident node to every other resident node in the blockchain network; a proxy pool maintained by any temporary node includes node information of at least one resident node connected to the temporary node, and the temporary node is not connected to any nodes in the blockchain network other than the at least one resident node; the method comprising: In response to the proxy network access request sent by the first temporary node, establishing a connection with the first temporary node; Create an agent unit corresponding to the first temporary node, where the agent unit is used to: receiving a first message sent by a first temporary node, changing a source address of the first message to a node address of a first resident node and marking the first message with an agent identifier corresponding to the agent unit, and forwarding the first message based on a destination address of the first message; as well as, When receiving a second message whose destination address is the node address of the first resident node and is marked with the proxy identifier, the second message is forwarded to the first temporary node.
2. The method according to claim 1, wherein the first temporary node sends a temporary network access request to the blockchain network to obtain the node address of the first resident node returned by the blockchain network in response to the temporary network access request.
3. According to the method of claim 1, the first permanent node is a permanent node with the lowest load in the blockchain network, is geographically closest to the first temporary node, or has the smallest network delay with the first temporary node.
4. The method according to claim 1, further comprising: In the case of detecting that the connection established with the first temporary node is disconnected, the proxy unit is deleted.
5. The method according to claim 1, further comprising: In response to the proxy network access request sent by the first temporary node, node information of each resident node in the blockchain network is sent to the first temporary node. The method according to claim 1 or 5, wherein the node information comprises a node identifier and / or a node address.
7. According to the method of claim 1, any resident node includes a node that undertakes the work of the blockchain system in the blockchain network, any temporary node temporarily joins the blockchain network or a node in the blockchain network that is frequently offline.
8. The method according to claim 1, wherein the same P2P communication protocol is used between any temporary node and at least one resident node connected thereto, and between any two resident nodes.
9. A device for joining a blockchain network, applied to a first resident node in the blockchain network, wherein the nodes in the blockchain network include resident nodes and temporary nodes, the routing policy set maintained by any resident node includes a routing policy for routing from the resident node to every other resident node in the blockchain network; the proxy pool maintained by any temporary node includes node information of at least one resident node connected to the temporary node, and the temporary node is not connected to any nodes in the blockchain network other than the at least one resident node; the device comprises: a connection establishing unit, configured to establish a connection with the first temporary node in response to the proxy network access request sent by the first temporary node; An agent creation unit is configured to create an agent unit corresponding to the first temporary node, wherein the agent unit is configured to: receiving a first message sent by a first temporary node, changing a source address of the first message to a node address of a first resident node and marking the first message with an agent identifier corresponding to the agent unit, and forwarding the first message based on a destination address of the first message; as well as, When receiving a second message whose destination address is the node address of the first resident node and is marked with the proxy identifier, the second message is forwarded to the first temporary node.
10. A blockchain network system, wherein the nodes in the blockchain network system include resident nodes and temporary nodes, wherein: The routing policy set maintained by any resident node includes a routing policy for routing from the resident node to each other resident node in the blockchain network system; The proxy pool maintained by any temporary node includes node information of at least one resident node connected to the temporary node. The temporary node is not connected to any node in the blockchain network other than the at least one resident node. The at least one resident node has a proxy unit corresponding to the temporary node created, and the proxy unit is used to: receiving a first message sent by any temporary node, changing a source address of the first message to the node address of the at least one resident node and marking the first message with an agent identifier corresponding to the agent unit, and forwarding the first message based on a destination address of the first message; as well as, When receiving a second message whose destination address is the node address of the at least one resident node and is marked with the proxy identifier, the second message is forwarded to the any temporary node.
11. An electronic device comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 8 by running the executable instructions.
12. A computer-readable storage medium having computer instructions stored thereon, wherein when the instructions are executed by a processor, the steps of the method according to any one of claims 1 to 8 are implemented.
Citation Information
Patent Citations
Message routing method based on DHT network, electronic device, proxy node and medium
CN111245727A
Consensus system and method
CN111630826A