A blockchain-based data storage method and a blockchain node
By using a master-slave node architecture and smart contract mechanism, the blockchain system only stores the address and hash value of the slave node, which solves the cost problem of multi-party data storage, achieves data tamper-proof and scalability, and improves the security and efficiency of the system.
Patent Information
- Application Number
- CN202110617903.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-06-03
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2041-06-03
AI Technical Summary
In existing technologies, the cost problem caused by multiple data storage in blockchain systems has not been fundamentally solved, and the data anti-tampering capability is insufficient.
It adopts a master-slave node architecture. The master node receives the data hash value and address collected by the slave node and broadcasts it in the blockchain through a smart contract. By leveraging the immutability of the blockchain and the contract mechanism, it only saves the address and hash value of the slave node, thereby achieving data tamper-proof and scalable performance.
It effectively solves the cost problem caused by multiple data storage in blockchain systems, while achieving data tamper-proofing and scalability, and improving the security and efficiency of the system.
Smart Images

Figure CN115438118B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure belongs to the technical field of data storage, and particularly relates to a data storage method based on a block chain and a block chain node. BACKGROUND
[0002] In the prior art, a data storage method based on a block chain is disclosed, comprising the following steps: a first data acquisition request is sent by a master node server to each slave node server; when the first data acquisition request is received, the slave node server feeds back service data currently stored by the slave node server; when the service data fed back by the slave node server is received, the master node server stores the service data. The present application also discloses a data storage system based on a block chain and a computer readable storage medium. The present application enables all blocks, i.e. service data, in the distributed network to be stored only in the master node server, and the slave node servers do not need to store service data of other node servers, thereby greatly saving resources of each slave node server. Moreover, the running efficiency of application programs related to the distributed network in each slave node server is improved.
[0003] Although the present application also adopts the mode of master node and slave node, the purpose of the present application is to enable the master node to acquire data of the slave node, to avoid repeated downloading of data of multiple slave nodes in the block chain system, and to realize the method by using identification information to operate. This data acquisition method does not fundamentally solve the cost problem caused by multi-party storage of data in the block chain system. SUMMARY
[0004] The present disclosure aims at the above-mentioned deficiencies in the prior art, and provides a data storage method based on a block chain and a block chain node.
[0005] As a first aspect of the present disclosure, a data storage method based on a block chain is provided, which is applied to a master node in a block chain, the master node being connected with at least one slave node, and comprising the following steps:
[0006] receiving first information and an address of a slave node connected with the master node, the first information being obtained by the slave node according to collected data;
[0007] broadcasting the first information and the address of the slave node to the block chain.
[0008] Preferably, the method further comprises the following steps:
[0009] receiving second information corresponding to the address of the slave node and sent by the slave node connected with the master node;
[0010] In response to determining that the second information is inconsistent with the first information, it is determined that the data stored in the slave node is tampered, and a data tampering message is sent to the slave node.
[0011] Preferably, the method further comprises:
[0012] broadcasting third information corresponding to the address of the slave node in the blockchain;
[0013] In response to the number of times of receiving the verification failure message broadcast in the blockchain being greater than a preset threshold, it is determined that the first information stored in the master node is tampered, the verification failure message being broadcast when other master nodes in the blockchain receive third information corresponding to the address of the slave node broadcast in the blockchain and determine that the third information is inconsistent with the first information stored locally.
[0014] Preferably, the method further comprises:
[0015] receiving third information corresponding to the address of the slave node broadcast by other master nodes in the blockchain;
[0016] In response to determining that the third information is inconsistent with the first information stored locally, a verification failure message is broadcast in the blockchain.
[0017] Preferably, before the first information and the address of the slave node are broadcast into the blockchain, the method further comprises:
[0018] recording operation information of the slave node;
[0019] The broadcasting of the first information and the address of the slave node into the blockchain comprises:
[0020] In response to passing the legal authentication of the first information, the address of the slave node, and the operation information, the first information and the address of the slave node are broadcast into the blockchain.
[0021] As a second aspect of the present disclosure, a blockchain node is provided, applied to a master node in a blockchain, the master node being connected with at least one slave node, comprising:
[0022] The receiving module is configured to receive first information and an address of a slave node connected with the master node, the first information being derived by the slave node from collected data.
[0023] The first broadcasting module is configured to broadcast the first information and the address of the slave node into the blockchain.
[0024] Preferably, the receiving module is further configured to receive second information corresponding to the address of the slave node sent by the slave node connected with the master node;
[0025] The blockchain node further comprises:
[0026] A determination module configured to determine that the data stored in the slave node is tampered in response to determining that the second information is inconsistent with the first information.
[0027] A sending module configured to send a data tampering message by the slave node.
[0028] Preferably, the blockchain node further comprises:
[0029] A second broadcasting module configured to broadcast third information corresponding to the address of the slave node in the blockchain.
[0030] A determination module configured to determine that the first information stored in the master node is tampered in response to receiving a number of verification failure messages broadcast in the blockchain being greater than a preset threshold, the verification failure message being broadcast by other master nodes in the blockchain when the third information broadcast in the blockchain is received and it is determined that the third information is inconsistent with the first information stored locally.
[0031] Preferably, the receiving module is further configured to receive third information broadcast by other master nodes in the blockchain and corresponding to the address of the slave node.
[0032] The blockchain node further comprises:
[0033] A third broadcasting module configured to broadcast a verification failure message in the blockchain in response to determining that the third information is inconsistent with the first information stored locally.
[0034] Preferably, the blockchain node further comprises:
[0035] A recording module configured to record operation information of the slave node.
[0036] The first broadcasting module is specifically configured to:
[0037] Broadcast the first information and the address of the slave node to the blockchain in response to passing the legal authentication on the first information, the address of the slave node and the operation information.
[0038] The blockchain-based data storage method disclosed in this embodiment involves a master node receiving first information and the address of a slave node connected to it, and broadcasting this first information and slave node address to the blockchain. The blockchain node (master node) does not need to store all collected data, but only the slave node address and the corresponding first information sent by the connected slave node. Compared to existing technologies that still require the blockchain node (master node) to store the collected data, this disclosure utilizes a master-slave node pair, solving the cost problem caused by multi-party data storage while achieving tamper-proof and scalable effects. Attached Figure Description
[0039] Figure 1 A flowchart illustrating a blockchain-based data storage method for the master node side provided in this embodiment of the disclosure;
[0040] Figure 2 Another flowchart of a blockchain-based data storage method for the master node side provided in this disclosure embodiment;
[0041] Figure 3 Another flowchart of a blockchain-based data storage method for the master node side provided in this disclosure embodiment;
[0042] Figure 4 Another flowchart of a blockchain-based data storage method for the master node side provided in this disclosure embodiment;
[0043] Figure 5 This is a schematic diagram of the structure of a blockchain node provided in an embodiment of this disclosure. Detailed Implementation
[0044] To enable those skilled in the art to better understand the technical solution of the present invention, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0045] To address the shortcomings of existing blockchain-related data storage methods, which employ master and child nodes, this invention does not fundamentally solve the cost problem caused by multi-party data storage in blockchain systems. This disclosure provides a blockchain-based data storage method and blockchain node. The following detailed description, in conjunction with the accompanying drawings of the embodiments provided in this disclosure, will illustrate these methods in detail.
[0046] Figure 1 A flowchart illustrating a blockchain-based data storage method on the master node side provided in an embodiment of this disclosure is shown. Figure 1 As shown, the blockchain-based data storage method provided in this embodiment is applied to the master node in the blockchain, wherein the master node is connected to at least one slave node, and includes the following steps.
[0047] Step S101, receiving first information and an address of a slave node connected to the master node.
[0048] Step S102, broadcasting the first information and the address of the slave node to the blockchain.
[0049] The first information is obtained by the slave node according to the collected data. The first information is a hash value.
[0050] In steps S101-S102, the blockchain is composed of a master node, and the master node is connected to at least one slave node. When the slave node collects data, the slave node obtains first information according to the collected data, and sends the first information and the address of the slave node to the master node connected to the slave node. The master node has a pre-set smart contract for receiving the first information and the address of the slave node sent by the slave node connected to the master node, and broadcasting the first information and the address of the slave node to the blockchain. After receiving the first information and the address of the slave node broadcast in the blockchain, the other master nodes in the blockchain save the address of the slave node and the first information corresponding to the address of the slave node in the local.
[0051] It should be noted that, in addition to saving the collected data, the slave node also saves the smart contract. The smart contract is used to take a hash value of the collected data, and store the hash value and the address of the slave node to the master node connected to the slave node.
[0052] It should be noted that, if new data needs to be stored in the blockchain, only new master-slave node pairs need to be added, and the newly added master node can be added to the blockchain.
[0053] It should be noted that if the master node is a server. After the master node stores the address of the slave node and the first information corresponding to the address of the slave node, if there is still remaining space, the remaining space can be virtualized as a new node, without affecting the stored data.
[0054] The data storage method based on the blockchain provided by the embodiments of the present disclosure utilizes the tamper-proof, smart contract and other characteristics of the blockchain technology, sets master-slave node pairs, the master node is located in the blockchain, the slave node is connected to the master node, the slave node collects data, and the smart contract triggers the collection and storage of new data and the information on the chain. The blockchain node (master node) does not need to save all the collected data, but only needs to save the address of the slave node sent by the connected slave node and the first information corresponding to the address of the slave node. Compared with the prior art, the blockchain node (master node) still needs to save the collected data. The present disclosure utilizes the master-slave node pair and adds the mechanism of the smart contract, which not only solves the cost problem caused by the multi-party storage of the blockchain system data, but also achieves the tamper-proof and scalable effect.
[0055] Figure 2 Another flowchart of a data storage method based on a blockchain on a master node side is shown.
[0056] In step S201, second information corresponding to the address of the slave node is received.
[0057] In step S202, in response to determining that the second information is inconsistent with the first information, it is determined that the data saved in the slave node is tampered.
[0058] In step S203, a data tampering message is sent to the slave node.
[0059] In steps S201-S203, the smart contract is also saved in the master node. The smart contract in the master node is used to verify whether the data collected in the slave node is tampered. When the master node receives the second information corresponding to the address of the slave node connected to the master node, and verifies that the second information is inconsistent with the first information corresponding to the address of the same slave node stored locally in the master node, it is determined that the data saved in the slave node is tampered. The master node fails to authenticate and sends a data tampering message to the slave node connected to the master node, so that the data of the slave node cannot be written or should be deleted.
[0060] Figure 3 Another flowchart of a data storage method based on a blockchain on a master node side is shown.
[0061] In some embodiments, the method further comprises:
[0062] In step S301, third information corresponding to the address of the slave node is broadcasted in the blockchain.
[0063] In step S302, in response to the number of times of receiving a verification failure message broadcasted in the blockchain being greater than a preset threshold, it is determined that the first information stored in the master node is tampered.
[0064] The verification failure message is broadcasted by other master nodes in the blockchain when they receive the third information corresponding to the address of the slave node broadcasted in the blockchain and determine that the third information is inconsistent with the first information saved locally.
[0065] In step S301-step S302, the smart contract in the master node is also used to verify whether the first information stored by the master node is tampered, that is, whether the hash value stored by the master node is tampered. The master node broadcasts the third information corresponding to the address of the slave node in the blockchain, and other master nodes in the blockchain verify that the third information is inconsistent with the first information corresponding to the address of the same slave node stored locally by other master nodes. If the verification fails, a verification failure message is broadcast in the blockchain. If the number of verification failure messages received by the master node in the blockchain is greater than a preset threshold, that is, most of the other master nodes verify that the third information is inconsistent with the first information corresponding to the address of the same slave node stored locally, it is determined that the first information stored by the master node is tampered.
[0066] Figure 4 Another flowchart of a blockchain-based data storage method provided by the master node side of the embodiments of the present disclosure is shown.
[0067] In some embodiments, the method further comprises:
[0068] Step S401, receiving third information corresponding to the address of the slave node broadcast by other master nodes in the blockchain.
[0069] Step S402, in response to determining that the third information is inconsistent with the locally stored first information, broadcasting a verification failure message in the blockchain.
[0070] In step S401-step S402, one master node broadcasts third information corresponding to the address of the slave node in the blockchain, and other master nodes in the blockchain verify that the third information is inconsistent with the first information corresponding to the address of the same slave node stored locally by other master nodes. If the verification fails, a verification failure message is broadcast in the blockchain.
[0071] In some embodiments, before the first information and the address of the slave node are broadcast to the blockchain (i.e., step S102), the method further comprises: recording operation information of the slave node. The broadcasting of the first information and the address of the slave node to the blockchain (i.e., step S102) comprises: in response to passing the legal authentication of the first information, the address of the slave node and the operation information, broadcasting the first information and the address of the slave node to the blockchain.
[0072] In the embodiments of the present disclosure, when the slave node sends the address of the slave node and the first information corresponding to the address of the slave node to the master node connected to the slave node, the master node records the operation information of the slave node. If the master node passes the legal authentication of the first information, the address of the slave node and the operation information, the master node broadcasts the first information and the address of the slave node to the blockchain.
[0073] Figure 5 A structure diagram of a blockchain node provided by the embodiments of the present disclosure is shown. Based on the address of the slave node and the first information corresponding to the address of the slave nodeFigure 1 Corresponding embodiments of the same technical concept are shown in Figure 5 The blockchain node provided by the embodiments of the present disclosure is applied to a master node in a blockchain, and the master node is connected with at least one slave node, and the master node comprises the following modules.
[0074] The receiving module 11 is configured to receive first information and an address of a slave node connected with the master node, and the first information is obtained by the slave node according to collected data.
[0075] The first broadcasting module 12 is configured to broadcast the first information and the address of the slave node to the blockchain.
[0076] Preferably, the receiving module 11 is further configured to receive second information corresponding to the address of the slave node and sent by the slave node connected with the master node.
[0077] The blockchain node further comprises:
[0078] The determining module is configured to determine that the data stored in the slave node is tampered with in response to determining that the second information is inconsistent with the first information.
[0079] The sending module is configured to send a data tampering message by the slave node.
[0080] Preferably, the blockchain node further comprises:
[0081] The second broadcasting module is configured to broadcast third information corresponding to the address of the slave node in the blockchain.
[0082] The determining module is configured to determine that the first information stored in the master node is tampered with in response to receiving a number of verification failure messages broadcast in the blockchain being greater than a preset threshold, the verification failure message being broadcast by other master nodes in the blockchain when the other master nodes receive the third information broadcast in the blockchain and determine that the third information is inconsistent with the first information stored locally.
[0083] Preferably, the receiving module 11 is further configured to receive third information corresponding to the address of the slave node and broadcast by other master nodes in the blockchain.
[0084] The blockchain node further comprises:
[0085] The third broadcasting module is configured to broadcast a verification failure message in the blockchain in response to determining that the third information is inconsistent with the first information stored locally.
[0086] Preferably, the blockchain node further comprises:
[0087] The recording module is configured to record operation information of the slave node.
[0088] The first broadcast module 12 is specifically configured to:
[0089] In response to passing the legal authentication on the first information, the address of the slave node and the operation information, broadcast the first information and the address of the slave node into the blockchain.
[0090] It can be understood that the above embodiments are only exemplary embodiments adopted for illustrating the principles of the present application, and the present application is not limited thereto. Various modifications and improvements can be made by those of ordinary skill in the art without departing from the spirit and essence of the present application, and these modifications and improvements are also considered as the protection scope of the present application.
Claims
1. A blockchain-based data storage method, characterized by, A master node applied to a blockchain, the master node being connected with at least one slave node, comprising: receiving first information and an address of a slave node connected with the master node, the first information being derived by the slave node from collected data, the first information being a hash value; broadcasting the first information and the address of the slave node to the blockchain; broadcasting third information corresponding to the address of the slave node in the blockchain; in response to a number of times of receiving a verification failure message broadcast in the blockchain being greater than a preset threshold, determining that the first information stored by the master node is tampered, the verification failure message being broadcast by other master nodes in the blockchain when the third information broadcast in the blockchain is received and it is determined that the third information is inconsistent with the first information stored locally.
2. The blockchain-based data storage method of claim 1, wherein, The method further comprises: receiving second information corresponding to the address of the slave node sent by the slave node connected with the master node; in response to determining that the second information is inconsistent with the first information, determining that data stored in the slave node is tampered, and sending a data tampering message to the slave node.
3. The blockchain-based data storage method of claim 1, wherein, The method further comprises: receiving third information corresponding to the address of the slave node broadcast by other master nodes in the blockchain; in response to determining that the third information is inconsistent with the first information stored locally, broadcasting a verification failure message in the blockchain.
4. The blockchain-based data storage method of claim 1, wherein, Before the first information and the address of the slave node are broadcast to the blockchain, the method further comprises: recording operation information of the slave node; broadcasting the first information and the address of the slave node to the blockchain comprises: in response to passing a legal authentication on the first information, the address of the slave node, and the operation information, broadcasting the first information and the address of the slave node to the blockchain.
5. A blockchain-based data storage apparatus, characterized by, A master node applied to a blockchain, the master node being connected with at least one slave node, comprising: a receiving module configured to receive first information and an address of a slave node connected with the master node, the first information being derived by the slave node from collected data, the first information being a hash value; a first broadcasting module configured to broadcast the first information and the address of the slave node to the blockchain; a second broadcasting module configured to broadcast third information corresponding to the address of the slave node in the blockchain; a determining module configured to, in response to a number of times of receiving a verification failure message broadcast in the blockchain being greater than a preset threshold, determine that the first information stored by the master node is tampered, the verification failure message being broadcast by other master nodes in the blockchain when the third information broadcast in the blockchain is received and it is determined that the third information is inconsistent with the first information stored locally.
6. The blockchain-based data storage apparatus of claim 5, wherein, The receiving module is further configured to receive second information corresponding to the address of the slave node sent by the slave node connected with the master node; The blockchain-based data storage device further comprises: a determining module configured to, in response to determining that the second information is inconsistent with the first information, determine that data stored in the slave node is tampered; a sending module configured to send a data tampering message by the slave node.
7. The blockchain-based data storage apparatus of claim 5, wherein, The receiving module is further configured to receive third information corresponding to the address of the slave node and broadcasted by other master nodes in a blockchain; The blockchain-based data storage device further includes: A third broadcasting module configured to broadcast a verification failure message in the blockchain in response to determining that the third information is inconsistent with the locally saved first information.
8. The blockchain-based data storage apparatus of claim 5, wherein, The blockchain-based data storage device further includes: A recording module configured to record operation information of the slave node; The first broadcasting module is specifically configured to: Broadcast the first information and the address of the slave node to the blockchain in response to passing the legal authentication of the first information, the address of the slave node, and the operation information.
Citation Information
Patent Citations
Method and system for solving potential safety hazards of rights and interests of DPOS consensus nodes
CN111586068A
Notarization file information processing method, system and platform, equipment and storage medium
CN112163241A