A data storage method and device, electronic equipment and storage medium

By sharding blockchain data and deploying smart contracts, the problem of high data storage costs in blockchain is solved, achieving efficient and secure distributed storage.

CN119718186BActive Publication Date: 2026-02-03CHINA MOBILE INTERNET CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411619815.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-11-13
Publication Date
2026-02-03
Estimated Expiration
2044-11-13

AI Technical Summary

Technical Problem

Existing blockchain-based data storage methods result in excessively high storage costs because the data is distributed across multiple nodes.

Method used

By sharding the data to be stored, generating smart contracts, and deploying them on the blockchain, storage nodes can determine the data storage location and send storage requests based on the contracts, thus achieving distributed storage.

Benefits of technology

It reduces data storage costs, improves data management efficiency and security, and reduces the storage load on each node.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119718186B_ABST
    Figure CN119718186B_ABST
Patent Text Reader

Abstract

The application discloses a data storage method, and belongs to the technical field of blockchains, which is used to reduce data storage cost. The method comprises the following steps: acquiring first encrypted data to be stored in a distributed manner to a plurality of storage nodes, the plurality of storage nodes being connected with the same blockchain; performing fragmentation processing on the first encrypted data to obtain a plurality of first encrypted sub-data; generating a first smart contract based on the plurality of first encrypted sub-data, and deploying the first smart contract in the blockchain, so that each storage node determines, based on the first smart contract, the first encrypted sub-data in the plurality of first encrypted sub-data that is expected to be stored in the storage node, and sends a storage request to a terminal device; and after receiving the storage request sent by the storage node, sending each first encrypted sub-data to the corresponding storage node for distributed storage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of blockchain technology, specifically relating to a data storage method, device, electronic device, and storage medium. Background Technology

[0002] Currently, blockchain-based data storage methods primarily leverage the decentralized nature of blockchain technology, using smart contracts to manage data uploading, storage, and access. This approach allows data to be securely distributed across multiple nodes in the network without a centralized storage server. Every data operation is verified and recorded through the blockchain, ensuring data security and immutability. However, because the data is distributed across multiple nodes in the network, and each node needs to maintain a copy of the data, this significantly increases storage costs.

[0003] Therefore, a storage method that can reduce data storage costs is needed. Summary of the Invention

[0004] This application provides a data storage method that can reduce data storage costs.

[0005] In a first aspect, embodiments of this application provide a data storage method, the method comprising: acquiring first encrypted data to be distributed and stored to multiple storage nodes, the multiple storage nodes being connected to the same blockchain; performing sharding processing on the first encrypted data to obtain multiple first encrypted sub-data; generating a first smart contract based on the multiple first encrypted sub-data, and deploying the first smart contract in the blockchain, so that each of the storage nodes determines, based on the first smart contract, the first encrypted sub-data that it wishes to store in itself and sends a storage request to a terminal device; and after receiving the storage request sent by the storage node, sending each of the first encrypted sub-data to the corresponding storage node for distributed storage.

[0006] Secondly, embodiments of this application provide a data storage device, comprising: a first acquisition module, configured to acquire first encrypted data to be distributed and stored to multiple storage nodes, wherein the multiple storage nodes are connected to the same blockchain; a first processing module, configured to perform sharding processing on the first encrypted data to obtain multiple first encrypted sub-data; a first generation module, configured to generate a first smart contract based on the multiple first encrypted sub-data and deploy the first smart contract in the blockchain, so that each of the storage nodes determines, based on the first smart contract, the first encrypted sub-data that it wishes to store in itself and sends a storage request to a terminal device; and a first sending module, configured to, after receiving the storage request sent by the storage node, send each of the first encrypted sub-data to the corresponding storage node for distributed storage.

[0007] Thirdly, embodiments of this application provide an electronic device including a processor, a memory, and a program or instructions stored in the memory and executable on the processor, wherein the program or instructions, when executed by the processor, implement the steps of the method described in the first aspect.

[0008] Fourthly, embodiments of this application provide a readable storage medium on which a program or instructions are stored, which, when executed by a processor, implement the steps of the method described in the first aspect.

[0009] Fifthly, embodiments of this application provide a chip, the chip including a processor and a communication interface, the communication interface being coupled to the processor, the processor being used to run programs or instructions to implement the method as described in the first aspect.

[0010] In this embodiment, by acquiring first encrypted data to be distributed and stored to multiple storage nodes connected to the same blockchain, the first encrypted data is sharded to obtain multiple first encrypted sub-data. A first smart contract is generated based on the multiple first encrypted sub-data and deployed in the blockchain, so that each storage node determines the first encrypted sub-data it wishes to store and sends a storage request to the terminal device. After receiving the storage request from the storage node, each first encrypted sub-data is sent to the corresponding storage node for distributed storage, thereby reducing data storage costs. Attached Figure Description

[0011] Figure 1 This is a flowchart illustrating a data storage method provided in an embodiment of this application;

[0012] Figure 2 This is a schematic diagram of the structure of a data storage system provided in an embodiment of this application;

[0013] Figure 3 This is a flowchart illustrating the second data storage method provided in the embodiments of this application;

[0014] Figure 4 This is a flowchart illustrating the third data storage method provided in the embodiments of this application.

[0015] Figure 5 This is a schematic diagram of the structure of a data storage device provided in an embodiment of this application;

[0016] Figure 6 This is a schematic diagram of the structure of a data storage device provided in an embodiment of this application. Detailed Implementation

[0017] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0018] The terms "first," "second," etc., used in the specification and claims of this application are used to distinguish similar objects and not to describe a specific order or sequence. It should be understood that such use of data can be interchanged where appropriate so that embodiments of this application can be implemented in orders other than those illustrated or described herein, and the objects distinguished by "first," "second," etc., are generally of the same class and the number of objects is not limited; for example, a first object can be one or more. Furthermore, in the specification and claims, "and / or" indicates at least one of the connected objects, and the character " / " generally indicates that the preceding and following objects are in an "or" relationship.

[0019] The data storage method provided in this application will be described in detail below with reference to the accompanying drawings, through specific embodiments and application scenarios.

[0020] Figure 1 This illustration shows a data storage method provided by an embodiment of the present invention. The method can be executed by an electronic device, which may include a server and / or a terminal device, wherein the terminal device may be, for example, an in-vehicle terminal or a mobile phone terminal. In other words, the method can be executed by software or hardware installed on a data storage device, and the method includes the following steps:

[0021] Step 102: Obtain the first encrypted data to be distributed and stored to multiple storage nodes;

[0022] The multiple storage nodes are connected to the same blockchain.

[0023] The terminal device acquires the first encrypted data to be distributed and stored to multiple storage nodes, wherein the multiple storage nodes are connected to the same blockchain. The terminal device can be a mobile terminal or other terminal devices.

[0024] Specifically, the first encrypted data to be distributed storage can be determined by performing symmetric encryption on the data to be stored, or by performing asymmetric encryption on the data to be stored, or by performing a hybrid encryption of symmetric and asymmetric encryption on the data to be stored.

[0025] Step 104: The first encrypted data is fragmented to obtain multiple first encrypted sub-data;

[0026] After acquiring the first encrypted data, the terminal device segments the first encrypted data into multiple first encrypted sub-data. In other words, the terminal device divides the first encrypted data to be distributed storage into multiple first encrypted sub-data.

[0027] Specifically, when segmenting the first encrypted data, it can be divided into multiple first encrypted sub-data of equal size, or it can be divided into first encrypted sub-data of different sizes. The size of each first encrypted sub-data fragment can be set according to the actual situation. When segmenting the first encrypted sub-data into multiple first encrypted sub-data of equal size, if the total size of the data is not an integer multiple of the fragment size, the terminal device can fill in blanks in the last fragment to achieve the required fragment size.

[0028] More specifically, when the terminal device performs fragmentation processing on the first encrypted data, it can determine the size of the fragments based on the access frequency of the first encrypted data. For example, when the access frequency of the first encrypted data is high, the first encrypted data can be divided into a larger number to facilitate access to the first encrypted sub-data. When the access frequency of the first encrypted data is low, the first encrypted data can be divided into a smaller number to reduce the storage pressure on each storage node.

[0029] Step 106: Generate a first smart contract based on multiple first encrypted sub-data, and deploy the first smart contract in the blockchain, so that each storage node determines the first encrypted sub-data that it wants to store in itself among the multiple first encrypted sub-data based on the first smart contract and sends a storage request to the terminal device;

[0030] After identifying multiple first encrypted sub-data, the terminal device generates a first smart contract based on the first encrypted data and deploys the generated first smart contract in the blockchain. This enables each storage node to determine, based on the first smart contract, the first encrypted sub-data it wishes to store within itself and send a storage request to the terminal device. In other words, after deploying the first smart contract in the blockchain, multiple storage nodes connected to the blockchain can use the first smart contract to determine the multiple first encrypted sub-data that need to be distributedly stored, identify the first encrypted sub-data they wish to store within themselves, and then send a storage request to the terminal device, requesting the terminal device to send the first encrypted sub-data it wishes to store within itself for storage.

[0031] Specifically, the first smart contract deployed on the terminal device is used to record the attribute information of multiple first encrypted sub-data and the information required to send storage requests to the terminal device. In this way, the storage node can determine the relevant information of multiple first encrypted sub-data that need to be distributed and stored based on the first smart contract, and determine the first encrypted sub-data that is expected to be stored based on the relevant information. Then, it generates a storage request based on the first encrypted sub-data that is expected to be stored and sends the request to the terminal device, requesting the terminal device to send the first encrypted sub-data that is expected to be stored to itself and store it.

[0032] More specifically, when a storage node generates a storage request and sends it to a terminal device, the storage node first generates a storage request based on the attribute information of the first encrypted sub-data that it expects to store, so that the terminal device can determine the first encrypted sub-data that the storage node expects to store based on the storage request. Then, the storage node sends the storage request to the terminal device based on the information required to send the storage request to the terminal device included in the first smart contract.

[0033] Step 108: After receiving the storage request sent by the storage node, send each of the first encrypted sub-data to the corresponding storage node for distributed storage.

[0034] After receiving a storage request from a storage node, the terminal device sends each of the first encrypted sub-data items to the corresponding storage node for distributed storage. In other words, after receiving storage requests from multiple storage nodes, the terminal device sends the requested first encrypted sub-data items to the storage node corresponding to each storage request, enabling each storage node to store the desired first encrypted sub-data items, thereby achieving distributed storage of multiple first encrypted sub-data items.

[0035] When a terminal device sends a storage request to a storage node, it can use an encrypted P2P communication protocol for data transmission. Specifically, a secure communication channel is established between the terminal device and the storage node, using the TLS (Transport Layer Security) protocol to ensure the security of the data transmission process. The terminal device then sends the first encrypted sub-data to the storage node through this secure channel. Upon receiving the first encrypted sub-data from the terminal device, the storage node sends an acknowledgment of receipt to the terminal device to ensure the complete transmission of the data fragments.

[0036] Specifically, after receiving the first encrypted sub-data, the storage node can store it in its distributed storage system. Furthermore, after storing the first encrypted sub-data, the storage node can generate a storage proof, which may include the hash value and storage timestamp of the stored first encrypted sub-data, and submit it to the smart contract to prove that the first encrypted sub-data has been correctly stored.

[0037] Figure 2 This is a schematic diagram of the structure of a data storage system provided in one embodiment of this specification, such as... Figure 2 As shown, the system includes a terminal device, a blockchain, a first storage node, and a second storage node. The terminal device acquires the first encrypted data that needs to be distributed for storage, then segments the first encrypted data into multiple first encrypted sub-data. It then determines the attribute information (such as size and feature values) of these sub-data to generate a first smart contract, which is then deployed on the blockchain. After the first smart contract is deployed, the first and second storage nodes connected to the blockchain determine, based on the first smart contract, the multiple first encrypted sub-data that need to be distributed for storage, as well as the first encrypted sub-data that they wish to store themselves. They then generate storage requests based on the first encrypted sub-data they wish to store and send these requests to the terminal device. When the terminal device receives the storage requests from the storage nodes, it sends the first encrypted sub-data that each storage node wishes to store to its corresponding storage node, thus performing distributed storage.

[0038] The data storage method provided in this invention involves: acquiring first encrypted data to be distributed and stored on multiple storage nodes connected to the same blockchain; performing sharding on the first encrypted data to obtain multiple first encrypted sub-data; generating a first smart contract based on the multiple first encrypted sub-data and deploying the first smart contract on the blockchain, so that each storage node determines the first encrypted sub-data it wishes to store and sends a storage request to a terminal device based on the first smart contract; and sending each first encrypted sub-data to the corresponding storage node for distributed storage after receiving the storage request from the storage node, thereby reducing the cost of data storage.

[0039] In one implementation, before obtaining the first encrypted data to be distributed and stored to multiple storage nodes (step 102), steps A1-A3 may also be performed:

[0040] Step A1: Obtain the attribute information of the SIM card in the user identity module of the terminal device;

[0041] The terminal device obtains the attribute information of the SIM card in the user identity module of the terminal device. The attribute information of the SIM card may include relevant information such as the SIM card's IMSI number, operator identifier, and country code. The IMSI number is the International Mobile Subscriber Identity, which is a unique identifier assigned to the user.

[0042] Specifically, when obtaining the attribute information of the SIM card in the terminal device, a registration application can be launched, and the SIM card attribute information can be automatically obtained based on the application. This reduces the need for users to manually enter information, lowers the possibility of input errors, and improves the efficiency of the registration process and the user experience.

[0043] Step A2: Generate a registration request based on the attribute information of the SIM card and the pre-generated asymmetric encryption public key;

[0044] The registration request is used to request the blockchain to register an account for the user to whom the SIM card belongs.

[0045] After obtaining the SIM card's attribute information, the terminal device generates a registration request based on the SIM card's attribute information and a pre-generated asymmetric encryption public key. This registration request is used to request the blockchain to register an account for the user to whom the SIM card belongs.

[0046] Specifically, the terminal device will pre-generate a public-private key pair for asymmetric encryption on the user's local device, and then generate a registration request based on the asymmetric encryption public key and the SIM card's attribute information. The public key will be used to identify the user on the blockchain, while the private key will be stored on the user's device for signing transactions and verifying identity.

[0047] Step A3: Sign the registration request based on the pre-generated asymmetric encryption private key, and send the signed registration request to the blockchain.

[0048] After generating a registration request, the terminal device signs the request using a pre-generated asymmetric encryption public key and then sends the signed request to the blockchain. The terminal device's digital signature of the registration request using its private key ensures the request's authenticity and integrity. Once the registration request is accepted by the blockchain network, the blockchain generates a smart contract to record the user's attribute information (such as IMSI number) and public key. This smart contract serves as the user's unique identifier on the blockchain. By leveraging the blockchain's immutability and transparency to record user attribute information, the terminal device not only protects user information security but also ensures reliable and effective user authentication in subsequent transactions and data storage requests.

[0049] After receiving the signed registration request, the blockchain verifies the signature of the registration request based on the asymmetric encryption public key, and registers an account for the user to whom the SIM card belongs based on the SIM attribute information included in the registration request.

[0050] In one implementation, after signing the registration request based on an asymmetric encryption private key and sending the signed registration request to the blockchain (step A3), steps B1-B2 can also be performed:

[0051] Step B1: Obtain the verification information received by the SIM card in the terminal device, and verify the identity of the terminal device based on the verification information;

[0052] The terminal device obtains the verification information received by the SIM card and uses this verification information to authenticate itself. In other words, after the user of the SIM card in the terminal device successfully registers their identity, it still needs to obtain the verification information received by the SIM card and use this information to authenticate itself.

[0053] Specifically, the terminal device can complete the identity verification of the terminal through an SMS verification step, that is, send an SMS containing a verification code to the mobile phone number corresponding to the user's SIM card, and then receive the verification code entered by the user. The application of the terminal device can verify the verification code to complete the identity verification of the terminal device.

[0054] Step B2: If the identity verification is successful, send an activation request to the blockchain;

[0055] The activation request is used to request the blockchain to activate the account of the user to whom the SIM card belongs.

[0056] Once the terminal device's identity verification is successful, an activation request is sent to the blockchain. This activation request requests the blockchain to activate the account of the user belonging to the SIM card. In other words, after the user of the SIM card completes registration on the terminal device, verification information needs to be sent to the SIM card. After the SIM card's terminal verification is successful, the terminal device sends an activation request to the blockchain to request the blockchain to activate the account of the user belonging to the SIM card.

[0057] Specifically, after the blockchain receives an activation request from the terminal device, it can update the user's account status to "activated" in the smart contract. In other words, after registering a user's identity, the blockchain only sets the user's account status to "inactive" in the smart contract. Then, upon receiving an activation request from the terminal device, it changes the account status from "inactive" to "activated." This not only verifies the user's true identity and prevents accidental registration, but also increases the system's security and reliability.

[0058] In one implementation, obtaining the first encrypted data to be distributed and stored to multiple storage nodes (step 102) can be performed via steps C1-C3:

[0059] Step C1: Obtain the International Mobile Subscriber Identity (IMSI) number, which is included in the attribute information of the SIM card, and the data to be stored;

[0060] The terminal device obtains the International Mobile Subscriber Identity (IMSI) number, which is included in the attribute information of the SIM card, and obtains the data to be stored, wherein the data to be stored is the data to be distributed and stored.

[0061] Step C2: Generate a symmetric encryption key based on the asymmetric encryption private key and the IMSI number;

[0062] The terminal device pre-generates a public-private key pair for asymmetric encryption, and then generates a symmetric encryption key based on the asymmetric encryption private key and the IMSI number.

[0063] Specifically, when generating a symmetric encryption key based on the asymmetric encryption private key and the IMSI number and then encrypting the data, the AES-256 encryption algorithm can be used to encrypt the data. AES-256 is a widely used symmetric encryption algorithm that provides high-strength security. The symmetric encryption key k is generated based on the user's private key and the SIM card's IMSI number, using the formula k=H(kuser||IMSI), where H is a hash function, kuser is the user's pre-generated private key, || represents string concatenation, and IMSI is the International Mobile Subscriber Identity (IMSI) of the user's SIM card.

[0064] Step C3: Perform symmetric encryption on the data to be stored based on the symmetric encryption key to obtain the first encrypted data.

[0065] After generating the symmetric encryption key, the terminal device performs symmetric encryption on the data to be stored based on the symmetric encryption key to obtain the first encrypted data. In other words, the terminal device uses the generated key k to encrypt the original data, i.e., the data to be stored, to obtain the encrypted data, i.e., the first encrypted data.

[0066] Figure 3 This is a flowchart illustrating a second data storage method provided in one embodiment of this specification, as shown below. Figure 3 As shown, the schematic diagram includes:

[0067] Step 302: Obtain the attribute information of the SIM card in the user identity module of the terminal device;

[0068] Step 304: Generate a registration request based on the attribute information of the SIM card and the pre-generated asymmetric encryption public key;

[0069] The registration request is used to request the blockchain to register an account for the user to whom the SIM card belongs.

[0070] Step 306: Sign the registration request based on the pre-generated asymmetric encryption private key, and send the signed registration request to the blockchain;

[0071] Step 308: Obtain the International Mobile Subscriber Identity (IMSI) number, which is included in the attribute information of the SIM card, and the data to be stored;

[0072] Step 310: Generate a symmetric encryption key based on the asymmetric encryption private key and the IMSI number;

[0073] Step 312: Perform symmetric encryption on the data to be stored based on the symmetric encryption key to obtain the first encrypted data;

[0074] Step 314: The first encrypted data is fragmented to obtain multiple first encrypted sub-data;

[0075] Step 316: Generate a first smart contract based on multiple first encrypted sub-data, and deploy the first smart contract in the blockchain, so that each storage node determines the first encrypted sub-data that it wants to store in itself among the multiple first encrypted sub-data based on the first smart contract and sends a storage request to the terminal device;

[0076] Step 318: After receiving the storage request sent by the storage node, send each of the first encrypted sub-data to the corresponding storage node for distributed storage.

[0077] In the embodiments of this specification, user identity registration and activation are performed based on the attribute information of the SIM card of the terminal device. After successful identity activation, the first encrypted data in the terminal device is fragmented, and the multiple first encrypted sub-data obtained from the fragmentation are distributed and stored. This not only improves the efficiency of data management and enhances data security, but also reduces the amount of data that each node must store, thereby reducing the overall storage cost.

[0078] In one implementation, generating a first smart contract based on multiple first encrypted sub-data and deploying the first smart contract in the blockchain (step 106) can execute steps D1-D4:

[0079] Step D1: Generate multiple first sub-smart contracts based on multiple first encrypted sub-data;

[0080] Each of the first sub-smart contracts is used to record the attribute information of the first encrypted sub-data corresponding to it.

[0081] After obtaining multiple first encrypted sub-data, the terminal device generates multiple first sub-smart contracts based on these first encrypted sub-data. Each first sub-smart contract records the attribute information of its corresponding first encrypted sub-data, such as size and feature values. In other words, the terminal device generates a corresponding first sub-smart contract for each first encrypted sub-data, and this corresponding first sub-smart contract records the attribute information of that first encrypted sub-data, which describes the first encrypted sub-data.

[0082] Step D2: Deploy the first sub-smart contract in the blockchain;

[0083] After generating multiple first-level smart contracts corresponding to each first encrypted sub-data, the terminal device deploys these first-level smart contracts on the blockchain, enabling the blockchain to record the first-level smart contracts corresponding to each first encrypted sub-data. In other words, multiple first-level smart contracts are deployed on the blockchain, and each first-level smart contract is used to record relevant information about its corresponding first encrypted sub-data. By deploying multiple first-level smart contracts on the blockchain, the terminal device ensures that all sharding information is public, transparent, and immutable on the blockchain.

[0084] Step D3: Generate the first upload information based on multiple first sub-smart contracts;

[0085] The first upload information is used to record the attribute information of multiple first encrypted sub-data.

[0086] After generating multiple first sub-smart contracts, the terminal device generates first upload information based on these first sub-smart contracts. This first upload information records the attribute information of multiple first encrypted sub-data. In other words, the terminal device summarizes and organizes the attribute information of the first encrypted sub-data recorded in the multiple first sub-smart contracts, and then determines the attribute information of the multiple first encrypted sub-data. This first upload information, generated by the terminal device based on the multiple first sub-smart contracts, includes the attribute information of the multiple first encrypted sub-data obtained from the first encrypted data fragments.

[0087] Step D4: Generate the first smart contract based on the first uploaded information, and deploy the first smart contract in the blockchain so that the storage node sends a storage request to the terminal device based on the first smart contract.

[0088] After generating the first upload information, the terminal device generates a first smart contract based on the first upload information and deploys the first smart contract in the blockchain so that the storage node can send a storage request to the terminal device based on the first smart contract.

[0089] Specifically, the first smart contract generated by the terminal device can not only be used by storage nodes to send storage requests, but also to realize the status tracking and updating of each first encrypted sub-data. That is, when the storage status of each first encrypted sub-data changes, the updated information can be saved to the corresponding smart contract of the blockchain.

[0090] In one implementation, the step of generating multiple first sub-smart contracts based on multiple first encrypted sub-data (step D1) can execute steps E1-E2:

[0091] Step E1: Determine the first attribute information of each of the first encrypted sub-data based on multiple first encrypted sub-data;

[0092] The first attribute information includes one or more of the following: the fragment number, hash value, and total number of fragments of the first encrypted sub-data.

[0093] After the terminal device obtains multiple first encrypted sub-data, the terminal device determines the first attribute information of each first encrypted sub-data based on the multiple first encrypted sub-data. The first attribute information includes one or more of the fragment number, hash value and total fragment data of the corresponding first encrypted sub-data.

[0094] Specifically, when the terminal device determines the first attribute information based on the first encrypted sub-data, it parses the obtained first encrypted sub-data and then determines the attribute information of the first encrypted sub-data, such as calculating the hash value H(Fi) of each shard. Here, Fi represents the i-th shard, and H is the hash function.

[0095] Step E2: Generate multiple first sub-smart contracts based on multiple first attribute information;

[0096] After determining the first attribute information corresponding to each first encrypted sub-data, the terminal device generates multiple first sub-smart contracts based on the multiple first attribute information. In other words, the terminal device generates a first sub-smart contract corresponding to each first attribute information.

[0097] Specifically, when generating multiple first sub-smart contracts based on multiple first attribute information, the terminal device can also create a sharding information table, which records the attribute information of each first sub-smart contract for subsequent verification and reassembly of the first encrypted data.

[0098] The step of generating the first smart contract based on the first uploaded information (step D4) can be executed via steps E3-E4:

[0099] Step E3: Obtain the first setting information of the terminal device;

[0100] The first setting information is the information required to send the storage request to the terminal device.

[0101] The terminal device obtains first setting information, which may include information required to send a storage request to the terminal device. Furthermore, the first setting information may also include descriptive information (such as filename, file type, etc.) for each first encrypted sub-data, so that the storage node can determine the first encrypted sub-data to be stored based on the descriptive information.

[0102] Step E4: Generate the first smart contract based on the first uploaded information and the first setting information.

[0103] After obtaining the initial setup information, the terminal device generates a first smart contract based on the initial upload information and the initial setup information. This enables each storage node to determine the first encrypted sub-data it wishes to store and send a storage request to the terminal device. By deploying the first smart contract on the blockchain, the terminal device ensures that all sharded information is public, transparent, and immutable on the blockchain.

[0104] In one implementation, deploying the first sub-smart contract in the blockchain (step D2) can be performed by executing step F1:

[0105] Step F1: Sign the first sub-smart contract based on the pre-set asymmetric encryption private key, and deploy the signed first sub-smart contract in the blockchain;

[0106] After generating the first sub-smart contract, the terminal device can sign the first sub-smart contract based on a pre-set asymmetric encryption private key and deploy the signed first sub-smart contract in the blockchain. In other words, the terminal device pre-generates a public-private key pair for asymmetric encryption, then deploys each first sub-smart contract through its on-device application. This deployment operation is signed using the generated asymmetric encryption private key, allowing the blockchain to verify the signed first sub-smart contract.

[0107] Deploying the first smart contract in the blockchain (step D4) can be performed via step F2:

[0108] Step F2: Sign the first smart contract based on the asymmetric encryption private key, and deploy the signed first smart contract in the blockchain.

[0109] After generating the first smart contract, the terminal device can sign the first smart contract based on a pre-set asymmetric encryption private key and deploy the signed first smart contract in the blockchain. In other words, the terminal device can deploy the first smart contract through its onboard application, and this deployment operation uses the generated asymmetric encryption private key for signing, so that the blockchain can verify the signed first smart contract.

[0110] In one implementation, after receiving the storage request sent by the storage node, the first encrypted sub-data is sent to the corresponding storage node for distributed storage (step 108), and steps G1-G3 may also be executed:

[0111] Step G1: Obtain the first public key from the storage request;

[0112] The first public key is an asymmetric encryption public key generated by the storage node.

[0113] The terminal device obtains the first public key from the storage request sent by the storage node, where the first public key is an asymmetric encryption public key generated by the storage node. In other words, the storage request includes not only the attribute information of the first encrypted sub-data that the storage node expects to store, but also the public key used by the storage node for asymmetric encryption.

[0114] Specifically, the storage node pre-generates a first public key pair (including a first public key and a first private key) for asymmetric encryption, then generates a storage request based on the first smart contract and the first public key, and sends the storage request to the terminal device so that the terminal device can obtain the first public key based on the storage request.

[0115] Step G2: Encrypt the first encrypted sub-data based on the first public key to obtain the second encrypted sub-data;

[0116] After obtaining the first public key, the terminal device encrypts the first encrypted sub-data based on the first public key to obtain the second encrypted sub-data. In other words, the terminal device encrypts the first encrypted sub-data that the storage node intends to store based on the first public key to obtain the encrypted result, the second encrypted sub-data, ensuring that only the corresponding storage node can decrypt it.

[0117] Step G3: Send the second encrypted sub-data to the storage node so that the storage node decrypts the second encrypted sub-data based on its generated asymmetric encryption private key and stores the decrypted first encrypted sub-data.

[0118] After obtaining the second encrypted sub-data, the terminal device sends the second encrypted sub-data to the storage node, so that the storage node can decrypt the second encrypted sub-data based on its generated asymmetric encryption private key, namely the first private key, and store the decrypted first encrypted sub-data.

[0119] Specifically, the terminal device encrypts the first encrypted sub-data using a first public key generated by the storage node, and then sends the decrypted second encrypted sub-data to the storage node. Upon receiving the second encrypted sub-data, the storage node decrypts it using a pre-generated first private key, obtaining the decrypted result, i.e., the first encrypted sub-data, which it then stores. The terminal device then uses the storage node's public key to perform asymmetric encryption on the symmetrically encrypted first encrypted sub-data again, and sends the encrypted data to the storage node, thereby ensuring the security and reliability of data transmission between the terminal device and the storage node.

[0120] In one implementation, after receiving the storage request sent by the storage node, the first encrypted sub-data is sent to the corresponding storage node for distributed storage (step 108), and steps H1-H3 may also be executed:

[0121] Step H1: Receive storage requests sent by storage nodes;

[0122] The storage request includes attribute information of the SIM card of the device to which the storage node belongs.

[0123] After receiving a storage request from a storage node, the terminal device obtains the attribute information of the SIM card of the storage node's device, which is included in the storage request. In other words, the storage node has a SIM card installed, and when generating a storage request, it obtains the SIM card's attribute information and generates the storage request based on the SIM card's attribute information and the first smart contract.

[0124] Step H2: Verify the identity of the storage node based on the attribute information of the SIM card of the device to which the storage node belongs;

[0125] After obtaining the SIM card's attribute information, the terminal device authenticates the storage node based on the attribute information, verifying that the initiator of the storage request is an authentic storage node.

[0126] Specifically, when the terminal device verifies the attribute information of the SIM card of the storage node, it can verify whether the attribute information of the SIM card is the same as the attribute information stored in the database, and determine that the identity verification is successful when the attribute information is the same. The attribute information of the storage node stored in the database can be stored when the storage node registers its identity.

[0127] Step H3: After the storage node is authenticated, the first encrypted sub-data is sent to the storage node for distributed storage.

[0128] After the terminal device authenticates the storage node and confirms that the authentication is successful, the storage node determines that it is capable of storing the first encrypted sub-data, and then sends the first encrypted sub-data that the storage node wants to store to the storage node for distributed storage.

[0129] Specifically, the terminal device verifies the validity of the storage request sent by the storage node based on the acquired storage request. If the storage request is verified as valid, the terminal device grants storage permissions to the storage node through a smart contract, and updates the state of the smart contract in this process, marking the storage node as the authorized storage provider for the specific data shard. After the terminal device authorizes the storage node to perform storage, the terminal device sends the authorization result to the storage node.

[0130] In one implementation, after receiving the storage request sent by the storage node, sending each of the first encrypted sub-data to the corresponding storage node for distributed storage (step 108) may also include steps I1-I3:

[0131] Step I1: Obtain the attribute information of the target storage sub-data included in the storage request and the storage performance information of the storage node;

[0132] The target storage sub-data is the first encrypted sub-data that the storage node intends to store.

[0133] After the terminal device obtains the storage request, it obtains the attribute information of the target storage sub-data and the storage performance information of the storage node included in the storage request. The target storage sub-data is the first encrypted sub-data that the storage node expects to store. The storage performance information is used to describe the storage performance of the storage node. The storage performance information of the storage node may include the storage user's reputation score and / or historical storage performance indicators.

[0134] Step I2: Determine whether the storage node meets the preset storage conditions based on the storage performance information;

[0135] After obtaining the storage performance information of the storage node, the terminal device determines whether the storage node meets the preset storage conditions based on the storage performance information. The preset storage conditions are the storage conditions set by the terminal device based on the actual situation.

[0136] Specifically, when the storage performance information is the storage user's reputation score or historical storage performance indicators, the terminal device can determine that the storage node meets the preset storage conditions when the storage user's reputation score or historical storage performance indicators are greater than a preset threshold. When the storage performance information is the storage user's reputation score and historical storage performance indicators, the terminal device can determine that the storage node meets the preset storage conditions when both the storage user's reputation score and historical storage performance indicators are greater than the preset threshold.

[0137] Step I3: If yes, then send the target storage sub-data to the storage node for distributed storage.

[0138] After determining that the storage node meets the preset storage conditions, the storage node sends the target storage sub-data to the storage node for distributed storage.

[0139] Figure 4 This is a flowchart illustrating a third data storage method provided in one embodiment of this specification, as shown below. Figure 4 As shown, the schematic diagram includes:

[0140] Step 402: Obtain the first encrypted data to be distributed and stored to multiple storage nodes;

[0141] The multiple storage nodes are connected to the same blockchain.

[0142] Step 404: The first encrypted data is fragmented to obtain multiple first encrypted sub-data;

[0143] Step 406: Generate a first smart contract based on multiple first encrypted sub-data, and deploy the first smart contract in the blockchain, so that each storage node determines the first encrypted sub-data that it wants to store in itself among the multiple first encrypted sub-data based on the first smart contract and sends a storage request to the terminal device;

[0144] Step 408: After receiving the storage request sent by the storage node, obtain the first public key, the attribute information of the SIM card of the device to which the storage node belongs, the attribute information of the target storage sub-data, and the storage performance information of the storage node from the storage request;

[0145] Wherein, the target storage sub-data is the first encrypted sub-data that the storage node expects to store, and the first public key is the asymmetric encryption public key generated by the storage node.

[0146] Step 410: Verify the identity of the storage node based on the attribute information of the SIM card of the device to which the storage node belongs;

[0147] Step 412: After the storage node is authenticated, determine whether the storage node meets the preset storage conditions based on the storage performance information;

[0148] Step 414: If so, encrypt the target storage sub-data based on the first public key to obtain the first target storage sub-data;

[0149] Step 416: Send the first target storage sub-data to the storage node, so that the storage node decrypts the first target storage sub-data based on its generated asymmetric encryption private key and performs distributed storage of the decrypted target storage sub-data.

[0150] In the embodiments of this specification, after receiving the SIM card attribute information, storage performance information, first public key, and target storage sub-data attribute information from the storage request of the storage node, the attribute information of the SIM card in the storage request is authenticated. After successful authentication, the storage node is determined to meet the storage conditions based on the storage performance information. Finally, when the storage node meets the storage conditions, the target storage sub-data is encrypted based on the first public key, and the encrypted data is sent to the storage node. This not only authenticates the SIM card of the storage node but also ensures the security of the data transmission process, enhancing data privacy protection.

[0151] It should be noted that the data storage method provided in this application embodiment can be executed by a data storage device or a control module within that data storage device for executing the data storage method. This application embodiment uses the execution of the data storage method by a data storage device as an example to illustrate the data storage device provided in this application embodiment.

[0152] Figure 5 This is a schematic diagram of the structure of a data storage device according to an embodiment of the present invention. Figure 5 As shown, the data storage device includes: a first acquisition module 502, a first processing module 504, a first generation module 506, and a first sending module 508.

[0153] The first acquisition module 502 is used to acquire first encrypted data to be distributed and stored to multiple storage nodes, wherein the multiple storage nodes are connected to the same blockchain.

[0154] The first processing module 504 is used to segment the first encrypted data to obtain multiple first encrypted sub-data.

[0155] The first generation module 506 is used to generate a first smart contract based on multiple first encrypted sub-data, and deploy the first smart contract in the blockchain, so that each storage node determines the first encrypted sub-data that it wants to store in itself based on the first smart contract and sends a storage request to the terminal device.

[0156] The first sending module 508 is used to send each of the first encrypted sub-data to the corresponding storage node for distributed storage after receiving the storage request sent by the storage node.

[0157] The data storage device in this application embodiment can be a device, or a component, integrated circuit, or chip in a terminal. The device can be a mobile electronic device or a non-mobile electronic device. For example, mobile electronic devices can be mobile phones, tablets, laptops, PDAs, in-vehicle electronic devices, wearable devices, ultra-mobile personal computers (UMPCs), netbooks, or personal digital assistants (PDAs), etc., while non-mobile electronic devices can be servers, network-attached storage (NAS), personal computers (PCs), televisions (TVs), ATMs, or self-service machines, etc. This application embodiment does not impose specific limitations.

[0158] The data storage device in this application embodiment can be a device with an operating system. This operating system can be Android, iOS, or other possible operating systems; this application embodiment does not specifically limit the specific operating system used.

[0159] The data storage device provided in this application embodiment can achieve... Figures 1 to 4 The various processes implemented in the method embodiments are not described in detail here to avoid repetition.

[0160] Based on the same technical concept, embodiments of this application also provide an electronic device for executing the above-described data storage method. Figure 6 This is a schematic diagram of the structure of an electronic device to implement various embodiments of this application. The electronic device can vary significantly due to differences in configuration or performance, and may include a processor 602, a communications interface 604, a memory 608, and a communication bus 608. The processor 602, communications interface 604, and memory 606 communicate with each other via the communication bus 608. The processor 602 can call a computer program stored in the memory 606 and executable on the processor 602 to perform the following steps:

[0161] Acquire first encrypted data to be distributed and stored to multiple storage nodes, wherein the multiple storage nodes are connected to the same blockchain;

[0162] The first encrypted data is fragmented to obtain multiple first encrypted sub-data;

[0163] A first smart contract is generated based on multiple first encrypted sub-data, and the first smart contract is deployed in the blockchain, so that each storage node determines the first encrypted sub-data that it wants to store in itself based on the first smart contract and sends a storage request to the terminal device.

[0164] After receiving the storage request sent by the storage node, each of the first encrypted sub-data is sent to the corresponding storage node for distributed storage.

[0165] In one implementation, before obtaining the first encrypted data to be distributed and stored across multiple storage nodes, the method further includes:

[0166] Obtain the attribute information of the SIM card in the user identity module of the terminal device;

[0167] A registration request is generated based on the attribute information of the SIM card and a pre-generated asymmetric encryption public key. The registration request is used to request the blockchain to register an account for the user to whom the SIM card belongs.

[0168] The registration request is signed based on a pre-generated asymmetric encryption private key, and the signed registration request is sent to the blockchain.

[0169] In one implementation, after signing the registration request based on an asymmetric encryption private key and sending the signed registration request to the blockchain, the method further includes:

[0170] Obtain the verification information received by the SIM card in the terminal device, and verify the identity of the terminal device based on the verification information;

[0171] Upon successful authentication, an activation request is sent to the blockchain, which requests the blockchain to activate the account of the user to whom the SIM card belongs.

[0172] In one implementation, obtaining the first encrypted data to be distributed and stored to multiple storage nodes includes:

[0173] Obtain the International Mobile Subscriber Identity (IMSI) number, which is included in the attribute information of the SIM card, as well as the data to be stored;

[0174] Generate a symmetric encryption key based on the asymmetric encryption private key and the IMSI number;

[0175] The data to be stored is symmetrically encrypted using the symmetric encryption key to obtain the first encrypted data.

[0176] In one implementation, generating a first smart contract based on multiple first encrypted sub-data and deploying the first smart contract in the blockchain includes:

[0177] Multiple first sub-smart contracts are generated based on multiple first encrypted sub-data, and each first sub-smart contract is used to record the attribute information of the first encrypted sub-data corresponding to it.

[0178] Deploy the first sub-smart contract on the blockchain;

[0179] First upload information is generated based on multiple first sub-smart contracts, and the first upload information is used to record the attribute information of multiple first encrypted sub-data.

[0180] The first smart contract is generated based on the first uploaded information, and the first smart contract is deployed in the blockchain so that the storage node sends a storage request to the terminal device based on the first smart contract.

[0181] In one implementation, generating multiple first sub-smart contracts based on multiple first encrypted sub-data includes:

[0182] Based on multiple first encrypted sub-data, first attribute information of each first encrypted sub-data is determined, and the first attribute information includes one or more of the fragment sequence number, hash value and total number of fragments of the first encrypted sub-data.

[0183] Multiple first sub-smart contracts are generated based on multiple first attribute information;

[0184] The step of generating the first smart contract based on the first uploaded information includes:

[0185] Obtain first setting information of the terminal device, wherein the first setting information is the information required to send the storage request to the terminal device;

[0186] The first smart contract is generated based on the first uploaded information and the first setting information.

[0187] In one implementation, deploying the first sub-smart contract in the blockchain includes:

[0188] The first sub-smart contract is signed based on a pre-set asymmetric encryption private key, and the signed first sub-smart contract is deployed in the blockchain;

[0189] Deploying the first smart contract in the blockchain includes:

[0190] The first smart contract is signed based on the asymmetric encryption private key, and the signed first smart contract is deployed in the blockchain.

[0191] In one implementation, the step of sending each of the first encrypted sub-data items to the corresponding storage node for distributed storage after receiving the storage request from the storage node further includes:

[0192] Obtain the first public key from the storage request, wherein the first public key is the asymmetric encryption public key generated by the storage node;

[0193] The first encrypted sub-data is encrypted using the first public key to obtain the second encrypted sub-data.

[0194] The second encrypted sub-data is sent to the storage node, so that the storage node decrypts the second encrypted sub-data based on its generated asymmetric encryption private key and stores the decrypted first encrypted sub-data.

[0195] In one implementation, the step of sending each of the first encrypted sub-data items to the corresponding storage node for distributed storage after receiving the storage request from the storage node further includes:

[0196] Receive a storage request sent by a storage node, the storage request including attribute information of the SIM card of the device to which the storage node belongs;

[0197] The storage node is authenticated based on the attribute information of the SIM card of the device to which it belongs;

[0198] After the storage node is authenticated, the first encrypted sub-data is sent to the storage node for distributed storage.

[0199] In one implementation, the step of sending each of the first encrypted sub-data items to the corresponding storage node for distributed storage after receiving the storage request from the storage node further includes:

[0200] Obtain the attribute information of the target storage sub-data included in the storage request and the storage performance information of the storage node, wherein the target storage sub-data is the first encrypted sub-data that the storage node expects to store;

[0201] Based on the storage performance information, determine whether the storage node meets the preset storage conditions;

[0202] If so, the target storage sub-data is sent to the storage node for distributed storage.

[0203] The above electronic device structure does not constitute a limitation on the electronic device. An electronic device may include more or fewer components than illustrated, or combine certain components, or arrange them differently. For example, an input unit may include a Graphics Processing Unit (GPU) and a microphone, and a display unit may use a liquid crystal display (LCD), organic light-emitting diode (OLED), or other similar display panels. User input units include at least one of a touch panel and other input devices. A touch panel is also called a touchscreen. Other input devices may include, but are not limited to, physical keyboards, function keys (such as volume control buttons, power buttons, etc.), trackballs, mice, and joysticks, which will not be elaborated further here.

[0204] Memory can be used to store software programs and various data. Memory can primarily include a first storage area for storing programs or instructions and a second storage area for storing data. The first storage area can store the operating system, application programs or instructions required for at least one function (such as sound playback, image playback, etc.). Furthermore, memory can include volatile memory or non-volatile memory, or both. Non-volatile memory can be read-only memory (ROM), programmable read-only memory (PROM), erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), or flash memory. Volatile memory can be random access memory (RAM), static random access memory (SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (SDRAM), double data rate synchronous dynamic random access memory (DDRSDRAM), enhanced synchronous dynamic random access memory (ESDRAM), synchronous linked dynamic random access memory (Synchlink DRAM, SLDRAM), and direct memory bus RAM (DRRAM).

[0205] The processor may include one or more processing units; optionally, the processor integrates an application processor and a modem processor, wherein the application processor mainly handles operations related to the operating system, user interface, and applications, while the modem processor mainly handles wireless communication signals, such as a baseband processor. It is understood that the aforementioned modem processor may also not be integrated into the processor.

[0206] This application embodiment also provides a data storage method applied to a SIM card. The method includes: receiving an acquisition instruction sent by a terminal device, the acquisition instruction being used to instruct a user identity module SIM card to send attribute information of the SIM card, the terminal device being an installation terminal for the SIM card; sending the attribute information of the SIM card to the terminal device, so that the terminal device registers an account in a blockchain based on the attribute information of the SIM card and deploys a first smart contract generated based on first encrypted sub-data in the blockchain; and after receiving a storage request sent by a storage node, sending the first encrypted sub-data to the corresponding storage node for distributed storage, the first encrypted sub-data being obtained by fragmenting first encrypted data to be distributedly stored to multiple storage nodes, the multiple storage nodes being connected to the same blockchain, and the storage request being determined by the storage node based on the first encrypted sub-data determined by the first smart contract, which is the first encrypted sub-data that it wishes to store in itself.

[0207] In other words, the SIM card can receive an acquisition command sent by the terminal device and, upon receiving the command, send its attribute information to the terminal device. The terminal device, upon receiving this attribute information, can then send a registration request to the blockchain and register its identity. After registration, the terminal device acquires the first encrypted data to be distributed and stored across multiple storage nodes. It then segments this first encrypted data into multiple first encrypted sub-data items, generates a first smart contract based on these sub-data items, and deploys it on the blockchain. This allows each storage node to determine, based on the smart contract, the first encrypted sub-data items it wishes to store and send a storage request to the terminal device. Finally, upon receiving the requests from the storage nodes, the terminal device sends each first encrypted sub-data item to its corresponding storage node for distributed storage. Specifically, the interaction between the SIM card and the terminal device, and between the terminal device and the storage nodes, is described in the data storage method applied to the terminal device described above and will not be repeated here.

[0208] Correspondingly, this application embodiment also provides a SIM card, which includes:

[0209] The first acquisition unit is used to receive an acquisition instruction sent by a terminal device, wherein the acquisition instruction is used to instruct the user identity module SIM card to send the attribute information of the SIM card, and the terminal device is the SIM card installation terminal;

[0210] The first sending unit is configured to send the attribute information of the SIM card to the terminal device, so that the terminal device can register an account in the blockchain based on the attribute information of the SIM card and deploy a first smart contract generated based on the first encrypted sub-data in the blockchain. After receiving a storage request from a storage node, the first encrypted sub-data is sent to the corresponding storage node for distributed storage. The first encrypted sub-data is obtained by fragmenting the first encrypted data to be distributed to multiple storage nodes. The multiple storage nodes are connected to the same blockchain. The storage request is determined by the storage node based on the first encrypted sub-data that it wants to store in itself from among the multiple first encrypted sub-data determined by the first smart contract.

[0211] This application also provides a computer device, which includes: a processor; and a memory arranged to store computer-executable instructions, the executable instructions being configured to be executed by the processor, the executable instructions including various steps in the above data storage method, and achieving the same technical effect, so they will not be described again here to avoid repetition.

[0212] This application also provides a computer product, which includes a computer and a program. When the computer program is executed by a processor, it implements each step of the above-described data storage method and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0213] This application also provides a readable storage medium storing a program or instructions. When the program or instructions are executed by a processor, they implement the various processes of the above-described data storage method embodiments and achieve the same technical effect. To avoid repetition, they will not be described again here.

[0214] The processor is the processor in the electronic device described in the above embodiments. The readable storage medium includes computer-readable storage media, such as computer read-only memory (ROM), random access memory (RAM), magnetic disk, or optical disk.

[0215] This application embodiment also provides a chip, which includes a processor and a communication interface. The communication interface is coupled to the processor. The processor is used to run programs or instructions to implement the various processes of the above data storage method embodiments and can achieve the same technical effect. To avoid repetition, it will not be described again here.

[0216] It should be understood that the chip mentioned in the embodiments of this application may also be referred to as a system-on-a-chip, system chip, chip system, or system-on-a-chip, etc.

[0217] It should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes that element. Furthermore, it should be noted that the scope of the methods and apparatuses in the embodiments of this application is not limited to performing functions in the order shown or discussed, but may also include performing functions substantially simultaneously or in the reverse order, depending on the functions involved. For example, the described methods may be performed in a different order than described, and various steps may be added, omitted, or combined. Additionally, features described with reference to certain examples may be combined in other examples.

[0218] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0219] The embodiments of this application have been described above with reference to the accompanying drawings. However, this application is not limited to the specific embodiments described above. The specific embodiments described above are merely illustrative and not restrictive. Those skilled in the art can make many other forms under the guidance of this application without departing from the spirit and scope of the claims, and all of these forms are within the protection scope of this application.

Claims

1. A data storage method, applied to a terminal device, comprising: Acquire first encrypted data to be distributed and stored to multiple storage nodes, wherein the multiple storage nodes are connected to the same blockchain; The first encrypted data is fragmented to obtain multiple first encrypted sub-data; A first smart contract is generated based on multiple first encrypted sub-data, and the first smart contract is deployed in the blockchain, so that each storage node determines the first encrypted sub-data that it wants to store in itself based on the first smart contract and sends a storage request to the terminal device. After receiving the storage request sent by the storage node, each of the first encrypted sub-data is sent to the corresponding storage node for distributed storage.

2. The method according to claim 1, wherein before obtaining the first encrypted data to be distributed and stored to multiple storage nodes, the method further comprises: Obtain the attribute information of the SIM card in the user identity module of the terminal device; A registration request is generated based on the attribute information of the SIM card and a pre-generated asymmetric encryption public key. The registration request is used to request the blockchain to register an account for the user to whom the SIM card belongs. The registration request is signed based on a pre-generated asymmetric encryption private key, and the signed registration request is sent to the blockchain.

3. The method according to claim 2, after signing the registration request based on an asymmetric encryption private key and sending the signed registration request to the blockchain, the method further includes: Obtain the verification information received by the SIM card in the terminal device, and verify the identity of the terminal device based on the verification information; Upon successful authentication, an activation request is sent to the blockchain, which requests the blockchain to activate the account of the user to whom the SIM card belongs.

4. The method according to claim 2, wherein obtaining the first encrypted data to be distributed and stored to multiple storage nodes includes: Obtain the International Mobile Subscriber Identity (IMSI) number, which is included in the attribute information of the SIM card, as well as the data to be stored; Generate a symmetric encryption key based on the asymmetric encryption private key and the IMSI number; The data to be stored is symmetrically encrypted using the symmetric encryption key to obtain the first encrypted data.

5. The method according to claim 1, wherein generating a first smart contract based on a plurality of the first encrypted sub-data and deploying the first smart contract in the blockchain comprises: Multiple first sub-smart contracts are generated based on multiple first encrypted sub-data, and each first sub-smart contract is used to record the attribute information of the first encrypted sub-data corresponding to it. Deploy the first sub-smart contract on the blockchain; First upload information is generated based on multiple first sub-smart contracts, and the first upload information is used to record the attribute information of multiple first encrypted sub-data. The first smart contract is generated based on the first uploaded information, and the first smart contract is deployed in the blockchain so that the storage node sends a storage request to the terminal device based on the first smart contract.

6. The method according to claim 5, wherein generating multiple first sub-smart contracts based on multiple first encrypted sub-data comprises: Based on multiple first encrypted sub-data, first attribute information of each first encrypted sub-data is determined, and the first attribute information includes one or more of the fragment sequence number, hash value and total number of fragments of the first encrypted sub-data. Multiple first sub-smart contracts are generated based on multiple first attribute information; The step of generating the first smart contract based on the first uploaded information includes: Obtain first setting information of the terminal device, wherein the first setting information is the information required to send the storage request to the terminal device; The first smart contract is generated based on the first uploaded information and the first setting information.

7. The method according to claim 1, wherein after receiving the storage request sent by the storage node, sending each of the first encrypted sub-data to the corresponding storage node for distributed storage further comprises: Obtain the first public key from the storage request, wherein the first public key is the asymmetric encryption public key generated by the storage node; The first encrypted sub-data is encrypted using the first public key to obtain the second encrypted sub-data. The second encrypted sub-data is sent to the storage node, so that the storage node decrypts the second encrypted sub-data based on its generated asymmetric encryption private key and stores the decrypted first encrypted sub-data.

8. The method according to claim 1, wherein after receiving the storage request sent by the storage node, sending each of the first encrypted sub-data to the corresponding storage node for distributed storage further comprises: Receive a storage request sent by a storage node, the storage request including attribute information of the SIM card of the device to which the storage node belongs; The storage node is authenticated based on the attribute information of the SIM card of the device to which it belongs; After the storage node is authenticated, the first encrypted sub-data is sent to the storage node for distributed storage.

9. A data storage method applied to a SIM card, comprising: The terminal device receives an acquisition instruction sent by a terminal device, the acquisition instruction being used to instruct the user identity module SIM card to send the attribute information of the SIM card, the terminal device being the installation terminal of the SIM card; The terminal device sends the attribute information of the SIM card to the terminal device, so that the terminal device can register an account in the blockchain based on the attribute information of the SIM card and deploy a first smart contract generated based on the first encrypted sub-data in the blockchain. After receiving a storage request from a storage node, the terminal device sends the first encrypted sub-data to the corresponding storage node for distributed storage. The first encrypted sub-data is obtained by sharding the first encrypted data to be distributed to multiple storage nodes. The multiple storage nodes are connected to the same blockchain. The storage request is determined by the storage node based on the first encrypted sub-data that it wants to store in itself from among the multiple first encrypted sub-data determined by the first smart contract.

10. A data storage device, comprising: The first acquisition module is used to acquire first encrypted data to be distributed and stored to multiple storage nodes, wherein the multiple storage nodes are connected to the same blockchain. The first processing module is used to segment the first encrypted data to obtain multiple first encrypted sub-data. The first generation module is used to generate a first smart contract based on multiple first encrypted sub-data, and deploy the first smart contract in the blockchain, so that each storage node determines the first encrypted sub-data that it wants to store in itself based on the first smart contract and sends a storage request to the terminal device. The first sending module is configured to, after receiving the storage request sent by the storage node, send each of the first encrypted sub-data to the corresponding storage node for distributed storage.

11. A SIM card, comprising: The first acquisition unit is used to receive an acquisition instruction sent by a terminal device, wherein the acquisition instruction is used to instruct the user identity module SIM card to send the attribute information of the SIM card, and the terminal device is the SIM card installation terminal; The first sending unit is configured to send the attribute information of the SIM card to the terminal device, so that the terminal device can register an account in the blockchain based on the attribute information of the SIM card and deploy a first smart contract generated based on the first encrypted sub-data in the blockchain. After receiving a storage request from a storage node, the first encrypted sub-data is sent to the corresponding storage node for distributed storage. The first encrypted sub-data is obtained by fragmenting the first encrypted data to be distributed to multiple storage nodes. The multiple storage nodes are connected to the same blockchain. The storage request is determined by the storage node based on the first encrypted sub-data that it wants to store in itself from among the multiple first encrypted sub-data determined by the first smart contract.

12. A computer device, characterized in that, The device includes: Processor; and A memory configured to store computer-executable instructions configured to be executed by the processor, the executable instructions including steps for performing the data storage method as described in any one of claims 1 to 8.

13. A storage medium, characterized in that, The storage medium is used to store computer-executable instructions that cause the computer to perform the data storage method as described in any one of claims 1 to 8.

14. A computer program product, characterized in that, Includes a computer program that, when executed by a processor, implements the data storage method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Data processing method, apparatus, device and storage medium for block chain network

    CN108648084A

  • An electronic data storage method based on a block chain intelligent contract

    CN109165190A