Efficient data storage method and device based on block chain and medium
By combining IPFS and edge computing in the IoT data storage platform, and using the KMMR algorithm and smart contracts, the problems of low storage efficiency and high transaction costs in traditional blockchains are solved, and efficient and secure IoT data storage is achieved. , reducing costs and enhancing the decentralized nature of the system.
Patent Information
- Application Number
- CN202410606568.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-16
- Publication Date
- 2024-10-18
- Estimated Expiration
- 2044-05-16
AI Technical Summary
Traditional IoT data storage platforms have problems such as single points of failure, data leakage, high transaction fees, low processing efficiency and centralization risks. Especially when processing a large number of high-frequency small-amount transactions, existing blockchain technology is difficult to process efficiently.
Adopting an efficient data storage method based on blockchain, by obtaining the data to be stored, uploading it to IPFS for calculation, using edge computing nodes for real-time analysis and processing, combining the KMMR calculation method to record the data on the blockchain, and through smart contracts Control access permissions and design multi-level distributed system architecture to improve storage and processing efficiency.
It realizes an efficient IoT data storage solution, reduces blockchain storage costs and transaction fees, improves data processing efficiency, enhances data security and decentralization characteristics, and is suitable for large-scale IoT data storage scenarios.
Smart Images

Figure CN118797716A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data storage, and in particular to an efficient data storage method, device and medium based on blockchain. Background Art
[0002] In traditional IoT data storage platforms, centralized server clusters control all data, which has common drawbacks of centralization, such as single point failure and data leakage. How to use the advantages of blockchain to efficiently store a large amount of IoT real-time data has become a key issue. At the same time, ensuring the immutability of these data is also a basic requirement for building a trusted digital society.
[0003] Although blockchain technology effectively solves the problems of data security and reliability, it also faces the challenge of high on-chain transaction fees in some application scenarios with large amounts of data and the need to upload data frequently. Faced with the continuous data generated by IoT devices, this means the processing needs of a large number of high-frequency small transactions, and most existing blockchain technologies are not yet able to efficiently handle frequent transactions of this scale, so batch processing needs to be optimized. In addition, storing a large amount of IoT data information summaries on the chain may result in excessive on-chain information storage, thereby increasing latency.
[0004] The prior art has the following disadvantages:
[0005] (1) Large-scale data storage: The data generated by IoT devices is growing explosively. Traditional data storage solutions are often difficult to scale to accommodate this growth and are unable to effectively store and manage this massive amount of data. This data includes but is not limited to sensor readings, operation logs, status updates, etc., which may require rapid access and analysis.
[0006] (2) Processing efficiency: Traditional blockchain designs are not suitable for processing high-precision, large amounts of data input, such as data generated by IoT devices, because it takes time to verify and confirm each transaction, which limits their ability to process real-time data.
[0007] (3) Transaction Fees: Although Ethereum has made an important transition from proof-of-work to proof-of-stake in the hope of reducing environmental impact and improving network efficiency, the issue of gas fees still exists. This is because gas fees are not determined solely by the verification mechanism, but are closely related to the usage of the network and the complexity of transactions. With the dramatic increase in data storage and transaction frequency, each data record and verification requires computing resources, which in turn pushes up gas fees. For many operations of IoT devices, although the value of a single transaction may not be large, the accumulated fees of frequent transactions may still become a heavy economic burden.
[0008] (4) Centralization risk: Centralized systems usually have a single point of failure. If the central point is attacked or fails, the stability and security of the entire system will be threatened. In addition, centralized systems may cause data leakage due to administrator misoperation, internal malicious behavior or external attacks. Summary of the invention
[0009] The main purpose of the embodiments of the present application is to provide an efficient data storage method, device and medium based on blockchain.
[0010] In one aspect, the present invention provides an efficient data storage method based on blockchain, the method comprising:
[0011] Get the data to be stored;
[0012] Uploading the data to be stored to IPFS, and calculating the data to be stored to obtain first data;
[0013] Analyze and process the first data in real time through an edge computing node to generate second data;
[0014] By utilizing the KMMR calculation method, the second data is recorded in a corresponding position of the blockchain.
[0015] Further, the obtaining of the data to be stored includes:
[0016] The data to be stored is obtained from a plurality of IoT sensors and IoT devices.
[0017] Further, uploading the data to be stored to IPFS, calculating the data to be stored, and obtaining the first data includes:
[0018] Build a BI-TSFID model; the BI-TSFID model includes a user layer, an edge network layer and an Ethereum network layer;
[0019] In the user layer, uploading the data to be stored to IPFS;
[0020] An encryption algorithm is performed on the data to be stored to obtain first data.
[0021] Furthermore, the building of the BI-TSFID model includes:
[0022] The participants of the BI-TSFID model include system administrators, data storage, data validators, IoT devices, IPFS nodes, edge computing nodes, data storage smart contracts, and identity management smart contracts.
[0023] Furthermore, the step of analyzing and processing the first data in real time through an edge computing node to generate second data includes:
[0024] Perform batch calculation on the first data through edge computing nodes to generate second data;
[0025] The second data is returned to the IoT device.
[0026] Furthermore, the step of recording the second data in a corresponding position of the blockchain by using the KMMR calculation method includes:
[0027] Design the KMMR algorithm;
[0028] The edge computing node calculates the second data using the KMMR algorithm to generate a KMMR commitment;
[0029] If the IoT device confirms the KMMR commitment, the KMMR commitment is put on the blockchain;
[0030] According to the KMMR commitment on the blockchain, the second data is recorded in a corresponding position of the blockchain.
[0031] Furthermore, the design of the KMMR algorithm includes:
[0032] Design a data structure of KMMR; the data structure of KMMR includes a multi-branch Merkle tree;
[0033] KMMR is represented as an unragged two-dimensional array.
[0034] Furthermore, the efficient data storage method based on blockchain also includes:
[0035] Control visitor access rights through smart contracts.
[0036] On the other hand, the present invention also provides an efficient data storage device based on blockchain, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the efficient data storage method based on blockchain as described above is implemented.
[0037] On the other hand, the present invention also provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the efficient data storage method based on blockchain as described above.
[0038] The embodiments of the present application include at least the following beneficial effects: the present application provides an efficient data storage method, device and medium based on blockchain, which obtains data to be stored; uploads the data to be stored to IPFS, calculates the data to be stored, and obtains first data; analyzes and processes the first data in real time through edge computing nodes to generate second data; and records the second data in the corresponding position of the blockchain by using the KMMR calculation method. The present invention can overcome the high cost and low efficiency of storing a large amount of data in the blockchain, and realize an efficient IoT data storage solution. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 is a flowchart of an efficient data storage method based on blockchain provided by an embodiment of the present invention;
[0040] Figure 2 is a diagram of the BI-TSFID architecture provided by an embodiment of the present invention;
[0041] Figure 3 is a diagram of a BI-TSFID processing process provided by an embodiment of the present invention;
[0042] Figure 4 is a schematic diagram of Algorithm 3.2 provided in an embodiment of the present invention;
[0043] Figure 5 is a schematic diagram of Algorithm 3.5 provided in an embodiment of the present invention;
[0044] Figure 6 is a timing diagram of the BI-TSFID architecture provided by an embodiment of the present invention;
[0045] Figure 7 Schematic diagram of KMMR (taking 3 branches as an example) provided in an embodiment of the present invention;
[0046] Figure 8 is a schematic diagram of Algorithm 3.6 provided in an embodiment of the present invention;
[0047] Fig. 9 is a schematic diagram of Algorithm 3.7 provided in an embodiment of the present invention;
[0048] Fig.10 is a schematic diagram of Algorithm 3.8 provided in an embodiment of the present invention;
[0049] Fig.11 It is a schematic diagram of the KMMR certification path provided by an embodiment of the present invention;
[0050] Fig.12 It is a schematic diagram of Algorithm 3.9 provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0051] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.
[0052] It is understood that the terms "first", "second", etc. used in this application can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0053] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0055] Before describing the embodiments of the present application in detail, some nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.
[0056] 1) Merkle Mountain Range: Merkle Mountain Range (MMR) is a variant of the Merkle tree that allows for continuous addition of data without knowing the total amount of data. Compared to the traditional Merkle tree, it is more efficient when adding data dynamically. This makes it very suitable for scenarios such as blockchain where data needs to be added continuously.
[0057] 2) BI-TSFID: BI-TSFID (Blockchain and IPFS-based Trusted Storage Framework for IoT Data) is a data trusted storage framework based on blockchain and IPFS in the IoT scenario defined in this invention.
[0058] 3) KMMR: KMMR (K-ary Merkle Mountain Range) is a multi-branch Merkle Mountain Range structure improved based on the Merkle Mountain Range in the present invention.
[0059] 4) IPFS: IPFS (InterPlanetary File System) is a peer-to-peer distributed file storage system designed to connect all computing devices with the same file system. In the IPFS network, files are divided into small pieces, stored on multiple nodes, and identified by unique cryptographic hashes. This enables IPFS to provide efficient content retrieval methods and robustness to network partitions and server failures.
[0060] 5) Orbit-db: Orbit-db is a distributed database built on IPFS that allows different users to share and store data without a central server. It is completely decentralized and uses the distributed nature of IPFS to synchronize and store data. Orbit-db is suitable for developing decentralized applications (DApps), making data sharing efficient and secure without a single point of failure.
[0061] 6) Blockchain: Blockchain is a distributed ledger technology that records transactions through a series of data blocks (blocks) arranged in chronological order and connected by cryptographic methods. Each block contains a certain number of transactions and the hash value of the previous block, forming an unchangeable and persistent data chain. This makes blockchain a transparent and secure way to store and transmit data without the need for a central trusted authority.
[0062] 7) Ethereum: Ethereum is an open source blockchain platform.
[0063] 8) Smart Contracts: A smart contract is a computer program that automatically executes, controls or documents legally relevant events or actions. On a blockchain platform, smart contracts allow for verifiable, enforceable contracts to be executed without an intermediary. They can automate complex processes such as the allocation of funds, the transfer of equity, etc. using programming logic.
[0064] The embodiments of the present invention are further described below in conjunction with the accompanying drawings.
[0065] On the one hand, the embodiment of the present invention provides an efficient data storage method based on blockchain, specifically, referring to Figure 1 , the method comprising:
[0066] S100, obtaining data to be stored;
[0067] S200, uploading the data to be stored to IPFS, calculating the data to be stored, and obtaining first data;
[0068] S300, analyzing and processing the first data in real time through an edge computing node to generate second data;
[0069] S400. Record the second data in a corresponding position of the blockchain by using the KMMR calculation method.
[0070] As an optional implementation, the data summary of the embodiment of the present invention is stored on the chain, and the batch computing work is retained off the chain:
[0071] First, determine which data needs to be stored on the blockchain and store its digest (a digest is a short representation of the data, usually generated by a hash function) on the blockchain to ensure the integrity and traceability of the data.
[0072] Then, the batch computing work is moved off-chain for processing, which means moving a large amount of data processing operations from blockchain nodes to off-chain computing nodes or servers to improve processing efficiency and reduce the cost of on-chain operations.
[0073] The embodiment of the present invention uses the KMMR calculation method to improve the efficiency of data uplinking:
[0074] Using KMMR, the data that needs to be uploaded to the chain is processed to reduce the size of the data or optimize its representation, thereby reducing the resource consumption of the chain operation.
[0075] The calculation work of steps S200-S300 is performed off-chain.
[0076] The embodiment of the present invention discloses step S100 of obtaining data to be stored, including:
[0077] S110: Obtain data to be stored from a plurality of IoT sensors and IoT devices.
[0078] The embodiment of the present invention discloses that step S200 uploads the data to be stored to IPFS, calculates the data to be stored, and obtains first data, including:
[0079] S210. Build a BI-TSFID model. The BI-TSFID model includes a user layer, an edge network layer, and an Ethereum network layer.
[0080] S220, in the user layer, uploading the data to be stored to IPFS;
[0081] S230: Perform encryption algorithm calculation on the data to be stored to obtain first data.
[0082] As an optional implementation, the encryption algorithm includes a symmetric encryption algorithm, an asymmetric encryption algorithm and a hash function.
[0083] The embodiment of the present invention discloses step S210 of building a BI-TSFID model, including:
[0084] S211. Participants in the BI-TSFID model include system administrators, data storage, data verifiers, IoT devices, IPFS nodes, edge computing nodes, data storage smart contracts, and identity management smart contracts.
[0085] As an optional implementation, in step S210 of the embodiment of the present invention, a BI-TSFID model is constructed. Figure 2 The architecture of the BI-TSFID model is presented, which is a distributed system consisting of a user layer, an edge network layer, and an Ethereum network layer. At the user layer, IoT devices can communicate with edge networks and Ethereum networks through protocols such as Wi-Fi, mobile networks, or LoRaWAN, and upload collected data to IPFS in real time. At the same time, users can use smart contracts to manage data access permissions for IoT devices.
[0086] In the edge network, the edge computing node and the node that integrates the IPFS service may be the same entity. The edge computing node periodically extracts data from IPFS to perform aggregate calculations and generate KMMR commitments. After confirming the results, the node transmits it back to the IoT device authorized by the client to verify the accuracy of the data. Once the verification is completed, the data will be securely recorded to the Ethereum network, thus ensuring that it cannot be tampered with. At the blockchain network layer, IoT devices with corresponding permissions can submit data to the data storage contract. At the same time, authenticated users can control the upload process of device data, and can download and verify data stored on IPFS. This multi-level architecture ensures the security and integrity of the data, while providing a high degree of flexibility and scalability for device management in the IoT environment. The main participants in BI-TSFID are as follows:
[0087] 1. System Administrator: This role is usually held by the Ethereum account that deploys the contract. This role can authorize other Ethereum accounts and modify the data access permissions of a certain Ethereum account.
[0088] 2. Data storer: The data storer can be an organization or an individual. With the authorization of the administrator, they can register their own IoT devices and store the IoT device data in BI-TSFID. They can also download and share the data uploaded by the device.
[0089] 3. Data Verifier: They can initiate data verification after obtaining the data by requesting the use of the data from the data store or they are a third-party regulatory agency.
[0090] 4. IoT devices: The entities that generate data belong to the data storer. They upload the generated data to IPFS. At the same time, they need to verify the results of the KMMR calculations of the edge computing nodes and put the KMMR commitments on the chain.
[0091] 5. IPFS nodes: IPFS nodes deployed at the edge network layer can quickly save large amounts of original data from IoT devices or users.
[0092] 6. Edge computing nodes: In order to ensure the immutability and traceability of data to the greatest extent, edge computing nodes undertake a large amount of data calculation tasks, by periodically pulling data from IPFS for batch calculation and returning the calculation results to the IoT devices.
[0093] 7. Data storage smart contract: used to store a small amount of important information, such as the KMMR commitment root value of IoT data. Once a large amount of data is recorded in the storage contract, it cannot be tampered with or deleted. Authorized users can audit and verify historical changes to the data.
[0094] 8. Identity management smart contract: Provides administrators with identity authentication and permission control mechanisms to ensure that only authorized devices and users can access the data in the contract.
[0095] The embodiment of the present invention discloses that step S300 analyzes and processes the first data in real time through the edge computing node to generate second data, including:
[0096] S310, performing batch calculation on the first data through the edge computing node to generate second data;
[0097] S320: Return the second data to the Internet of Things device.
[0098] The embodiment of the present invention discloses that step S400 records the second data in the corresponding position of the blockchain by using the KMMR calculation method, including:
[0099] S410, design KMMR algorithm;
[0100] S420, the edge computing node calculates the second data using the KMMR algorithm to generate a KMMR commitment;
[0101] S430. If the IoT device confirms the KMMR commitment, the KMMR commitment is placed on the blockchain;
[0102] S440. According to the KMMR commitment on the blockchain, the second data is recorded in a corresponding position on the blockchain.
[0103] The embodiment of the present invention discloses step S410 of designing a KMMR algorithm, including:
[0104] S411. Design the data structure of KMMR; the data structure of KMMR includes a multi-branch Merkle tree;
[0105] S412. Use an irregular two-dimensional array to represent KMMR.
[0106] As an optional implementation, the following is the design of the KMMR of an embodiment of the present invention:
[0107] The present invention proposes a KMMR data structure. KMMR has the same properties as MMR except that each tree inside it is a multi-branch Merkle tree. Figure 7 The example of KMMR with 3 branches is shown, which contains 4 3-branch Merkle trees. When the number of branches is set to 3, the upward merge will only be performed when there are 3 trees of the same size. By increasing the number of branches, we reduce the height of MMR and the number of hashes required. The following section will elaborate on the main algorithm of KMMR.
[0108] (1) Generate KMMR
[0109] refer to Figure 8 Algorithm 3.6 describes the generation process of KMMR, where an irregular two-dimensional array is used to represent KMMR. Among them, kmmr[i][j] represents the jth (from left to right) node of the i-th layer (from bottom to top) of KMMR. First, the input data dataList is hashed item by item to make it a leaf node of KMMR, and then the hash calculation is merged from the leaf node step by step upward according to the branch number K of the input parameter to generate KMMR.
[0110] (2) Add leaf nodes
[0111] refer to Fig. 9Algorithm 3.7 describes the process of adding leaf nodes in KMMR. First, the leaf node is placed at the last position of the 0th layer (the number of layers starts from 0). By calculating the total number of nodes, we determine whether KMMR will merge. If a merge is required, the position of the new parent node is calculated based on the leaf node (see line 5). Then continue to determine whether the layer where the parent node is located needs to be merged. This process is carried out from bottom to top until a layer is encountered that cannot be merged.
[0112] (3) Generate a proof path
[0113] Fig.10 Algorithm 3.8 of describes the process of generating a KMMR proof set. Similar to the way of constructing KMMR, first, the first-level nodes of the proof set P are the same as the leaf nodes of KMMR, except that the nodes being proved are replaced with null to facilitate direct filling of the gaps in the subsequent verification. The mergePath() function will construct the proof of P from the bottom up.
[0114] Fig.11 The following figure shows the case of generating proofs for a 3-branch KMMR. To generate proofs for leaf nodes 5 and 14, the proof set will contain the siblings of nodes 5 and 14, as well as the siblings of their ancestors on the path to the root of the tree.
[0115] (4) Verification Proof Path
[0116] Fig.12 Algorithm 3.9 is the process of verifying the KMMR proof path, through Fig.10 After generating the proof path P using Algorithm 3.8, we can verify whether vdList has been tampered with. The method is very intuitive, and we only need to calculate P from the bottom up, and finally compare it with the KMMRroot value obtained on the chain.
[0117] An efficient data storage method based on blockchain provided by an embodiment of the present invention also includes:
[0118] S500, control visitor access rights through smart contracts.
[0119] The embodiment of the present invention combines Ethereum smart contracts with IPFS:
[0120] First, the smart contract function of Ethereum is used to achieve data security and transaction record management to ensure the credibility and security of the data.
[0121] Then, IPFS is used as a decentralized file system for actual file storage and access to provide efficient file storage and retrieval capabilities.
[0122] Combining these two technologies can create a highly decentralized data storage architecture that not only takes advantage of Ethereum's blockchain characteristics, but also leverages IPFS's file storage and access advantages to provide users with a secure and efficient decentralized data processing platform.
[0123] The embodiment of the present invention combines Ethereum, IPFS and multi-branch Merkle Mountain technology to solve the cost and efficiency problems in existing IoT storage and verification, and realize an efficient IoT data storage solution.
[0124] In view of the problems existing in the prior art, the present invention proposes an efficient data storage architecture BI-TSFID (Blockchain and IPFS-based Trusted Storage Framework for IoTData) that combines IPFS and Ethereum technology. In order to overcome the high cost and low efficiency of storing a large amount of data in the blockchain, the present invention introduces a multi-branch Merkle Mountain data chain method to achieve an efficient and secure IoT data storage solution. The features of the present invention include:
[0125] 1. Improved data storage and processing efficiency: By storing data summaries on-chain and keeping batch computing work off-chain, this method significantly improves data processing efficiency and significantly reduces Ethereum's Gas consumption.
[0126] 2. Using the KMMR calculation method, the present invention significantly improves the efficiency of data on-chain, greatly reduces the consumption of CPU resources and memory resources, and is suitable for large-scale IoT data storage scenarios.
[0127] 3. Highly decentralized data storage framework BI-TSFID: By combining Ethereum's smart contract function with IPFS's decentralized file system, a highly decentralized data storage architecture is achieved. It not only takes advantage of Ethereum's powerful capabilities in data security and transaction records, but also takes advantage of IPFS's advantages in file storage and access speed, providing users with a secure and efficient decentralized data processing platform.
[0128] 4. Multi-level system architecture: A distributed system architecture consisting of the user layer, edge network layer and Ethereum network layer is proposed to ensure the security and integrity of data and provide high flexibility and scalability for device management in the IoT environment.
[0129] Figure 3 The general process of BI-TSFID is shown, which is mainly divided into three stages: initialization, storage and verification.
[0130] (1) System initial stage
[0131] When registering a device, the user first assigns an Ethereum account to the IoT device and registers the information on the smart contract, indicating the device's serial number and other detailed information. In order to complete the authentication, the IoT device needs to confirm the device information registered on the smart contract and the assigned Ethereum account. This is to facilitate accurate tracking and management of the device. Only licensed and authenticated devices have the authority to perform corresponding operations on the smart contract.
[0132] (2) System storage stage
[0133] In the data storage phase, IoT devices will upload data to Orbit-db regularly or irregularly, and edge nodes will continue to monitor Orbit-db and periodically pull a batch of IoT data sets D that are not calculated on the chain. The variables involved in the storage phase are defined as follows:
[0134] D={ds1,ds2,…,ds N}
[0135]
[0136] where ds i It is a collection of data items generated by IoT devices with ID value i. It is a data item with ID value j generated by the IoT device with ID value i. The ID set of IoT devices that generate the data set D is <1,2,…,N>.
[0137] refer to Figure 4 Algorithm 3.2 shows the data storage process of BI-TSFID. The calculations from line 1 to line 6 occur in the edge node, and the calculations from line 7 to line 18 occur in the IoT device. First, the edge node calculates and generates KMMR with data set D as the leaf node, and serializes and saves the KMMR to Orbit-db. A proof is generated for each data set and sent to the IoT device that generated the data set for verification. The IoT device pulls the data ds generated by itself from Orbit-db. k Verification is performed. Only after verification by the IoT device will the root value of the KMMR generated by the edge computing node be stored on the chain.
[0138] The system does not assume that edge nodes are completely trustworthy. In order to prevent edge computing nodes from generating false calculation results, auxiliary verification of IoT devices is required. After the IoT device is successfully verified, the contract operation Create_S() or Append() will be called. When all relevant IoT devices are verified, the last verified device will execute the Notify() operation to notify the smart contract to randomly select the corresponding IoT device to store the root value of KMMR. By constructing the KMMR commitment with data and storing it in Ethereum, users can detect data tampering in a timely manner.
[0139] (3) System verification phase
[0140] In the data verification phase, the data set VD that the user needs to verify contains data items of M IoT devices, which are defined as follows:
[0141] VD[i]=<dataID,devID,rawData> ,0≤i≤M
[0142] refer to Figure 5 Algorithm 3.5 shows the verification process. First, the user must classify VD[i] according to the KMMR where it is stored, and obtain the corresponding root value from the smart contract through the data ID, where VerifyMap[root] represents the IoT data item promised by the root value. Then the user downloads the corresponding KMMR from Orbit-db to construct the proof and verify the data items one by one.
[0143] refer to Figure 6 The main processes of the BI-TSFID system in the initialization, storage and verification phases are summarized. First, the user needs to register the serial number of the IoT device and its account address in the smart contract. After the device is started and ready, it will use web3.js to authenticate to the identity management smart contract. Once the authentication information matches the registration information, the device will continuously monitor the data storage smart contract. At the same time, the edge computing node will listen to the storage events of Orbit-db.
[0144] After the IoT device completes data collection, it will<dataID,devID,rawData> Upload to Orbit-db. At this point, Orbit-db will issue a storage event notification, and the edge node will extract the data set based on the data volume or preset threshold parameters. <ds1,ds2,…,ds N > and calculate KMMR. Then, serialize KMMR and store it in Orbit-db, and set the proof of this calculation <T.root,P i ,ds i.dataID> is distributed to IoT devices that participated in the calculation of the data. The devices that received the proof will use the previously sent data or the data items downloaded from Orbit-db to verify the calculation results of the edge node.
[0145] The first IoT device to complete verification will use information on the smart contract <root,N,IDs{ds k .dataID}>Create storage structure S. Then the device that has completed verification adds its own data information ds k Before adding .dataID, the storage structure S will be verified. If the verification passes, data will continue to be added to the structure; if the verification fails, data will be refused to be added to the structure S. When the last IoT device completes the verification, the smart contract will randomly select a device to initiate a transaction to persist S. This operation will prevent other devices from adding data to the structure S, and store all data item IDs and corresponding KMMRroot values in S in Orbit-db.
[0146] Ultimately, users can download the required data from Orbit-db, or obtain data shared by others through other means. By calculating KMMR and obtaining the root value on the chain, users can verify the integrity of the data.
[0147] The following is an embodiment of using the technical solution of the present invention in an application system:
[0148] (1) Intelligent agricultural monitoring system:
[0149] In a smart agricultural system, multiple IoT sensors are deployed to monitor crop growth conditions, such as soil moisture, light intensity, temperature, etc. These sensors collect data in real time and upload it to IPFS to ensure high-speed data storage and retrieval. Through edge computing nodes, these data are analyzed and processed in real time to generate key agricultural indicators, which are securely recorded on the Ethereum blockchain through KMMR commitments. This provides a transparent and tamper-proof data record for agricultural managers, researchers or regulators to verify data and make decisions. At the same time, through smart contracts, agricultural operators can control who can access this data to ensure data privacy and security.
[0150] (2) Smart home energy management system:
[0151] In a smart home environment, energy consumption data generated by various IoT devices (such as smart meters, thermostats, and home solar panels) can be uploaded to IPFS in real time. Edge computing nodes can analyze this data to optimize energy use and costs, such as dynamically adjusting power supply or starting high-energy-consuming devices to operate when electricity prices are lower based on real-time data. Through KMMR's commitment to securely record data on the blockchain, home users or service providers can verify the authenticity of energy usage data, which is critical for billing and auditing. Smart contracts can also automatically execute energy transactions, such as selling excess solar power within a certain period of time.
[0152] (3) Telemedicine and patient monitoring systems:
[0153] In the healthcare sector, patients’ vital signs are constantly monitored through connected devices and data is uploaded to IPFS, ensuring high availability and security. Edge computing nodes can process this data in real time and provide timely health feedback and early warnings. Through blockchain, this data is securely recorded and can serve as an indisputable electronic health record. Healthcare providers and patients can set data access rights through smart contracts, ensuring data privacy and security. In terms of drug therapy management or remote patient monitoring, this system can provide efficient and transparent data management, increasing the adaptability and personalization of treatment plans.
[0154] The beneficial effects brought by the present invention are:
[0155] 1. Improve data security and credibility: This invention uses Ethereum and IPFS technology to provide a data storage solution that ensures the difficulty of tampering and credibility of data. The decentralized nature of blockchain and the distributed storage mechanism of IPFS can complement each other and enhance the security of data storage.
[0156] 2. Improve computing and storage efficiency: By introducing the KMMR algorithm and edge computing nodes, the present invention achieves more efficient data commitment generation, greatly reduces the consumption of computing resources, and at the same time reduces network transmission overhead and Ethereum Gas fees.
[0157] 3. Reduce economic costs: Through the batch chain strategy, the Gas fee required to pay for data transactions is effectively reduced, making the present invention more economically feasible and particularly suitable for processing large-scale IoT data.
[0158] The present invention greatly improves the efficiency and security of data processing on the basis of decentralization. Using the KMMR algorithm and off-chain batch computing method, this study optimizes the data storage process and effectively reduces network communication costs and blockchain transaction fees. Furthermore, the introduced sampling data integrity verification method significantly reduces the verification time and communication bandwidth requirements, while ensuring high accuracy and greatly reducing the overall verification cost. The above features enable the present invention to achieve cost-effectiveness optimization and ensure the authenticity and integrity of the data when processing large-scale data.
[0159] On the other hand, an embodiment of the present invention also provides an efficient data storage device based on blockchain, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the efficient data storage method based on blockchain as described above is implemented.
[0160] The processor and the memory can be connected via a bus or other means. The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely arranged relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0161] The non-transitory software program and instructions required to implement the efficient data storage method based on blockchain in the above-mentioned embodiment are stored in the memory, and when executed by the processor, the efficient data storage method based on blockchain in the above-mentioned embodiment is executed.
[0162] On the other hand, an embodiment of the present invention further provides a computer-readable storage medium, which stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the above-mentioned efficient blockchain-based data storage method.
[0163] It will be appreciated by those skilled in the art that all or some of the steps and systems in the disclosed method above may be implemented as software, firmware, hardware and appropriate combinations thereof. Some physical components or all physical components may be implemented as software executed by a processor, such as a central processing unit, a digital signal processor or a microprocessor, or may be implemented as hardware, or may be implemented as an integrated circuit, such as an application specific integrated circuit. Such software may be distributed on a computer-readable medium, which may include a computer storage medium (or a non-transitory medium) and a communication medium (or a temporary medium). As known to those skilled in the art, the term computer storage medium includes volatile and non-volatile, removable and non-removable media implemented in any method or technology for storing information (such as computer-readable instructions, data structures, program modules or other data). Computer storage media include, but are not limited to, RAM, ROM, EEPROM, flash memory or other memory technologies, CD-ROM, digital versatile disks (DVD) or other optical disk storage, magnetic cassettes, magnetic tapes, disk storage or other magnetic storage devices, or any other medium that may be used to store desired information and may be accessed by a computer. Furthermore, it is well known to those skilled in the art that communication media typically embodies computer readable instructions, data structures, program modules, or other data in a modulated data signal such as a carrier wave or other transport mechanism, and may include any information delivery media.
[0164] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. An efficient data storage method based on blockchain, characterized in that: The method comprises: Get the data to be stored; Uploading the data to be stored to IPFS, and calculating the data to be stored to obtain first data; Analyze and process the first data in real time through an edge computing node to generate second data; By utilizing the KMMR calculation method, the second data is recorded in a corresponding position of the blockchain.
2. The method according to claim 1, characterized in that The obtaining of the data to be stored includes: The data to be stored is obtained from a plurality of IoT sensors and IoT devices.
3. The method according to claim 1, characterized in that The uploading the data to be stored to IPFS, and calculating the data to be stored to obtain the first data, includes: Build a BI-TSFID model; the BI-TSFID model includes a user layer, an edge network layer and an Ethereum network layer; In the user layer, uploading the data to be stored to IPFS; An encryption algorithm is performed on the data to be stored to obtain first data.
4. The method according to claim 3, characterized in that The construction of the BI-TSFID model includes: The participants of the BI-TSFID model include system administrators, data storage, data validators, IoT devices, IPFS nodes, edge computing nodes, data storage smart contracts, and identity management smart contracts.
5. The method according to claim 1, characterized in that The step of analyzing and processing the first data in real time through an edge computing node to generate second data includes: Perform batch calculation on the first data through edge computing nodes to generate second data; The second data is returned to the IoT device.
6. The method according to claim 1, characterized in that The step of recording the second data in a corresponding position of the blockchain by using the KMMR calculation method comprises: Design the KMMR algorithm; The edge computing node calculates the second data using the KMMR algorithm to generate a KMMR commitment; If the IoT device confirms the KMMR commitment, the KMMR commitment is put on the blockchain; According to the KMMR commitment on the blockchain, the second data is recorded in a corresponding position of the blockchain.
7. The method according to claim 6, characterized in that The design of the KMMR algorithm includes: Design a data structure of KMMR; the data structure of KMMR includes a multi-branch Merkle tree; KMMR is represented as an unragged two-dimensional array.
8. The method according to claim 1, characterized in that The method further comprises: Control visitor access rights through smart contracts.
9. An efficient data storage device based on blockchain, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the efficient data storage method based on blockchain as described in any one of claims 1 to 8 is implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and the computer-executable instructions are used to enable a computer to execute the efficient blockchain-based data storage method as described in any one of claims 1 to 8.
Citation Information
Patent Citations
Data verification method and system
CN113378242A
Internet of Things tracing method based on Fabric and IPFS and related equipment thereof
CN114358775A
Internet-of-things-oriented block chain data storage expansion model construction method
CN114915404A
Data synchronization method of light node in block chain, node, storage medium and equipment
CN115860742A
