CN109379396B - Method, medium, device and block chain system for preventing hard branching phenomenon in block chain system - Google Patents

Method, medium, device and block chain system for preventing hard branching phenomenon in block chain system Download PDF

Info

Publication number
CN109379396B
CN109379396B CN201810969344.1A CN201810969344A CN109379396B CN 109379396 B CN109379396 B CN 109379396B CN 201810969344 A CN201810969344 A CN 201810969344A CN 109379396 B CN109379396 B CN 109379396B
Authority
CN
China
Prior art keywords
node
blockchain system
production
current
block chain
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810969344.1A
Other languages
Chinese (zh)
Other versions
CN109379396A (en
Inventor
吴胜文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ke'an Xiamen Technology Co ltd
Original Assignee
Tailian Xiamen Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tailian Xiamen Technology Co ltd filed Critical Tailian Xiamen Technology Co ltd
Priority to CN201810969344.1A priority Critical patent/CN109379396B/en
Publication of CN109379396A publication Critical patent/CN109379396A/en
Application granted granted Critical
Publication of CN109379396B publication Critical patent/CN109379396B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • 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/1044Group management mechanisms 
    • H04L67/1048Departure or maintenance mechanisms
    • 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
    • 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/1061Peer-to-peer [P2P] networks using node-based peer discovery mechanisms
    • H04L67/1065Discovery involving distributed pre-established resource-based relationships among peers, e.g. based on distributed hash tables [DHT] 
    • 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/1074Peer-to-peer [P2P] networks for supporting data block transmission mechanisms
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • H04L41/082Configuration setting characterised by the conditions triggering a change of settings the condition being updates or upgrades of network functionality

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Theoretical Computer Science (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a method, a medium, a device and a block chain system for preventing hard branching phenomenon in the block chain system; the method comprises the following steps: when the production node produces the current block, the total number N of the current online nodes is obtained, and the current block produced by the production node is numbered; analyzing the content of the mth block to obtain the total number Nm of the online nodes of the blockchain system in the mth block during production; acquiring a difference value between Nm and N, and judging whether the difference value is less than N/2; if the difference is smaller than N/2, controlling to continue the current block production; if the difference is more than or equal to N/2, controlling to stop the current block production, and broadcasting the block chain system to be in an unavailable state through the current production node; therefore, the hard branching phenomenon of the block chain system caused by the block chain system is prevented by monitoring the number of the online nodes in the block chain system, judging the upgrading condition of the system according to the number of the online nodes and controlling the state of the block chain system according to the judgment.

Description

Method, medium, device and block chain system for preventing hard branching phenomenon in block chain system
Technical Field
The present invention relates to the field of blockchain technologies, and in particular, to a method, medium, apparatus, and blockchain system for preventing hard forking in a blockchain system.
Background
The block chain system is a technical scheme for maintaining a reliable database in a decentralized and distrust-free mode; the method is widely applied due to the characteristics of decentralization, distrust and difficult data tampering.
In the existing blockchain system, when the blockchain system needs to perform function expansion or other requirements need to upgrade the composed nodes, the situation that part of the nodes do not accept upgrading often occurs, so that the part of the nodes which do not accept upgrading still perform block production on the old blockchain system, and the upgraded nodes perform block production on a new blockchain system, so that the blockchain system is hard to diverge, and further, the existence of two versions of the system causes users to be shunted.
Disclosure of Invention
The present invention is directed to solving, at least to some extent, one of the technical problems in the art described above. Therefore, an object of the present invention is to provide a method for preventing hard bifurcation in a blockchain system, which can prevent the hard bifurcation of the blockchain system caused by the blockchain system by monitoring the number of online nodes in the blockchain system, determining the upgrade status of the system according to the number of online nodes, and controlling the state of the blockchain system according to the determination.
A second object of the invention is to propose a computer-readable storage medium.
A third objective of the present invention is to provide a device for preventing hard bifurcation in a blockchain system.
A fourth objective of the present invention is to provide a block chain system.
In order to achieve the above object, a first embodiment of the present invention provides a method for preventing hard forking in a block chain system, including the following steps: when a production node in the block chain system carries out current block production, acquiring the total number N of current online nodes of the block chain system, and numbering the current block produced by the production node; analyzing the content of the mth block to obtain the total number Nm of online nodes of the block chain system when the mth block is produced, wherein m is u-i, u is the number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers; acquiring a difference value between Nm and N, and judging whether the difference value is less than N/2; if the difference is smaller than N/2, controlling the current production node to continue to perform the current block production; and if the difference is more than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the current block chain system in an unavailable state through the current production node in the whole network.
According to the method for preventing the hard bifurcation phenomenon in the block chain system, firstly, when a production node in the block chain system carries out current block production, the total number N of current online nodes of the block chain system is obtained, and the current block produced by the production node is numbered; then, analyzing the content of the mth block to obtain the total number Nm of online nodes of the block chain system in the mth block production time zone, wherein m is u-i, u is the number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers; then, acquiring a difference value between Nm and N, and judging whether the difference value is smaller than N/2; then, if the difference value is smaller than N/2, controlling the current production node to continue to perform the current block production; then, if the difference value is larger than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the block chain system in the whole network through the current production node to be in an unavailable state currently; therefore, the hard branching phenomenon of the block chain system caused by the block chain system upgrading is prevented by monitoring the number of the online nodes in the block chain system, judging the upgrading condition of the system according to the number of the online nodes and controlling the state of the block chain system according to the judgment.
In addition, the method for preventing the hard bifurcation in the block chain system proposed by the above embodiment of the present invention may further have the following additional technical features:
optionally, when any node in the blockchain system receives a new node access request, monitoring a connection address of the new node to determine whether the new node is connected to the blockchain system, and performing full-network broadcast when the new node is connected to the blockchain system, so that the production node adds 1 to the total number of online nodes of the blockchain system.
Optionally, the address of each node in the blockchain system is monitored to determine whether there is an offline node in the blockchain system, and the block chain system is broadcasted over the whole network when there is any offline node, so that the production node subtracts 1 from the total number of online nodes in the blockchain system.
Optionally, when any node in the blockchain system receives the broadcast that the blockchain system is currently in the unavailable state, the node enters into the sleep state.
In order to achieve the above object, a second aspect of the present invention provides a computer-readable storage medium, on which a program for preventing a hard branch phenomenon in a block chain system is stored, where the program for preventing a hard branch phenomenon in a block chain system is executed by a processor to implement the above method for preventing a hard branch phenomenon in a block chain system.
In order to achieve the above object, a third embodiment of the present invention provides an apparatus for preventing hard bifurcation in a blockchain system, including: the acquisition module is used for acquiring the total number N of the current online nodes of the block chain system and numbering the current blocks produced by the production nodes when the production nodes in the block chain system produce the current blocks; the analysis module is used for analyzing the content of the mth block to obtain the total number Nm of online nodes of the block chain system when the mth block is produced, wherein m is u-i, u is the serial number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers; the control module is used for acquiring a difference value between Nm and N and judging whether the difference value is smaller than N/2, wherein if the difference value is smaller than N/2, the current production node is controlled to continue to carry out current block production; and if the difference is more than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the current block chain system in an unavailable state through the current production node in the whole network.
According to the device for preventing the hard bifurcation phenomenon in the block chain system, the obtaining module is used for obtaining the total number N of the current online nodes of the block chain system and numbering the current block produced by the production nodes when the production nodes in the block chain system produce the current block; the analysis module is used for analyzing the content of the mth block to obtain the total number Nm of online nodes of the block chain system in the mth block production time, wherein m is u-i, u is the number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers; the control module is used for acquiring a difference value between the Nm and the N and judging whether the difference value is smaller than N/2, wherein if the difference value is smaller than N/2, the current production node is controlled to continue to carry out current block production; if the difference is larger than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the block chain system in the whole network through the current production node to be in an unavailable state currently; therefore, the hard branching phenomenon of the block chain system caused by the block chain system upgrading is prevented by monitoring the number of the online nodes in the block chain system, judging the upgrading condition of the system according to the number of the online nodes and controlling the state of the block chain system according to the judgment.
In addition, the device for preventing the hard bifurcation in the block chain system proposed by the above embodiment of the present invention may further have the following additional technical features:
optionally, the obtaining module is further configured to, when any one node in the blockchain system receives a new node access request, monitor a connection address of the new node to determine whether the new node is connected to the blockchain system, and perform full-network broadcast when the new node is connected to the blockchain system, so that the production node adds 1 to the total number of online nodes in the blockchain system.
Optionally, the obtaining module is further configured to monitor an address of each node in the blockchain system to determine whether an offline node exists in the blockchain system, and perform full-network broadcast when any offline node exists in the blockchain system, so that the production node performs a subtraction operation of 1 from a total number of online nodes in the blockchain system.
Optionally, when any node in the blockchain system receives the broadcast that the blockchain system is currently in the unavailable state, the node enters into the sleep state.
In order to achieve the above object, a fourth aspect of the present invention provides a blockchain system, which includes the above apparatus for preventing hard branching phenomenon in the blockchain system.
Drawings
FIG. 1 is a flowchart illustrating a method for preventing hard forking in a blockchain system according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating an online node statistical method according to an embodiment of the present invention;
fig. 3 is a block diagram illustrating an apparatus for preventing hard bifurcation in a blockchain system according to an embodiment of the present invention.
Detailed Description
Reference will now be made in detail to embodiments of the present invention, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are illustrative and intended to be illustrative of the invention and are not to be construed as limiting the invention.
In the existing block chain system, when the block chain system needs to be subjected to function expansion or other requirements need to upgrade the composed nodes, the hard branching phenomenon of the block chain system is often caused; according to the method for preventing the hard bifurcation phenomenon in the block chain system, firstly, when a production node in the block chain system carries out current block production, the total number N of current online nodes of the block chain system is obtained, and the current block produced by the production node is numbered; then, analyzing the content of the mth block to obtain the total number Nm of online nodes of the block chain system in the mth block production time zone, wherein m is u-i, u is the number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers; then, acquiring a difference value between Nm and N, and judging whether the difference value is smaller than N/2; then, if the difference value is smaller than N/2, controlling the current production node to continue to perform the current block production; then, if the difference value is larger than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the block chain system in the whole network through the current production node to be in an unavailable state currently; therefore, the hard branching phenomenon of the block chain system caused by the block chain system upgrading is prevented by monitoring the number of the online nodes in the block chain system, judging the upgrading condition of the system according to the number of the online nodes and controlling the state of the block chain system according to the judgment.
In order to better understand the above technical solutions, exemplary embodiments of the present invention will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the invention are shown in the drawings, it should be understood that the invention can be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the invention to those skilled in the art.
In order to better understand the technical solution, the technical solution will be described in detail with reference to the drawings and the specific embodiments.
Fig. 1 is a flowchart illustrating a method for preventing hard bifurcation in a blockchain system according to an embodiment of the present invention, where the method for preventing hard bifurcation in a blockchain system includes the following steps:
s101, when the production node in the block chain system carries out current block production, the total number N of the current online nodes of the block chain system is obtained, and the current block produced by the production node is numbered.
For example, a query packet is sent to a node connected to the block chain system every preset time by any node in the block chain system to query the state of the node connected to the block chain system, after receiving the query packet, a node number of the block chain system is returned to the sending node, and after receiving the returned node number, the node sending the query packet broadcasts the node number, so that a block chain producer counts the number of the current online nodes according to the broadcasted node number; or, when a new node accesses the system, the intra-system node directly connected to the new node monitors the new node (e.g., ping the ip address of the new node at intervals), and broadcasts the monitoring result over the whole network, so that the producer in the blockchain system can count the number of the current online nodes.
And S102, analyzing the content of the mth block to obtain the total number Nm of online nodes of the block chain system in the mth block production time zone, wherein m is u-i, u is the number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers.
That is, when the production node produces the u-th block, the content of the m-th block is analyzed to obtain the total number Nm of online nodes of the blockchain system in the m-th block production; and m is u-i, u is the number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers.
As an example, when a producer corresponding to the u-th block in the block chain system generates, or when the production condition of the u-th block is reached, that is, the u-th block is to be produced; a producer corresponding to the u block obtains m by inquiring a system preset variable i and calculating according to the preset variable i and the current block number u, and analyzes the m block according to m to obtain the total number Nm of online nodes of the block chain system in the m block production time zone; so as to judge the system status of the blockchain in the following process according to the Nm and the total number of online nodes of the current blockchain.
S103, acquiring a difference value between the Nm and the N, and judging whether the difference value is smaller than N/2.
That is, the difference between the total number Nm of online nodes of the blockchain system in the mth blockchain system and the current total number N of online nodes of the blockchain system is calculated, and it is determined whether the difference is smaller than N/2.
And S104, if the difference is smaller than N/2, controlling the current production node to continue to produce the current block.
And S105, if the difference value is larger than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the block chain system in the whole network through the current production node to be in an unavailable state currently.
That is, if the difference between Nm and N is less than N/2, the current production node is controlled to continue to perform the current block production; if the difference value of Nm and N is larger than N/2, controlling the current production node to stop the current block production, and broadcasting the block chain system in the whole network through the current production node to be in an unavailable state currently;
as an example, when any node in the blockchain system with the difference between Nm and N larger than N/2 enters the sleep state to stop the production of the blockchain after receiving the broadcast that the blockchain system is currently in the unavailable state, so as to prevent the occurrence of the blockchain branching phenomenon.
In summary, according to the method for preventing hard forking in the blockchain system of the embodiment of the invention, first, when a current block is produced by a production node in the blockchain system, the total number N of current online nodes of the blockchain system is obtained, and the current block produced by the production node is numbered; then, analyzing the content of the mth block to obtain the total number Nm of online nodes of the block chain system in the mth block production time zone, wherein m is u-i, u is the number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers; then, acquiring a difference value between Nm and N, and judging whether the difference value is smaller than N/2; then, if the difference value is smaller than N/2, controlling the current production node to continue to perform the current block production; then, if the difference value is larger than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the block chain system in the whole network through the current production node to be in an unavailable state currently; therefore, the hard branching phenomenon of the block chain system caused by the block chain system upgrading is prevented by monitoring the number of the online nodes in the block chain system, judging the upgrading condition of the system according to the number of the online nodes and controlling the state of the block chain system according to the judgment.
As shown in fig. 2, in some embodiments, in the method for preventing a hard bifurcation in a blockchain system according to an embodiment of the present invention, when a new node needs to access the blockchain system, the method for preventing a hard bifurcation in the blockchain system further includes the following steps:
s201, receiving an access request of a new node through any node in the block chain system.
That is, after the blockchain system is constructed, a new node that needs to join the blockchain system can initiate an access request to any one node in the blockchain system to link into the blockchain system.
S202, monitoring the connection address of the new node to judge whether the new node is connected to the block chain system.
That is, after receiving an access request initiated by a new node, the blockchain system monitors a connection address of the new node according to the access request to determine whether the new node is connected to the blockchain system.
There are various ways to monitor the connection address of the new node. For example, a node in the blockchain system directly connected to the new node pings a connection ip address of the new node every preset time to determine whether the new node is successfully connected to itself, and after the operation is successful, determines that the new node is successfully connected to itself, and confirms that the new node is connected to the blockchain system; or, firstly, sending a query packet to a node connected with any node in the block chain system at preset time intervals, and then returning a number and an online identifier corresponding to the node to respond to the query packet by the node receiving the query packet; and then, any node which receives the number and the online identification sent by the node broadcasts the number and the online identification all over the network, so that a producer can count the online nodes after receiving the number and the online identification.
As an example, the address of each node in the blockchain system is also monitored to determine whether there is an offline node in the blockchain system, and the full-network broadcast is performed when there is any offline node in the blockchain system, so that the production node subtracts 1 from the total number of online nodes in the blockchain system.
And S203, when the judgment result is yes, performing full-network broadcast on the message of the new node accessing the blockchain system so that the production node adds 1 to the total number of the online nodes of the blockchain system.
That is, when it is determined that a new node is connected to the blockchain system, a message that the new node is connected to the blockchain system is broadcast all over the network, so that the current production node adds 1 to the total number of online nodes after receiving the message to count the total number of online nodes.
In summary, in the method for preventing a hard bifurcation in a blockchain system according to an embodiment of the present invention, first, an access request of a new node is received through any node in the blockchain system; then, monitoring the connection address of the new node to judge whether the new node is connected to the block chain system; then, when the judgment result is yes, performing full-network broadcasting on the message of the new node connected to the blockchain system so that the production node adds 1 to the total number of the online nodes of the blockchain system; therefore, when a new node is added into the block chain system, the current online node is counted, and the subsequent block chain system can conveniently judge the current state.
In order to implement the foregoing embodiment, an embodiment of the present invention further provides a computer-readable storage medium, on which a program for preventing a hard branch phenomenon in a blockchain system is stored, and when executed by a processor, the program for preventing a hard branch phenomenon in a blockchain system implements the method for preventing a hard branch phenomenon in a blockchain system.
As shown in fig. 3, in order to implement the foregoing embodiment, an embodiment of the present invention further provides an apparatus for preventing a hard bifurcation phenomenon in a blockchain system, including: the system comprises an acquisition module 10, a resolution module 20 and a control module 30.
The obtaining module 10 is configured to obtain a total number N of current online nodes of the blockchain system and number a current block produced by a production node every time the production node in the blockchain system performs current block production.
The analyzing module 20 is configured to analyze the content of the mth block to obtain a total number Nm of online nodes of the block chain system in the mth block production time zone, where m is u-i, u is a number of the current block, i is smaller than u and is a preset value, and u, i, and Nm are positive integers.
The control module 30 is configured to obtain a difference between the Nm and the N, and determine whether the difference is smaller than N/2, where if the difference is smaller than N/2, the current production node is controlled to continue to perform current block production; and if the difference is more than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the block chain system in the whole network through the current production node to be in an unavailable state currently.
In summary, according to the apparatus for preventing hard forking in the blockchain system of the embodiment of the invention, the obtaining module is configured to obtain the total number N of the current online nodes of the blockchain system and number the current block produced by the production node each time the production node in the blockchain system performs the current block production; the analysis module is used for analyzing the content of the mth block to obtain the total number Nm of online nodes of the block chain system in the mth block production time, wherein m is u-i, u is the number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers; the control module is used for acquiring a difference value between the Nm and the N and judging whether the difference value is smaller than N/2, wherein if the difference value is smaller than N/2, the current production node is controlled to continue to carry out current block production; if the difference is larger than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the block chain system in the whole network through the current production node to be in an unavailable state currently; therefore, the hard branching phenomenon of the block chain system caused by the block chain system upgrading is prevented by monitoring the number of the online nodes in the block chain system, judging the upgrading condition of the system according to the number of the online nodes and controlling the state of the block chain system according to the judgment.
In some embodiments, in the apparatus for preventing a hard bifurcation in a blockchain system according to an embodiment of the present invention, the obtaining module 10 is further configured to, when any node in the blockchain system receives a new node access request, monitor a connection address of the new node to determine whether the new node is connected to the blockchain system, and perform a full network broadcast when the new node is connected to the blockchain system, so that the production node adds 1 to the total number of online nodes in the blockchain system.
In some embodiments, in the apparatus for preventing a hard bifurcation in a blockchain system according to an embodiment of the present invention, the obtaining module 10 is further configured to monitor an address of each node in the blockchain system to determine whether there is an offline node in the blockchain system, and perform a full network broadcast when there is any offline node in the blockchain system, so that the production node subtracts 1 from a total number of online nodes in the blockchain system.
In some embodiments, in the apparatus for preventing a hard bifurcation in a blockchain system according to an embodiment of the present invention, when any node in the blockchain system receives a broadcast that the blockchain system is currently in an unavailable state, the node enters a sleep state.
It should be noted that the above description of the method for preventing the hard bifurcation in the blockchain system in fig. 1 is also applicable to the apparatus for preventing the hard bifurcation in the blockchain system, and is not repeated herein.
In order to implement the foregoing embodiment, an embodiment of the present invention further provides a blockchain system, including the apparatus for preventing a hard bifurcation phenomenon in the blockchain system.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should be noted that in the claims, any reference signs placed between parentheses shall not be construed as limiting the claim. The word "comprising" does not exclude the presence of elements or steps not listed in a claim. The word "a" or "an" preceding an element does not exclude the presence of a plurality of such elements. The invention may be implemented by means of hardware comprising several distinct elements, and by means of a suitably programmed computer. In the unit claims enumerating several means, several of these means may be embodied by one and the same item of hardware. The usage of the words first, second and third, etcetera do not indicate any ordering. These words may be interpreted as names.
While preferred embodiments of the present invention have been described, additional variations and modifications in those embodiments may occur to those skilled in the art once they learn of the basic inventive concepts. Therefore, it is intended that the appended claims be interpreted as including preferred embodiments and all such alterations and modifications as fall within the scope of the invention.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.
In the description of the present invention, it is to be understood that the terms "first", "second" and the like are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implying any number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present invention, "a plurality" means two or more unless specifically defined otherwise.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above should not be understood to necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made to the above embodiments by those of ordinary skill in the art within the scope of the present invention.

Claims (10)

1. A method for preventing hard forking in a blockchain system, comprising the steps of:
when a production node in the block chain system carries out current block production, acquiring the total number N of current online nodes of the block chain system, and numbering the current block produced by the production node;
analyzing the content of the mth block to obtain the total number Nm of online nodes of the block chain system when the mth block is produced, wherein m = u-i, u is the number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers;
acquiring a difference value between Nm and N, and judging whether the difference value is less than N/2;
if the difference is smaller than N/2, controlling the current production node to continue to perform the current block production;
and if the difference is more than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the current block chain system in an unavailable state through the current production node in the whole network.
2. The method as claimed in claim 1, wherein when any node in the blockchain system receives a new node access request, the connection address of the new node is monitored to determine whether the new node is connected to the blockchain system, and a full-network broadcast is performed when the new node is connected to the blockchain system, so that the production node adds 1 to the total number of online nodes of the blockchain system.
3. The method as claimed in claim 1, wherein the method further comprises monitoring the address of each node in the blockchain system to determine whether there is a drop node in the blockchain system, and performing a full network broadcast when there is any drop node in the blockchain system, so that the production node subtracts 1 from the total number of online nodes in the blockchain system.
4. A method for preventing hard forking in a blockchain system as recited in any one of claims 1-3, wherein a sleep state is entered when any node in the blockchain system receives a broadcast that the blockchain system is currently in an unavailable state.
5. A computer-readable storage medium, having stored thereon a program for preventing a hard bifurcation phenomenon in a blockchain system, the program for preventing a hard bifurcation phenomenon in a blockchain system implementing a method for preventing a hard bifurcation phenomenon in a blockchain system according to any one of claims 1 to 4 when being executed by a processor.
6. An apparatus for preventing hard bifurcation in a blockchain system, comprising:
the acquisition module is used for acquiring the total number N of the current online nodes of the block chain system and numbering the current blocks produced by the production nodes when the production nodes in the block chain system produce the current blocks;
the analysis module is used for analyzing the content of the mth block to obtain the total number Nm of online nodes of the block chain system when the mth block is produced, wherein m = u-i, u is the number of the current block, i is smaller than u and is a preset value, and u, i and Nm are positive integers;
a control module for obtaining a difference between Nm and N and determining whether the difference is less than N/2, wherein,
if the difference is smaller than N/2, controlling the current production node to continue to perform the current block production;
and if the difference is more than or equal to N/2, controlling the current production node to stop the current block production, and broadcasting the current block chain system in an unavailable state through the current production node in the whole network.
7. The apparatus for preventing hard forking in a blockchain system as claimed in claim 6, wherein the acquiring module is further configured to, when any node in the blockchain system receives a new node access request, monitor a connection address of a new node to determine whether the new node is connected to the blockchain system, and perform a full network broadcast when the new node is connected to the blockchain system, so that the production node adds 1 to a total number of online nodes in the blockchain system.
8. The apparatus for preventing hard forking in blockchain system as claimed in claim 6, wherein the obtaining module is further configured to monitor an address of each node in the blockchain system to determine whether there is a drop node in the blockchain system, and perform a full network broadcast when there is any drop node in the blockchain system, so that the production node subtracts 1 from a total number of online nodes in the blockchain system.
9. The apparatus for preventing hard forking in a blockchain system as claimed in any one of claims 6-8, wherein a sleep state is entered when any node in the blockchain system receives a broadcast that the blockchain system is currently in an unavailable state.
10. A blockchain system comprising a means for preventing hard bifurcation in a blockchain system according to any one of claims 6 to 9.
CN201810969344.1A 2018-08-23 2018-08-23 Method, medium, device and block chain system for preventing hard branching phenomenon in block chain system Active CN109379396B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810969344.1A CN109379396B (en) 2018-08-23 2018-08-23 Method, medium, device and block chain system for preventing hard branching phenomenon in block chain system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810969344.1A CN109379396B (en) 2018-08-23 2018-08-23 Method, medium, device and block chain system for preventing hard branching phenomenon in block chain system

Publications (2)

Publication Number Publication Date
CN109379396A CN109379396A (en) 2019-02-22
CN109379396B true CN109379396B (en) 2021-06-29

Family

ID=65404461

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810969344.1A Active CN109379396B (en) 2018-08-23 2018-08-23 Method, medium, device and block chain system for preventing hard branching phenomenon in block chain system

Country Status (1)

Country Link
CN (1) CN109379396B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4221068A1 (en) * 2022-01-31 2023-08-02 Siemens Aktiengesellschaft System and method for writing and retrieval of data in blockchain

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111445247B (en) * 2020-04-09 2021-05-28 堡垒科技有限公司 Method and apparatus for preventing block chain forking
CN112114852B (en) * 2020-09-18 2024-07-19 山大地纬软件股份有限公司 Blockchain node upgrade system and method for avoiding blockchain bifurcation
CN112256798A (en) * 2020-11-03 2021-01-22 公安部第三研究所 Block chain system and method for realizing decentralized block chain data structure and avoiding data bifurcation based on introduction of space coordinates
CN113672680A (en) * 2021-07-19 2021-11-19 哈尔滨工业大学(深圳) Lightweight probability verification method and device in block chain, block chain node and medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106878000A (en) * 2017-03-06 2017-06-20 中钞信用卡产业发展有限公司北京智能卡技术研究院 A kind of alliance's chain common recognition method and system
CN108269090A (en) * 2018-01-19 2018-07-10 中国科学院软件研究所 Based on the common recognition method and apparatus for block catenary system drawn lots at random without negotiation

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10313108B2 (en) * 2016-06-29 2019-06-04 Intel Corporation Energy-efficient bitcoin mining hardware accelerators
JP6825296B2 (en) * 2016-10-11 2021-02-03 富士通株式会社 Edge server and its encrypted communication control method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106878000A (en) * 2017-03-06 2017-06-20 中钞信用卡产业发展有限公司北京智能卡技术研究院 A kind of alliance's chain common recognition method and system
CN108269090A (en) * 2018-01-19 2018-07-10 中国科学院软件研究所 Based on the common recognition method and apparatus for block catenary system drawn lots at random without negotiation

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
比特币区块链分叉研究;王健;《通信技术》;20180110;全文 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP4221068A1 (en) * 2022-01-31 2023-08-02 Siemens Aktiengesellschaft System and method for writing and retrieval of data in blockchain
WO2023144244A1 (en) * 2022-01-31 2023-08-03 Siemens Aktiengesellschaft System and method for writing and retrieval of data in blockchain

Also Published As

Publication number Publication date
CN109379396A (en) 2019-02-22

Similar Documents

Publication Publication Date Title
CN109379396B (en) Method, medium, device and block chain system for preventing hard branching phenomenon in block chain system
CN106685676B (en) Node switching method and device
CN108810100B (en) Method, device and equipment for electing master node
CN110601900B (en) Network fault early warning method and device
CN105679319B (en) Voice recognition processing method and device
CN108924252B (en) Method, medium, and blockchain system for reducing storage load of nodes in blockchain system
CN109347901B (en) Method, medium, device and system for realizing consensus mechanism of block chain system
CN106817250B (en) Dynamic election method and system
CN110275992B (en) Emergency processing method, device, server and computer readable storage medium
CN111355600B (en) Main node determining method and device
CN109660624B (en) Planning method, server and storage medium for content distribution network resources
CN111352799A (en) Inspection method and device
CN110113187B (en) Configuration updating method and device, configuration server and configuration system
CN107395428A (en) Version file upgrade method, device, server and client device
CN111078466B (en) Sensor data loss analysis method and system
CN108965329B (en) Method, medium, device and system for realizing consensus mechanism of block chain system
CN108628901A (en) A kind of data-updating method and device
CN106202084A (en) Date storage method and data storage device
TW200803277A (en) Method used to process multiple continuous Top-k queries
CN109327349B (en) Method, medium, device and system for limiting block chain account during creation
CN109302307B (en) Network host and method for rapidly deploying block chain nodes based on network host
CN113868216B (en) Block chain monitoring method and device
CN111967968B (en) Block chain-based vulnerability processing method and device
CN116225834A (en) Alarm information sending method and device, storage medium and electronic device
CN115712529A (en) Edge intelligent equipment testing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP03 Change of name, title or address

Address after: 361000 B1F-065, Zone A, Huaxun Building, Software Park, Xiamen Torch Hi-tech Zone, Huli District, Xiamen City, Fujian Province

Patentee after: Ke'an (Xiamen) Technology Co.,Ltd.

Address before: B1f-065, zone a, Huaxun building, software park, torch hi tech Zone, Xiamen City, Fujian Province, 361000

Patentee before: TAILIAN (XIAMEN) TECHNOLOGY Co.,Ltd.

CP03 Change of name, title or address