CN113254264B - Data backup method and device for blockchain and storage medium - Google Patents

Data backup method and device for blockchain and storage medium Download PDF

Info

Publication number
CN113254264B
CN113254264B CN202110401426.8A CN202110401426A CN113254264B CN 113254264 B CN113254264 B CN 113254264B CN 202110401426 A CN202110401426 A CN 202110401426A CN 113254264 B CN113254264 B CN 113254264B
Authority
CN
China
Prior art keywords
node
backup
data
contract
backup node
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
CN202110401426.8A
Other languages
Chinese (zh)
Other versions
CN113254264A (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.)
Zhuo Erzhi Lian Wuhan Research Institute Co Ltd
Original Assignee
Zhuo Erzhi Lian Wuhan Research Institute 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 Zhuo Erzhi Lian Wuhan Research Institute Co Ltd filed Critical Zhuo Erzhi Lian Wuhan Research Institute Co Ltd
Priority to CN202110401426.8A priority Critical patent/CN113254264B/en
Publication of CN113254264A publication Critical patent/CN113254264A/en
Application granted granted Critical
Publication of CN113254264B publication Critical patent/CN113254264B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • G06F11/1402Saving, restoring, recovering or retrying
    • G06F11/1446Point-in-time backing up or restoration of persistent data
    • G06F11/1458Management of the backup or restore process
    • G06F11/1464Management of the backup or restore process for networked environments
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload
    • 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/1097Protocols in which an application is distributed across nodes in the network for distributed storage of data in networks, e.g. transport arrangements for network file system [NFS], storage area networks [SAN] or network attached storage [NAS]
    • 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

Abstract

The application discloses a data backup method of a block chain, which comprises the following steps: the main node in the blockchain performs positive sequence ordering based on at least one of the online time length, the disconnection rate and the data synchronization accuracy rate of the at least one backup node, and confirms that the at least one backup node arranged at the forefront is the first backup node; the master node determining a first contract between the master node and the first backup node; the master node sending first data to the first backup node based on the first contract; the first data is used for backing up the first data by the first backup node. The application also discloses a data backup device and a storage medium of the blockchain, and the data security can be improved through the data backup method, the device and the storage medium of the blockchain.

Description

Data backup method and device for blockchain and storage medium
Technical Field
The present disclosure relates to the field of blockchain technologies, and in particular, to a method and an apparatus for backing up blockchain data, and a storage medium.
Background
In a distributed storage system of a blockchain, an interstellar file system (Inter Planetary File System, IPFS) is generally used for data storage, and important data is backed up in a certain node; there is still a possibility that data stored at a single node may be lost. If a single node fails, the corresponding data may not be found, and an exception may be generated. Therefore, how to improve the security of the backup data is a technical problem to be solved.
Disclosure of Invention
The embodiment of the application provides a data backup method, device and storage medium for a blockchain, which can improve the safety of backup data in the blockchain.
The technical scheme of the embodiment of the application is realized as follows:
in a first aspect, the present application provides a method for backing up data of a blockchain, including:
a main node in the block chain determines a first backup node based on behavior information corresponding to at least one backup node;
the master node determining a first contract between the master node and the first backup node;
the master node sending first data to the first backup node based on the first contract; the first data is used for backing up the first data by the first backup node.
In the above solution, the determining, by the master node in the blockchain, the first backup node based on behavior information corresponding to at least one backup node includes:
and the master node performs positive sequence ordering based on at least one of the online time length, the disconnection rate and the data synchronization accuracy rate of the at least one backup node, and confirms that the at least one backup node arranged at the forefront is the first backup node.
In the above scheme, the method further comprises:
The master node sends first request information to the first backup node; the first request information is used for requesting backup information of the first backup node; the backup information of the first backup node at least comprises data information corresponding to the first backup node and behavior information corresponding to the first backup node;
and determining whether data backup can be performed between the main node and the first backup node based on the backup information of the first backup node.
In the above solution, the determining, by the master node, the first contract includes:
the master node sending the first contract encrypted using a first key to the first backup node;
receiving the first contract encrypted using a second key; the first contract encrypted by the second key comprises the establishment time of the first contract and the duration interval of the first contract;
the master node sending the first data to the first backup node based on the first contract for a duration interval of the first contract;
the first key and the second key are key pairs.
In the above solution, the sending, by the master node, first data to the first backup node based on the first contract includes:
Under the condition that the master node needs to backup data, the master node stores the first data needing to be backed up into the first contract, generates a second contract and sends the second contract encrypted based on a first key to the first backup node;
and if the first backup node confirms to backup the first data, the master node receives the second contract encrypted based on a second key.
In the above scheme, the method further comprises one of the following steps:
a third node confirms whether the hash value of the first data at the main node is the same as the hash value of the first data at the first backup node; if the hash value of the first data at the main node is different from the hash value of the first data at the first backup node, replacing the first backup node by using a second backup node;
the third node confirms the online time length of the first backup node; if the online time length of the first backup node is smaller than a first threshold value, replacing the first backup node by using a second backup node;
the third node confirms the disconnection rate of the first backup node; if the disconnection rate of the first backup node is greater than or equal to a second threshold value, replacing the first backup node by using a second backup node;
Wherein the third node comprises nodes on the blockchain other than the primary node and the first backup node.
In a second aspect, an embodiment of the present application provides a data backup method for a blockchain, including:
the method comprises the steps that a first backup node sends backup information of the first backup node to a main node based on first request information sent by the main node;
the first backup node determining a first contract between the primary node and the first backup node;
the first backup node receives first data sent by the master node based on the first contract.
In the above solution, the determining, by the first backup node, the first contract includes:
receiving a first contract encrypted by using a first key sent by a master node;
if the first backup node agrees with the first contract, the first backup node sends the first contract encrypted by using the second key to the master node;
the first backup node receives first data sent by the master node based on the first contract in a duration region of the first contract; and/or the first backup node stores the first data sent by the main node;
The first key and the second key are key pairs.
In the above solution, the receiving, by the first backup node, the first data sent by the primary node based on the first contract includes:
receiving the second contract encrypted based on the first key; the second contract includes the first data and the first contract;
if the first backup node confirms to backup the first data, the first backup node sends the second contract encrypted based on a second key to the master node;
the first backup node stores the first data.
In a third aspect, an embodiment of the present application provides a data backup apparatus for a blockchain, the apparatus including:
the first determining unit is used for determining a first backup node based on behavior information corresponding to at least one backup node; determining a first contract between the primary node and the first backup node;
a first sending unit, configured to send first data to the first backup node based on the first contract; the first data is used for backing up the first data by the first backup node.
In a fourth aspect, an embodiment of the present application provides a data backup apparatus for a blockchain, the apparatus including:
The second sending unit is used for sending the backup information of the first backup node to the main node based on the first request information sent by the main node;
a second determining unit configured to determine a first contract between the primary node and the first backup node;
and the second receiving unit is used for receiving the first data sent by the master node.
In a fifth aspect, an embodiment of the present application provides a storage medium storing an executable program, where the executable program, when executed by a processor, implements a blockchain data backup method executed by the blockchain data backup device described above.
In a sixth aspect, an embodiment of the present application provides a data backup device for a blockchain, where the data backup device for a blockchain causes a processor to execute the data backup device for a blockchain.
According to the data backup method, the data backup device and the storage medium of the blockchain, a main node in the blockchain determines a first backup node based on behavior information corresponding to at least one backup node; the master node determining a first contract between the master node and the first backup node; the master node sending first data to the first backup node based on the first contract; the first data is used for backing up the first data by the first backup node. Thus, the security of the backup data can be improved. .
Drawings
FIG. 1 is a schematic flow chart of an alternative method for backing up data of a blockchain according to an embodiment of the present disclosure;
FIG. 2 is a schematic flow chart of another alternative method for backing up data of a blockchain according to the embodiments of the present application;
FIG. 3 is a schematic flow chart of a block chain data backup method according to an embodiment of the present disclosure;
FIG. 4 is a schematic flow chart of an alternative method for backing up data of a blockchain according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of an alternative architecture of a master node in a blockchain provided in an embodiment of the present application;
FIG. 6 is a schematic diagram of an alternative architecture of a first backup node in a blockchain provided in an embodiment of the present application;
fig. 7 is a schematic diagram of a hardware composition structure of a data backup device of a blockchain according to an embodiment of the present application.
Detailed Description
The present application will be described in further detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
In a blockchain distributed storage system, IPFS techniques are typically used, but there is still a possibility that data stored at a single node may be lost. If a single node fails, the system may fail to find the corresponding data, resulting in an exception.
In particular, in existing IPFS systems, a backup method is generally adopted, where data is directly backed up locally on a distributed server, or the data is individually and centrally backed up in a new server. However, the backup methods have defects, and once the backup node fails, the security of the whole system is affected.
The application provides a data backup method of a block chain, which can solve the technical problems and disadvantages which cannot be solved in the prior art.
Fig. 1 is a schematic flow chart of an alternative data backup method of a blockchain according to an embodiment of the present application, and will be described according to various steps.
Step S101, the master node in the blockchain performs positive sequence ordering based on at least one of the online time length, the disconnection rate and the data synchronization accuracy rate of the at least one backup node, and confirms that the at least one backup node arranged at the forefront is the first backup node.
In some embodiments, a primary node in the blockchain determines a first backup node based on behavior information corresponding to at least one backup node. The behavior information corresponding to the at least one backup node may at least include: at least one of the online time length, the disconnection rate and the data synchronization accuracy of the backup node; the first backup node comprises at least one backup node.
In some embodiments, the master node performs positive sequence ordering based on at least one of an online time length, a disconnection rate and a data synchronization accuracy rate of the at least one backup node, and confirms that the at least one backup node arranged at the forefront is the first backup node.
And in specific implementation, the master node performs weighted summation on the online time length, the disconnection rate and the data synchronization accuracy rate of the at least one backup node, confirms the comprehensive value and performs positive sequence ordering on the at least one backup node based on the comprehensive value. The weight factors of the online time length, the disconnection rate and the correct rate of data synchronization are completely different or not completely the same.
In a specific implementation, the master node may further determine a first backup node based on the importance level of the data to be backed up. For example, if the data to be backed up is important data, at least one backup node with a comprehensive value greater than a first value is confirmed as the first backup node (for example, at least one backup node with a comprehensive value greater than the first value is a backup node located in the first bit to the a-th bit); if the data to be backed up is general important data, confirming that the comprehensive value is smaller than or equal to a first value and at least one backup node larger than a second value is the first backup node (for example, the first value is smaller than or equal to the first value and the at least one backup node larger than the second value is the backup node located between the a+1th bit and the b-th bit); if the data to be backed up is non-important data, at least one backup node with the integrated value smaller than or equal to the second value and larger than the third value is confirmed to be the first backup node (for example, at least one backup node with the integrated value smaller than or equal to the second value and larger than the third value is a backup node located between the b+1th bit and the c-th bit). Wherein a, b and c are positive integers; a is less than b and less than c.
Step S102, the master node determines a first contract between the master node and the first backup node.
In some embodiments, a master node in the blockchain determines a first contract between the master node and the first backup node.
In implementation, the master node sends first request information to the first backup node; the first request information is used for requesting backup information of the first backup node; the backup information of the first backup node at least comprises data information corresponding to the first backup node and behavior information corresponding to the first backup node; and determining whether data backup can be performed between the main node and the first backup node based on the backup information of the first backup node.
If it is confirmed that the data backup can be performed between the master node and the first backup node, the method further includes:
the master node sending the first contract encrypted using a first key to the first backup node; receiving the first contract encrypted by using a second key sent by the first backup node; the first contract encrypted by the second key comprises the establishment time of the first contract and the duration interval of the first contract; the master node sending the first data to the first backup node based on the first contract for a duration interval of the first contract; the first key and the second key are key pairs.
Step S103, the master node sends first data to the first backup node based on the first contract.
In some embodiments, the primary node sends first data to the first backup node based on the first contract; the first data is used for backing up the first data by the first backup node.
When the method is implemented, under the condition that the master node needs to backup data, the master node stores the first data needing to be backed up into the first contract, generates a second contract, and sends the second contract encrypted based on a first key to the first backup node; and if the first backup node confirms to backup the first data, the master node receives the second contract encrypted based on a second key.
Optionally, in a first time interval after the master node receives the second contract encrypted based on the second key, the master node may further send third data to the first backup node; accordingly, the first backup node directly backs up the third data.
Thus, by the data backup method of the blockchain provided by the embodiment of the application, the master node in the blockchain determines the first backup node based on the behavior information corresponding to at least one backup node; the master node determining a first contract between the master node and the first backup node; the master node sending first data to the first backup node based on the first contract; the first data is used for the first backup node to backup the first data; the security of data backup in the IPFS system is improved, in the flow of data backup, the main node and the first backup node execute data backup based on the first contract, external intervention is reduced, and meanwhile, the probability of tampering data by malicious nodes can be avoided.
Fig. 2 is a schematic flow chart of another alternative data backup method of a blockchain according to an embodiment of the present application, and will be described according to the steps.
In step S201, the first backup node sends backup information of the first backup node to the master node based on the first request information sent by the master node.
In some embodiments, the first backup node receives first request information sent by the primary node; the first request information is used for requesting backup information of the first backup node. The backup information of the first backup node at least comprises data information corresponding to the first backup node and behavior information corresponding to the first backup node; the behavior information corresponding to the first backup node may at least include: and one of the online time length, the disconnection rate and the data synchronization accuracy rate of the first backup node.
If the master node determines that data backup is enabled between the master node and the first backup node, the method further includes step S202.
In step S202, a first backup node determines a first contract between the primary node and the first backup node.
In some embodiments, the first backup node receives a first contract sent by the primary node encrypted using a first key; if the first backup node agrees with the first contract, the first backup node sends the first contract encrypted by using the second key to the master node; the first backup node receives first data sent by the master node based on the first contract in a duration region of the first contract; and/or the first backup node stores the first data sent by the main node; the first key and the second key are key pairs.
In step S203, the first backup node receives the first data sent by the master node based on the first contract.
In some embodiments, the first backup node receives the first data sent by the primary node based on the first contract and stores the first data.
In particular implementations, the first backup node receives the second contract encrypted based on a first key; the second contract includes the first data and the first contract; if the first backup node confirms to backup the first data, the first backup node sends the second contract encrypted based on a second key to the master node; the first backup node stores the first data.
Thus, by the data backup method of the blockchain provided by the embodiment of the application, the first backup node sends the backup information of the first backup node to the master node based on the first request information sent by the master node; a first backup node determines a first contract between the primary node and the first backup node; the first backup node receives first data sent by the main node based on the first contract; the security of data backup in the IPFS system is improved, in the flow of data backup, the main node and the first backup node execute data backup based on the first contract, external intervention is reduced, and meanwhile, the probability of tampering data by malicious nodes can be avoided.
Fig. 3 is a schematic flow chart of another alternative data backup method of a blockchain according to an embodiment of the present application, and will be described according to the steps.
In step S301, a primary node in the blockchain determines a first backup node based on behavior information corresponding to at least one backup node.
In some embodiments, a primary node in the blockchain determines a first backup node based on behavior information corresponding to at least one backup node. The behavior information corresponding to the at least one backup node may at least include: at least one of the online time length, the disconnection rate and the data synchronization accuracy of the backup node; the first backup node comprises at least one backup node.
In some embodiments, the master node performs positive sequence ordering based on at least one of an online time length, a disconnection rate and a data synchronization accuracy rate of the at least one backup node, and confirms that the at least one backup node arranged at the forefront is the first backup node.
In specific implementation, the master node performs weighted summation on the online time length, the disconnection rate and the data synchronization accuracy rate of the at least one backup node, and performs positive sequence ordering on the at least one backup node based on the weighted summation result. The weight factors of the online time length, the disconnection rate and the correct rate of data synchronization are completely different or not completely the same.
In step S302, the master node sends first request information to the first backup node.
In some embodiments, the first request information is used to request backup information of the first backup node; the backup information of the first backup node at least comprises data information corresponding to the first backup node and behavior information corresponding to the first backup node; and determining whether data backup can be performed between the main node and the first backup node based on the backup information of the first backup node.
In step S303, the first backup node sends backup information of the first backup node to the master node based on the first request information sent by the master node.
In some embodiments, the first backup node receives first request information sent by the primary node; the first request information is used for requesting backup information of the first backup node. The behavior information corresponding to the first backup node may at least include: and one of the online time length, the disconnection rate and the data synchronization accuracy rate of the first backup node.
Step S304, the first contract is confirmed between the primary node and the first backup node.
In some embodiments, the first contract is interactively validated between the primary node and the first backup node.
In specific implementation, the master node sends the first contract encrypted by using a first key to the first backup node; if the first backup node agrees with the first contract, the first backup node sends the first contract encrypted by using the second key to the master node; the master node receives the first contract encrypted by using the second key, which is sent by the first backup node; the first contract encrypted by the second key comprises the establishment time of the first contract and the duration interval of the first contract; the master node sending the first data to the first backup node based on the first contract for a duration interval of the first contract; the first key and the second key are key pairs.
Step S305, the master node sends first data to the first backup node based on the first contract.
In some embodiments, the primary node sends first data to the first backup node based on the first contract; the first data is used for backing up the first data by the first backup node.
When the method is implemented, under the condition that the master node needs to backup data, the master node stores the first data needing to be backed up into the first contract, generates a second contract, and sends the second contract encrypted based on a first key to the first backup node; and if the first backup node confirms to backup the first data, the master node receives the second contract encrypted based on a second key.
Optionally, in a first time interval after the master node receives the second contract encrypted based on the second key, the master node may further send third data to the first backup node; accordingly, the first backup node directly backs up the third data.
In step S306, the first backup node receives the first data sent by the master node based on the first contract.
In some embodiments, the first backup node receives the first data sent by the primary node based on the first contract and stores the first data.
In particular implementations, the first backup node receives the second contract encrypted based on a first key; the second contract includes the first data and the first contract; if the first backup node confirms to backup the first data, the first backup node sends the second contract encrypted based on a second key to the master node; the first backup node stores the first data.
In some alternative embodiments, the method may further comprise:
in step S307, the third node monitors the first backup node.
In some embodiments, the third node comprises a node on a blockchain other than the primary node and the first backup node.
When the method is implemented, the third node confirms whether the hash value of the first data at the main node is the same as the hash value of the first data at the first backup node; if the hash value of the first data at the main node is different from the hash value of the first data at the first backup node, replacing the first backup node by using a second backup node;
or the third node confirms the online time length of the first backup node; if the online time length of the first backup node is smaller than a first threshold value, replacing the first backup node by using a second backup node;
or the third node confirms the disconnection rate of the first backup node; and if the disconnection rate of the first backup node is greater than or equal to a second threshold value, replacing the first backup node by using a second backup node.
In this way, by the data backup method of the blockchain provided by the embodiment of the application, the security of data backup in the IPFS system is improved, in the flow of data backup, the master node and the first backup node execute data backup based on the first contract, so that the external intervention is reduced, and meanwhile, the first backup node is monitored by other nodes in the blockchain, and malicious nodes can be prevented from tampering with data.
Fig. 4 is a schematic flow chart of another alternative method for backing up data of a blockchain according to an embodiment of the present application.
In step S401, the master node confirms the first backup node.
After determining the main node for storing the key data, at least one backup node corresponding to the main node needs to be determined, and the key data of the main node is backed up synchronously.
Specifically, the daily average online time of at least one node in the IPFS is counted (in actual operation, the online time of each node is inconsistent due to some dropped lines of some faults may occur), the historical average value of the daily average online time of the at least one node is confirmed, and the daily average online time is ranked. At least one backup node is selected as a first backup node according to the requirement,
other master nodes storing key data in the blockchain also confirm the backup nodes according to the scheme, and each master node is provided with at least one backup node corresponding to the backup node.
In a specific implementation, the master node may further determine a first backup node based on the importance level of the data to be backed up. For example, if the data to be backed up is important data, at least one backup node with a comprehensive value greater than a first value is confirmed as the first backup node (for example, at least one backup node with a comprehensive value greater than the first value is a backup node located in the first bit to the a-th bit); if the data to be backed up is general important data, confirming that the comprehensive value is smaller than or equal to a first value and at least one backup node larger than a second value is the first backup node (for example, the first value is smaller than or equal to the first value and the at least one backup node larger than the second value is the backup node located between the a+1th bit and the b-th bit); if the data to be backed up is non-important data, at least one backup node with the integrated value smaller than or equal to the second value and larger than the third value is confirmed to be the first backup node (for example, at least one backup node with the integrated value smaller than or equal to the second value and larger than the third value is a backup node located between the b+1th bit and the c-th bit). Wherein a, b and c are positive integers; a is less than b and less than c.
In step S402, data is backed up between the master node and the first backup node based on the first contract.
In some embodiments, the master node and the first backup node backing up data based on a first contract may include: confirming a first contract between the master node and the first backup node; the primary node and the first backup node backup data based on the first contract.
In the implementation process, a main node sends first request information to a first backup node; the first request information is used for requesting backup information of the first backup node; the backup information of the first backup node at least comprises data information corresponding to the first backup node and behavior information corresponding to the first backup node; and determining whether data backup can be performed between the main node and the first backup node based on the backup information of the first backup node.
And after the first backup node receives the first request, the first backup node sends backup information of the first backup node to the main node.
The master node evaluates the backup information of the first backup node, and if the master node confirms that the data backup is performed with the first backup node based on the backup information of the first backup node, a first contract is generated; the primary node sends the first contract encrypted using an asymmetric encryption private key (first key) to the first backup node.
If the first backup node agrees with the first contract, the first backup node encrypts the first contract by using an asymmetric encryption private key (a second key), and adds the establishment time of the first contract (the first contract is formally established after the first backup node agrees with) and the duration time interval of the first contract in the first contract; and sent to the master node.
The master node sending the first data to the first backup node based on the first contract for a duration interval of the first contract; the first key and the second key are key pairs.
In the above process, if any one of the primary node and the first backup node refuses or does not respond in any link, the first contract confirmation fails.
In some alternative embodiments, the first contract may include:
Figure BDA0003020492330000131
step S403, update the first contract.
After the first contract is established, if the data (or backup data) in the master node or the first backup node needs to be updated in the duration time interval of the first contract, the first contract is updated.
In implementation, the master node initiates a first contract update, stores first data to be backed up into the first contract, generates a second contract, and sends the second contract encrypted based on a first key to the first backup node.
After the first backup node receives the second contract, decrypting the second contract based on the public key of the master node, and if the first backup node confirms that the first data is backed up, sending the second contract encrypted based on the second key to the master node by the first backup node; the first backup node stores the first data.
After receiving the second contract encrypted by the second key, the master node decrypts the second contract based on the public key of the first backup node and verifies the signature of the first backup node; after verification passes, the second contract is stored on the blockchain. The primary node or the first backup node adds time to acknowledge a second contract in the second contract. Wherein the second contract is the updated first contract.
In the above process, if any one of the primary node and the first backup node refuses or does not respond in any link, the first contract update fails.
In step S404, the third node monitors the first backup node.
In some embodiments, the third node comprises a node on a blockchain other than the primary node and the first backup node. Optionally, the third node periodically monitors the performance of the first backup node.
When the method is implemented, the third node confirms whether the hash value of the first data at the main node is the same as the hash value of the first data at the first backup node; if the hash value of the first data at the main node is different from the hash value of the first data at the first backup node, replacing the first backup node by using a second backup node;
or the third node confirms the online time length of the first backup node; if the online time length of the first backup node is smaller than a first threshold value, replacing the first backup node by using a second backup node;
or the third node confirms the disconnection rate of the first backup node; and if the disconnection rate of the first backup node is greater than or equal to a second threshold value, replacing the first backup node by using a second backup node.
In this way, the data backup method of the blockchain provided by the embodiment of the application comprises a first contract backup scheme based on a backup node selection method and a peer (third node) assistance monitoring. After the backup nodes are selected through specific rules, the master node and the first backup node establish a copying contract (first contract), a backup scheme of the copying contract which is monitored by the aid of peers is established, data of the other parties are mutually stored, and backup data can be updated at any time. In the process of executing the copying contract, a monitoring mechanism based on companion-assisted monitoring is used for monitoring the execution condition of the first backup node on the copying contract, once the monitoring mechanism finds that the first backup node does not execute the contract, the copying contract is canceled, and the backup node is selected again according to a backup node selection algorithm. External intervention is reduced, and malicious nodes can be prevented from tampering with data.
Fig. 5 is a schematic diagram illustrating an alternative structure of a master node in a blockchain according to an embodiment of the present application, and will be described according to various parts.
In some embodiments, the master node 500 in the blockchain includes: a first determination unit 501 and a first transmission unit 502.
The first determining unit 501 is configured to determine a first backup node based on behavior information corresponding to at least one backup node; determining a first contract between the primary node and the first backup node;
the first sending unit 502 is configured to send first data to the first backup node based on the first contract; the first data is used for backing up the first data by the first backup node.
The first determining unit 501 is specifically configured to perform positive sequence ordering based on at least one of an online duration, a disconnection rate, and a data synchronization accuracy rate of the at least one backup node, and confirm that the at least one backup node ranked at the front is the first backup node.
The first sending unit 502 is further configured to send first request information to the first backup node; the first request information is used for requesting backup information of the first backup node; the backup information of the first backup node at least comprises data information corresponding to the first backup node and behavior information corresponding to the first backup node;
The first determining unit 501 is specifically configured to determine whether data backup can be performed between the primary node and the first backup node based on backup information of the first backup node.
The first sending unit 502 is further configured to send the first contract encrypted using a first key to the first backup node;
in some embodiments, the master node 500 in the blockchain further includes: a first receiving unit 503.
The first receiving unit 503 is configured to receive the first contract encrypted using a second key; the first contract encrypted by the second key comprises the establishment time of the first contract and the duration interval of the first contract;
the master node sending the first data to the first backup node based on the first contract for a duration interval of the first contract;
the first key and the second key are key pairs.
The first sending unit 502 is specifically configured to store, when the master node needs to backup data, the first data that needs to be backed up into the first contract, generate a second contract, and send the second contract encrypted based on a first key to the first backup node;
The first receiving unit 503 is further configured to receive the second contract encrypted based on a second key if the first backup node confirms that the first data is backed up.
Fig. 6 is a schematic diagram illustrating an alternative structure of a first backup node in a blockchain according to an embodiment of the present application, which will be described in terms of the respective parts.
In some embodiments, the first backup node 600 in the blockchain includes: a second transmitting unit 601, a second determining unit 602, and a second receiving unit 603.
The second sending unit 601 is configured to send backup information of the first backup node to a master node based on first request information sent by the master node;
the second determining unit 602 is configured to determine a first contract between the primary node and the first backup node;
the second receiving unit 603 is configured to receive the first data sent by the master node.
The second receiving unit 603 is further configured to receive a first contract encrypted using a first key sent by the master node;
the second sending unit 601 is further configured to send the first contract encrypted using the second key to the master node if the first backup node agrees with the first contract;
The second receiving unit 603 is further configured to receive, in a duration region of the first contract, first data sent by the master node based on the first contract;
the first backup node 600 in the blockchain may further include: a storage unit 604.
The storage unit 604 is configured to store, by the first backup node, the first data sent by the primary node; the first key and the second key are key pairs.
The second receiving unit 603 is configured to receive the second contract encrypted based on the first key; the second contract includes the first data and the first contract;
the second sending unit 601 is configured to send, if the first backup node confirms that the first data is backed up, the second contract encrypted based on a second key to the master node by the first backup node.
Fig. 7 is a schematic diagram of a hardware composition structure of a data backup device of a blockchain according to an embodiment of the present application, where the data backup device 700 of the blockchain may be a device corresponding to a master node in the block or a device corresponding to a first backup node in the blockchain.
The data backup apparatus 700 of a blockchain includes: at least one processor 701, memory 702, and at least one network interface 704. The various components in the blockchain data backup device 700 are coupled together by a bus system 705. It is appreciated that the bus system 705 is used to enable connected communications between these components. The bus system 705 includes a power bus, a control bus, and a status signal bus in addition to the data bus. But for clarity of illustration, the various buses are labeled as bus system 705 in fig. 7.
It is to be appreciated that the memory 702 can be either volatile memory or nonvolatile memory, and can include both volatile and nonvolatile memory. Wherein the nonvolatile Memory may be ROM, programmable read-Only Memory (PROM, programmable Read-Only Memory), erasable programmable read-Only Memory (EPROM, erasable Programmable Read-Only Memory), electrically erasable programmable read-Only Memory (EEPROM, electrically Erasable Programmable Read-Only Memory), magnetic random access Memory (FRAM, ferromagnetic random access Memory), flash Memory (Flash Memory), magnetic surface Memory, optical disk, or compact disk read-Only Memory (CD-ROM, compact Disc Read-Only Memory); the magnetic surface memory may be a disk memory or a tape memory. The volatile memory may be random access memory (RAM, random Access Memory), which acts as external cache memory. By way of example, and not limitation, many forms of RAM are available, such as static random access memory (SRAM, static Random Access Memory), synchronous static random access memory (SSRAM, synchronous Static Random Access Memory), dynamic random access memory (DRAM, dynamic Random Access Memory), synchronous dynamic random access memory (SDRAM, synchronous Dynamic Random Access Memory), double data rate synchronous dynamic random access memory (ddr SDRAM, double Data Rate Synchronous Dynamic Random Access Memory), enhanced synchronous dynamic random access memory (ESDRAM, enhanced Synchronous Dynamic Random Access Memory), synchronous link dynamic random access memory (SLDRAM, syncLink Dynamic Random Access Memory), direct memory bus random access memory (DRRAM, direct Rambus Random Access Memory). The memory 702 described in embodiments of the present application is intended to comprise, without being limited to, these and any other suitable types of memory.
The memory 702 in the embodiments of the present application is used to store various types of data to support the operation of the data backup device 700 of the blockchain. Examples of such data include: any computer program, such as application 722, for operating on the blockchain data backup device 700. A program implementing the method of the embodiment of the present application may be included in the application 722.
The method disclosed in the embodiments of the present application may be applied to the processor 701 or implemented by the processor 701. The processor 701 may be an integrated circuit chip having signal processing capabilities. In implementation, the steps of the method may be performed by integrated logic circuitry in hardware or instructions in software in the processor 701. The processor 701 may be a general purpose processor, a digital signal processor (DSP, digital Signal Processor), or other programmable logic device, discrete gate or transistor logic device, discrete hardware components, or the like. The processor 701 may implement or perform the methods, steps, and logic blocks disclosed in embodiments of the present application. The general purpose processor may be a microprocessor or any conventional processor or the like. The steps of the method disclosed in the embodiments of the present application may be directly embodied in a hardware decoding processor or implemented by a combination of hardware and software modules in the decoding processor. The software modules may be located in a storage medium in a memory 702. The processor 701 reads information in the memory 702 and, in combination with its hardware, performs the steps of the method as described above.
In an exemplary embodiment, the blockchain data backup device 700 may be implemented by one or more application specific integrated circuits (ASIC, application Specific Integrated Circuit), DSPs, programmable logic devices (PLDs, programmable Logic Device), complex programmable logic devices (CPLDs, complex Programmable Logic Device), FPGAs, general purpose processors, controllers, MCUs, MPUs, or other electronic components for performing the aforementioned methods.
The embodiment of the application also provides a storage medium for storing the computer program.
Optionally, the storage medium may be applied to the first client in the embodiments of the present application, and the computer program causes the computer to execute corresponding flows in the methods in the embodiments of the present application, which are not described herein for brevity.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations 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.
The foregoing description of the preferred embodiments of the present application is not intended to limit the scope of the present application, but is intended to cover any modifications, equivalents, and alternatives falling within the spirit and principles of the present application.

Claims (10)

1. A method for backing up data for a blockchain, the method comprising:
The main node in the block chain performs positive sequence ordering based on at least one of the online time length, the disconnection rate and the data synchronization accuracy rate of at least one backup node, and confirms that the at least one backup node arranged at the forefront is a first backup node;
the master node determines a first contract between the master node and the first backup node, wherein the first contract at least comprises an IPFS address and a data size of the interstellar file system of the master node and the first backup node;
the master node sending first data to the first backup node based on the first contract; the first data is used for the first backup node to backup the first data;
the method further comprises the steps of: and after the first contract is established, if the data or the backup data in the main node or the first backup node needs to be updated in the duration time interval of the first contract, updating the first contract.
2. The method of claim 1, wherein the master node determining a first contract between the master node and the first backup node comprises:
the master node sending the first contract encrypted using a first key to the first backup node;
Receiving the first contract encrypted using a second key; the first contract encrypted by the second key comprises the establishment time of the first contract and the duration interval of the first contract;
the master node sending the first data to the first backup node based on the first contract for a duration interval of the first contract;
the first key and the second key are key pairs.
3. The method of claim 1, wherein the master node sending first data to the first backup node based on the first contract comprises:
under the condition that the master node needs to backup data, the master node stores the first data needing to be backed up into the first contract, generates a second contract and sends the second contract encrypted based on a first key to the first backup node;
and if the first backup node confirms to backup the first data, the master node receives the second contract encrypted based on a second key.
4. A method for backing up data for a blockchain, the method comprising:
the method comprises the steps that a first backup node sends backup information of the first backup node to a main node based on first request information sent by the main node;
The first backup node determines a first contract between the main node and the first backup node, wherein the first contract at least comprises an IPFS address and a data size of the interstellar file system of the main node and the first backup node;
the first backup node receives first data sent by the main node based on the first contract;
the method further comprises the steps of: and after the first contract is established, if the data or the backup data in the main node or the first backup node needs to be updated in the duration time interval of the first contract, updating the first contract.
5. The method of claim 4, wherein the first backup node determining a first contract comprises:
receiving a first contract encrypted by using a first key sent by a master node;
if the first backup node agrees with the first contract, the first backup node sends the first contract encrypted by using the second key to the master node;
the first backup node receives first data sent by the master node based on the first contract in a duration region of the first contract; and/or the first backup node stores the first data sent by the main node;
The first key and the second key are key pairs.
6. The method of claim 4, wherein the receiving, by the first backup node, the first data sent by the primary node based on the first contract comprises:
receiving a second contract encrypted based on the first key; the second contract includes the first data and the first contract;
if the first backup node confirms to backup the first data, the first backup node sends the second contract encrypted based on a second key to the master node;
the first backup node stores the first data.
7. A data backup apparatus for a blockchain, the apparatus comprising:
the first determining unit is used for carrying out positive sequence ordering based on at least one of the online time length, the disconnection rate and the data synchronization accuracy rate of at least one backup node, and confirming that the at least one backup node arranged at the forefront is the first backup node;
a first sending unit, configured to send first data to the first backup node based on a first contract, where the first contract includes at least an interstellar file system IPFS address of the primary node and the first backup node, and a data size; wherein the first data is used for the first backup node to backup the first data;
The apparatus further comprises: and the first updating unit is used for updating the first contract in the duration time interval of the first contract after the first contract is established if the data or backup data in the master node or the first backup node need to be updated.
8. A data backup apparatus for a blockchain, the apparatus comprising:
a second determining unit, configured to determine a first contract between the primary node and the first backup node, where the first contract includes at least an interstellar file system IPFS address and a data size of the primary node and the first backup node;
the second receiving unit is used for receiving the first data sent by the master node;
the apparatus further comprises: and the second updating unit is used for updating the first contract in the duration time interval of the first contract after the first contract is established if the data or backup data in the master node or the first backup node need to be updated.
9. A storage medium storing an executable program, wherein the executable program, when executed by a processor, implements the blockchain data backup method of any of claims 1 to 3;
Alternatively, a data backup method of a blockchain as in any of claims 4 to 6 is implemented.
10. A data backup apparatus of a blockchain, comprising a memory, a processor and an executable program stored on the memory and capable of being executed by the processor, characterized in that the processor executes the steps of the data backup method of a blockchain according to any of claims 1 to 3 when executing the executable program;
alternatively, a data backup method of a blockchain as in any of claims 4 to 6 is performed.
CN202110401426.8A 2021-04-14 2021-04-14 Data backup method and device for blockchain and storage medium Active CN113254264B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110401426.8A CN113254264B (en) 2021-04-14 2021-04-14 Data backup method and device for blockchain and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110401426.8A CN113254264B (en) 2021-04-14 2021-04-14 Data backup method and device for blockchain and storage medium

Publications (2)

Publication Number Publication Date
CN113254264A CN113254264A (en) 2021-08-13
CN113254264B true CN113254264B (en) 2023-06-09

Family

ID=77222040

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110401426.8A Active CN113254264B (en) 2021-04-14 2021-04-14 Data backup method and device for blockchain and storage medium

Country Status (1)

Country Link
CN (1) CN113254264B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114281605B (en) * 2022-03-07 2022-06-21 杭州费尔斯通科技有限公司 Calculation method and system based on block chain partitioned storage

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110351363A (en) * 2019-07-12 2019-10-18 全链通有限公司 Data back up method, equipment and computer readable storage medium
WO2020258831A1 (en) * 2019-06-28 2020-12-30 创新先进技术有限公司 Method and device for master node handover processing in blockchain system

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109271283A (en) * 2018-09-06 2019-01-25 北京云测信息技术有限公司 A kind of data back up method based on block chain
US10880076B1 (en) * 2019-08-29 2020-12-29 Blockstack Pbc Backup of encrypted information stored off-chain in a blockchain-based decentralized storage system
CN110798308A (en) * 2019-10-31 2020-02-14 支付宝(杭州)信息技术有限公司 Block chain signature method and system
CN111209113B (en) * 2019-12-31 2022-12-13 卓尔智联(武汉)研究院有限公司 Resource allocation method, device, equipment and storage medium based on intelligent contract
CN112486736A (en) * 2020-12-28 2021-03-12 山西中液互联能源有限公司 Block chain based data backup system and backup method

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020258831A1 (en) * 2019-06-28 2020-12-30 创新先进技术有限公司 Method and device for master node handover processing in blockchain system
CN110351363A (en) * 2019-07-12 2019-10-18 全链通有限公司 Data back up method, equipment and computer readable storage medium

Also Published As

Publication number Publication date
CN113254264A (en) 2021-08-13

Similar Documents

Publication Publication Date Title
JP6675518B1 (en) Method and device for processing a service request
JP7007398B2 (en) Methods and equipment for processing transaction requests
US10742393B2 (en) Confidentiality in a consortium blockchain network
WO2019119929A1 (en) Block chain consensus method, apparatus and system, and identification information processing method and apparatus
CN111045855B (en) Method, apparatus and computer program product for backing up data
US11088875B2 (en) Asynchronous processing of blockchain blocks
TWI749488B (en) Computer-implemented method, system, and non-transitory computer-readable storage medium for detecting disabling replay attacks
JPWO2015125765A1 (en) Security device, method thereof, and program
JP2009003933A (en) Method, system, and apparatus for encrypting, integrity, and anti-replay protecting data in nonvolatile memory in fault tolerant manner
US11496327B1 (en) Secure and trustworthy bridge for transferring assets across different networks
CN111786812A (en) Node management method, node management device, computer equipment and storage medium
US20240062191A1 (en) Secure and trustworthy bridge for transferring assets across networks with different data architecture
CN112073433B (en) SSL certificate updating method and device, electronic equipment and storage medium
CN113254264B (en) Data backup method and device for blockchain and storage medium
WO2019243816A1 (en) Leader selection for permissioned blockchain
US11671248B2 (en) System and method for secure storage and distribution of encryption keys
CN113886899A (en) Method, device, equipment and medium for managing service life of automatic driving software
CN111314393B (en) Data processing method, device and equipment based on block chain
US20200266983A1 (en) Entitlement management message epoch as an external trusted time source
CN113726781B (en) Message information processing method, device, computer equipment and storage medium
GB2575266A (en) A password management system and method for providing access to a password protected device
US11626986B1 (en) Method and system of rescinding access to blockchain data
CN116432163A (en) Authentication information processing method, device, equipment and storage medium
WO2024072815A1 (en) Method for securely generating and distributing symmetric keys for grouping secure communications
CN115398856A (en) Key attribute verification

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