Data storage method and device, electronic equipment and storage medium
By generating and deploying smart contracts on the blockchain, determining the encrypted sub-data that storage nodes need to store, solving the problem of high cost of blockchain data storage and achieving lower cost and higher security data storage.
Patent Information
- Application Number
- CN202411619815.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-13
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-11-13
AI Technical Summary
The blockchain-based data storage method has a high storage cost because data is distributed and stored on multiple nodes.
By obtaining the encrypted data to be stored in a distributed manner, the encrypted sub-data is processed into multiple encrypted sub-data, a smart contract is generated based on these sub-data, and deployed on the blockchain. Each storage node determines the sub-data to be stored according to the contract and sends a storage request to the terminal device, and finally sends the sub-data to the corresponding storage node for distributed storage.
The cost of data storage is reduced, and through the decentralized characteristics of smart contracts and blockchain, the security and immutability of data are improved, while reducing the amount of data that each node must store.
Smart Images

Figure CN119718186A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of blockchain technology, and specifically relates to a data storage method, device, electronic device and storage medium. Background Art
[0002] At present, the data storage method based on blockchain mainly utilizes the decentralized characteristics of blockchain technology to manage data upload, storage and access through smart contracts. This method allows data to be securely distributed across multiple nodes in the network without a centralized storage server. Every operation of the data is verified and recorded through the blockchain to ensure the security and immutability of the data. However, since the data is distributed across multiple nodes in the network and each node needs to save a copy of the data, this greatly increases the storage cost.
[0003] Therefore, a storage method that can reduce data storage costs is needed. Summary of the invention
[0004] The embodiment of the present application provides a data storage method, which can reduce the storage cost of data.
[0005] In a first aspect, an embodiment of the present application provides a data storage method, the method comprising: obtaining first encrypted data to be distributedly stored in multiple storage nodes, the multiple storage nodes being connected to the same blockchain; sharding 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 storage node determines the first encrypted sub-data desired to be stored in itself among the multiple first encrypted sub-data based on the first smart contract and sends a storage request to a terminal device; after receiving the storage request sent by the storage node, sending each first encrypted sub-data to the corresponding storage node for distributed storage.
[0006] In a second aspect, an embodiment of the present application provides a data storage device, which includes: a first acquisition module, used to acquire first encrypted data to be distributedly stored in multiple storage nodes, and the multiple storage nodes are connected to the same blockchain; a first processing module, used to shard the first encrypted data to obtain multiple first encrypted sub-data; a first generation module, used 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 storage node determines the first encrypted sub-data expected to be stored in itself among the multiple first encrypted sub-data based on the first smart contract and sends a storage request to a terminal device; a first sending module, used to send each first encrypted sub-data to the corresponding storage node for distributed storage after receiving the storage request sent by the storage node.
[0007] In a third aspect, an embodiment of the present application provides an electronic device, which includes a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method described in the first aspect.
[0008] In a fourth aspect, an embodiment of the present application provides a readable storage medium, on which a program or instruction is stored, and when the program or instruction is executed by a processor, the steps of the method described in the first aspect are implemented.
[0009] In a fifth aspect, an embodiment of the present application provides a chip, comprising a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run a program or instruction to implement the method described in the first aspect.
[0010] In an embodiment of the present application, by obtaining first encrypted data to be distributedly stored in multiple storage nodes, the multiple storage nodes are 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 the first smart contract is deployed in the blockchain, so that each storage node determines the first encrypted sub-data expected to be stored in itself among the multiple first encrypted sub-data 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 first encrypted sub-data is sent to the corresponding storage node for distributed storage, which can reduce the storage cost of data. BRIEF DESCRIPTION OF THE DRAWINGS
[0011] Figure 1 It is a flowchart of a data storage method provided by an embodiment of the present application; Figure 2It is a structural schematic diagram of a data storage system provided in an embodiment of the present application; Figure 3 is a flow chart of a second data storage method provided in an embodiment of the present application; Figure 4 This is a flow chart of the third data storage method provided in the embodiment of the present application. Figure 5 is a structural schematic diagram of a data storage device provided in an embodiment of the present application; Figure 6 It is a structural schematic diagram of a data storage device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0012] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0013] The terms "first", "second", etc. in the specification and claims of the present application are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described here, and the objects distinguished by "first", "second", etc. are generally of one type, and the number of objects is not limited. For example, the first object can be one or more. In addition, "and / or" in the specification and claims represents at least one of the connected objects, and the character " / " generally indicates that the objects associated with each other are in an "or" relationship.
[0014] The data storage method provided in the embodiment of the present application is described in detail below through specific embodiments and application scenarios in conjunction with the accompanying drawings.
[0015] Figure 1 A data storage method provided by an embodiment of the present invention is shown. The method can be executed by an electronic device, and the electronic device may include: a server and / or a terminal device, wherein the terminal device may be, for example, a vehicle-mounted terminal or a mobile phone terminal. In other words, the method can be executed by software or hardware installed in a data storage device, and the method includes the following steps: Step 102: Obtain first encrypted data to be distributed and stored in multiple storage nodes; Wherein, the multiple storage nodes are connected to the same blockchain.
[0016] The terminal device obtains the first encrypted data to be distributed and stored in multiple storage nodes, wherein the multiple storage nodes are connected to the same blockchain, and the terminal device can be a mobile phone terminal or other terminal devices.
[0017] Specifically, the first encrypted data to be distributedly stored may be determined by symmetric encryption of the data to be stored, or by asymmetric encryption of the data to be stored, or by a hybrid encryption of symmetric encryption and asymmetric encryption of the data to be stored.
[0018] Step 104: Slice the first encrypted data to obtain a plurality of first encrypted sub-data; After obtaining the first encrypted data, the terminal device performs sharding processing on the first encrypted data to obtain a plurality of first encrypted sub-data. In other words, the terminal device divides the first encrypted data to be distributedly stored into a plurality of first encrypted sub-data.
[0019] Specifically, when the first encrypted data is segmented, the first encrypted data may be segmented into a plurality of first encrypted sub-data of equal size, or the first encrypted data may be segmented into first encrypted sub-data of different sizes, wherein the size of each first encrypted sub-data segment may be set according to actual conditions. When the first encrypted sub-data is segmented into a plurality of first encrypted sub-data of equal size, if the total size of the data is not an integer multiple of the segment size, the terminal device may fill blanks in the last segment to reach the segment size.
[0020] More specifically, when the terminal device performs sharding processing on the first encrypted data, it can determine the size of the shards of the first encrypted data according to 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 of each storage node.
[0021] Step 106: Generate a first smart contract based on the plurality of first encrypted sub-data, and deploy the first smart contract in the blockchain, so that each storage node determines the first encrypted sub-data desired to be stored in itself among the plurality of first encrypted sub-data based on the first smart contract and sends a storage request to a terminal device; After determining the plurality of first encrypted sub-data, the terminal device generates a first smart contract based on the plurality of first encrypted data, and deploys the generated first smart contract in the blockchain, so that each storage node determines the first encrypted sub-data expected to be stored in itself among the plurality of first encrypted sub-data based on the first smart contract and sends a storage request to the terminal device. That is, after the first smart contract is deployed in the blockchain, the plurality of storage nodes connected to the blockchain can determine the plurality of first encrypted sub-data that need to be distributedly stored through the first smart contract, and determine the first encrypted sub-data expected to be stored in itself from the plurality of first encrypted sub-data, and then send a storage request to the terminal device to request the terminal device to send the first encrypted sub-data expected to be stored in itself to itself for storage.
[0022] Specifically, the first smart contract deployed by the terminal device is used to record the attribute information of multiple first encrypted sub-data and the information required to send a storage request to the terminal device, so that the storage node can determine the relevant information of multiple first encrypted sub-data that need to be distributed 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, and then generate a storage request based on the first encrypted sub-data expected to be stored and send the request to the terminal device, requesting the terminal device to send the first encrypted sub-data expected to be stored to itself and store it.
[0023] 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 in itself, so that the terminal device can determine the first encrypted sub-data that the storage node expects to store based on the storage request, and then 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.
[0024] Step 108: 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.
[0025] After the terminal device receives the storage request sent by the storage node, the terminal device sends each first encrypted sub-data to the corresponding storage node for distributed storage. That is, after the terminal device receives the storage request sent by multiple storage nodes, the first encrypted sub-data requested for storage in each storage request is sent to the storage node corresponding to the storage request, so that each storage node stores the first encrypted sub-data expected to be stored, thereby realizing distributed storage of multiple first encrypted sub-data.
[0026] When the terminal device sends a storage request to the storage node, the terminal device can use the encrypted P2P communication protocol for data transmission. Specifically, a secure communication channel is established between the terminal device and the storage node, and the TLS (Transport Layer Security) protocol is used to ensure the security of the data transmission process. Then, the terminal device sends the first encrypted sub-data to the storage node based on the established secure channel. After the storage node receives the first encrypted sub-data sent by the terminal device, it will also send a confirmation receipt to the terminal device to ensure the complete transmission of the data shard.
[0027] Specifically, after receiving the first encrypted sub-data, the storage node can store the first encrypted sub-data in its distributed storage system. After storing the first encrypted sub-data, the storage node can also generate a storage certificate, 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.
[0028] Figure 2 is a schematic diagram of a data storage system provided in an 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 obtains the first encrypted data that needs to be distributed stored, and then performs sharding processing on the first encrypted data to obtain multiple first encrypted sub-data, and then determines the attribute information (such as size, characteristic value, etc.) of the multiple first encrypted sub-data to generate a first smart contract, and deploys the first smart contract in the blockchain. After the first smart contract is deployed in the blockchain, the first storage node and the second storage node connected to the blockchain determine the multiple first encrypted sub-data that need to be distributed stored and the first encrypted sub-data that are expected to be stored in themselves according to the first smart contract, and then generate a storage request based on the first encrypted sub-data expected to be stored in themselves and send the storage request to the terminal device. After the terminal device receives the storage request sent by the storage node, the first encrypted sub-data that each storage node expects to store is sent to the corresponding storage node based on the storage request, so as to perform distributed storage on the storage node.
[0029] The data storage method provided by the embodiment of the present invention obtains first encrypted data to be distributedly stored in multiple storage nodes, and the multiple storage nodes are 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 the first smart contract is deployed in the blockchain, so that each storage node determines the first encrypted sub-data expected to be stored in itself among the multiple first encrypted sub-data based on the first smart contract and sends a storage request to a terminal device; after receiving the storage request sent by the storage node, each first encrypted sub-data is sent to the corresponding storage node for distributed storage, which can reduce the cost of data storage.
[0030] In one implementation, before obtaining the first encrypted data to be distributed and stored in multiple storage nodes (step 102), steps A1-A3 may also be performed: Step A1: Acquire attribute information of a subscriber identity module SIM card in the terminal device; The terminal device obtains the attribute information of the user identity module SIM card in the terminal device, wherein the attribute information of the SIM card may include the IMSI number, operator identification and country code of the SIM card and other related information. The IMSI number is the International Mobile Subscriber Identity, which is a unique identifier assigned to the user.
[0031] Specifically, when obtaining the attribute information of the SIM card in the terminal device, a registration application can be started, and the attribute information of the SIM card can be automatically obtained based on the application APP, thereby reducing the need for users to manually enter information, reducing the possibility of input errors, and improving the efficiency of the registration process and user experience.
[0032] Step A2: Generate a registration request 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.
[0033] After obtaining the attribute information of the SIM card, the terminal device generates a registration request based on the attribute information of the SIM card and a pre-generated asymmetric encryption public key, wherein the registration request is used to request the blockchain to register an account for the user to whom the SIM card belongs.
[0034] 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 encrypted public key and the attribute information of the SIM card. The public key will be used to identify the user on the blockchain, while the private key will be retained on the user's device for signing transactions and verifying identity.
[0035] Step A3: Sign the registration request based on a pre-generated asymmetric encryption private key, and send the signed registration request to the blockchain.
[0036] After generating the registration request, the terminal device signs the registration request based on the pre-generated asymmetric encryption public key, and then sends the signed registration request to the blockchain. The terminal device digitally signs the registration request based on the private key to ensure the authenticity and integrity of the request. Once the registration request is accepted by the blockchain network, the blockchain will generate a smart contract for recording the user's attribute information (such as IMSI number) and public key. The smart contract serves as the user's unique identity on the blockchain. The terminal device records the user's attribute information based on the immutability and transparency of the blockchain, which not only protects the security of user information, but also ensures that the identity authentication of the user in subsequent task transactions and data storage requests is reliable and effective.
[0037] After the blockchain receives the signed registration request, the blockchain verifies the signature of the registration request based on the asymmetric encryption public key, and after the verification is passed, registers the account for the user of the SIM card based on the attribute information of the SIM included in the registration request.
[0038] In one implementation, after signing the registration request based on the asymmetric encryption private key and sending the signed registration request to the blockchain (step A3), steps B1-B2 may also be performed: Step B1: obtaining the verification information received by the SIM card in the terminal device, and performing identity authentication on the terminal device based on the verification information; The terminal device obtains the verification information received by the SIM card and authenticates the terminal device based on the verification information. That is, after the user of the SIM card in the terminal device successfully registers his identity, it is also necessary to obtain the verification information obtained by the SIM card and authenticate the terminal device based on the obtained verification information.
[0039] Specifically, the terminal device can complete the identity authentication of the terminal through a text message verification step, that is, sending a text message containing a verification code to the mobile phone number corresponding to the user's SIM card, and then receiving the verification code entered by the user. The application of the terminal device can complete the identity authentication of the terminal device by verifying the verification code.
[0040] Step B2: When identity verification is successful, an activation request is sent to the blockchain; The activation request is used to request the blockchain to activate the account of the user to which the SIM card belongs.
[0041] When the identity authentication of the terminal device is passed, an activation request is sent to the blockchain, where the activation request is used to request the blockchain to activate the account of the SIM user. That is to say, after the SIM user completes the registration in the terminal device, it is also necessary to send verification information to the SIM card and after the terminal to which the SIM card belongs is verified, the terminal device sends an activation request to the blockchain to request the blockchain to activate the account of the SIM card user.
[0042] Specifically, after the blockchain receives the activation request sent by the terminal device, it can update the user's account status in the smart contract to the "activated" state. In other words, after completing the identity registration of the user, the blockchain only sets the user's account status in the smart contract to the "inactivated" state, and then changes the account status from the "inactivated" state to the "activated" state when receiving the activation request sent by the terminal device. This can not only determine the user's true identity and prevent the user from registering by mistake, but also increase the security and reliability of the system.
[0043] In one implementation, the obtaining of the first encrypted data to be distributedly stored in multiple storage nodes (step 102) may include executing steps C1-C3: Step C1: obtaining the International Mobile Subscriber Identity (IMSI) number and the data to be stored included in the attribute information of the SIM card; The terminal device obtains the International Mobile Subscriber Identity Number (IMSI) 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 distributedly stored.
[0044] Step C2: generating a symmetric encryption key based on the asymmetric encryption private key and the IMSI number; The terminal device pregenerates 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.
[0045] Specifically, when a symmetric encryption key is generated based on an asymmetric encryption private key and an IMSI number and encrypted, the AES-256 encryption algorithm can be used to encrypt data. AES-256 is a widely used symmetric encryption algorithm that provides high security. The symmetric encryption key k is generated based on the user's private key and the IMSI number of the SIM card, using the formula k=H(kuser||IMSI), where H is a hash function, kuser is a private key generated in advance by the user, || represents string concatenation, and IMSI is the international mobile subscriber identity of the user's SIM card.
[0046] Step C3: symmetrically encrypt the data to be stored based on the symmetric encryption key to obtain the first encrypted data.
[0047] After generating the symmetric encryption key, the terminal device symmetrically encrypts 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, that is, the data to be stored, to obtain the encrypted data, that is, the first encrypted data.
[0048] Figure 3 is a flow chart of a second data storage method provided in an embodiment of this specification, such as Figure 3 As shown, the schematic diagram includes: Step 302: Acquire attribute information of a subscriber identity module SIM card in a terminal device; Step 304: Generate a registration request 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.
[0049] Step 306: Sign the registration request based on a pre-generated asymmetric encryption private key, and send the signed registration request to the blockchain; Step 308: Obtain the International Mobile Subscriber Identity (IMSI) number and the data to be stored included in the attribute information of the SIM card; Step 310: Generate a symmetric encryption key based on the asymmetric encryption private key and the IMSI number; Step 312: symmetrically encrypt the data to be stored based on the symmetric encryption key to obtain the first encrypted data; Step 314: Slice the first encrypted data to obtain a plurality of first encrypted sub-data; Step 316: Generate a first smart contract based on the plurality of first encrypted sub-data, and deploy the first smart contract in the blockchain, so that each storage node determines the first encrypted sub-data desired to be stored in itself among the plurality of first encrypted sub-data based on the first smart contract and sends a storage request to the terminal device; Step 318: 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.
[0050] In the embodiments of the present specification, the user's identity is registered and activated based on the attribute information of the SIM card of the terminal device. After the identity is successfully activated, the first encrypted data in the terminal device is sharded, and the multiple first encrypted sub-data obtained by the sharding are distributedly stored, which not only improves the efficiency of data management and enhances the security of the data, but also reduces the amount of data that must be stored in each node, thereby reducing the overall storage cost.
[0051] In one implementation, the generating of the first smart contract based on the plurality of the first encrypted sub-data and the deploying of the first smart contract in the blockchain (step 106) may include executing steps D1-D4: Step D1: Generate multiple first sub-smart contracts based on multiple first encrypted sub-data; Among them, each of the first sub-smart contracts is used to record the attribute information of the first encrypted sub-data corresponding to it.
[0052] After obtaining a plurality of first encrypted sub-data, the terminal device generates a plurality of first sub-smart contracts based on the plurality of first encrypted sub-data, wherein each first sub-smart contract is used to record the attribute information of the first encrypted sub-data corresponding thereto, such as size, characteristic value, etc. In other words, the terminal device generates a first sub-smart contract corresponding thereto for each first encrypted sub-data, and the corresponding first sub-smart contract is used to record the attribute information of the first encrypted sub-data, wherein the attribute information of the first encrypted sub-data is information describing the first encrypted sub-data.
[0053] Step D2: deploying the first sub-smart contract in the blockchain; After generating multiple first sub-smart contracts corresponding to each first encrypted sub-data, the terminal device deploys the multiple first sub-smart contracts in the blockchain so that the first sub-smart contracts corresponding to each first encrypted sub-data of the blockchain are recorded. In other words, multiple first sub-smart contracts are deployed in the blockchain, and each first sub-smart contract is used to record the relevant information of the first encrypted sub-data corresponding to it. By deploying multiple first sub-smart contracts on the blockchain, the terminal device ensures that all sharding information is open, transparent and cannot be tampered with on the blockchain.
[0054] Step D3: Generate first upload information based on multiple first sub-smart contracts; The first upload information is used to record the attribute information of a plurality of the first encrypted sub-data.
[0055] After generating multiple first sub-smart contracts, the terminal device generates first upload information based on the multiple first sub-smart contracts, wherein the first upload information is used to record 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, that is, the 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 by slicing the first encrypted data.
[0056] 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.
[0057] 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 sends a storage request to the terminal device based on the first smart contract.
[0058] Specifically, the first smart contract generated by the terminal device can not only be used for the storage node to send storage requests, but also can be used to realize the status tracking and update of each first encrypted sub-data, that is, when the storage status of each first encrypted sub-data changes, the update information can be saved in the smart contract corresponding to the blockchain.
[0059] In one implementation, the generating of a plurality of first sub-smart contracts based on the plurality of first encrypted sub-data (step D1) may include executing steps E1-E2: Step E1: determining first attribute information of each of the first encrypted sub-data based on a plurality of the first encrypted sub-data; 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.
[0060] After the terminal device obtains multiple first encrypted sub-data, the terminal device determines first attribute information of each first encrypted sub-data based on the multiple first encrypted sub-data, wherein each first attribute information includes one or more of the shard sequence number, hash value and total shard data of the corresponding first encrypted sub-data.
[0061] 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 a hash function.
[0062] Step E2: generating a plurality of the first sub-smart contracts based on a plurality of the first attribute information; 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 the first sub-smart contract corresponding to each first attribute information.
[0063] 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 reorganization of the first encrypted data.
[0064] The generating of the first smart contract based on the first uploaded information (step D4) may execute steps E3-E4: Step E3: Acquire first setting information of the terminal device; The first setting information is information required to send the storage request to the terminal device.
[0065] The terminal device obtains first setting information of the terminal device, wherein the first setting information may include information required to send a storage request to the terminal device. Further, the first setting information may also include description information (such as file name, file type, etc.) of each first encrypted sub-data, so that the storage node can determine the first encrypted sub-data to be stored based on the description information.
[0066] Step E4: Generate the first smart contract based on the first uploaded information and the first setting information.
[0067] After obtaining the first setting information, the terminal device generates a first smart contract based on the first upload information and the first setting information, so that each storage node determines the first encrypted sub-data that it wishes to store in itself based on the first smart contract and sends a storage request to the terminal device. The terminal device deploys the first smart contract in the blockchain, thereby ensuring that all shard information is open, transparent and tamper-proof on the blockchain.
[0068] In one implementation, the deploying the first sub-smart contract in the blockchain (step D2) may execute step F1: Step F1: Signing the first sub-smart contract based on a preset asymmetric encryption private key, and deploying the signed first sub-smart contract in the blockchain; After the first sub-smart contract is generated, the terminal device can 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. That is, the terminal device pre-generates a pair of public and private key pairs for asymmetric encryption, and then deploys each first sub-smart contract through the application on its device, and the deployment operation is signed using the generated asymmetric encryption private key so that the blockchain verifies the signed first sub-smart contract.
[0069] The step of deploying the first smart contract in the blockchain (step D4) may include executing step F2: Step F2: Sign the first smart contract based on the asymmetric encryption private key, and deploy the signed first smart contract in the blockchain.
[0070] After the first smart contract is generated, the terminal device can sign the first smart contract based on the preset 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 the application on its device, and the deployment operation is signed using the generated asymmetric encryption private key so that the blockchain can verify the signed first smart contract.
[0071] In one implementation, 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 (step 108), and steps G1-G3 may also be performed: Step G1: Obtain the first public key in the storage request; The first public key is an asymmetric encryption public key generated by the storage node.
[0072] The terminal device obtains the first public key in the storage request sent by the storage node, wherein 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.
[0073] 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 obtains the first public key based on the storage request.
[0074] Step G2: Encrypting the first encrypted sub-data based on the first public key to obtain second encrypted sub-data; 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 expects to store based on the first public key to obtain the encrypted result second encrypted sub-data, ensuring that only the corresponding storage node can decrypt it.
[0075] 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 the asymmetric encryption private key generated by it and stores the first encrypted sub-data obtained by decryption.
[0076] 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 decrypts the second encrypted sub-data based on the asymmetric encryption private key generated by it, that is, the first private key, and stores the decrypted first encrypted sub-data.
[0077] Specifically, the terminal device encrypts the first encrypted sub-data based on the first public key generated by the storage node, and sends the decrypted second encrypted sub-data to the storage node. After the storage node receives the second encrypted sub-data, the storage node can decrypt the second encrypted sub-data based on the pre-generated first private key to obtain the decryption result, i.e., the first encrypted sub-data, and store the first encrypted sub-data. The terminal device asymmetrically encrypts the symmetrically encrypted first encrypted sub-data again through the public key of the storage node, 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.
[0078] In one implementation, 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 (step 108), and steps H1-H3 may also be performed: Step H1: receiving a storage request sent by a storage node; The storage request includes attribute information of a SIM card of a device to which the storage node belongs.
[0079] After receiving the storage request sent by the storage node, the terminal device obtains the attribute information of the SIM card of the device of the storage node included in the storage request. That is, the storage node is installed with a SIM card, and when the storage node generates a storage request, the attribute information of the SIM card is obtained and the storage request is generated based on the attribute information of the SIM card and the first smart contract.
[0080] Step H2: authenticating the storage node based on the attribute information of the SIM card of the device to which the storage node belongs; After acquiring the attribute information of the SIM card, the terminal device authenticates the storage node based on the attribute information to verify that the initiator of the storage request is a verified storage node.
[0081] 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 authentication is passed when the attribute information is the same, wherein the attribute information of the storage node stored in the database can be stored when the storage node performs identity registration.
[0082] Step H3: After the storage node identity authentication is passed, the first encrypted sub-data is sent to the storage node for distributed storage.
[0083] After the terminal device authenticates the storage node and determines that the authentication is successful, the storage node determines that the storage node can store the first encrypted sub-data, and thus sends the first encrypted sub-data that the storage node expects to store to the storage node for distributed storage.
[0084] 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 to be valid, the terminal device grants the storage node storage permission through the smart contract, and updates the state of the smart contract in the process, marking the storage node as the authorized storer of a specific data shard. After the terminal device authorizes the storage node to store, the terminal device sends the authorization result to the storage node.
[0085] In one implementation, 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 (step 108), and steps I1-I3 may also be performed: Step I1: Acquire the attribute information of the target storage sub-data included in the storage request and the storage performance information of the storage node; The target storage sub-data is the first encrypted sub-data that the storage node expects to store.
[0086] After the terminal device obtains the storage request, the terminal device obtains 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, and the storage performance information is used to describe the storage performance of the storage node, and the storage performance information of the storage node may include the reputation score of the storer and / or historical storage performance indicators.
[0087] Step I2: determining whether the storage node meets a preset storage condition based on the storage performance information; After acquiring the storage performance information of the storage node, the terminal device determines whether the storage node meets the preset storage condition based on the storage performance information, wherein the preset storage condition is a storage condition set by the terminal device based on actual conditions.
[0088] Specifically, when the storage performance information is the storage provider'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 provider's reputation score or historical storage performance indicators are greater than a preset threshold. When the storage performance information is the storage provider'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 provider's reputation score and historical storage performance indicators are greater than a preset threshold.
[0089] Step I3: If yes, the target storage sub-data is sent to the storage node for distributed storage.
[0090] After determining that the storage node meets the preset storage condition, the storage node sends the target storage sub-data to the storage node for distributed storage.
[0091] Figure 4 is a flow chart of a third data storage method provided in an embodiment of this specification, such as Figure 4 As shown, the schematic diagram includes: Step 402: Obtain first encrypted data to be distributed and stored in multiple storage nodes; Wherein, the multiple storage nodes are connected to the same blockchain.
[0092] Step 404: Slice the first encrypted data to obtain a plurality of first encrypted sub-data; Step 406: Generate a first smart contract based on the plurality of first encrypted sub-data, and deploy the first smart contract in the blockchain, so that each storage node determines the first encrypted sub-data desired to be stored in itself among the plurality of first encrypted sub-data based on the first smart contract and sends a storage request to a terminal device; Step 408: after receiving the storage request sent by the storage node, obtaining the first public key in the storage request, 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; The target storage sub-data is the first encrypted sub-data that the storage node expects to store, and the first public key is an asymmetric encryption public key generated by the storage node.
[0093] Step 410: authenticating the storage node based on the attribute information of the SIM card of the device to which the storage node belongs; Step 412: after the storage node identity authentication is passed, determining whether the storage node meets the preset storage condition based on the storage performance information; Step 414: If yes, encrypt the target storage sub-data based on the first public key to obtain first target storage sub-data; 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 the asymmetric encryption private key generated by it and performs distributed storage on the decrypted target storage sub-data.
[0094] In the embodiments of the present specification, after receiving the attribute information of the SIM card, the storage performance information, the first public key and the attribute information of the target storage sub-data in the storage request of the storage node, the attribute information of the SIM in the storage request is authenticated, and after the identity authentication is passed, it is determined whether the storage node meets the storage conditions based on the storage performance information, and 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, which not only can authenticate the SIM card of the storage node, but also can ensure the security of the data transmission process, thereby enhancing the privacy protection of the data.
[0095] It should be noted that the data storage method provided in the embodiment of the present application can be executed by a data storage device or a control module in the data storage device for executing the data storage method. In the embodiment of the present application, the data storage device provided in the embodiment of the present application is described by taking the data storage device executing the data storage method as an example.
[0096] Figure 5 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 .
[0097] A first acquisition module 502 is used to acquire first encrypted data to be distributed and stored in multiple storage nodes, where the multiple storage nodes are connected to the same blockchain; A first processing module 504, configured to perform slicing processing on the first encrypted data to obtain a plurality of first encrypted sub-data; A first generating module 506, configured to generate a first smart contract based on the plurality of the first encrypted sub-data, and deploy the first smart contract in the blockchain, so that each of the storage nodes determines the first encrypted sub-data desired to be stored in itself among the plurality of the first encrypted sub-data based on the first smart contract and sends a storage request to a terminal device; The first sending module 508 is configured to send each first encrypted sub-data to the corresponding storage node for distributed storage after receiving the storage request sent by the storage node.
[0098] The data storage device in the embodiment of the present application 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. Exemplarily, the mobile electronic device can be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, an ultra-mobile personal computer (UMPC), a netbook, or a personal digital assistant (PDA), etc. The non-mobile electronic device can be a server, a network attached storage (NAS), a personal computer (PC), a television (TV), a teller machine or a self-service machine, etc., which is not specifically limited in the embodiment of the present application.
[0099] The data storage device in the embodiment of the present application may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiment of the present application.
[0100] The data storage device provided in the embodiment of the present application can realize Figures 1 to 4 To avoid repetition, the various processes implemented in the method embodiment are not described here.
[0101] Based on the same technical concept, an embodiment of the present application further provides an electronic device, which is used to execute the above data storage method. Figure 6A schematic diagram of the structure of an electronic device for implementing various embodiments of the present application. The electronic device may have relatively large differences due to different configurations or performances, and may include a processor (processor) 602, a communication interface (Communications Interface) 604, a memory (memory) 608 and a communication bus 608, wherein the processor 602, the communication interface 604, and the memory 606 communicate with each other through the communication bus 608. The processor 602 may call a computer program stored in the memory 606 and executable on the processor 602 to perform the following steps: Obtaining first encrypted data to be distributedly stored in a plurality of storage nodes, wherein the plurality of storage nodes are connected to the same blockchain; Slice the first encrypted data to obtain a plurality of first encrypted sub-data; generating a first smart contract based on the plurality of the first encrypted sub-data, and deploying the first smart contract in the blockchain, so that each of the storage nodes determines the first encrypted sub-data desired to be stored in itself among the plurality of the first encrypted sub-data based on the first smart contract and sends a storage request to a 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.
[0102] In one implementation, before obtaining the first encrypted data to be distributed and stored in multiple storage nodes, the method further includes: Obtaining attribute information of a user identity module SIM card in the terminal device; Generate a registration request based on the attribute information of the SIM card and a pre-generated asymmetric encryption public key, wherein 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.
[0103] 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: Acquire the verification information received by the SIM card in the terminal device, and perform identity authentication on the terminal device based on the verification information; If the identity authentication is passed, an activation request is sent to the blockchain, where the activation request is used to request the blockchain to activate the account of the user to whom the SIM card belongs.
[0104] In one implementation, the step of obtaining first encrypted data to be distributedly stored in multiple storage nodes includes: Obtaining the International Mobile Subscriber Identity (IMSI) number and the data to be stored included in the attribute information of the SIM card; Generate a symmetric encryption key based on the asymmetric encryption private key and the IMSI number; The data to be stored is symmetrically encrypted based on the symmetric encryption key to obtain the first encrypted data.
[0105] In one implementation, generating a first smart contract based on the plurality of first encrypted sub-data and deploying the first smart contract in the blockchain includes: Generate multiple first sub-smart contracts based on the multiple first encrypted sub-data, each of the first sub-smart contracts is used to record attribute information of the first encrypted sub-data corresponding thereto; Deploy the first sub-smart contract in the blockchain; Generate first upload information based on the plurality of first sub-smart contracts, where the first upload information is used to record attribute information of the plurality of first encrypted sub-data; The first smart contract is generated based on the first upload 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.
[0106] In one implementation, the generating a plurality of first sub-smart contracts based on the plurality of first encrypted sub-data includes: Determine first attribute information of each of the first encrypted sub-data based on the plurality of the first encrypted sub-data, where the first attribute information includes one or more of a fragment sequence number, a hash value, and a total number of fragments of the first encrypted sub-data; Generate multiple first sub-smart contracts based on multiple first attribute information; The generating the first smart contract based on the first uploaded information includes: Acquire first setting information of the terminal device, where the first setting information is 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.
[0107] In one implementation, deploying the first sub-smart contract in the blockchain includes: Signing the first sub-smart contract based on a preset asymmetric encryption private key, and deploying the signed first sub-smart contract in the blockchain; The step of deploying the first smart contract in the blockchain includes: The first smart contract is signed based on the asymmetric encryption private key, and the signed first smart contract is deployed in the blockchain.
[0108] In one implementation, after receiving the storage request sent by the storage node, sending each first encrypted sub-data to the corresponding storage node for distributed storage further includes: Obtaining a first public key in the storage request, where the first public key is an asymmetric encryption public key generated by the storage node; Encrypting the first encrypted sub-data based on the first public key to obtain 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 the asymmetric encryption private key generated by the storage node and stores the first encrypted sub-data obtained by decryption.
[0109] In one implementation, after receiving the storage request sent by the storage node, sending each first encrypted sub-data to the corresponding storage node for distributed storage further includes: Receiving a storage request sent by a storage node, wherein the storage request includes attribute information of a SIM card of a device to which the storage node belongs; Authentication of the storage node is performed based on attribute information of a SIM card of a device to which the storage node belongs; After the storage node identity authentication is passed, the first encrypted sub-data is sent to the storage node for distributed storage.
[0110] In one implementation, after receiving the storage request sent by the storage node, sending each first encrypted sub-data to the corresponding storage node for distributed storage further includes: Acquire attribute information of target storage sub-data included in the storage request and 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; Determining whether the storage node meets a preset storage condition based on the storage performance information; If yes, the target storage sub-data is sent to the storage node for distributed storage.
[0111] The above electronic device structure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently. For example, the input unit may include a graphics processing unit (GPU) and a microphone, and the display unit may be configured with a display panel in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit includes a touch panel and at least one of other input devices. The touch panel is also called a touch screen. Other input devices may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which will not be repeated here.
[0112] The memory can be used to store software programs and various data. The memory may mainly include a first storage area for storing programs or instructions and a second storage area for storing data, wherein the first storage area may store an operating system, an application program or instructions required for at least one function (such as a sound playback function, an image playback function, etc.), etc. In addition, the memory may include a volatile memory or a non-volatile memory, or the memory may include both volatile and non-volatile memories. Among them, the non-volatile memory may be a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), or a 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 link dynamic random access memory (SLDRAM) and direct memory bus random access memory (DRRAM).
[0113] 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 processes operations related to the operating system, user interface, and application programs, and the modem processor mainly processes wireless communication signals, such as a baseband processor. It is understandable that the modem processor may not be integrated into the processor.
[0114] An embodiment of the present application also provides a data storage method, which is applied to a SIM card, the method comprising: 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 of the SIM card; sending the attribute information of the SIM card to the terminal device, so that the terminal device registers an account in the 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 sharding the first encrypted data to be distributedly stored in 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 that is desired to be stored in itself among the multiple first encrypted sub-data determined by the first smart contract.
[0115] That is to say, the SIM card can receive the acquisition instruction sent by the terminal device, and after receiving the acquisition instruction, send the attribute information of the SIM card to the terminal device, and after receiving the attribute information sent by the SIM, the terminal device can send a registration request to the blockchain based on the attribute information and perform identity registration. After the registration is completed, the terminal device obtains the first encrypted data to be distributed and stored in multiple storage nodes, and performs sharding processing on the first encrypted data to obtain multiple first encrypted sub-data, and then generates a first smart contract based on the multiple first encrypted sub-data, and deploys the first smart contract in the blockchain, so that each storage node determines the first encrypted sub-data expected to be stored in itself among the multiple first encrypted sub-data based on the first smart contract and sends a storage request to the terminal device, and finally after the terminal device receives the request sent by the storage node, each first encrypted sub-data is sent to the corresponding storage node for distributed storage. Specifically, the way in which the SIM card interacts with the terminal device in this method, and the way in which the terminal device interacts with the storage node, refer to the above-mentioned data storage method applied to the terminal device, and will not be repeated here.
[0116] Correspondingly, an embodiment of the present application further provides a SIM card, the SIM card comprising: A first acquisition unit, configured to receive an acquisition instruction sent by a terminal device, wherein the acquisition instruction is used to instruct a user identity module SIM card to send attribute information of the SIM card, and the terminal device is an installation terminal of the SIM card; A first sending unit is used to send the attribute information of the SIM card to the terminal device, so that the terminal device registers an account in the blockchain based on the attribute information of the SIM card and deploys the first smart contract generated based on the first encrypted sub-data in the blockchain, and after receiving the storage request sent by the storage node, send 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 distributedly stored in multiple storage nodes, the multiple storage nodes are connected to the same blockchain, and the storage request is determined by the storage node based on the first encrypted sub-data that is expected to be stored in itself among the multiple first encrypted sub-data determined by the first smart contract.
[0117] An embodiment of the present application also provides a computer device, which includes: a processor; and a memory arranged to store computer executable instructions, the executable instructions are configured to be executed by the processor, the executable instructions include instructions for executing each step in the above-mentioned data storage method, and can achieve the same technical effect. To avoid repetition, they are not repeated here.
[0118] An embodiment of the present application also provides a computer product, which includes a computer and a program. When the computer program is executed by a processor, each step in the above-mentioned data storage method is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0119] An embodiment of the present application also provides a readable storage medium, on which a program or instruction is stored. When the program or instruction is executed by a processor, each process of the above-mentioned data storage method embodiment is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be repeated here.
[0120] The processor is the processor in the electronic device described in the above embodiment. The readable storage medium includes a computer readable storage medium, such as a computer read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0121] An embodiment of the present application further provides a chip, which includes a processor and a communication interface, wherein the communication interface is coupled to the processor, and the processor is used to run programs or instructions to implement the various processes of the above-mentioned data storage method embodiment, and can achieve the same technical effect. To avoid repetition, it will not be repeated here.
[0122] It should be understood that the chip mentioned in the embodiments of the present application can also be called a system-level chip, a system chip, a chip system or a system-on-chip chip, etc.
[0123] It should be noted that, in this article, the terms "comprise", "include" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements includes not only those elements, but also includes other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise one..." do not exclude the presence of other identical elements in the process, method, article or device including the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present application is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in reverse order according to the functions involved, for example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.
[0124] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present application.
[0125] The embodiments of the present application are described above in conjunction with the accompanying drawings, but the present application is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present application, ordinary technicians in this field can also make many forms without departing from the purpose of the present application and the scope of protection of the claims, all of which are within the protection of the present application.
Claims
1. A data storage method, applied to a terminal device, comprising: Obtaining first encrypted data to be distributedly stored in a plurality of storage nodes, wherein the plurality of storage nodes are connected to the same blockchain; Slice the first encrypted data to obtain a plurality of first encrypted sub-data; generating a first smart contract based on the plurality of the first encrypted sub-data, and deploying the first smart contract in the blockchain, so that each of the storage nodes determines the first encrypted sub-data desired to be stored in itself among the plurality of the first encrypted sub-data based on the first smart contract and sends a storage request to a 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, before obtaining the first encrypted data to be distributed and stored in multiple storage nodes, the method further comprises: Obtaining attribute information of a user identity module SIM card in the terminal device; Generate a registration request based on the attribute information of the SIM card and a pre-generated asymmetric encryption public key, wherein 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 comprises: Acquire the verification information received by the SIM card in the terminal device, and perform identity authentication on the terminal device based on the verification information; If the identity authentication is passed, an activation request is sent to the blockchain, where the activation request is used to request 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 distributedly stored in a plurality of storage nodes comprises: Obtaining the International Mobile Subscriber Identity (IMSI) number and the data to be stored included in the attribute information of the SIM card; Generate a symmetric encryption key based on the asymmetric encryption private key and the IMSI number; The data to be stored is symmetrically encrypted based on 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 the plurality of the first encrypted sub-data and deploying the first smart contract in the blockchain comprises: Generate multiple first sub-smart contracts based on the multiple first encrypted sub-data, each of the first sub-smart contracts is used to record attribute information of the first encrypted sub-data corresponding thereto; Deploy the first sub-smart contract in the blockchain; Generate first upload information based on the plurality of first sub-smart contracts, where the first upload information is used to record attribute information of the plurality of first encrypted sub-data; The first smart contract is generated based on the first upload 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 a plurality of first sub-smart contracts based on a plurality of the first encrypted sub-data comprises: Determine first attribute information of each of the first encrypted sub-data based on the plurality of the first encrypted sub-data, where the first attribute information includes one or more of a fragment sequence number, a hash value, and a total number of fragments of the first encrypted sub-data; Generate multiple first sub-smart contracts based on multiple first attribute information; The generating the first smart contract based on the first uploaded information includes: Acquire first setting information of the terminal device, where the first setting information is 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, 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 comprising: Obtaining a first public key in the storage request, where the first public key is an asymmetric encryption public key generated by the storage node; Encrypting the first encrypted sub-data based on the first public key to obtain 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 the asymmetric encryption private key generated by the storage node and stores the first encrypted sub-data obtained by decryption.
8. The method according to claim 1, 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 comprising: Receiving a storage request sent by a storage node, wherein the storage request includes attribute information of a SIM card of a device to which the storage node belongs; Authentication of the storage node is performed based on attribute information of a SIM card of a device to which the storage node belongs; After the storage node identity authentication is passed, 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: Receiving an acquisition instruction sent by a terminal device, the acquisition instruction is used to instruct a user identity module SIM card to send attribute information of the SIM card, and the terminal device is an installation terminal of the SIM card; The attribute information of the SIM card is sent to the terminal device, so that the terminal device registers an account in the blockchain based on the attribute information of the SIM card and deploys the first smart contract generated based on the first encrypted sub-data in the blockchain, and 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, the first encrypted sub-data is obtained by sharding the first encrypted data to be distributedly stored in multiple storage nodes, the multiple storage nodes are connected to the same blockchain, and the storage request is determined by the storage node based on the first encrypted sub-data that is expected to be stored in itself from the multiple first encrypted sub-data determined by the first smart contract.
10. A data storage device, comprising: A first acquisition module, used to acquire first encrypted data to be distributed and stored in multiple storage nodes, where the multiple storage nodes are connected to the same blockchain; A first processing module, configured to perform slicing processing on the first encrypted data to obtain a plurality of first encrypted sub-data; A first generating module, configured to generate a first smart contract based on the plurality of the first encrypted sub-data, and deploy the first smart contract in the blockchain, so that each of the storage nodes determines the first encrypted sub-data desired to be stored in itself among the plurality of the first encrypted sub-data based on the first smart contract and sends a storage request to a terminal device; A first sending module is configured to send each first encrypted sub-data to a corresponding storage node for distributed storage after receiving the storage request sent by the storage node.
11. A SIM card, comprising: A first acquisition unit, configured to receive an acquisition instruction sent by a terminal device, wherein the acquisition instruction is used to instruct a user identity module SIM card to send attribute information of the SIM card, and the terminal device is an installation terminal of the SIM card; A first sending unit is used to send the attribute information of the SIM card to the terminal device, so that the terminal device registers an account in the blockchain based on the attribute information of the SIM card and deploys the first smart contract generated based on the first encrypted sub-data in the blockchain, and after receiving the storage request sent by the storage node, send 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 distributedly stored in multiple storage nodes, the multiple storage nodes are connected to the same blockchain, and the storage request is determined by the storage node based on the first encrypted sub-data that is expected to be stored in itself among the multiple first encrypted sub-data determined by the first smart contract.
12. A computer device, characterized in that: The device comprises: Processor; and A memory arranged to store computer executable instructions, the executable instructions being configured to be executed by the processor, the executable instructions comprising instructions for executing the steps in the data storage method according to any one of claims 1 to 8.
13. A storage medium, characterized in that: The storage medium is used to store computer-executable instructions, and the executable instructions enable a computer to execute the data storage method according to any one of claims 1 to 8.
14. A computer program product, characterized in that The invention comprises a computer program, which, 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
Distributed data encryption storage method based on block chain and electronic equipment
CN111611621A
Data uplink storage method, data uplink tracing method, device and equipment based on block chain
CN112182609A
Block chain digital asset key management method and system based on SIM card
CN112862481A
Cited By
Data storage method and system, electronic equipment and vehicle
CN121166042A
Data storage method, system, electronic device and vehicle
CN121166042B