Ethereum Network Topology Simulation Method, Device, Medium and Terminal Based on Pipeline Technology
Through the Ethereum network topology simulation method based on pipeline technology, the problem of limited number of node simulations is solved, and any number of Ethereum nodes in memory is realized to accurately control traffic and delays, simulate attacks, and guide blockchain system design.
Patent Information
- Application Number
- CN202211016957.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-08-22
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2042-08-22
AI Technical Summary
Existing point-to-point networks cannot meet the needs of relevant security analysis, and the number of node simulations is limited by locally available ports, so they cannot provide important support for the verification of specific security technologies.
The Ethereum network topology simulation method based on pipeline technology is adopted to generate an initial blockchain network, simulate node communication operations through pipeline technology, and use a recursive length prefix coding scheme to change the communication encoding method of the simulation node to form an accurate simulation node.
Simulate any number of Ethereum nodes within the memory allowable range, avoid unnecessary encapsulation losses in the network layer and the transmission layer, accurately control traffic and delay jitter between nodes, simulate various attacks, and guide the point-to-point network design of blockchain systems in real environments.
Smart Images

Figure CN115567401B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of Ethereum networks, and in particular, to an Ethereum network topology simulation method, device, medium, and terminal based on pipeline technology. Background Art
[0002] The Ethereum network is currently the most widely used smart contract platform, and the secure and stable operation of tens of thousands of smart contracts depends on the security of the Ethereum network itself. At present, the analysis of the security of blockchain systems mainly focuses on consensus mechanisms and smart contract semantics, and few people pay attention to the security of the underlying peer-to-peer network itself. However, the reliable node connection mechanism and efficient data sharing protocol provided by the underlying peer-to-peer network are the premise of the security of the blockchain network.
[0003] In traditional simulation technologies, in order to simulate an environment similar to the communication of blockchain nodes in reality, it is necessary to use a local loopback address and occupy a local port to implement the simulation of the peer-to-peer network. This results in the network communication between nodes depending on the network interface of the operating system, and the number of node simulations is limited by the local available ports.
[0004] In summary, the existing peer-to-peer network cannot meet the needs of relevant security analysis, cannot provide important support for the verification of specific security technologies, and the number of node simulations in the existing blockchain network simulation technology is limited by the local available ports. Summary of the Invention
[0005] In view of the deficiencies of the above-mentioned prior art, the purpose of the present application is to provide an Ethereum network topology simulation method, device, medium, and terminal based on pipeline technology, aiming to solve the problems that the existing peer-to-peer network cannot meet the needs of relevant security analysis and the number of node simulations in the existing blockchain network simulation technology is limited by the local available ports.
[0006] To solve the above technical problems, in the first aspect of the embodiments of the present application, an Ethereum network topology simulation method based on pipeline technology is provided, and the method includes:
[0007] Generate an initial blockchain network according to the received simulation blockchain node parameter information;
[0008] Simulate the communication operations of the nodes in the initial blockchain network based on pipeline technology to form simulation nodes;
[0009] Change the communication coding method of the simulation nodes according to the received communication coding information to complete the update of the blockchain network.
[0010] As a further improved technical solution, the generating an initial blockchain network according to the received simulation blockchain node parameter information includes:
[0011] Generate N nodes of the blockchain network according to the received information that the number of simulated blockchain nodes is N;
[0012] Define the nodes of the blockchain network according to the received node parameter information of the blockchain network, where the node parameter information of the blockchain network includes the node name;
[0013] Network the N nodes of the blockchain network in the Socket network communication mode to generate an initialized blockchain network.
[0014] As a further improved technical solution, the simulation of the communication operations of the nodes in the initialized blockchain network based on the pipeline technology to form simulation nodes includes:
[0015] Change the data packet distribution method of the initialized blockchain network according to the received simulation network type information;
[0016] The nodes in the initialized blockchain network perform communication operations according to the data packet distribution method, and simulate the communication operations of the nodes based on the pipeline technology to form simulation nodes.
[0017] As a further improved technical solution, the simulation network types include a memory pipeline communication network and a named pipeline communication network.
[0018] As a further improved technical solution, the communication operations of the nodes include: connection establishment, message sending, message reading, and connection closing.
[0019] As a further improved technical solution, the completion of the update of the blockchain network by changing the communication coding method of the simulation nodes according to the received communication coding information includes:
[0020] After receiving the communication coding information using recursive length prefix coding, change the communication coding method of the simulation nodes to complete the update of the blockchain network, where the simulation nodes use the recursive length prefix coding method for encoding before communication, and the recursive length prefix coding can encode any nested binary data array.
[0021] As a further improved technical solution, the encoding steps include:
[0022] Detect the data types of the data communicated by the simulation nodes, perform encoding operations on the data based on the detected data types, and pack the encoded data into blocks, where the data types include strings and word lists;
[0023] Verify the blocks, and add the blocks to the ledgers of each simulation node after verification.
[0024] In the second aspect of the embodiments of the present application, an Ethereum network topology simulation device based on pipeline technology is provided, including:
[0025] An initialization module, configured to generate an initialized blockchain network according to the received simulation blockchain node parameter information;
[0026] A node simulation module, configured to simulate the communication operations of nodes in the initialized blockchain network based on pipeline technology to form simulation nodes;
[0027] An encoding module, configured to change the communication encoding method of the simulation nodes according to the received communication encoding information to complete the update of the blockchain network.
[0028] In the third aspect of the embodiments of the present application, a computer-readable storage medium is provided. The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in any of the above-mentioned Ethereum network topology simulation methods based on pipeline technology.
[0029] In the fourth aspect of the embodiments of the present application, a terminal device is provided, which includes: a processor, a memory, and a communication bus; a computer-readable program executable by the processor is stored on the memory;
[0030] The communication bus realizes the connection communication between the processor and the memory;
[0031] When the processor executes the computer-readable program, the steps in any of the above-mentioned Ethereum network topology simulation methods based on pipeline technology are implemented.
[0032] Advantageous effects: Compared with the prior art, the Ethereum network topology simulation method based on pipeline technology of the present invention includes: generating an initialized blockchain network according to the received simulation blockchain node parameter information; simulating the communication operations of nodes in the initialized blockchain network based on pipeline technology to form simulation nodes; changing the communication encoding method of the simulation nodes according to the received communication encoding information to complete the update of the blockchain network; after adopting the above method, the present invention can simulate any number of Ethereum nodes within the range allowed by the memory, avoiding the loss caused by the unnecessary encapsulation of data packets by the network layer and the transport layer. Using pipeline technology to simulate network communication avoids the influence of the operating system on the sending of network packets, and can more accurately implement the simulation of traffic control, packet loss rate, and delay jitter of the connections between nodes. It can simulate various attacks that may occur in the simulated blockchain system and guide the design of the peer-to-peer network of the blockchain system in the real environment. Using pipeline technology to directly simulate synchronous and full-duplex network connections in memory avoids the limitations of traditional local socket communication. Description of the Drawings
[0033] Figure 1 It is a flowchart of the Ethereum network topology simulation method based on pipeline technology of the present invention.
[0034] Figure 2 It is a schematic structural diagram of the terminal device provided by the present invention.
[0035] Figure 3 It is a block diagram of the device structure provided by the present invention.
[0036] Figure 4 It is a specific implementation flowchart of the Ethereum network topology simulation method based on pipeline technology of the present invention.
[0037] The realization, functional features and advantages of the object of the present invention will be further described with reference to the embodiments and the accompanying drawings. Specific Embodiments
[0038] To facilitate the understanding of the present application, the present application will be described more comprehensively below with reference to the relevant drawings. The preferred embodiments of the present application are shown in the drawings. However, the present application can be implemented in many different forms and is not limited to the embodiments described herein. On the contrary, these embodiments are provided to make the disclosure of the present application more thorough and comprehensive.
[0039] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by those of ordinary skill in the technical field to which this application belongs. The terms used in the specification of this application herein are only for the purpose of describing specific embodiments and are not intended to limit this application.
[0040] The inventors have found through research that the prior art has the following problems:
[0041] (1) Currently, Ethereum is the most widely used smart contract platform in blockchain. Although there are more and more studies on the consensus algorithm of Ethereum and the security analysis of contract codes, the research on the peer-to-peer network characteristics of Ethereum has not been fully emphasized. Some studies have shown that the security of blockchain systems using the proof-of-work mechanism depends on the reliability of the peer-to-peer network. Therefore, we need a technically complete network simulation tool for the Ethereum peer-to-peer network to find out the possible risks and hidden dangers therein.
[0042] (2) In traditional simulation technologies, in order to simulate an environment similar to the communication of blockchain nodes in reality, it is necessary to use local loopback addresses and occupy local ports to implement the simulation of the peer-to-peer network. This results in the network communication between nodes depending on the network interface of the operating system, and the number of node simulations is limited by the local available ports.
[0043] Such as Figure 1As shown in the figure, an Ethereum network topology simulation method based on pipeline technology provided by an embodiment of the present application includes the following steps:
[0044] S1. Generate an initial blockchain network according to the received simulation blockchain node parameter information;
[0045] Specifically, the normal operation of each node in the blockchain system and their joint participation in forming the entire network rely on the efficient operation of the underlying peer-to-peer network. Generally speaking, the process of initializing a node to join the peer-to-peer network can be divided into two processes: node discovery and data communication. Specifically, the node discovery process can be divided into three steps: First, specify a series of seed nodes for the local node and save them in the local node database; then, the local node executes the node discovery algorithm on the seed nodes to obtain the node record information of other nodes; finally, the local node saves the obtained records in the node database, selects specific nodes from the database using the routing algorithm, and continues the query, repeating this process.
[0046] The data communication process can be divided into two steps: First, use a specific algorithm to select peer nodes with shorter distances from the local node database; then, perform an encrypted handshake and a sub-protocol handshake with the peer nodes. After passing the verification, an encrypted communication link can be successfully established for block data exchange.
[0047] Two main protocols run on the peer-to-peer network of Ethereum, namely the UDP-based node discovery protocol and the TCP-based RLPx protocol. Initially, the local node needs to obtain the basic information of the other nodes through the node discovery protocol and can establish an encrypted data communication link with the other party through the RLPx protocol after selecting the corresponding nodes.
[0048] To implement the simulation of the Ethernet, it is necessary to first initialize the blockchain network. The user inputs the simulation blockchain node parameter information into the blockchain system. After the blockchain system receives the simulation blockchain node parameter information, it generates an initial blockchain network.
[0049] Among them, generating an initial blockchain network according to the received simulation blockchain node parameter information includes the following steps:
[0050] S101. Generate N nodes of the blockchain network according to the received information that the number of simulation blockchain nodes is N;
[0051] S102. Define the nodes of the blockchain network according to the received node parameter information of the blockchain network, where the node parameter information of the blockchain network includes the node name;
[0052] S103. Network the N nodes of the blockchain network in the Socket network communication mode to generate an initial blockchain network.
[0053] Specifically, the user inputs information about the number of simulated blockchain nodes as N to the blockchain system. After receiving the information about the number of simulated blockchain nodes as N, the blockchain system generates N nodes of the blockchain network. All N nodes of the blockchain network are child process nodes generated under the main process. Then the user inputs the node parameter information of each blockchain network to the blockchain system. The blockchain system defines the nodes of the blockchain network according to the received node parameter information of the blockchain network. The node parameter information of the blockchain network includes the node name. The N nodes of the blockchain network are networked according to the Socket network communication method to generate an initialized blockchain network, thus completing the initialization of the blockchain network.
[0054] S2. Simulate the communication operations of the nodes in the initialized blockchain network based on the pipe technology to form simulated nodes.
[0055] Specifically, this step requires defining the data transmission method of the initialized blockchain network. First, the network type to be simulated needs to be selected. The main network types for simulation are the memory pipe (pipe) communication network and the named pipe (FIFO) communication network. The user can select the memory pipe communication network or the named pipe communication network as the data packet distribution method for the initialized blockchain network of the present invention, and simulate the communication operations of the nodes based on the pipe technology to form simulated nodes.
[0056] Among them, the step of simulating the communication operations of the nodes in the initialized blockchain network based on the pipe technology to form simulated nodes includes the following steps:
[0057] S201. Change the data packet distribution method of the initialized blockchain network according to the received simulated network type information.
[0058] S202. The nodes in the initialized blockchain network perform communication operations according to the data packet distribution method, and simulate the communication operations of the nodes based on the pipe technology to form simulated nodes.
[0059] Preferably, the simulated network type includes a memory pipe communication network and a named pipe communication network.
[0060] Preferably, the communication operations of the nodes include: connection establishment, message sending, message reading, and connection closing.
[0061] Specifically, if the user selects the memory pipe communication network method, two file descriptors will be created for each process to perform read and write operations on the data.
[0062] If the named pipe communication network method is selected, the node needs to create two FIFO files, and use the mkfifo function to obtain the file descriptors fd_read and fd_write for reading and writing to perform communication between nodes;
[0063] Next, the node will operate within the selected in-memory pipe communication network or named pipe communication network. The main life cycle of the node includes three states, namely: Initializing state, Running state, and Closed state;
[0064] Initializing state: Creating a node in the initializing state requires two steps: allocating the required resources and registering the network protocol. The resources allocated to each node include the data folder allowed for the node to operate, registering the remote procedure call (RPC) service provided externally, and the key-value database that can be read and written. After completing the resource allocation, the next step is to define the network layer protocol that the newly created node can run, such as the node discovery protocol and data communication protocol described above.
[0065] Running state: After the resource allocation is in place and the network protocol registration is completed, the newly created node is ready to start at any time. The started node will continuously execute the specified network layer protocol until the protocol runs to completion. A node in the running state cannot register any network layer protocol again.
[0066] Closed state: A node in the closed state will release all resources it occupies. The specific resources released depend on the state of the node before it is closed. A node in the initializing state that is closed will release all allocated system resources. A node in the running state will also close all network connections and the running RPC services in addition to releasing system resources.
[0067] During the operation of the node, operations such as connection establishment (Connect), message sending (Send), message reading (Read), and connection closing (Close) will be performed based on the data in the communication network. The operations of connection establishment (Connect), message sending (Send), message reading (Read), and connection closing (Close) are common operations of the node. Any network layer protocol running in a blockchain system can be implemented through these four common operations. Therefore, by simulating these four common operations through an in-memory pipe or named pipe, it can be used as the underlying communication link.
[0068] S3. According to the received communication coding information, change the communication coding method of the simulation node to complete the update of the blockchain network.
[0069] Specifically, since general formats such as JSON have low encoding efficiency and are not conducive to scenarios like simulation environments that require frequent large - scale data exchanges. Moreover, the data structure for communication between blockchain nodes is clear, the specification is explicit, the changes are extremely few, and the readability is low, making it suitable for a higher - encoding - efficiency solution. Therefore, a recursive length prefix encoding scheme is adopted to encode communication data. Before each node communicates, this encoding scheme is first used for encoding. The recursive length prefix encoding scheme can encode any nested binary data array, and there are only two data types, namely: strings and lists. Users send communication encoding information to the blockchain system, and the blockchain system receives the communication encoding information, changing the communication encoding method of the simulation node to complete the update of the blockchain network.
[0070] Among them, the changing of the communication encoding method of the simulation node according to the received communication encoding information to complete the update of the blockchain network includes:
[0071] After receiving the communication encoding information encoded using the recursive length prefix encoding, change the communication encoding method of the simulation node to complete the update of the blockchain network. Among them, the simulation node uses the recursive length prefix encoding method for encoding before communication, and the recursive length prefix encoding can encode any nested binary data array.
[0072] Preferably, the encoding steps include:
[0073] S301, detect the data type of the communication of the simulation node, perform an encoding operation on the data based on the detected data type, and package the encoded data into a block. Among them, the data types include strings and word lists;
[0074] S302, verify the block, and after verification, add the block to the ledger of each simulation node.
[0075] Specifically, the blockchain system detects the data type of the communication of the simulation node and performs an encoding operation on the data based on the detected data type;
[0076] If the detected data type is a string, the encoding operation process is as follows: If the length of the string to be passed into the blockchain network by the simulation node is less than or equal to 5, the encoding result is the array itself, plus 128 as a prefix. If the length of the string to be passed into the blockchain network by the simulation node is greater than 55, the first value of the encoding result is 183 (128 + 55) plus the length of the encoding of the array length, then the encoding of the array length itself, and finally the encoding of the string;
[0077] If the detected data type is a word list, the encoding operation process is as follows: If the length of the data list is less than 55, the first bit of the encoding result is the encoding length of 192 plus the length of the list, and then the encodings of each sub-list are connected in sequence; If the length of the data list exceeds 55, the first bit of the encoding result is the encoding length of 247 (192 + 55) plus the length of the list, then the encoding of the list itself, and finally the encodings of the sub-lists are connected in sequence;
[0078] Finally, verify the block. After verification, add the block to the ledger of each simulation node, and finally obtain a blockchain network simulation system to complete the update of the blockchain network.
[0079] The advantages of this method are:
[0080] (1) According to the implemented prototype system, using this method can simulate any number of Ethereum nodes within the range allowed by the memory, avoiding the losses caused by the unnecessary encapsulation of data packets by the network layer and the transport layer; In addition, using pipes to simulate network communication avoids the influence of the operating system on the sending of network packets, and can more accurately implement the simulation of traffic control, packet loss rate, and delay jitter of the connections between nodes; By cutting off the connections between any specified nodes and observing the changes in the connections in the peer-to-peer network, hot nodes in the network can be found. Cutting off the network connections of hot nodes can simulate various attacks that may occur in the blockchain system and guide the design of the peer-to-peer network of the blockchain system in the real environment.
[0081] (2) In traditional simulation technologies, in order to simulate an environment similar to the communication of blockchain nodes in reality, it is necessary to use local loopback addresses and occupy local ports to implement the simulation of the peer-to-peer network. This results in the network communication between nodes depending on the network interface of the operating system, and the number of node simulations is limited by the local available ports. In the simulation of the Ethereum network, the pipeline technology will be explored to directly simulate a synchronous and full-duplex network connection in memory to avoid the limitations of traditional local socket communication according to the characteristics of the simulation environment; The network protocol of the Ethereum system will also be deeply studied, and all network communication interfaces will be replaced with simulation links; Finally, a variety of network topology generation algorithms will be designed to quickly build various simulation networks such as bus-shaped, ring-shaped, and star-shaped.
[0082] (3) The finally obtained blockchain network simulation system can be used to test the performance characteristics of a variety of different algorithms, evaluate the data processing capabilities and overall performance of different blockchain platforms, and solve the problem of difficult unified evaluation of algorithms caused by differences in algorithm principles and application scenarios. This is crucial for the in-depth study of key blockchain technologies, helping developers analyze bottlenecks, understand limitations, make efficient decisions, and the self-optimization of private blockchain platforms.
[0083] Based on the above Ethereum network topology simulation method based on pipeline technology, this embodiment provides an Ethereum network topology simulation device based on pipeline technology, including:
[0084] An initialization module 1, configured to generate an initialized blockchain network according to the received simulation blockchain node parameter information;
[0085] A node simulation module 2, configured to simulate the communication operations of nodes in the initialized blockchain network based on pipeline technology to form simulation nodes;
[0086] An encoding module 3, configured to change the communication encoding method of the simulation nodes according to the received communication encoding information to complete the update of the blockchain network.
[0087] In addition, it is worth noting that the working process of the Ethereum network topology simulation device based on pipeline technology provided in this embodiment is the same as the working process of the above Ethereum network topology simulation method based on pipeline technology. Specifically, it can refer to the working process of the Ethereum network topology simulation method based on pipeline technology, which will not be elaborated here.
[0088] Based on the above Ethereum network topology simulation method based on pipeline technology, this embodiment provides a computer-readable storage medium. The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the Ethereum network topology simulation method based on pipeline technology as described in the above embodiment.
[0089] As Figure 2 shown, based on the above Ethereum network topology simulation method based on pipeline technology, this application also provides a terminal device, which includes at least one processor 20; a display screen 21; and a memory 22. It may also include a communication interface 23 and a bus 24. Among them, the processor 20, the display screen 21, the memory 22, and the communication interface 23 can complete mutual communication through the bus 24. The display screen 21 is set to display a preset user guidance interface in the initial setting mode. The communication interface 23 can transmit information. The processor 20 can call the logical instructions in the memory 22 to execute the method in the above embodiment.
[0090] In addition, when the logical instructions in the above memory 22 are implemented in the form of a software functional unit and sold or used as an independent product, they can be stored in a computer-readable storage medium.
[0091] The memory 22 is a computer-readable storage medium and can be configured to store software programs and computer-executable programs, such as the program instructions or modules corresponding to the methods in the embodiments of the present disclosure. The processor 20 executes functional applications and data processing by running the software programs, instructions or modules stored in the memory 22, that is, the methods in the above embodiments are implemented.
[0092] The memory 22 may include a program storage area and a data storage area. Among them, the program storage area may store an operating system and application programs required for at least one function; the data storage area may store data created according to the use of the terminal device, etc. In addition, the memory 22 may include a high-speed random access memory and may also include a non-volatile memory. For example, various media that can store program codes such as USB flash drives, mobile hard disks, read-only memories (ROM), random access memories (RAM), magnetic disks or optical discs may also be transient storage media.
[0093] Compared with the prior art, the Ethereum network topology simulation method based on the pipeline technology of the present invention includes: generating an initial blockchain network according to the received simulation blockchain node parameter information; simulating the communication operations of the nodes in the initial blockchain network based on the pipeline technology to form simulation nodes; changing the communication coding method of the simulation nodes according to the received communication coding information to complete the update of the blockchain network; after adopting the above method, the present invention can simulate any number of Ethereum nodes within the range allowed by the memory, avoiding the loss caused by the unnecessary encapsulation of data packets by the network layer and the transport layer, using the pipeline technology to simulate network communication to avoid the influence of the operating system on the sending of network packets, and can more accurately implement the simulation of traffic control, packet loss rate, and delay jitter between nodes, and can simulate various attacks that may occur in the simulated blockchain system to guide the design of the peer-to-peer network of the blockchain system in the real environment. Using the pipeline technology to directly simulate a synchronous and full-duplex network connection in the memory, avoiding the limitations of traditional local socket communication.
[0094] It should be understood that the application of the present invention is not limited to the above examples. For those of ordinary skill in the art, improvements or transformations can be made according to the above description, and all such improvements and transformations should fall within the protection scope of the appended claims of the present invention.
[0095] Of course, the above description of the embodiments of the present invention is relatively detailed, but it should not be construed as a limitation on the protection scope of the present invention. The present invention may have other various implementation manners. Based on this implementation manner, other implementation manners obtained by those of ordinary skill in the art without any creative labor belong to the protection scope of the present invention. The protection scope of the present invention is subject to the appended claims.
Claims
1. An Ethereum network topology simulation method based on pipeline technology, characterized in that, Including: Generate an initial blockchain network according to the received simulation blockchain node parameter information; Simulate the communication operations of nodes in the initial blockchain network based on pipeline technology to form simulation nodes; Change the communication coding method of the simulation nodes according to the received communication coding information to complete the update of the blockchain network; The changing the communication coding method of the simulation nodes according to the received communication coding information to complete the update of the blockchain network includes: After receiving the communication coding information using recursive length prefix coding, change the communication coding method of the simulation nodes to complete the update of the blockchain network, where the simulation nodes use recursive length prefix coding for encoding before communication, and the recursive length prefix coding can encode any nested binary data array; The data types of communication of the simulation nodes include strings and lists. The blockchain network performs encoding operations on the data according to the detected data types, packs the encoded data into blocks, verifies the blocks, and adds the blocks to the ledgers of each simulation node after successful verification; If the detected data type is a string, the encoding operation process includes: if the length of the string to be transmitted by the simulation node into the blockchain network is less than or equal to 55, use the array itself as the encoding result and add 128 as the prefix; otherwise, if the length of the string to be transmitted by the simulation node into the blockchain network is greater than 55, the first value of the encoding result is the length of the encoding of 183 plus the length of the array, followed by the encoding of the array length itself, and finally the encoding of the string; If the detected data type is a list, the encoding operation process includes: if the length of the data list is less than 55, the first digit of the encoding result is the length of the encoding of 192 plus the length of the list, and then the encodings of each sub-list are connected in sequence; otherwise, if the length of the data list is greater than 55, the first digit of the encoding result is the length of the encoding of 247 plus the length of the list, followed by the encoding of the list itself, and finally the encodings of the sub-lists are connected in sequence; The simulating the communication operations of nodes in the initial blockchain network based on pipeline technology to form simulation nodes includes: Change the data packet distribution method of the initial blockchain network according to the received simulation network type information; The nodes in the initial blockchain network perform communication operations according to the data packet distribution method, and simulate the communication operations of the nodes based on pipeline technology to form simulation nodes.
2. The Ethereum network topology simulation method based on pipeline technology according to claim 1, wherein The generating an initial blockchain network according to the received simulation blockchain node parameter information includes: Generate N nodes of the blockchain network according to the received information that the number of simulation blockchain nodes is N; Define the nodes of the blockchain network according to the received node parameter information of the blockchain network, where the node parameter information of the blockchain network includes node names; Network the N nodes of the blockchain network in the Socket network communication mode to generate an initial blockchain network.
3. The Ethereum network topology simulation method based on pipeline technology according to claim 1, wherein The simulation network types include memory pipeline communication networks and named pipeline communication networks.
4. The Ethereum network topology simulation method based on pipeline technology according to claim 3, wherein, The communication operations of the node include: connection establishment, message sending, message reading, and connection closing.
5. An Ethereum network topology simulation device based on pipeline technology, characterized in that, including: An initialization module for generating an initialized blockchain network according to the received simulation blockchain node parameter information; A node simulation module for simulating the communication operations of nodes in the initialized blockchain network based on pipeline technology to form simulation nodes; An encoding module for changing the communication encoding method of the simulation nodes according to the received communication encoding information to complete the update of the blockchain network; Specifically, the encoding module is used to: after receiving the communication encoding information using recursive length prefix encoding, change the communication encoding method of the simulation nodes to complete the update of the blockchain network, where the simulation nodes use recursive length prefix encoding for encoding before communication, and the recursive length prefix encoding can encode any nested binary data array; The data types of the communication of the simulation nodes include strings and lists. The blockchain network performs encoding operations on the data according to the detected data types, packs the encoded data into blocks, verifies the blocks, and adds the blocks to the ledgers of each simulation node after successful verification; If the detected data type is a string, the encoding operation process includes: if the length of the string to be passed into the blockchain network by the simulation node is less than or equal to 55, the array itself is used as the encoding result, plus 128 as a prefix; otherwise, if the length of the string to be passed into the blockchain network by the simulation node is greater than 55, the first value of the encoding result is the length of the encoding of 183 plus the length of the array, followed by the encoding of the array length itself, and finally the encoding of the string; If the detected data type is a list, the encoding operation process includes: if the length of the data list is less than 55, the first bit of the encoding result is the length of the encoding of 192 plus the length of the list, and then the encodings of each sub-list are connected in sequence; otherwise, if the length of the data list is greater than 55, the first bit of the encoding result is the length of the encoding of 247 plus the length of the list, followed by the encoding of the list itself, and finally the encodings of the sub-lists are connected in sequence; Specifically, the node simulation module is used to: change the data packet distribution method of the initialized blockchain network according to the received simulation network type information; the nodes in the initialized blockchain network perform communication operations according to the data packet distribution method, and simulate the communication operations of the nodes based on pipeline technology to form simulation nodes.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores one or more programs, and the one or more programs can be executed by one or more processors to implement the steps in the method for simulating the Ethereum network topology based on pipeline technology as described in any one of claims 1-4.
7. A terminal device, characterized in that, including: A processor, a memory, and a communication bus; The memory stores a computer-readable program executable by the processor; The communication bus realizes the connection communication between the processor and the memory; When the processor executes the computer-readable program, it implements the steps in the method for simulating the Ethereum network topology based on pipeline technology as described in any one of claims 1-4.
Citation Information
Patent Citations
Distributed energy transaction simulation hardware platform system based on block chain
CN114880831A