Decentralized identity storage method and system
Through the combination of distributed database and FISCO blockchain, the problems of data privacy and identity management in the traditional centralized identity authentication model are solved, decentralized identity storage is realized, and data security and system stability are ensured. Supports high concurrent data reading, writing and synchronization.
Patent Information
- Application Number
- CN202411237211.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-05
- Publication Date
- 2024-10-15
- Estimated Expiration
- Not applicable · inactive patent
Smart Images

Figure CN118779384A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of identity authentication technology, and in particular to a decentralized identity identification storage method and system. Background Art
[0002] In the traditional identity authentication model, it usually relies on a centralized network structure, and data interaction is mainly based on a centralized client-server model. However, this model has gradually revealed its shortcomings in the era of big data.
[0003] First of all, in terms of data privacy, it is difficult to trust all software and service scenarios, but obtaining privacy data is a necessary process for many software in the data authentication link, which poses a risk of privacy leakage.
[0004] Secondly, in the traditional identity authentication system, centralized digital identities often result in users not having a true personal identity, because identity-related information, in addition to the necessary participants, that is, the issuer and the subject of the identity, must also be controlled and managed by the necessary service nodes. Therefore, the distributed identity authentication system must not only ensure the realization of traditional functions, but also solve the problem of missing identity layers caused by centralized digital identities. Summary of the invention
[0005] In order to solve the above problems, the present invention proposes a decentralized identity storage method and system, and designs a storage solution that combines a distributed database and a FISCO blockchain. The distributed database solves the problem that user nodes exist independently and public data is difficult to store synchronously. The FISCO blockchain ensures the anti-tampering characteristics of the data, provides a verification method for user untrusted data, ensures data security, and solves the problems of data information record synchronization and data verification in the distributed database.
[0006] In order to achieve the above object, the present invention adopts the following technical solution: In a first aspect, the present invention provides a decentralized identity storage method, comprising: receiving a key seed; Generate a private key based on the key seed, derive a public key from the private key, generate a corresponding DID identifier based on the public key, and generate a DID document based on the DID identifier and the corresponding private key and public key; Build a distributed database and FISCO blockchain that write data synchronously, store DID documents on the distributed database, and store the data hash value in the DID document on the chain; when reading data, read the required data from the distributed database, read the corresponding data hash value from the FISCO blockchain, and compare the data read from the distributed database and the FISCO blockchain to complete data verification.
[0007] As an optional implementation, the public key is derived from the private key by using a point multiplication operation on an elliptic curve; specifically, the private key is used as a scalar in the elliptic point multiplication operation, the base point on the elliptic curve is used as a multiplier, and the point coordinates obtained by the operation are converted into a public key through data conversion.
[0008] As an optional implementation, after the binary format of the public key is converted, a fixed-length character sequence is obtained through a hash operation, the character sequence is used as a DID identity identifier, and identification characters are added to the single key when the DID identity identifier executes different transactions.
[0009] As an optional implementation, when storing the DID document, the DID document is represented in the form of a Json object, and the data in the DID document is stored in a structured manner.
[0010] As an optional implementation method, when building a distributed database, newly added data is stored on the distributed node where the data is written, and then synchronized to the distributed storage network, with the data stored in each user node being used as a data node.
[0011] As an optional implementation method, the smart contract for data storage and reading and writing is written in Solidity, and the data storage is stored in a dictionary. Solidity data is stored in the form of unordered key-value pairs. When writing data, the corresponding data is added to the dictionary; when reading data, the relevant data is queried in the dictionary and verified.
[0012] In a second aspect, the present invention provides a decentralized identity storage system, comprising: A receiving module, configured to receive a key seed; A generation module is configured to generate a private key according to a key seed, derive a public key from the private key, generate a corresponding DID identity identifier according to the public key, and generate a DID document according to the DID identity identifier and the corresponding private key and public key; The storage module is configured to build a distributed database and FISCO blockchain for synchronous data writing, store the DID document on the distributed database, and store the data hash value in the DID document on the chain; when reading data, read the required data from the distributed database, read the corresponding data hash value from the FISCO blockchain, and compare the data read from the distributed database and the FISCO blockchain to complete data verification.
[0013] In a third aspect, the present invention provides an electronic device comprising a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method described in the first aspect is performed.
[0014] In a fourth aspect, the present invention provides a computer-readable storage medium for storing computer instructions, wherein when the computer instructions are executed by a processor, the method described in the first aspect is performed.
[0015] In a fifth aspect, the present invention provides a computer program product, comprising a computer program, which, when executed by a processor, implements the method described in the first aspect.
[0016] Compared with the prior art, the present invention has the following beneficial effects: The present invention proposes a decentralized identity storage method and system, and designs a storage solution combining a distributed database and a FISCO blockchain. The distributed database solves the problem that user nodes exist independently in a distributed system and public data is difficult to store synchronously, and supports high-concurrency data reading and writing and data synchronization of each node. The FISCO blockchain ensures the anti-tampering characteristics of the data, synchronizes the data with the distributed database, provides a verification method for the data that the user does not trust, ensures the security of the data and the system, and solves the problems of data information record synchronization and data verification in the distributed database. At the same time, the backup synchronization characteristics of the data avoid the instability caused by fully sharded storage in the distributed cluster database.
[0017] The present invention proposes a decentralized identity storage method and system. Combining the decentralized characteristics of distributed systems and the problem of lack of service nodes, a DIDs (Decentralized Identifiers) identity system and identity identifier are designed to complete the design of an identifiable and verifiable identity architecture under a distributed network, solving the identification and verification problems of independent nodes in a distributed system.
[0018] Unlike the existing storage methods that are only used for blockchain, the blockchain itself does not support high-concurrency reading and writing, and its original design intention is not to store data. The system application scenario involved in the present invention requires the storage and reading of a large amount of data. Therefore, considering the public data reading and writing performance, consistency and security, data with high performance, timely reading and writing and consistency are suitable for storage through the characteristics of distributed databases, and data with non-tamperability and traceability characteristics are suitable for storage through blockchain.
[0019] Advantages of additional aspects of the present invention will be given in part in the following description, and in part will become obvious from the following description, or will be learned through practice of the present invention. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying creative work.
[0021] Figure 1 A schematic diagram of a DIDs system provided in Example 1 of the present invention; Figure 2 A schematic diagram of the management layer DID Method provided in Example 1 of the present invention; Figure 3 A storage diagram of the distributed database and FISCO blockchain provided in Example 1 of the present invention. DETAILED DESCRIPTION
[0022] The present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0023] It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.
[0024] It should be noted that the terms used herein are only for describing specific embodiments, and are not intended to limit exemplary embodiments according to the present invention. As used herein, unless the context clearly indicates otherwise, the singular form is also intended to include the plural form. In addition, it should be understood that the terms "include" and "comprise" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] In the absence of conflict, the embodiments of the present invention and the features of the embodiments may be combined with each other.
[0026] Example 1 This embodiment provides a decentralized identity storage method, including: receiving a key seed; Generate a private key based on the key seed, derive a public key from the private key, generate a corresponding DID identifier based on the public key, and generate a DID document based on the DID identifier and the corresponding private key and public key; Build a distributed database and FISCO blockchain that write data synchronously, store DID documents on the distributed database, and store the data hash value in the DID document on the chain; when reading data, read the required data from the distributed database, read the corresponding data hash value from the FISCO blockchain, and compare the data read from the distributed database and the FISCO blockchain to complete data verification.
[0027] Combine the following Figure 1-Figure 3 The method of this embodiment is described in detail.
[0028] In this embodiment, the identification and verification problems of independent nodes in the distributed system are solved by constructing a DID (decentralized ID) identity identifier, a management layer (DID Method), and a storage document (DID Document).
[0029] The specific implementation steps are as follows: Step 1: Generate a DID identity identifier.
[0030] Step 1.1: Generate key seed; Design the generation and management of DID identity identifiers based on a single key, that is, by generating a random number as a key seed or generating a key seed from a mnemonic.
[0031] Step 1.2: Calculate the private key and public key; Taking the Ed25519 algorithm (Ed25519 is an elliptic curve algorithm used for digital signatures) as an example, the private key is calculated through the key seed, and the public key is derived from the private key.
[0032] Among them, the public key is derived by using the point multiplication operation on the elliptic curve for the private key; Specifically: the private key is used as a scalar in the elliptic point multiplication operation, and the base point on the elliptic curve is used as the multiplier. The point coordinates obtained by the operation are converted into a public key through data conversion; the public key is 256 bits long and has 32 bits of data expressed in hexadecimal.
[0033] Step 1.3: Generate the corresponding DID identifier using a hash algorithm-based summary operation based on the public key; Specifically: Convert the binary format of the public key into a readable string format such as Base58 or Base64 (both are encoding methods); obtain a fixed-length character sequence through a hash operation such as SHA-256 (Secure Hash Algorithm-256, a hash function algorithm standard); use the character sequence obtained after the operation as the DID identity identifier, which is the identifier of the user's identity.
[0034] Since a DID identity identifier requires multiple pairs of keys when executing multiple transactions, in order to avoid confusion of keys, a single key is serially identified, that is, an identification character (DID URL) is added. The identification character is a special character located after the key, which can realize the judgment of specific transactions when a single key executes multiple transactions.
[0035] Step 2: Parse the DID identity identifier and create a DID document, including the DID identity identifier and key; for the DID document that the user already has, if a new authentication key is generated, it needs to be recorded in the DID document.
[0036] Step 3: The purpose of DID document design is to centrally record the information under the same DID identity identifier and manage it uniformly by the user. This is because it is necessary to standardize the format of DID documents and store DID documents to ensure their security.
[0037] Specifically: Step 3.1: The DID identity identifier and its private key are stored in the local wallet. For credential information such as personal wallet information and verifiable credentials VC, the embedded database SQLite is used to store it locally.
[0038] The local wallet ensures that each node user has a corresponding SQLite database before the software runs. The wallet data is stored in a structured form, mainly including the DID identity identifier, the key seed for generating the DID identity identifier, various private keys, and various credentials obtained by individuals.
[0039] Step 3.2: It is specified that the DID document is stored in a distributed database and represented in the form of a Json object, and the data in the DID document is stored in a structured manner; including the DID identity identifier, the public key and ID for verifying the DID identity identifier, and the public key information, generation time, generation type, etc. used for other verification functions.
[0040] Distributed databases support storage and reading and writing. Existing blockchains are not designed for storage. To solve this problem, this embodiment designs a storage solution that combines the MySQL Cluster distributed database and the FISCO blockchain, deploys a distributed database that supports high concurrency, and stores all data on the distributed database and the FISCO blockchain. Distributed databases solve the problem of public data storage, support high-concurrency data reading and writing, and data synchronization of each node. The FISCO blockchain solves the problems of data information record synchronization and data verification in distributed databases.
[0041] Public data is read and written through a distributed database. Newly written data is recorded on the blockchain, and read data is verified on the blockchain. Data that the node already trusts is no longer verified through the blockchain to ensure the performance of the storage system.
[0042] Specifically: The public ledger is the data that needs to be stored in the distributed database, including DID documents. For public information such as ledgers, a combination of distributed database + FISCO blockchain is used for storage.
[0043] (1) The public ledger is stored in the distributed database MySQL Cluster.
[0044] Specifically: (1-1) The MySQL Cluster network is a storage network for distributed databases. During deployment, users connect to the MySQL Cluster network, synchronize all information, and perform data synchronization with the MySQL Cluster network.
[0045] (1-2) The distributed node that writes data first stores the newly written data and then synchronizes it to the MySQL Cluster network.
[0046] (1-3) The MySQL Cluster storage module of each user node is used as a data node, and the backend processing plays the role of a SQL node.
[0047] (2): Storing public ledgers through the FISCO blockchain; When writing data, the data is stored in the MySQL Cluster network of the distributed database and then synchronously recorded in the FISCO blockchain.
[0048] Smart contracts for data storage and reading and writing are written in solidity (a contract-based programming language). Data storage is stored in dictionaries, and solidity data is stored in the form of unordered key-value pairs. The blockchain only stores the hash value of the DID identity identifier, so the key refers to the DID identity identifier, and the value refers to the hash value of the stored public ledger. When writing data, the corresponding data is added to the dictionary; when reading data, the relevant data is queried in the dictionary and verified.
[0049] In this embodiment, the trusted data reading design of the public ledger includes: For writing data, the distributed database and FISCO blockchain need to be stored at the same time. For the distributed database, the data is stored in the MySQL Cluster distributed storage network through the corresponding module. For the FISCO blockchain, data is stored through smart contracts, and the changes in contract information are added to the block as transaction records, and the hash address corresponding to the block and the hash summary of the data to be written are synchronized to the distributed database.
[0050] The distributed database MySQL Cluster can read data directly from the accessible database; the blockchain data reads the corresponding DID identity identifier and hash value from the dictionary of the smart contract, compares the data of the blockchain and the distributed database, and completes the data verification.
[0051] Since the core purpose of blockchain data reading is to verify the authenticity of data, when reading data for the first time or knowing that the corresponding related data in the distributed database has changed, the new data generated is not trusted and needs to be verified through the blockchain for data authenticity; in addition, when the transaction involving the trusted data fails, it is also necessary to verify the information on the chain to confirm whether the information in the distributed database has been tampered with. For data that nodes frequently access, they will trust the authenticity of the data and do not need to verify the data hash value stored in the blockchain. In this way, trusted reading of frequent and commonly used data is achieved, data reading efficiency is improved, and a verification and correction mechanism is implemented when distributed data is tampered with.
[0052] It is worth noting that attacks on distributed databases will not cause system transactions to get erroneous results. The reason is that in the data trust model, only data extracted through the distributed database is involved in decryption and verification. Therefore, even if it is tampered with, it can only cause the paired key to fail to decrypt or verify, and there will be no scenario where a transaction that "should have failed to authenticate" will be "authenticated successfully". If the key decryption or verification fails, the system also provides a data verification mechanism. Therefore, this trusted data extraction model will not affect the security of the system.
[0053] Example 2 This embodiment provides a decentralized identity storage system, including: A receiving module, configured to receive a key seed; A generation module is configured to generate a private key according to a key seed, derive a public key from the private key, generate a corresponding DID identity identifier according to the public key, and generate a DID document according to the DID identity identifier and the corresponding private key and public key; The storage module is configured to build a distributed database and FISCO blockchain for synchronous data writing, store the DID document on the distributed database, and store the data hash value in the DID document on the chain; when reading data, read the required data from the distributed database, read the corresponding data hash value from the FISCO blockchain, and compare the data read from the distributed database and the FISCO blockchain to complete data verification.
[0054] As an optional implementation, the public key is derived from the private key by using a point multiplication operation on an elliptic curve; specifically, the private key is used as a scalar in the elliptic point multiplication operation, the base point on the elliptic curve is used as a multiplier, and the point coordinates obtained by the operation are converted into a public key through data conversion.
[0055] As an optional implementation, after the binary format of the public key is converted, a fixed-length character sequence is obtained through a hash operation, the character sequence is used as a DID identity identifier, and identification characters are added to the single key when the DID identity identifier executes different transactions.
[0056] As an optional implementation, when storing the DID document, the DID document is represented in the form of a Json object, and the data in the DID document is stored in a structured manner.
[0057] As an optional implementation method, when building a distributed database, newly added data is stored on the distributed node where the data is written, and then synchronized to the distributed storage network, with the data stored in each user node being used as a data node.
[0058] As an optional implementation method, the smart contract for data storage and reading and writing is written in Solidity, and the data storage is stored in a dictionary. Solidity data is stored in the form of unordered key-value pairs. When writing data, the corresponding data is added to the dictionary; when reading data, the relevant data is queried in the dictionary and verified.
[0059] It should be noted that the above modules correspond to the steps described in Example 1, and the examples and application scenarios implemented by the above modules and the corresponding steps are the same, but are not limited to the contents disclosed in the above Example 1. It should be noted that the above modules, as part of the system, can be executed in a computer system such as a set of computer executable instructions.
[0060] In further embodiments, there is also provided: An electronic device includes a memory and a processor, and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method described in Embodiment 1 is performed. For the sake of brevity, it will not be described in detail here.
[0061] It should be understood that in this embodiment, the processor may be a central processing unit CPU, and the processor may also be other general-purpose processors, digital signal processors DSP, application-specific integrated circuits ASIC, off-the-shelf programmable gate arrays FPGA or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0062] The memory may include a read-only memory and a random access memory, and provide instructions and data to the processor. A portion of the memory may also include a non-volatile random access memory. For example, the memory may also store information about the device type.
[0063] A computer-readable storage medium is used to store computer instructions, and when the computer instructions are executed by a processor, the method described in Example 1 is completed.
[0064] The method in Example 1 can be directly embodied as a hardware processor, or a combination of hardware and software modules in the processor. The software module can be located in a mature storage medium in the field such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware. To avoid repetition, it is not described in detail here.
[0065] A computer program product includes a computer program, and when the computer program is executed by a processor, the method described in embodiment 1 is implemented.
[0066] The present invention also provides at least one computer program product tangibly stored on a non-transitory computer-readable storage medium. The computer program product includes computer executable instructions, such as instructions included in a program module, which are executed in a device on a real or virtual processor of the target to perform the process / method as described above. Typically, program modules include routines, programs, libraries, objects, classes, components, data structures, etc. that perform specific tasks or implement specific abstract data types. In various embodiments, the functions of program modules can be combined or divided between program modules as needed. Machine executable instructions for program modules can be executed in local or distributed devices. In distributed devices, program modules can be located in local and remote storage media.
[0067] The computer program code for implementing the method of the present invention can be written in one or more programming languages. These computer program codes can be provided to the processor of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the computer or other programmable data processing device, causes the function / operation specified in the flow chart and / or block diagram to be implemented. The program code can be executed completely on a computer, partially on a computer, as an independent software package, partially on a computer and partially on a remote computer or completely on a remote computer or server.
[0068] In the context of the present invention, computer program codes or related data may be carried by any appropriate carrier to enable a device, apparatus or processor to perform the various processes and operations described above. Examples of carriers include signals, computer readable media, etc. Examples of signals may include electrical, optical, radio, acoustic or other forms of propagation signals, such as carrier waves, infrared signals, etc.
[0069] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with this embodiment can be implemented in electronic hardware or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0070] Although the above describes the specific implementation mode of the present invention in conjunction with the accompanying drawings, it is not intended to limit the scope of protection of the present invention. Those skilled in the art should understand that various modifications or variations that can be made by those skilled in the art on the basis of the technical solution of the present invention without creative work are still within the scope of protection of the present invention.
Claims
1. A decentralized identity storage method, characterized in that: include: Receive a key seed; Generate a private key based on the key seed, derive a public key from the private key, generate a corresponding DID identifier based on the public key, and generate a DID document based on the DID identifier and the corresponding private key and public key; Build a distributed database and FISCO blockchain that write data synchronously, store DID documents on the distributed database, and store the data hash value in the DID document on the chain; when reading data, read the required data from the distributed database, read the corresponding data hash value from the FISCO blockchain, and compare the data read from the distributed database and the FISCO blockchain to complete data verification.
2. A decentralized identity storage method as claimed in claim 1, characterized in that: The public key is derived from the private key by performing a point multiplication operation on an elliptic curve; specifically, the private key is used as a scalar in the elliptic point multiplication operation, the base point on the elliptic curve is used as a multiplier, and the point coordinates obtained by the operation are converted into a public key through data conversion.
3. A decentralized identity storage method as claimed in claim 1, characterized in that: After the binary format of the public key is converted, a fixed-length character sequence is obtained through a hash operation, and the character sequence is used as the DID identity identifier, and identification characters are added to the single key when the DID identity identifier performs different transactions.
4. A decentralized identity storage method as claimed in claim 1, characterized in that: When storing DID documents, the DID documents are represented in the form of Json objects, and the data in the DID documents are stored in a structured manner.
5. A decentralized identity storage method as claimed in claim 1, characterized in that: When building a distributed database, newly added data is stored on the distributed nodes where the data is written, and then synchronized to the distributed storage network, with the data stored in each user node as the data node.
6. A decentralized identity storage method as claimed in claim 1, characterized in that: The smart contracts for data storage and reading and writing are written in solidity. The data is stored in dictionaries, and solidity data is stored in the form of unordered key-value pairs. When writing data, the corresponding data is added to the dictionary; when reading data, the relevant data is queried in the dictionary and verified.
7. A decentralized identity storage system, characterized in that: include: A receiving module, configured to receive a key seed; A generation module is configured to generate a private key according to a key seed, derive a public key from the private key, generate a corresponding DID identity identifier according to the public key, and generate a DID document according to the DID identity identifier and the corresponding private key and public key; The storage module is configured to build a distributed database and FISCO blockchain for synchronous data writing, store the DID document on the distributed database, and store the data hash value in the DID document on the chain; when reading data, read the required data from the distributed database, read the corresponding data hash value from the FISCO blockchain, and compare the data read from the distributed database and the FISCO blockchain to complete data verification.
8. An electronic device, characterized in that: The method comprises a memory and a processor and computer instructions stored in the memory and executed on the processor, wherein when the computer instructions are executed by the processor, the method according to any one of claims 1 to 6 is completed.
9. A computer-readable storage medium, characterized in that: Used to store computer instructions, which, when executed by a processor, complete the method described in any one of claims 1 to 6.
10. A computer program product, characterized in that The invention comprises a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Enhanced virtual touchpad and touchscreen
CN104246682A
Blockchain-based identity generation method and identity system
CN113569298A
Privacy protection system based on meta universe
CN115964727A
Digital identity management method and device
CN117056981A
Trusted authorization data sharing method based on distributed identity and alliance chain
CN117200966A
Cited By
Hardware module identification method based on block chain technology
CN119276500A
