Communication protocol switching method, medium and device for multi-scale blockchain networks
By deploying preset contracts in the blockchain network and dynamically switching P2P communication protocols, the problem of unstable communication system caused by changes in the number of nodes is solved, efficient and stable blockchain network communication is achieved, and system suspension and chain forks are avoided.
Patent Information
- Application Number
- CN202310507480.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-08
- Publication Date
- 2025-09-23
- Estimated Expiration
- 2043-05-08
AI Technical Summary
The existing blockchain network communication system has poor adaptability in scenarios where the number of nodes changes dynamically, resulting in a decline in service capabilities, and the fixed P2P communication protocol is prone to system instability and forks.
It uses pre-built contracts to deploy different P2P communication protocols, dynamically switches protocols through initial node broadcast and election mechanisms, combines full connectivity, Gossip, Kad, and hub-and-spoke networks, switches communication methods according to changes in the number of nodes, and introduces time locks and multi-signatures to ensure transparent and trustworthy governance.
It achieves efficient and stable communication of blockchain networks at different scales, avoids system pauses and chain forks, and ensures the security and reliability of the communication network.
Smart Images

Figure CN116582549B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain network technology, and in particular to a communication protocol switching method for multi-scale blockchain networks. Background Art
[0002] Blockchain is a distributed ledger technology characterized by openness, transparency, tamper-proofing, trusted consensus, and decentralization. Data in the ledger is maintained by all nodes in the entire network and does not belong to any single individual or organization. Through its peer-to-peer (P2P) protocol, blockchain enables rapid data synchronization and consistent consensus mechanisms without a centralized server. Consequently, blockchain has garnered widespread attention from both industry and academia, and is being applied as infrastructure across various fields to address challenges and drive industry development.
[0003] P2P network protocols are categorized into four types based on whether they are decentralized and whether node addresses are structured: centralized P2P network protocols, fully distributed unstructured P2P network protocols, fully distributed structured P2P network protocols, and semi-distributed P2P network protocols. Due to the decentralized nature of blockchain networks, the latter three P2P protocols are currently the primary means of communication between nodes. Each of these protocols has its own advantages and disadvantages, and selection should be tailored to the specific application scenario. Furthermore, their effectiveness varies across blockchain networks with varying node sizes. Furthermore, the number of nodes in a blockchain network is constantly changing, sometimes even decreasing by more than half. For example, Ethereum's node count dropped from over 12,000 to just over 3,900 within a few months in 2022. However, current blockchain communication systems often choose a single P2P network protocol and hardcode it into the underlying network layer. Such communication systems are less adaptable to scenarios with large node size fluctuations. In particular, when the number of nodes decreases or increases dramatically, it will have a greater impact on the blockchain network, the system's service capabilities will be greatly reduced, and related content systems based on blockchain infrastructure will also suffer losses.
[0004] Related terms:
[0005] Blockchain: A peer-to-peer network system that uses cryptography and consensus mechanisms to create and store massive amounts of transaction data. Each block contains a cryptographic hash of the previous block, a corresponding timestamp, and transaction data (typically represented by a hash value calculated using a Merkle tree algorithm). This design makes the block content difficult to tamper with. The distributed ledger connected by blockchain technology allows two parties to effectively record transactions and permanently verify them.
[0006] Forking: Due to various factors, a blockchain can split into two. Both Bitcoin and Ethereum have experienced forks. This is a sign that users within the blockchain community cannot reach a consensus on the state of the chain. Forking is a very unfriendly governance method and is detrimental to the development of blockchains.
[0007] Timelocks: Timelocks in blockchain are different from traditional timelocks, but they are essentially the same. A timelock in blockchain is often a piece of code that locks certain functions of a smart contract, making them time-restricted. For example, funds in a blockchain address can only be spent at a specific date, time, or block height.
[0008] Multi-signature technology requires one or more additional users to sign a transaction before it can be submitted to the blockchain. This means that if one person's wallet is hacked, another wallet or wallets will also need to sign any transactions. Multi-signature technology also helps protect community funds by requiring a majority of designated users to sign before transactions can be made. This is very useful, for example, to prevent fraudulent activity by a community leader and to ensure the security of fundraising or other community-sponsored funds.
[0009] Pre-built contracts: Contracts include ordinary smart contracts and pre-built contracts. Ordinary smart contracts are developed and then deployed on the blockchain. Pre-built contracts are contracts integrated into the blockchain protocol. They are developed in advance and embedded in the blockchain protocol.
[0010] Fully distributed unstructured P2P network: Fully distributed P2P nodes can join and exit freely, and there is no central node. There is no structured unified standard for node addresses. The entire network structure is a random graph structure, and there is no fixed network structure diagram.
[0011] Fully distributed structured P2P network: The biggest problem with full distribution is node address management. There are no fixed rules between nodes, and node information cannot be accurately located. It can only be searched through flooding queries, which consumes a lot of network resources.
[0012] Semi-distributed P2P networks combine the advantages of both centralized and distributed models, classifying nodes into regular nodes and supernodes to create a semi-distributed network structure. Each supernode maintains some network node addresses, file indexes, and other tasks, collectively fulfilling the central server function. Supernodes themselves are distributed and can be freely expanded and withdrawn, retaining the advantages of a distributed network.
[0013] DHT (Distributed Hash Table): DHT uses a hashing algorithm to hash P2P network nodes into standard-length data, forming a massive hash table across the entire network. Each participating node maintains a portion of the hash table, storing and maintaining its own data. The hash table is distributed across the P2P network. Any node connected to the P2P network has an ID that identifies its position in the hash table. It can use the DHT to find more nodes and can be precisely located by other nodes based on its ID value. While DHT supports the free entry and exit of nodes, its complex maintenance mechanism makes it unsuitable for frequent node changes.
[0014] Kad: Kad is a type of DHT protocol that uses a binary tree structure. Node storage information is divided into multiple Kad buckets to simplify the query structure. This protocol can be used to quickly and accurately find addresses.
[0015] Gossip: Based on the infection and spread mechanisms of infectious diseases, Gossip is widely used as the underlying communication protocol in distributed systems. Gossip is not a new P2P network concept. Compared to traditional flooding and routing algorithms, Gossip provides a clearer type of network communication. However, Gossip cannot achieve precise search.
[0016] Block folding: Blocks and transactions within them are folded according to certain rules to reduce block size. This improves transmission efficiency and reduces node storage requirements. The folding rules include using the block height and transaction index to represent the hash of an existing transaction in the blockchain. Summary of the Invention
[0017] The present invention proposes a communication protocol switching method for multi-scale blockchain networks, which can solve at least one of the above technical problems.
[0018] To achieve the above object, the present invention adopts the following technical solutions:
[0019] A communication protocol switching method for a multi-scale blockchain network comprises the following steps:
[0020] S01. Randomly select any node as the initial node, which sends a broadcast message to regularly count the number of all nodes that can work normally in the entire network, and then switches the p2p communication protocol according to the change in the number of nodes;
[0021] S02. When the number of nodes changes and reaches a threshold, the communication protocol is switched. If the number of nodes is small or large, and there is only one applicable protocol, then the switch is made directly. If the network is medium-sized, all nodes democratically vote to determine which protocol to adopt. The initial node sends a voting message and counts the votes, and the protocol with the most votes is the final result. Different-sized networks implement scalable network transmission for two different block structures: ordinary unfolded block transactions and folded block transactions.
[0022] Among them, a small-scale network refers to 1-128 nodes, a medium-scale network refers to 129-1000 nodes, and a large-scale network refers to more than 1000 nodes.
[0023] Furthermore, in order to prevent initial node failures in step S01, an election mechanism is introduced to ensure that each node in the network has a chance to become an initial node, thereby ensuring the degree of decentralization of the network.
[0024] Furthermore, in step S02, when the blockchain network is in a small-scale network, full-connection communication is adopted. At this time, any node in the network stores information of all nodes in the network, so that communication can be carried out directly with any node.
[0025] Furthermore, in step S02, when the number of blockchain network nodes exceeds 128, the blockchain network communication protocol is switched to the Gossip protocol or the Kad protocol. At this time, each node only stores information of part of the nodes, so the nodes can only communicate indirectly.
[0026] Furthermore, in step S02, when the number of blockchain network nodes continues to increase to more than 1,000, a hub-and-spoke network communication protocol is adopted. At this time, there are multiple central nodes in the network, each of which is responsible for connecting to a portion of ordinary nodes, and then the central nodes are interconnected;
[0027] The communication method between ordinary nodes is to first transmit information to their own central node, and then the central node transmits the information to other central nodes, and finally these central nodes distribute the content.
[0028] Furthermore, the election mechanism is as follows:
[0029] When any node in the system does not receive a counting message within the set time, the node can broadcast a counting message to the entire network and attach the sending time to the message;
[0030] If it receives a reply message from the entire network and does not receive any other count messages sent earlier than its own, then the node successfully wins the election for the initial node; otherwise, the election fails.
[0031] The election mechanism can only be started when all nodes in the system have not received any counting messages for more than one counting period.
[0032] On the other hand, the present invention also discloses a communication protocol switching method for a multi-scale blockchain network, comprising the following steps:
[0033] S11, initialization process of blockchain network communication system;
[0034] S12. The process of changing the communication protocol during the operation of the blockchain network communication system;
[0035] The initialization process of the blockchain network communication system in S11 specifically includes the following:
[0036] Developers deploy the subsequent P2P communication protocols in the form of pre-built contracts to the underlying blockchain network protocol.
[0037] After the system is compiled and debugged, it starts to run normally;
[0038] Any node in the system is selected as the initial node. According to the time lock set in the preset contract, the initial node will broadcast a counting message to all the nodes it is connected to according to the counting cycle. After receiving the counting message for the first time, other nodes will first send a reply message to the initial node, and then forward the counting message to the nodes it is connected to;
[0039] In order to prevent the initial node from failing, an election mechanism is introduced;
[0040] The process of changing the communication protocol during the operation of the blockchain network communication system in S12 specifically includes:
[0041] The initial node counts the number of reply messages received and finds that the blockchain network scale has changed;
[0042] If the network is small, the protocol is fully connected. If the network is large, the protocol is hub-and-spoke. If the network is medium, all nodes are allowed to vote individually and select the communication protocol they think is most suitable through multi-signature.
[0043] Correctly change the communication protocol based on the information deployed by the pre-set contract.
[0044] Furthermore, the voting method in step S12 is that the initial node broadcasts a communication protocol voting message to the entire network. After receiving the message, each node needs to reply to the initial node in a signed manner with the communication protocol it supports. The protocol supported by the most nodes in the reply messages received by the initial node within the specified time is selected as the P2P communication protocol adopted by the blockchain network in the subsequent time.
[0045] On the other hand, the present invention further discloses a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the processor to perform the steps of the above method.
[0046] On the other hand, the present invention further discloses a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the above method.
[0047] As can be seen from the above technical solution, the present invention's communication protocol switching method for multi-scale blockchain networks is applicable to network transmission expansion with different block structures. Analysis of existing blockchain network communication systems reveals that existing communication systems suffer from the following drawbacks: single and fixed P2P communication protocol selection, poor adaptability to large changes in node proficiency, and communication performance easily affected by the number of nodes. To address these drawbacks, a design for a blockchain network system of varying scales and a dynamic communication protocol switching mechanism are proposed to address these issues and achieve efficient, convenient, and stable blockchain network communication. By pre-configuring contracts, different P2P network protocols are codified and deployed to the underlying blockchain network. For core developers in the blockchain community, they only need to compile and debug all code before the system is officially launched, eliminating the need for secondary development. For servers running node software, there's no need to shut down to replace software packages. For the entire blockchain network communication system, since there's no need to load newly developed software packages during operation, there's no need to suspend the system mid-run. This ensures long-term stable operation of the communication network, avoids chain forks caused by community disagreements, and safeguards system security. In order to make the dynamic switching process of P2P communication protocols open, transparent, trustworthy, traceable and controllable, time locks and multi-signatures are introduced, and the governance process is recorded on the chain. BRIEF DESCRIPTION OF THE DRAWINGS
[0048] Figure 1 is a flow chart of a method according to an embodiment of the present invention;
[0049] Figure 2 Schematic diagram of three blockchain networks of different scales and their common P2P communication protocols according to an embodiment of the present invention;
[0050] Figure 3 This is a flowchart of the blockchain system workflow according to an embodiment of the present invention;
[0051] Figure 4 Block transaction folding diagram. DETAILED DESCRIPTION
[0052] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments.
[0053] like Figure 1 As shown, a communication protocol switching method for a multi-scale blockchain network according to an embodiment of the present invention includes the following steps:
[0054] S1. Randomly select any node as the initial node, which sends broadcast messages to regularly count the number of all nodes that can work normally in the entire network, and then switches the p2p communication protocol according to the change in the number. In order to prevent initial node failure, an election mechanism is introduced to ensure that each node in the network has the chance to become the initial node, thereby ensuring the degree of decentralization of the network.
[0055] S2. When the number of nodes changes and reaches a threshold, the communication protocol can be switched. If the number of nodes is small or large, and there is only one applicable protocol, then switch directly. If it is medium-sized, there are many communication protocols that can be used, the most common ones are gossip and kad, which are unstructured and structured respectively. Kad also has a search function, while gossip does not, so the application scenarios are different. At this time, all nodes democratically vote to determine which protocol to use. The initial node sends a voting message and counts it, and the protocol selected by the majority of nodes is used as the final result.
[0056] This embodiment implements scalable network transmission for two different block sizes: ordinary unfolded block transactions and folded block transactions;
[0057] The embodiment of the present invention can embody a bidirectional switching mechanism for communication protocols. When the number of nodes increases, it can detect the number of nodes and switch to the appropriate protocol. When the number of nodes decreases due to some reason, it can also detect and switch the protocol. Moreover, it detects only the nodes that are working normally at that time.
[0058] like Figure 2 Below are three blockchain networks of different sizes and their common P2P communication protocols: small-scale networks are those with 1-128 nodes, medium-scale networks are those with 129-1000 nodes, and large-scale networks are those with more than 1000 nodes. This solution supports dynamic switching of P2P communication protocols beyond those listed below.
[0059] In a normal blockchain network communication system, the number of nodes often adjusts dynamically, and in some special circumstances, the number can fluctuate significantly. For example, environmental factors may cause most nodes in the system to malfunction, or a large number of nodes may join the network simultaneously for promotional purposes. In such cases, the original communication protocol is no longer suitable. For example, in small-scale networks, fully connected communication can be used. In this case, any node in the network stores information about all nodes, allowing direct communication with any node, which is very convenient and fast. However, once the network scales up, exceeding 128 nodes, fully connected communication should not be used, as it would incur a significant storage cost for each node. Therefore, medium-sized networks can switch the blockchain network communication protocol to gossip, Kad, or other protocols. In this case, each node only stores information about a subset of nodes, allowing nodes to communicate indirectly. Although this reduces communication speed, node storage consumption is also significantly reduced. As the number of blockchain network nodes continues to grow to over 1,000, to ensure a moderate decrease in communication speed, a certain degree of decentralization must be sacrificed, resulting in the adoption of a hub-and-spoke network communication protocol. In this scenario, there are multiple central nodes in the network. Each central node is responsible for connecting to a subset of regular nodes, which in turn are interconnected. Regular nodes communicate by first transmitting information to their own central node, which then transmits the information to other central nodes. Finally, these central nodes distribute the content. The communication protocol used in this solution changes with the number of nodes.
[0060] The overall workflow of this system is as follows Figure 3 As shown, it can be divided into two sub-processes. The first is the initialization process of the blockchain network communication system, and the other is the process of changing the communication protocol when the system is running.
[0061] (1) Blockchain network communication system initialization process
[0062] Developers deploy the subsequent P2P communication protocols in the form of pre-built contracts to the bottom layer of the blockchain network protocol.
[0063] After the system is compiled and debugged, it starts to run normally.
[0064] Any node in the system is selected as the initial node. Based on the time lock set in the pre-set contract, the initial node will broadcast a count message to all connected nodes at intervals (which can be called a count period). Upon receiving the count message for the first time, other nodes will first send a reply message to the initial node, which then forwards the count message to its connected nodes. By broadcasting the count, the initial node can determine the scale of the blockchain network and dynamically select the appropriate P2P communication protocol.
[0065] To prevent initial node failures, an election mechanism is introduced. If any node in the system fails to receive a count message for an extended period (this period can be set to twice the initial node's count message transmission period), the node can broadcast a count message to the entire network, appending the time it was sent. If it then receives a reply message from the entire network and does not receive any other count messages sent earlier than its own, the node successfully wins the election for initial node. Otherwise, the election fails. The election mechanism only activates if all nodes in the system have not received a count message for more than one counting period.
[0066] (2) The process of changing the communication protocol during system operation
[0067] The initial node counts the number of reply messages received and finds that the scale of the blockchain network has changed.
[0068] If it is changed to a small-scale network, change to a fully connected protocol; if it is changed to a large-scale network, change the protocol to a hub-and-spoke network protocol; if it is changed to a medium-scale network, because the protocols available for this scale network include but are not limited to Gossip or Kad, they each have their own advantages and disadvantages. All nodes can vote separately and elect the communication protocol they think is most suitable through multi-signature.
[0069] The voting method is that the initial node broadcasts a communication protocol voting message to the entire network. After receiving the message, each node needs to reply to the initial node with a signature on the communication protocol it supports. The protocol supported by the most nodes in the reply messages received by the initial node within the specified time is selected as the P2P communication protocol adopted by the blockchain network in the subsequent time.
[0070] Correctly change the communication protocol based on the information deployed by the pre-set contract.
[0071] (3) Networks of different sizes can achieve scalable network transmission for folded and unfolded block structures.
[0072] The block transaction folding method is to reduce the data size of each transaction based on the transaction data structure. The transaction hash size is generally 32 bytes and can be replaced by the block height and transaction index.
[0073] When verifying the folded transaction, the transaction hash can be queried from the blockchain based on the block height and transaction index. Each transaction in the block includes the transaction hash, sender and receiver addresses, etc. The block transaction folding method can use the block height and transaction index to represent a transaction hash. The block transaction folding method is as follows: Figure 4 shown.
[0074] Different scale networks implement scalable network transmission for two different block sizes: ordinary unfolded block transactions and folded block transactions. Different types of blocks are distinguished by version numbers.
[0075] In summary, the present invention proposes a communication protocol switching method for multi-scale blockchain networks. By analyzing existing blockchain network communication systems, it is found that existing communication systems suffer from the following pain points: single and fixed P2P communication protocol selection, poor adaptability to large changes in node proficiency, and communication performance that is easily affected by the number of nodes. To address these pain points, a design for blockchain network systems of varying scales and a dynamic communication protocol switching mechanism are proposed to address these issues and achieve efficient, convenient, and stable blockchain network communication. By pre-setting contracts, different P2P network protocols are codified and deployed to the underlying blockchain network. For core developers in the blockchain community, they only need to compile and debug all code before the system is officially launched, eliminating the need for secondary development. For servers running node software, there is no need to shut down to replace software packages. For the entire blockchain network communication system, since there is no need to load newly developed software packages during operation, there is no need to suspend the system mid-run. This ensures the long-term stable operation of the communication network, avoids chain forks caused by community disagreements, and safeguards system security. In order to make the dynamic switching process of P2P communication protocols open, transparent, trustworthy, traceable and controllable, time locks and multi-signatures are introduced, and the governance process is recorded on the chain.
[0076] In another aspect, the present invention further discloses a computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor executes the steps of any of the above methods.
[0077] On the other hand, the present invention further discloses a computer device, comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of any of the above methods.
[0078] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the steps of any one of the methods in the above embodiments.
[0079] It is understandable that the system provided by the embodiment of the present invention corresponds to the method provided by the embodiment of the present invention, and the explanation, examples and beneficial effects of the relevant contents can refer to the corresponding parts of the above method.
[0080] Those skilled in the art will appreciate that all or part of the processes in the above-described method embodiments can be implemented by instructing the relevant hardware through a computer program. The program can be stored in a non-volatile computer-readable storage medium. When executed, the program can include the processes of the above-described method embodiments. Any reference to memory, storage, database, or other media used in the various embodiments provided herein may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), RAMbus direct RAM (RDRAM), direct RAMbus dynamic RAM (DRDRAM), and RAMbus dynamic RAM (RDRAM).
[0081] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0082] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.
Claims
1. A communication protocol switching method for a multi-scale blockchain network, characterized in that: Based on blockchain network systems of different scales, The following steps are included: S01. Randomly select any node as the initial node, which sends a broadcast message to regularly count the number of all nodes that can work normally in the entire network, and then switches the p2p communication protocol according to the change in the number of nodes; S02. When the number of nodes changes and reaches a threshold, the communication protocol is switched. If the number of nodes is small or large, the switch is made directly. If the network is medium, all nodes democratically vote to determine which protocol to adopt. The initial node sends a voting message and counts the votes. The protocol with the most votes is the final result. Different scale networks use two different block structures for ordinary unfolded block transactions and folded block transactions to achieve scalable network transmission; Among them, a small-scale network refers to a network with 1-128 nodes, a medium-scale network refers to a network with 129-1000 nodes, and a large-scale network refers to a network with more than 1000 nodes.
2. The communication protocol switching method for a multi-scale blockchain network according to claim 1, characterized in that: In step S01, in order to prevent the occurrence of initial node failure, an election mechanism is introduced to ensure that each node in the network has a chance to become an initial node.
3. The communication protocol switching method for a multi-scale blockchain network according to claim 1, characterized in that: In step S02, when the blockchain network is in a small-scale network, full-connection communication is adopted. At this time, any node in the network stores information of all nodes in the network and can communicate directly with any node.
4. The communication protocol switching method for a multi-scale blockchain network according to claim 1, characterized in that: In step S02, when the number of blockchain network nodes exceeds 128, the blockchain network communication protocol is switched to the Gossip protocol or the Kad protocol. At this time, each node only stores the information of part of the nodes, and the nodes can only communicate indirectly.
5. The communication protocol switching method for a multi-scale blockchain network according to claim 1, characterized in that: In step S02, when the number of blockchain network nodes continues to increase to more than 1,000, a hub-and-spoke network communication protocol is adopted. At this time, there are multiple central nodes in the network, each of which is responsible for connecting to a specified part of the ordinary nodes, and then the central nodes are interconnected; The communication method between ordinary nodes is to first transmit information to their own central node, and then the central node transmits the information to other central nodes, and finally these central nodes distribute the content.
6. The communication protocol switching method for a multi-scale blockchain network according to claim 2, characterized in that: The campaign mechanism is as follows: When any node in the system does not receive a counting message within the set time, the node can broadcast a counting message to the entire network and attach the sending time to the message; If it receives a reply message from the entire network and does not receive any other count messages sent earlier than its own, then the node successfully wins the election for the initial node. Otherwise, the election will fail; The election mechanism can only be started when all nodes in the system have not received any counting messages for more than one counting period.
7. A communication protocol switching method for a multi-scale blockchain network, characterized by: The following steps are included: S11, initialization process of blockchain network communication system; S12. The process of changing the communication protocol during the operation of the blockchain network communication system; The initialization process of the blockchain network communication system in S11 specifically includes the following: Developers deploy the subsequent P2P communication protocols in the form of pre-built contracts to the underlying blockchain network protocol. After the system is compiled and debugged, it starts to run normally; Any node in the system is selected as the initial node. According to the time lock set in the preset contract, the initial node will broadcast a counting message to all the nodes it is connected to according to the counting cycle. After receiving the counting message for the first time, other nodes will first send a reply message to the initial node, and then forward the counting message to the nodes it is connected to; In order to prevent the initial node from failing, an election mechanism is introduced; The process of changing the communication protocol during the operation of the blockchain network communication system in S12 specifically includes: The initial node counts the number of reply messages received and finds that the blockchain network scale has changed; If the network is small, the protocol is fully connected. If the network is large, the protocol is hub-and-spoke. If the network is medium, all nodes are allowed to vote individually and select the communication protocol they think is most suitable through multi-signature. Correctly change the communication protocol based on the information deployed by the pre-set contract.
8. The communication protocol switching method for a multi-scale blockchain network according to claim 7, characterized in that: The voting method in step S12 is that the initial node broadcasts a communication protocol voting message to the entire network. After receiving the message, each node needs to reply to the initial node with a signature on the communication protocol it supports. The protocol supported by the most nodes in the reply messages received by the initial node within a specified time is selected as the P2P communication protocol adopted by the blockchain network in the subsequent time.
9. A computer-readable storage medium storing a computer program, wherein when the computer program is executed by a processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 8.
10. A computer device comprising a memory and a processor, wherein the memory stores a computer program, and when the computer program is executed by the processor, the processor is caused to perform the steps of the method according to any one of claims 1 to 8.
Citation Information
Patent Citations
Block chain network hierarchical transmission method based on multi-scale node management and storage medium
CN115296824A
Authentication Question Improvement Based on Vocal Confidence Processing
US20220405360A1