CN116582549A - Communication protocol switching method, medium and device for multi-scale blockchain network - Google Patents

Communication protocol switching method, medium and device for multi-scale blockchain network Download PDF

Info

Publication number
CN116582549A
CN116582549A CN202310507480.XA CN202310507480A CN116582549A CN 116582549 A CN116582549 A CN 116582549A CN 202310507480 A CN202310507480 A CN 202310507480A CN 116582549 A CN116582549 A CN 116582549A
Authority
CN
China
Prior art keywords
network
nodes
node
scale
communication protocol
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310507480.XA
Other languages
Chinese (zh)
Inventor
赵赫
赵越
余斌
李晓风
许金林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Anhui Zhongke Lattice Technology Co ltd
Anhui Zhongkezhilian Information Technology Co ltd
Hefei Institutes of Physical Science of CAS
Original Assignee
Anhui Zhongke Lattice Technology Co ltd
Anhui Zhongkezhilian Information Technology Co ltd
Hefei Institutes of Physical Science of CAS
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Anhui Zhongke Lattice Technology Co ltd, Anhui Zhongkezhilian Information Technology Co ltd, Hefei Institutes of Physical Science of CAS filed Critical Anhui Zhongke Lattice Technology Co ltd
Priority to CN202310507480.XA priority Critical patent/CN116582549A/en
Publication of CN116582549A publication Critical patent/CN116582549A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/20Network architectures or network communication protocols for network security for managing network security; network security policies in general
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1042Peer-to-peer [P2P] networks using topology management mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/18Multiprotocol handlers, e.g. single devices capable of handling multiple protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/32Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials
    • H04L9/3247Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures
    • H04L9/3255Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols including means for verifying the identity or authority of a user of the system or for message authentication, e.g. authorization, entity authentication, data integrity or data verification, non-repudiation, key authentication or verification of credentials involving digital signatures using group based signatures, e.g. ring or threshold signatures
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L9/00Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
    • H04L9/50Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols using hash chains, e.g. blockchains or hash trees
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/50Reducing energy consumption in communication networks in wire-line communication networks, e.g. low power modes or reduced link rate

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Security & Cryptography (AREA)
  • Business, Economics & Management (AREA)
  • General Business, Economics & Management (AREA)
  • Computer Hardware Design (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application relates to a communication protocol switching method, medium and equipment for a multi-scale blockchain network, which comprises the steps of randomly selecting any node as an initial node, sending a broadcast message by the node to count the number of all nodes capable of working normally in the whole network at regular time, and switching p2p communication protocols according to the change of the number of the nodes; when the number of nodes changes to reach a threshold value, switching the communication protocol, and if the number of nodes belongs to only one of the applicable protocols of a small-scale or large-scale network at the moment, directly switching; if the method belongs to the medium scale, determining which protocol is adopted by all node democratic votes, sending voting information by an initial node, counting, and taking the protocol with the largest votes as a final result; the application does not need to load newly developed software packages in the running process, so that the system does not need to be suspended midway, the long-term stable running of the communication network is ensured, the chain bifurcation caused by community bifurcation is avoided, and the safety of the system is ensured.

Description

Communication protocol switching method, medium and device for multi-scale blockchain network
Technical Field
The application relates to the technical field of blockchain networks, in particular to a communication protocol switching method for a multi-scale blockchain network.
Background
The blockchain is a distributed account book technology and has the characteristics of disclosure transparency, tamper resistance, consensus credibility, decentralization and the like, data in the account book is commonly maintained by all nodes of the whole network, and the account book does not belong to any individual or organization. The blockchain can achieve the purposes of quickly synchronizing data and realizing consistency of a consensus mechanism under the condition of no central server through the P2P protocol. Therefore, blockchains are receiving wide attention in industry and academia and are applied as an infrastructure to various fields to solve problems in the field, and to assist industry development.
The P2P network protocol is divided into four types according to whether the node address is decentralised or not and whether the node address is structured or not, namely, a centralized P2P network protocol, a full distributed unstructured P2P network protocol, a full distributed structured P2P network protocol and a semi-distributed P2P network protocol. Because the blockchain network has the decentralization characteristic, the current blockchain network mainly adopts the latter three P2P protocols to carry out inter-node communication. These three protocols have advantages and disadvantages, and should be selected according to practical application scenarios, and the effects generated by applying them to blockchain networks with different node scales are different. In addition, the number of blockchain network nodes is always dynamically changed, and sometimes even reduced by more than half. For example, the number of nodes in the ethernet falls from 12000 or more to 3900 or more within 2022 months. However, the blockchain communication system currently on the market often only selects one P2P network protocol and fixedly writes the P2P network protocol to the network bottom layer. Such a communication system has poor adaptation in a scenario where the dynamic change amplitude of the node is large. In particular, when the number of nodes decreases or increases drastically, the blockchain network is greatly affected, the service capability of the system is greatly reduced, and the related content system based on the blockchain infrastructure is lost.
Related terms:
blockchain: blockchains are point-to-point network systems that create and store blockchains of large transaction data by cryptographic and consensus mechanisms. Each block contains a cryptographic hash of the previous block, a corresponding time stamp, and transaction data (typically represented by a hash value calculated using the merck tree algorithm), which is designed to make the contents of the block difficult to tamper with. The distributed ledgers concatenated with blockchain technology enable both parties to record transactions efficiently and to permanently verify the transaction.
Branching: because of a variety of factors, a blockchain is split into two blockchains, and both bitcoin and ethernet are split, a representation that users in the blockchain community do not agree on the state of the chain. Bifurcation is a very unfriendly governance approach, which is unfavorable for blockchain development.
Time lock: the time locks in a blockchain are different from traditional ones, but are essentially contiguous. Time locks in blockchains are often a piece of code that locks certain functions of a smart contract such that certain functions of the contract are time-limited. For example, funds on a certain address of a blockchain can only be used on a particular date, a particular time, or a particular blockheight.
Multiple signature: multiple signature techniques require that another user or users must sign the relevant transaction before the transaction can be sent to the blockchain. This means that if one person's wallet is stolen by a hacker, another wallet or several wallets are also required to sign the transaction. The multi-signature technology is also helpful for protecting community funds, and the protection mode is as follows: the community fund must receive most of the specified user signatures before transacting. This is useful, for example, to avoid fraud by a community leader by multiple signature techniques, to ensure the security of a fund that is funded or otherwise initiated by the community.
Presetting contracts: the contracts comprise common intelligent contracts and preset contracts, wherein the common intelligent contracts are developed and then deployed on the blockchain, and the preset contracts are integrated in the blockchain protocol and are developed in advance and embedded in the blockchain protocol.
Full distributed unstructured P2P network: the full-distribution P2P node can be freely added and withdrawn, no central node exists, the node address does not have structural unified standard, the whole network structure is in a random graph structure, and a fixed network structure diagram does not exist.
Full distributed structured P2P network: the biggest problem of the full distribution type is that node address management is carried out, fixed rule constraint is not arranged among nodes, node information cannot be accurately positioned, searching can be carried out only in a flooding inquiry mode, and consumption on a network is large.
Semi-distributed P2P network: the nodes are classified into common nodes and super nodes by combining the respective advantages of the centralized model and the distributed model, so that a semi-distributed network structure is formed. Each super node maintains partial network node addresses, file indexes and the like, and the super nodes jointly realize the function of a central server. The super nodes are distributed, can freely expand and exit, and have the advantage of a distributed network.
DHT (distributed hash table): the DHT hashes the P2P network node into standard length data through a hash algorithm, and the whole network forms a huge hash table. Each participating node has a part of hash table, stores and maintains own data, the hash table is distributed on each node of the P2P network, any node accessing the P2P network has an ID (identity) of the node located in the hash table, more nodes can be searched through the DHT, and the nodes can also be accurately searched by the other nodes according to the ID value. While DHT support nodes are free to join or leave, the complex maintenance mechanisms of DHT make it unable to accommodate high frequency node changes.
Kad: kad is one of the DHT protocols, and adopts a binary tree structure, the node storage information is divided into a plurality of Kad barrels, the query structure is simplified, and the address can be quickly and accurately searched by using the protocol.
Gossip: gossip was developed based on the mechanism of infectious disease infection transmission and is widely used in distributed systems as an underlying communication protocol. Gossip is not a new P2P network concept, and provides an explicit network communication type compared to conventional flooding and routing algorithms. Gossip cannot achieve accurate lookup.
Folding the block: the blocks and the transactions in the blocks are folded according to a certain rule so as to reduce the size of the blocks, and after the blocks are folded, the transmission efficiency is improved and the requirement on the storage space of the nodes is reduced. The folding rule includes a hash that will represent a transaction that is already present in the blockchain with the blockheight and transaction index.
Disclosure of Invention
The communication protocol switching method for the multi-scale blockchain network provided by the application can at least solve one of the technical problems.
In order to achieve the above purpose, the present application adopts the following technical scheme:
a communication protocol switching method for a multi-scale blockchain network includes the steps of,
s01, randomly selecting any node as an initial node, sending a broadcast message to count the number of all nodes capable of working normally in the whole network at regular time, and switching p2p communication protocols according to the change of the number of the nodes;
s02, when the number of nodes changes to reach a threshold value, switching the communication protocol, and if the number of nodes belongs to a small-scale or large-scale network at the moment and only one applicable protocol exists, directly switching; if the method belongs to the medium scale, determining which protocol is adopted by all node democratic votes, sending voting information by an initial node, counting, and taking the protocol with the largest votes as a final result; aiming at two block structures with different sizes of common unfolded block transaction and folded block transaction, the different-scale network realizes expandable network transmission;
wherein, the small-scale network refers to 1-128 nodes, the medium-scale network refers to 128-1000 nodes, and the large-scale network refers to more than 1000 nodes.
Further, in step S01, in order to prevent node failure from occurring initially, an election mechanism is introduced to ensure that each node of the network has a probability of becoming an initial node, and ensure the decentralization degree of the network.
Further, in step S02, when the blockchain network uses full-connection communication to run on the small-scale network, information of all nodes in the network is stored between any node in the network, so that the blockchain network can directly communicate with any node.
Further, in step S02, when the number of the blockchain network nodes exceeds 128, the blockchain network communication protocol is switched to the Gossip protocol or the Kad protocol, and each node only stores the information of a part of the nodes, so that the nodes can only indirectly communicate.
Further, in step S02, when the number of blockchain network nodes continues to increase to more than 1000, a hub-spoke network communication protocol is adopted, and at this time, a plurality of central nodes exist in the network, each central node is responsible for connecting a part of common nodes, and then the central nodes are interconnected with each other;
the communication mode between the common nodes is that firstly, information is transmitted to the own central node, then the central node transmits the information to other central nodes, and finally, the central nodes distribute the content.
Further, the election mechanism is as follows:
when any node in the system does not receive the counting message when reaching the set time, the node can broadcast a counting message to the whole network by itself and attach the sending time after the message;
if it receives the reply message of the whole network and does not receive other counting messages which are earlier than the sending time of the node, the node election initial node is successful; otherwise, the election fails;
the election mechanism can only be started if all nodes in the system do not receive a counting message for more than one counting period.
On the other hand, the application also discloses a communication protocol switching method for the multi-scale blockchain network, which comprises the following steps,
s11, initializing a block chain network communication system;
s12, a communication protocol changing process when the block chain network communication system operates;
the initialization process of the block chain network communication system specifically comprises the following steps:
the developer deploys the P2P communication protocol required subsequently to the bottom layer of the blockchain network protocol in the form of preset contracts;
after compiling and debugging, the system starts to normally run;
selecting any node in the system as an initial node, broadcasting a counting message to all nodes connected with the initial node according to a counting period by the initial node according to a time lock set in a preset contract, sending a reply message to the initial node after other nodes receive the counting message for the first time, and forwarding the counting message to the nodes connected with the initial node;
in order to prevent the fault of the initial node, introducing an election mechanism;
the S12, a changing process of the communication protocol during the operation of the block chain network communication system specifically comprises the following steps:
the initial node counts the number of received reply messages and discovers that the scale of the block chain network is changed;
if the network is changed to a small-scale network, changing to a full-connection protocol; if the network is changed into a large-scale network, changing the protocol into a hub-spoke network protocol; if the network is changed into a medium-scale network, all nodes are respectively voted, and the communication protocol which is considered to be most suitable is elected by the nodes in a multi-signature mode;
and correctly changing the communication protocol according to the information of the preset contract deployment.
Further, in the step S12, the voting mode is that the initial node broadcasts a communication protocol voting message to the whole network, each node needs to reply to the communication protocol supported by the initial node in a signature mode after receiving the message, and the protocol supported by the most nodes in the reply message received by the initial node in the set time is selected as the P2P communication protocol adopted by the blockchain network in the later time.
In yet another aspect, the application also 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 method as described above.
In yet another aspect, the application also discloses a computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of the method as described above.
According to the technical scheme, the communication protocol switching method for the multi-scale blockchain network can be suitable for network transmission expansion of different blockchain structures, the existing communication system is found to have pain points which are single in P2P communication protocol selection, fixed, not suitable for the great change of node proficiency and easily affected by the number of nodes in communication effect by analyzing the existing blockchain network communication system, and for the pain points, the design of the blockchain network system and the dynamic switching mechanism of the communication protocol of different scales are provided to solve the pain points, so that efficient, convenient and stable blockchain network communication is realized. Different P2P network protocols are coded and deployed on the bottom layer of the blockchain network through preset contracts, and for core developers of the blockchain community, the core developers only need to compile and debug all codes before the system formally operates, so that secondary development is not needed; for a server running node software, the shutdown is not needed to replace the software package; for the whole blockchain network communication system, because a newly developed software package is not required to be loaded in the operation process, the system is not required to be suspended midway, the long-term stable operation of the communication network is ensured, chain bifurcation caused by community bifurcation is avoided, and the safety of the system is ensured. In order to make the P2P communication protocol dynamic switching process public, transparent, credible, traceable and controllable, a time lock and multiple signatures are introduced, and meanwhile, the treatment process is recorded on a chain.
Drawings
FIG. 1 is a flow chart of a method of an embodiment of the present application;
FIG. 2 is a schematic diagram of three different scale blockchain networks and their common P2P communication protocols according to embodiments of the present application;
FIG. 3 is a block chain system workflow diagram of an embodiment of the present application;
FIG. 4 is a block transaction folding schematic.
Detailed Description
For the purpose of making the objects, technical solutions and advantages of the embodiments of the present application more apparent, the technical solutions of the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application, and it is apparent that the described embodiments are some embodiments of the present application, but not all embodiments of the present application.
As shown in fig. 1, a communication protocol switching method for a multi-scale blockchain network according to an embodiment of the present application includes the steps of,
s1, randomly selecting any node as an initial node, sending a broadcast message to count the number of all nodes capable of working normally in the whole network at regular time, and switching p2p communication protocols according to the change of the number, so as to prevent node faults from occurring initially, introduce an election mechanism, ensure that each node of the network has a probability of becoming the initial node, and ensure the decentralization degree of the network.
S2, when the number of nodes changes to reach a threshold value, the communication protocol can be switched, and if the number of nodes belongs to a small-scale or large-scale network at the moment, the applicable protocol is only one, the communication protocol is directly switched; if the communication protocol is of medium scale, there are many communication protocols, usually gossip and kad, one of them is unstructured and one is structured, the kad has the searching function, but the gossip is not, so the application scene is different, at this time, all node democratics vote to determine which protocol to use, the initial node sends voting message and counts, and the protocol selected by most nodes is the final result.
Aiming at block structures with two different sizes of common unfolded block transaction and folded block transaction, the embodiment realizes expandable network transmission;
the embodiment of the application can embody a mechanism for switching communication protocols in two directions, can detect the number of nodes to switch proper protocols when the number of nodes is continuously increased, and can detect and switch the protocols when the number of nodes is reduced. And it detects all nodes that can work properly at the time.
As shown in fig. 2, three different-scale blockchain networks and their common P2P communication protocols are given below, where a small-scale network refers to 1-128 nodes, a medium-scale network refers to 128-1000 nodes, and a large-scale network refers to more than 1000 nodes. The P2P communication protocol that the present scheme can support dynamic handover is not limited to the following list.
For a normal blockchain network communication system, its number of nodes is often dynamically adjusted and in some special cases the number may vary greatly, for example environmental factors cause most nodes of the system to fail to function properly or for promotional reasons a large number of nodes join the network at the same time. At this time, the original communication protocol is not suitable for continuous application, for example, full-connection communication can be adopted in small-scale network running, and at this time, information of all nodes in the network is stored between any node in the network, so that the communication can be directly carried out with any node, and the method is very convenient and fast. However, once the network size becomes large, the number of nodes exceeds 128, the fully connected communication form should not be used continuously, otherwise, each node can bear a considerable storage cost. Thus, a medium-scale network may switch the blockchain network communication protocol to the Gossip protocol, the Kad protocol, or other communication protocols, where each node only stores part of the information of the node, and thus the nodes can only indirectly communicate. Although the communication speed is thus somewhat reduced, the consumption of node storage is also much reduced. When the number of the block chain network nodes continues to increase to more than 1000, in order to ensure that the communication speed is not reduced too much, a certain degree of decentralization can be sacrificed, and a hub-and-spoke network communication protocol is adopted. In this case, there are a plurality of central nodes in the network, each central node is responsible for connecting a part of the common nodes, and then the central nodes are interconnected with each other. The communication mode between the common nodes is that firstly, information is transmitted to the own central node, then the central node transmits the information to other central nodes, and finally, the central nodes distribute the content. The communication protocol adopted by the scheme changes along with the change of the number of the nodes.
The whole workflow of the system is shown in fig. 3, and can be divided into two subprocesses, wherein the first is an initialization process of the block chain network communication system, and the other is a change process of a communication protocol when the system runs.
(1) Initialization process for block chain network communication system
The developer deploys the P2P communication protocol required later to the bottom layer of the blockchain network protocol in the form of preset contracts.
And after compiling and debugging, the system starts to normally run.
Any node in the system is selected as an initial node. According to the time lock set in the preset contract, the initial node broadcasts a counting message to all the nodes connected with the initial node at intervals (which can be named as a counting period), other nodes firstly send a reply message to the initial node after receiving the counting message for the first time, and then forward the counting message to the nodes connected with the initial node. By means of broadcast counting, the initial node can determine the size of the blockchain network, thereby dynamically selecting the appropriate P2P communication protocol.
To prevent the failure of the original node, an election mechanism is introduced. When any node in the system does not receive the counting message for a long time (the time can be set to be twice the time period of the initial node for sending the counting message), the node can broadcast a counting message to the whole network by itself and attach the sending time after the message. If it then receives a reply message for the whole network and does not receive other counting messages that are sent earlier than it sent by itself, then the node elects the initial node to succeed. Otherwise, the election fails. The election mechanism can only be started if all nodes in the system do not receive a counting message for more than one counting period.
(2) Change process for system runtime communication protocol
The initial node counts the number of received reply messages and discovers the change of the scale of the block chain network.
If the network is changed to a small-scale network, the network is changed to a full-connection protocol: if the network is changed to a large-scale network, the protocol is changed to a hub-and-spoke network protocol: if changed to a medium-scale network, the protocols selectable by the scale network include, but are not limited to, gossip or Kad, which each have respective advantages and disadvantages that allow all nodes to vote individually, electing the communication protocol they consider most suitable by way of multiple signatures.
The voting mode is that the initial node broadcasts a communication protocol voting message to the whole network, each node needs to reply to the communication protocol supported by the initial node in a signature mode after receiving the message, and the protocol supported by the most nodes in the reply message received by the initial node in the set time is selected as the P2P communication protocol adopted by the blockchain network in the later time.
And correctly changing the communication protocol according to the information of the preset contract deployment.
(3) Different scale networks enable scalable network transport for folded and unfolded block structures.
The block transaction folding method reduces the data size of each transaction according to the data structure of the transaction. The transaction hash is typically 32 bytes in size and can be replaced with a chunk height and transaction index.
When verifying the folded transaction, the transaction hash can be queried from the blockchain according to the block height and the transaction index, each transaction in the block comprises the transaction hash, the addresses of a sender and a receiver, and the like, the block transaction folding method can use the block height and the transaction index to represent one transaction hash, and the block transaction folding method is shown in fig. 4.
The different-scale network realizes the expandable network transmission aiming at the block structures with two different sizes of common unfolded block transaction and folded block transaction. The different types of blocks are distinguished by version numbers.
In summary, the communication protocol switching method for multi-scale blockchain network according to the present application analyzes the existing blockchain network communication system to find out that the existing communication system has pain points where P2P communication protocol selection is single, fixed, not adaptive to the great variation of node proficiency, and the communication effect is easily affected by the number of nodes, and for these pain points, a blockchain network system design and communication protocol dynamic switching mechanism of different scales is provided to solve the above pain points, so as to realize efficient, convenient and stable blockchain network communication. Different P2P network protocols are coded and deployed on the bottom layer of the blockchain network through preset contracts, and for core developers of the blockchain community, the core developers only need to compile and debug all codes before the system formally operates, so that secondary development is not needed; for a server running node software, the shutdown is not needed to replace the software package; for the whole blockchain network communication system, because a newly developed software package is not required to be loaded in the operation process, the system is not required to be suspended midway, the long-term stable operation of the communication network is ensured, chain bifurcation caused by community bifurcation is avoided, and the safety of the system is ensured. In order to make the P2P communication protocol dynamic switching process public, transparent, credible, traceable and controllable, a time lock and multiple signatures are introduced, and meanwhile, the treatment process is recorded on a chain.
In yet another aspect, the application also discloses a computer readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of any of the methods described above.
In yet another aspect, the application also discloses a computer device comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of any of the methods described above.
In a further embodiment of the present application, there is also provided a computer program product containing instructions which, when run on a computer, cause the computer to perform the steps of any of the methods of the above embodiments.
It may be understood that the system provided by the embodiment of the present application corresponds to the method provided by the embodiment of the present application, and explanation, examples and beneficial effects of the related content may refer to corresponding parts in the above method.
Those skilled in the art will appreciate that all or part of the processes in the methods of the above embodiments may be implemented by a computer program for instructing relevant hardware, where the program may be stored in a non-volatile computer readable storage medium, and where the program, when executed, may include processes in the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above embodiments are only for illustrating the technical solution of the present application, and are not limiting; although the application has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A communication protocol switching method for a multi-scale blockchain network is characterized by comprising the following steps of,
s01, randomly selecting any node as an initial node, sending a broadcast message to count the number of all nodes capable of working normally in the whole network at regular time, and switching p2p communication protocols according to the change of the number of the nodes;
s02, when the number of nodes changes to reach a threshold value, switching the communication protocol, and if the number of nodes belongs to a small-scale network or a large-scale network at the moment, directly switching; if the network belongs to the medium-scale network, determining which protocol is adopted by all node democratic votes, sending voting information by an initial node, counting, and taking the protocol with the largest votes as a final result;
aiming at two block structures with different sizes of common unfolded block transaction and folded block transaction, the different-scale network realizes expandable network transmission;
wherein, the small-scale network refers to a network of 1-128 nodes, the medium-scale network refers to a network of 128-1000 nodes, and the large-scale network refers to a network of more than 1000 nodes.
2. The communication protocol switching method for a multi-scale blockchain network of claim 1, wherein: in the step S01, in order to prevent node failure from occurring initially, an election mechanism is introduced to ensure that each node of the network has a probability of becoming an initial node.
3. The communication protocol switching method for a multi-scale blockchain network of claim 1, wherein: in step S02, when the blockchain network uses full-connection communication to run in the small-scale network, information of all nodes in the network is stored between any node in the network, and the blockchain network can directly communicate with any node.
4. The communication protocol switching method for a multi-scale blockchain network of claim 1, wherein: in step S02, when the number of the blockchain network nodes exceeds 128, the blockchain network communication protocol is switched to the Gossip protocol or the Kad protocol, and each node only stores the information of part of the nodes, so that the nodes can only indirectly communicate.
5. The communication protocol switching method for a multi-scale blockchain network of claim 1, wherein: in step S02, when the number of the blockchain network nodes continues to increase to more than 1000, adopting a hub-spoke network communication protocol, wherein a plurality of center nodes exist in the network, each center node is responsible for connecting common nodes of a designated part, and then the center nodes are mutually interconnected;
the communication mode between the common nodes is that firstly, information is transmitted to the own central node, then the central node transmits the information to other central nodes, and finally, the central nodes distribute the content.
6. The communication protocol switching method for a multi-scale blockchain network of claim 2, wherein: the election mechanism is as follows:
when any node in the system does not receive the counting message when reaching the set time, the node can broadcast a counting message to the whole network by itself and attach the sending time after the message;
if it receives the reply message of the whole network and does not receive other counting messages which are earlier than the sending time of the node, the node election initial node is successful; otherwise, the election fails;
the election mechanism can only be started if all nodes in the system do not receive a counting message for more than one counting period.
7. A communication protocol switching method for a multi-scale blockchain network, characterized by: comprises the steps of,
s11, initializing a block chain network communication system;
s12, a communication protocol changing process when the block chain network communication system operates;
the initialization process of the block chain network communication system specifically comprises the following steps:
the developer deploys the P2P communication protocol required subsequently to the bottom layer of the blockchain network protocol in the form of preset contracts;
after compiling and debugging, the system starts to normally run;
selecting any node in the system as an initial node, broadcasting a counting message to all nodes connected with the initial node according to a counting period by the initial node according to a time lock set in a preset contract, sending a reply message to the initial node after other nodes receive the counting message for the first time, and forwarding the counting message to the nodes connected with the initial node;
in order to prevent the fault of the initial node, introducing an election mechanism;
the S12, a changing process of the communication protocol during the operation of the block chain network communication system specifically comprises the following steps:
the initial node counts the number of received reply messages and discovers that the scale of the block chain network is changed;
if the network is changed to a small-scale network, changing to a full-connection protocol; if the network is changed into a large-scale network, changing the protocol into a hub-spoke network protocol; if the network is changed into a medium-scale network, all nodes are respectively voted, and the communication protocol which is considered to be most suitable is elected by the nodes in a multi-signature mode;
and correctly changing the communication protocol according to the information of the preset contract deployment.
8. The communication protocol switching method for a multi-scale blockchain network of claim 7, wherein:
in the step S12, the voting mode is that the initial node broadcasts a communication protocol voting message to the whole network, each node needs to reply to the communication protocol supported by the initial node in a signature mode after receiving the message, and the protocol supported by the most nodes in the reply message received by the initial node in the set time is selected as the P2P communication protocol adopted by the blockchain network in the later time.
9. A computer readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of the method of any one of claims 1 to 8.
10. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method of any of claims 1 to 8.
CN202310507480.XA 2023-05-08 2023-05-08 Communication protocol switching method, medium and device for multi-scale blockchain network Pending CN116582549A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310507480.XA CN116582549A (en) 2023-05-08 2023-05-08 Communication protocol switching method, medium and device for multi-scale blockchain network

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310507480.XA CN116582549A (en) 2023-05-08 2023-05-08 Communication protocol switching method, medium and device for multi-scale blockchain network

Publications (1)

Publication Number Publication Date
CN116582549A true CN116582549A (en) 2023-08-11

Family

ID=87538998

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310507480.XA Pending CN116582549A (en) 2023-05-08 2023-05-08 Communication protocol switching method, medium and device for multi-scale blockchain network

Country Status (1)

Country Link
CN (1) CN116582549A (en)

Similar Documents

Publication Publication Date Title
CN110730204B (en) Method for deleting nodes in block chain network and block chain system
CN114401150B (en) Method for adding node in blockchain network and blockchain system
US11388043B2 (en) System and method for data replication using a single master failover protocol
US20210406279A1 (en) System and method for maintaining a master replica for reads and writes in a data store
CN106407430B (en) A kind of intelligent contract state synchronization method of complexity based on stage bucket
US10248704B2 (en) System and method for log conflict detection and resolution in a data store
US20210243032A1 (en) Sending cross-chain authenticatable messages
US8930312B1 (en) System and method for splitting a replicated data partition
US11385830B2 (en) Data storage method, apparatus and system, and server, control node and medium
EP4213038A1 (en) Data processing method and apparatus based on distributed storage, device, and medium
CN112422341B (en) Fault detection method of block chain network and related equipment
CN111163148B (en) Synchronization method and related equipment for consensus state of block chain system
WO2022121612A1 (en) Information processing method and apparatus for blockchain network, and device and storage medium
WO2023011022A1 (en) Blockchain-based data processing method, and device and computer-readable storage medium
US20230102617A1 (en) Repeat transaction verification method, apparatus, and device, and medium
CN111026767A (en) Data storage method and device of block chain and hardware equipment
US20230370285A1 (en) Block-chain-based data processing method, computer device, computer-readable storage medium
WO2023050986A1 (en) Maintenance of network architecture information of blockchain system
CN113922971A (en) Cross-chain interaction method and device
US20170300553A1 (en) System and methodology for propagating modifications in key-value pairs across a cluster of computers
CN113067897B (en) Cross-chain interaction method and device
CN113259454B (en) Cross-chain interaction method and device
CN109067849B (en) Block-based data synchronization method
CN114363162A (en) Block chain log generation method and device, electronic equipment and storage medium
CN111526165B (en) Consensus method and system in alliance chain

Legal Events

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