Data management method and related equipment based on combination of blockchain and IPFS
By adopting a combination of blockchain and IPFS data management method in smart city systems, the problem of insecurity of data storage is solved, the secure storage and traceability of data is realized, the credibility and security of data are improved, and the credibility and security of data are improved. Storage and access efficiency.
Patent Information
- Application Number
- CN202110146101.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-02-02
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2041-02-02
AI Technical Summary
Data storage is not secure in the prior art, especially in smart city systems, where data may be maliciously tampered with and cannot meet security needs.
Data management methods based on the combination of blockchain and IPFS are adopted to store data in a classified manner. The identification data is stored on the blockchain through smart contracts, and the data without traceability needs is stored on the interstellar file system IPFS through authentication.
It realizes the secure storage and traceability of data, improves the credibility and security of data, meets the security needs of smart city systems, and improves the efficiency of data storage and access.
Smart Images

Figure CN112818038B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of data management technology, and in particular to a data management method and related equipment based on a combination of blockchain and IPFS. Background Art
[0002] Currently, most service providers store data in database servers, and users perform operations such as adding, deleting, modifying, and querying data in the database. Database servers are centralized structures that rely on trusted third parties to provide services, which poses security issues. Malicious actors can maliciously tamper with data and logs through attack methods such as SQL injection. If the DNS (Domain Name System) domain name resolution records, domain name registration data, and digital identities used in smart cities are stored on servers, the data may be tampered with by malicious actors, so the data obtained from the server is not completely reliable and cannot meet the security requirements of smart cities. Summary of the invention
[0003] The present invention provides a data management method and related equipment based on the combination of blockchain and IPFS, which are used to solve the problem of insecure data storage in the prior art. By classifying and storing data, data trusteeship and data traceability are achieved under the premise of data storage security.
[0004] The present invention provides a data management method based on a combination of blockchain and IPFS, which is applied to a smart city system. The smart city system is used to realize smart management of the city, including:
[0005] dividing the target data into first data and second data according to data types;
[0006] Storing the first data in a blockchain through a smart contract and managing the first data by calling an interface of the smart contract; and
[0007] The second data is stored in the form of a file in the Interplanetary File System IPFS through an interface, and the second data is managed by identity authentication;
[0008] Among them, the first data and the second data are data sources of the smart city system.
[0009] According to a data management method based on a combination of blockchain and IPFS provided by the present invention, the first data is identification data traced using blockchain, including one or more combinations of the following data:
[0010] Domain name data, user information, identification, and transaction information;
[0011] The second data is data that has no traceability requirements and uses distributed storage, including one or more combinations of the following data:
[0012] Domain name recursive resolution records, pictures and video data.
[0013] According to a data management method based on a combination of blockchain and IPFS provided by the present invention, storing the first data in the blockchain through a smart contract includes:
[0014] The authoritative server caches the first data including domain name data, user information, identification and transaction information through a database and stores it in the blockchain.
[0015] According to a data management method based on a combination of blockchain and IPFS provided by the present invention, storing the second data in the form of a file in the Interplanetary File System IPFS through an interface includes:
[0016] The recursive server caches the second data including the domain name resolution record and the domain name query record through the database and stores it in the Interstellar File System IPFS. The recursive server records the correspondence between each domain name and the data access address through the database.
[0017] According to a data management method based on a combination of blockchain and IPFS provided by the present invention, the recursive server caches the second data including the domain name resolution record and the domain name query record through a database and stores the second data in the interplanetary file system IPFS, including:
[0018] The recursive server delivers the domain name resolution record to the resolution data recording module in an asynchronous queue manner;
[0019] The parsing data recording module regularly writes the parsing record of each domain name into the Interstellar File System IPFS in the form of small files based on the judgment criteria of time, queue data size and data size.
[0020] According to a data management method based on a combination of blockchain and IPFS provided by the present invention, the calling of the smart contract interface to manage the first data includes:
[0021] Calling the interface of the smart contract through the registration data management system RMS enables external users to manage the first data.
[0022] According to a data management method based on a combination of blockchain and IPFS provided by the present invention, the second data is managed by identity authentication, including:
[0023] Access the SDK of the unified authentication and authorization system through the data query interface provided by the registration data management system RMS;
[0024] Users who have been authenticated by the registration data management system RMS can manage files stored in IPFS.
[0025] The present invention also provides a data management device based on a combination of blockchain and IPFS, which is applied to a smart city system. The smart city system is used to realize smart management of the city, including:
[0026] A data division module, used for dividing the target data into first data and second data according to data types;
[0027] A blockchain module, used to store the first data in a blockchain through a smart contract and manage the first data by calling an interface of the smart contract; and
[0028] An IPFS module is used to store the second data in the form of a file in the InterPlanetary File System IPFS through an interface and manage the second data by means of identity authentication;
[0029] Among them, the first data and the second data are data sources of the smart city system.
[0030] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the data management method based on the combination of blockchain and IPFS as described in any one of the above are implemented.
[0031] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the data management method based on the combination of blockchain and IPFS as described in any one of the above.
[0032] The present invention provides a data management method and related equipment based on the combination of blockchain and IPFS. The data management of the combination of blockchain and IPFS realizes data classification storage, realizes data hosting and data traceability based on the security of data storage, and provides data support for smart city systems. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0034] Figure 1 It is a flowchart of a data management method based on a combination of blockchain and IPFS provided by the present invention;
[0035] Figure 2 It is a schematic diagram of the architecture of the data management method based on the combination of blockchain and IPFS provided by the present invention;
[0036] Figure 3 It is a schematic diagram of IPFS domain name resolution and domain name query provided by the present invention;
[0037] Figure 4 It is a schematic diagram of blockchain data management provided by the present invention;
[0038] Figure 5 It is a schematic diagram of the service operation between the CIS and the RMS provided by the present invention;
[0039] Figure 6 It is a schematic diagram of the process of managing data stored in IPFS provided by the present invention;
[0040] Figure 7 It is a structural schematic diagram of a data management device based on a combination of blockchain and IPFS provided by the present invention;
[0041] Figure 8 It is a structural schematic diagram of the electronic device provided by the present invention. DETAILED DESCRIPTION
[0042] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0043] The following describes the terms mentioned in the data management method based on the combination of blockchain and IPFS and related devices of the present invention:
[0044] Blockchain is a term in the field of information technology. In essence, it is a shared database that stores data or information. Blockchain has the security features of decentralization, immutability, distributed ledger, consensus trust mechanism, openness, anonymity, cross-platform and traceability. The types of blockchain include public blockchain, joint blockchain and private blockchain. The core technologies of blockchain include distributed ledger, asymmetric encryption, consensus mechanism and smart contract. Smart contracts are based on these reliable and immutable data and can automatically execute some pre-defined rules and terms.
[0045] IPFS (InterPlanetary File System) is a decentralized storage system that stores multiple files on different computers through hash calculations. When a user accesses a file, he or she can access it according to the hash address.
[0046] The existing technology uses cryptography and mathematical algorithms to establish trust relationships for data generated on blockchains, and does not require a centralized organization to build it. However, the transaction speed on blockchains is relatively slow, and the data on the chain cannot be modified or deleted, so blockchains are more suitable for storing "small data" that require high rights confirmation, traceability, and security requirements. The data that smart city systems need to store is not only "small data", but also DNS domain name resolution records, pictures, videos and other large data.
[0047] Therefore, the present invention provides a data management method and related equipment based on the combination of blockchain and IPFS, which solves the problem of insecure data storage in the prior art, realizes data classification storage through the data management of the combination of blockchain and IPFS, and realizes data hosting and data traceability under the premise of data storage security, providing data support for smart city systems.
[0048] The data management method based on the combination of blockchain and IPFS described in the present invention can be applied to smart city systems to provide data support for smart city systems, but the present invention is not limited to smart city systems and can also be applied to other systems that require data management.
[0049] Combine the following Figure 1-Figure 8 The present invention describes a data management method and related equipment based on a combination of blockchain and IPFS.
[0050] Figure 1 The flowchart of the data management method based on the combination of blockchain and IPFS provided by the present invention is shown in the figure. A data management method based on the combination of blockchain and IPFS is applied to a smart city system, and the smart city system is used to realize smart management of the city, including:
[0051] Step 101: divide the target data into first data and second data according to data types.
[0052] Optionally, the first data and the second data are data sources of the smart city system.
[0053] Alternatively, a smart city system uses information and communication technologies to sense, analyze, and integrate key data from the city's core operating systems, thereby making intelligent responses to various needs including people's livelihood, environmental protection, public safety, urban services, and industrial and commercial activities.
[0054] Based on the embodiment of the present invention, the first data refers to identification data that uses blockchain for traceability, which is generally small in size and is also called "small data", including one or more combinations of the following data: domain name data, user information, identification, and transaction information, etc. The second data refers to data that has no traceability requirements and uses distributed storage. Generally, such data is large in size and is also called "big data", including one or more combinations of the following data: domain name recursive resolution records, domain name query records, pictures, and video data.
[0055] Step 102: store the first data in the blockchain through a smart contract and manage the first data by calling the interface of the smart contract.
[0056] Step 103: Store the second data in the form of a file in the InterPlanetary File System IPFS through an interface and manage the second data through identity authentication.
[0057] The present invention combines blockchain and IPFS to process "small data" and "big data" separately and store them on blockchain and IPFS respectively. The use of blockchain and smart contracts to store "small data" ensures the security of small data and makes the data used in smart cities traceable. Secondly, due to the problem of slow transaction speed of blockchain, it is not suitable for the storage and access of large data (such as pictures, videos, etc.), so storing "big data" on IPFS can improve the data reading and writing rate problem, improve performance and save time. In addition, the method of combining blockchain and IPFS is used to store and manage data, taking into account data security and efficiency, and providing data source support for smart city systems.
[0058] Figure 2 This is a schematic diagram of the architecture of the data management method based on the combination of blockchain and IPFS provided by the present invention, as shown in the figure. The figure shows three parts: DIS (data representation system) composed of a recursive server (i.e., "recursion" in the figure), an authoritative server (i.e., "authority" in the figure), and RMS (registration data management system), a data source composed of "big data" stored by IPFS and "small data" stored by blockchain, and CIS (city identification center).
[0059] Optionally, the present invention is applied to a smart city management system. The "big data" stored by IPFS and the "small data" stored by blockchain are the data sources of the smart city, providing data support for the smart city management system.
[0060] Optionally, the recursive server is implemented based on CoreDNS, Golang language, and supports DOH (DNS-over-HTTPS, referred to as DOH), DOH JSON API, DNS (Domain Name System, referred to as DNS), DOT (Damage over time, referred to as DOT) through plug-ins. The request and corresponding parameter formats refer to Google and CloudFlare, and support data caching through the embedded Key / Value database (Badger). The downward interface of the recursive server principality is connected to the IPFS in the data source, and the data parsed by the recursive server is stored in IPFS through the interface. In addition, the configuration file of the recursive server supports digital identity authentication.
[0061] Among them, CoreDNS is a high-speed and very flexible DNS service that allows DNS data to be processed by writing plug-ins; Golang is a statically strongly typed, compiled, concurrent programming language developed by Google that has garbage collection capabilities.
[0062] The authoritative server is similar to the recursive server. It is also based on CoreDNS and implemented in Golang. It supports Zonefile and two domain name resolution data sources based on IPFS and blockchain in the form of plug-ins, and supports data caching through the embedded Key / Value database (Badger). The authoritative server also supports the domain name resolution data source and stores the domain name resolution data source in the blockchain. In addition, the configuration file of the authoritative server supports digital identity authentication. Among them, zonefile refers to a set of instructions on how to convert a network domain name into a corresponding IP address.
[0063] Optionally, when the DIS (Data Identification System) in the smart city system performs domain name resolution, if the domain name resolution record is needed, identity verification is performed and then taken out from IPFS. When DIS performs domain name registration management, it calls the smart contract to manage the domain names in the chain.
[0064] Optionally, RMS provides API (Application Programming Interface) services to the smart city system. The external service interface provided by RMS allows external users to call smart contracts to manage data such as identity registration and user subscription stored in the blockchain; they can also operate data files hosted in IPFS through the interface (such as write file Write File, read file Get File, update file Updata File, delete File), but users need to pass identity authentication when operating IPFS files.
[0065] When the CIS (City Identity Center) of the smart city system performs operations such as user registration, subscription, and transaction, it calls the smart contract through RMS to manage the data in the chain.
[0066] Specifically, the API Server in RMS provides API services for CIS. It is developed based on the Golang language and the GRPC protocol, supports data source management based on the combination of IPFS and blockchain, and provides a Java language client. It can provide external services through the HTTPRESTful API interface, manage data sources internally, manage domain name registration data by calling smart contracts, and perform a series of management operations such as adding, deleting, modifying, and checking data such as users, domain names, identifiers (resource records), and behavioral events. At the same time, it provides identity authentication for IPFS file management and confirms that users have the authority to save / read / update / delete files. Among them, HTTP RESTful API is currently a relatively mature set of API design theories for Internet applications.
[0067] Furthermore, the API Server supports digital identity verification, supports verification of subscription access authorization codes, provides access information write-back function, and interacts with CIS through CIS SDK. RMS's external services interact with users through SDK (Software Development Kit), which supports digital identity verification, access authorization code verification, and access information write-back.
[0068] It should be noted that RMS can use smart contracts to manage small data such as domain name registration and authoritative resolution stored in the blockchain.
[0069] Figure 3This is a schematic diagram of IPFS domain name resolution and domain name query provided by the present invention, as shown in the figure. The figure shows that the recursive server (i.e., "recursive" in the figure) and the authoritative server (i.e., "authoritative" in the figure) support DNS, DOT and DOH. The recursive server and the authoritative server cache the record data of the domain name resolution (i.e., "big data") to the database (Badger), and then store it in IPFS through the interface.
[0070] In addition, the present invention also supports digital identity verification of users through a unified authentication and authorization system and SDK, and the blockchain returns the access authorization code and access information to the user.
[0071] It should be noted that users manage the smart city data in the chain by calling smart contracts. The participating users have undergone identity authentication and the blockchain itself has security properties, so the data in the chain is credible and traceable. In addition, when users in the smart city system process and query domain name resolution data, they need to verify the identity of the user to ensure that the data is credible and secure.
[0072] Optional, for domain name resolution data records: the domain name resolution results are delivered to the resolution data recording module recorder in the form of an asynchronous queue. The recorder uses time, queue data size, data size and other factors as the basis for judgment, and regularly writes the resolution records of each domain name in the form of small files to IPFS.
[0073] Since each data update in IPFS will cause the returned data access address to change, the recursive service records the correspondence between each domain name and data access address through Badger (KV database).
[0074] Optional, for domain name resolution data query: provide a data query interface in HTTP RESTful API mode. The requester passes in the domain name as a parameter. The data query interface searches the Badger database, finds the data access address, accesses IPFS, and returns the domain name resolution record to the requester.
[0075] To reduce bandwidth usage, HTTP Compression is enabled. To ensure data transmission security, the data query interface uses HTTPS. To ensure data access security, the data query interface provided by RMS is connected to the SDK of the unified authentication and authorization system, verifies the digital identity and subscription relationship of the requester, and writes back the access information through this SDK to update the subscription status of the data in real time. To ensure data access security, the data query interface will use the public key of the requester to encrypt the response data, and the requester needs to use its own private key to decrypt the response result.
[0076] It can be seen that the present invention does not require redundant operations to distinguish "big data" from "small data". The recursive server directly calls the interface to store the data in the IPFS of the data source. Only users who have passed the RMS identity authentication can query the parsing records in IPFS and perform management operations on the files, such as save / read / update / delete, etc. The specific authentication process is as follows: Figure 3 The authoritative server stores the data in the blockchain, and the user calls the smart contract through RMS to perform corresponding management operations on the data.
[0077] Figure 4 This is a schematic diagram of blockchain data management provided by the present invention, as shown in the figure. The "small data" such as domain name data, user information, identification and transaction information used by the smart city are stored in the blockchain through smart contracts. RMS (Registration Data Management System) provides an interface for external services. Users with identity authentication can manage the data stored in the blockchain through smart contracts, and the characteristics of blockchain and smart contracts are used to ensure data security, and the data on the chain is traceable.
[0078] Figure 5 This is a schematic diagram of the business operation of CIS and RMS provided by the present invention, as shown in the figure. When the CIS (City Identity Center) of the smart city system performs operations such as user registration, subscription, and transaction, it calls the smart contract through the RMS (Registration Data Management System) to manage the data in the chain.
[0079] Specifically, the API Server in RMS provides API services for the City Identity Center. It is developed based on the Golang language and the GRPC protocol, supports the management of data sources, and provides a Java client. It provides external services through the HTTP RESTful API interface, and can manage data sources internally. It manages domain name registration data by calling smart contracts, and performs a series of management operations such as adding, deleting, modifying, and checking data such as users, domain names, identifiers (resource records), and behavioral events. At the same time, it provides identity authentication for IPFS file management and confirms that users have the authority to save / read / update / delete files. APIServer supports digital identity verification, supports verification of subscription access authorization codes, provides access information write-back function, and interacts with the City Identity Center through the CIS SDK. RMS's external services interact with users through SDK, which supports digital identity authentication, access authorization code verification, and access information write-back.
[0080] Figure 6The present invention provides a flow chart of managing data stored in IPFS, as shown in the figure. A data management method based on a combination of blockchain and IPFS is applied to a smart city system, and the smart city system is used to achieve smart management of the city, including:
[0081] Step 601, divide the target data into first data and second data according to the data type. The first data and the second data are the data sources of the smart city system. The first data is identification data that uses blockchain for traceability, including but not limited to one or more combinations of the following data: domain name data, user information, identification, and transaction information; the second data is data that has no traceability requirements and uses distributed storage, including but not limited to one or more combinations of the following data: domain name recursive resolution records, pictures, and video data.
[0082] Step 602: Store the first data in the blockchain through a smart contract and manage the first data by calling the interface of the smart contract.
[0083] Optionally, in step 602, storing the first data in a blockchain through a smart contract and managing the first data by calling an interface of the smart contract includes:
[0084] In step 6021, the authoritative server caches the first data including the domain name resolution record through the database and stores it in the blockchain.
[0085] Step 6022: The first data is managed by calling the interface of the smart contract through the registration data management system RMS. The management includes managing the domain name registration data and authoritative resolution data by using the smart contract.
[0086] Step 603: Store the second data in the form of a file in the InterPlanetary File System IPFS through an interface and manage the second data through identity authentication.
[0087] Optionally, in step 603, storing the second data in the form of a file in the InterPlanetary File System IPFS through an interface and managing the second data by identity authentication includes:
[0088] Step 6031, the recursive server caches the second data including the domain name resolution record and the domain name query record through the database and stores it in the Interstellar File System IPFS. The recursive server records the correspondence between each domain name and the data access address through the database.
[0089] Specifically, the recursive server delivers the domain name resolution record to the resolution data recording module in an asynchronous queue. The resolution data recording module regularly writes the resolution record of each domain name in the form of a small file to the Interplanetary File System IPFS based on the judgment criteria of time, queue data size and data size.
[0090] Step 6032, verify the user identity through the service interface provided by the registration data management system RMS; after the verification, call the smart contract to manage the second data, and the management package saves, reads, updates, and deletes one or more combined operations in the file.
[0091] The data management device based on the combination of blockchain and IPFS provided by the present invention is described below. The data management device based on the combination of blockchain and IPFS described below and the data management method based on the combination of blockchain and IPFS described above can be referenced to each other.
[0092] Figure 7 Schematic diagram of the structure of the data management device based on the combination of blockchain and IPFS provided by the present invention. A data management device 700 based on the combination of blockchain and IPFS is applied to a smart city system, which is used to realize smart management of the city, including a data partitioning module 701, a blockchain module 702 and an IPFS module 703, wherein:
[0093] The data division module 701 is used to divide the target data into first data and second data according to data types.
[0094] The blockchain module 702 is used to store the first data in the blockchain through a smart contract and manage the first data by calling the interface of the smart contract.
[0095] The IPFS module 703 is used to store the second data in the form of a file in the InterPlanetary File System IPFS through an interface and manage the second data by means of identity authentication.
[0096] Among them, the first data and the second data are data sources of the smart city system.
[0097] Figure 8 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 8As shown, the electronic device may include: a processor 810, a communication interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication interface 820, and the memory 830 communicate with each other through the communication bus 840. The processor 810 may call the logic instructions in the memory 830 to execute the above-mentioned data management method based on the combination of blockchain and IPFS, which is applied to the smart city system, and the smart city system is used to realize the smart management of the city, including:
[0098] dividing the target data into first data and second data according to data types;
[0099] Storing the first data in a blockchain through a smart contract and managing the first data by calling an interface of the smart contract; and
[0100] The second data is stored in the form of a file in the Interplanetary File System IPFS through an interface, and the second data is managed by identity authentication;
[0101] Among them, the first data and the second data are data sources of the smart city system.
[0102] In addition, the logic instructions in the above-mentioned memory 830 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0103] On the other hand, the present invention also provides a computer program product, the computer program product includes a computer program stored on a non-transitory computer-readable storage medium, the computer program includes program instructions, when the program instructions are executed by a computer, the computer can execute the data management method based on the combination of blockchain and IPFS provided by the above methods, applied to a smart city system, the smart city system is used to realize smart management of the city, including:
[0104] dividing the target data into first data and second data according to data types;
[0105] Storing the first data in a blockchain through a smart contract and managing the first data by calling an interface of the smart contract; and
[0106] The second data is stored in the form of a file in the Interplanetary File System IPFS through an interface, and the second data is managed by identity authentication;
[0107] Among them, the first data and the second data are data sources of the smart city system.
[0108] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to execute the above-mentioned data management method based on the combination of blockchain and IPFS, and is applied to a smart city system, wherein the smart city system is used to realize smart management of the city, including:
[0109] dividing the target data into first data and second data according to data types;
[0110] Storing the first data in a blockchain through a smart contract and managing the first data by calling an interface of the smart contract; and
[0111] The second data is stored in the form of a file in the Interplanetary File System IPFS through an interface, and the second data is managed by identity authentication;
[0112] Among them, the first data and the second data are data sources of the smart city system.
[0113] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.
[0114] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.
[0115] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data management method based on a combination of blockchain and IPFS, applied to a smart city system, wherein the smart city system is used to realize smart management of the city, characterized in that: include: The target data is divided into first data and second data according to the data type; the first data is identification data that uses blockchain for traceability, including one or more combinations of the following data: domain name data, user information, identification, and transaction information; the second data is data that has no traceability requirements and uses distributed storage, including one or more combinations of the following data: domain name recursive resolution records, pictures, and video data; the security requirements of the first data are higher than those of the second data, and the volume of the first data is smaller than the volume of the second data; The first data is stored in the blockchain through a smart contract and managed by calling the interface of the smart contract to ensure the security of the first data and to make the first data used by the smart city system traceable; as well as The second data is stored in the form of a file in the Interstellar File System IPFS through an interface and the second data is managed by identity authentication to improve the reading and writing speed of the second data; The storing the second data in the form of a file in the Interplanetary File System IPFS through an interface includes: Deliver the second data to the parsing data recording module in the form of an asynchronous queue, and the parsing data recording module is used to periodically write each second data in the form of a small file to the Interstellar File System IPFS based on factors such as time, queue data size, and data size; Among them, the first data and the second data are the data sources of the smart city system; the smart city system includes a data identification system and a city identification center; the data identification system is composed of a recursive server, an authoritative server and a registration data management system; when the data identification system performs domain name resolution, if the domain name resolution record is used, the domain name resolution record is retrieved from the Interstellar File System IPFS after identity authentication; when the data identification system performs domain name registration management, the smart contract is called to manage the domain names in the chain; when the city identification center performs user registration, subscription, transaction and other operations, the smart contract is called through the registration data management system to manage the data in the chain; The storing the first data in the blockchain through a smart contract includes: The authoritative server caches the first data including the domain name data, user information, identification, and transaction information through a database and stores the data in the blockchain; The storing the second data in the form of a file in the Interplanetary File System IPFS through an interface includes: The recursive server caches the second data including the domain name resolution record and the domain name query record through a database and stores the data in the Interstellar File System IPFS. The recursive server records the correspondence between each domain name and the data access address through the database.
2. The data management method based on the combination of blockchain and IPFS according to claim 1 is characterized in that: The recursive server caches the second data including the domain name resolution record and the domain name query record through the database and stores the data in the Interplanetary File System IPFS, including: The recursive server delivers the domain name resolution record to the resolution data recording module in an asynchronous queue manner; The parsing data recording module regularly writes the parsing record of each domain name into the Interstellar File System IPFS in the form of small files based on the judgment criteria of time, queue data size and data size.
3. The data management method based on the combination of blockchain and IPFS according to claim 1 is characterized in that: The calling of the smart contract interface to manage the first data includes: Calling the interface of the smart contract through the registration data management system RMS enables external users to manage the first data.
4. The data management method based on the combination of blockchain and IPFS according to claim 1 is characterized in that: The managing the second data by identity authentication includes: Access the SDK of the unified authentication and authorization system through the data query interface provided by the registration data management system RMS; Users who have been authenticated by the registration data management system RMS can manage files stored in IPFS.
5. A data management device based on a combination of blockchain and IPFS, applied to a smart city system, wherein the smart city system is used to realize smart management of the city, characterized in that: include: A data division module, used for dividing the target data into first data and second data according to data types; The first data is identification data that uses blockchain for traceability, including one or more combinations of the following data: domain name data, user information, identification, and transaction information; the second data is data that has no traceability requirements and uses distributed storage, including one or more combinations of the following data: domain name recursive resolution records, pictures, and video data; the security requirements for the first data are higher than those for the second data, and the volume of the first data is smaller than the volume of the second data; A blockchain module, used to store the first data in a blockchain through a smart contract and manage the first data by calling an interface of the smart contract to ensure the security of the first data and to make the first data used by the smart city system traceable; as well as An IPFS module is used to store the second data in the form of a file in the Interplanetary File System IPFS through an interface and manage the second data by identity authentication to improve the reading and writing speed of the second data; The IPFS module is further used to deliver the second data to the parsing data recording module in the form of an asynchronous queue, and the parsing data recording module is used to periodically write each second data in the form of a small file to the Interplanetary File System IPFS based on factors such as time, queue data size, and data size; Among them, the first data and the second data are the data sources of the smart city system; the smart city system includes a data identification system and a city identification center; the data identification system is composed of a recursive server, an authoritative server and a registration data management system; when the data identification system performs domain name resolution, if the domain name resolution record is used, the domain name resolution record is retrieved from the Interstellar File System IPFS after identity authentication; when the data identification system performs domain name registration management, the smart contract is called to manage the domain names in the chain; when the city identification center performs user registration, subscription, transaction and other operations, the smart contract is called through the registration data management system to manage the data in the chain; The blockchain module is further used to use the authoritative server to cache the first data including the domain name data, user information, identification and transaction information through the database and store it in the blockchain; The IPFS module is further used for the recursive server to cache the second data including the domain name resolution record and the domain name query record through the database and store it in the Interstellar File System IPFS. The recursive server records the correspondence between each domain name and the data access address through the database.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the steps of the data management method based on the combination of blockchain and IPFS as described in any one of claims 1 to 4 are implemented.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the data management method based on the combination of blockchain and IPFS as described in any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Decentralized storage system for DNS resource records, and implementation method and information retrieval method thereof
CN110061838A
Data management method and device, electronic equipment and storage medium
CN111782722A