Data storage method and device based on block chain
By deploying smart contracts and oracles on the blockchain, data authenticity and performance issues in blockchain data storage are solved, and efficient and secure data storage is achieved.
Patent Information
- Application Number
- CN202411374401.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2024-12-27
AI Technical Summary
When using blockchain to store data proofing, it is difficult to ensure the authenticity of the data, especially the proofing performance of large-capacity data is affected.
By deploying smart contracts on the blockchain, using oracles to obtain data content from external data sources and generate proof credentials, the data can be achieved safe and reliable proof storage.
It significantly improves the efficiency and credibility of data proof storage, and ensures the security and credibility of large-capacity data in external data sources.
Smart Images

Figure CN119210684A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of this specification belong to the field of blockchain, and in particular, to a data storage method and device based on blockchain. Background Art
[0002] Blockchain is a distributed database technology that connects data records in the form of blocks to form a chain. Each block contains all transaction records that occurred within a certain time range and contains the hash value of the previous block, thus forming an unalterable chain. Since blockchain has the characteristics of being unalterable and can ensure the security, transparency and traceability of data, it is widely used in the field of data storage.
[0003] At present, when using blockchain for data storage, the method usually adopted is to package the data content to be stored or the data summary of the data content (such as hash) into a blockchain transaction and publish it on the blockchain. Then, by executing the transaction on the blockchain, the data content or the data summary of the data content is persistently stored on the blockchain.
[0004] However, in this way, the data content or data summary of the data content that is finally stored persistently on the blockchain is usually added by the party that initiates the evidence storage in the transaction off-chain. In practical applications, it is difficult to ensure the authenticity of these contents. Moreover, if the data content to be stored is large-capacity data, directly publishing these data contents on the blockchain for evidence storage may also affect the performance of data storage. Summary of the invention
[0005] This specification proposes a data evidence storage method based on blockchain, wherein a smart contract for data evidence management is deployed on the blockchain; the method includes:
[0006] Obtaining a data evidence record provided by a user; wherein the data evidence record contains metadata corresponding to the target data; the data content of the target data is stored in an external data source connected to the blockchain;
[0007] Calling the evidence management logic contained in the smart contract to send the metadata to the oracle; wherein the oracle is used to obtain data for the smart contract from the external data source;
[0008] In response to the evidence certificate corresponding to the target data returned by the oracle to the smart contract, the evidence logic contained in the smart contract is further called to add the evidence certificate to the data evidence record; wherein the evidence certificate is the evidence certificate generated by the oracle based on the data content of the target data; the data content of the target data is the data content queried by the oracle from the external data source based on the metadata;
[0009] The data evidence record with the evidence certificate added is published to the blockchain for evidence storage.
[0010] Optionally, the external data source is a data source registered by a user on an external data platform connected to the blockchain;
[0011] Sending the metadata to the oracle includes:
[0012] Obtaining detailed data of the external data source registered by the user on the external data platform;
[0013] The metadata and the detail data are sent to the oracle.
[0014] Optionally, the oracle includes an oracle contract deployed on the blockchain and an oracle service program deployed outside the chain and connected to the external data source;
[0015] Sending the metadata and the detail data to the oracle, so that the oracle queries the data content of the target data from the external data source based on the metadata and the detail data, includes:
[0016] Using the metadata and the detail data as call parameters, further calling the oracle contract, generating an external data acquisition event including the metadata and the detail data, and obtaining the evidence certificate corresponding to the target data returned by the oracle contract;
[0017] Among them, the evidence certificate is the evidence certificate generated by the oracle service program based on the data content of the target data; the data content of the target data is the data content queried from the external data source by the oracle service program based on the metadata and the detailed data in response to the monitored external data acquisition event.
[0018] Optionally, the target data type is the user-defined data type; the smart contract also maintains a data specification corresponding to the user-defined data type;
[0019] Generating the evidence voucher based on the data content of the target data includes:
[0020] Obtaining a data specification corresponding to the target data type maintained in the smart contract;
[0021] Verify whether the data content of the target data complies with the data specification; if so, further generate an evidence certificate corresponding to the target data based on the data content of the target data.
[0022] Optionally, the external data source supports management of stored data content according to data version; the metadata also includes a data version identifier corresponding to the target data.
[0023] Optionally, the stored evidence is a hash value obtained by performing a hash calculation on the data content of the target data.
[0024] This specification also proposes a data evidence storage device based on blockchain, wherein a smart contract for data evidence management is deployed on the blockchain; the device includes:
[0025] An acquisition module is used to acquire a data evidence record provided by a user; wherein the data evidence record includes metadata corresponding to the target data; and the data content of the target data is stored in an external data source connected to the blockchain;
[0026] A sending module, calling the evidence management logic contained in the smart contract, and sending the metadata to the oracle; wherein the oracle is used to obtain data for the smart contract from the external data source;
[0027] The adding module further calls the evidence logic contained in the smart contract in response to the evidence certificate corresponding to the target data returned by the oracle to the smart contract, and adds the evidence certificate to the data evidence record; wherein the evidence certificate is the evidence certificate generated by the oracle based on the data content of the target data; the data content of the target data is the data content queried by the oracle from the external data source based on the metadata;
[0028] The evidence storage module publishes the data evidence record with the evidence storage certificate added to the blockchain for evidence storage.
[0029] In the above embodiment, when data notarization is performed by calling a smart contract deployed on the blockchain, the user only needs to provide the smart contract with the metadata of the data to be notarized, and no longer needs to provide the smart contract with the data content of the data. Therefore, the efficiency of data notarization can be significantly improved.
[0030] Moreover, since the data content of the data to be notarized is stored in an external data source connected to the blockchain, the oracle deployed on the blockchain can query the data content of the data from the external data source, and generate a notarization certificate for the smart contract in real time based on the data content of the queried data. The data verification capability of the oracle itself can be utilized to achieve secure and reliable data notarization for large-capacity data stored in external data sources. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0032] Figure 1 This is a flowchart of a data evidence storage method based on blockchain shown in an embodiment of this specification;
[0033] Figure 2 It is a schematic diagram of a service framework for data storage shown in an embodiment of this specification;
[0034] Figure 3 It is a schematic diagram of another data storage service framework shown in an embodiment of this specification;
[0035] Figure 4 It is a schematic diagram of another data storage service framework shown in an embodiment of this specification;
[0036] Figure 5 It is an interactive diagram of storing evidence data on a blockchain as shown in an embodiment of this specification;
[0037] Figure 6 It is an interactive diagram for verifying target data stored in an external data source shown in an embodiment of this specification;
[0038] Figure 7 is a schematic structural diagram of an electronic device shown in an embodiment of this specification;
[0039] Figure 8 It is a block diagram of a blockchain-based data storage device shown in one embodiment of this specification. DETAILED DESCRIPTION
[0040] In order to enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments of this specification will be clearly and completely described below in conjunction with the drawings in the embodiments of this specification. Obviously, the described embodiments are only part of the embodiments of this specification, not all of the embodiments. Based on the embodiments in this specification, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of this specification.
[0041] This specification aims to propose a technical solution for efficient, secure and reliable data storage of large amounts of data stored in external data sources by utilizing an oracle deployed on a blockchain.
[0042] See also Figure 1 , Figure 1 The flowchart of a data evidence storage method based on blockchain shown in this specification, wherein a smart contract for data evidence management is deployed on the blockchain. The method can be applied to any blockchain node in the blockchain system; the method includes the following execution process:
[0043] Step 102: Obtain a data evidence record provided by a user; wherein the data evidence record contains metadata corresponding to the target data; the data content of the target data is stored in an external data source connected to the blockchain;
[0044] The above target data may specifically include any type of data that needs to be stored on the blockchain. For example, in practical applications, the above target data may specifically be a data set with a large data capacity.
[0045] It should be noted that the data type of the above target data is not particularly limited in this specification.
[0046] For example, in an application scenario shown, the target data may specifically be carbon data related to carbon emissions.
[0047] Among them, it needs to be explained that carbon data usually refers to statistical data or information related to the carbon emissions of enterprises, which usually covers the emissions of carbon dioxide (CO2) and other greenhouse gases generated by various production activities of enterprises, and can be used to assess the impact of the production activities of enterprises on the environment. In practical applications, the carbon emission accounting, product carbon footprint analysis, carbon emission reduction project emission reduction analysis, etc. of enterprises all rely on carbon data related to the carbon emissions of enterprises. Whether the carbon data is credible directly determines whether the accounting and analysis results related to the carbon data are credible. Carbon data usually involves a large amount of quantitative information related to carbon emissions, which requires structured storage for easy use and analysis. Therefore, carbon data, as a data form with a large data capacity, can usually exist in the form of data sets.
[0048] The above-mentioned external data source may specifically be a data source deployed outside the chain for storing the data content of the data stored on the blockchain. The specific type of the data source is not specifically limited in this specification; for example, the external data source may be an external data platform deployed outside the chain, or it may be a data source (such as a data table) registered by a user on the external data platform.
[0049] The metadata may specifically include any type of data format for describing the target data; for example, in practical applications, the metadata may generally include a data type identifier corresponding to the data type of the target data, a user identifier of a user who owns the target data, a data identifier of the target data, etc. In an illustrated embodiment, if the external data source supports managing the stored data content according to data versions, in this case, the metadata may also include a data version identifier corresponding to the target data.
[0050] See also Figure 2 , Figure 2 A schematic diagram of a data storage service framework shown in this specification.
[0051] like Figure 2 As shown, in this specification, a smart contract for data evidence management can be deployed on the blockchain, so that users can complete data evidence on the blockchain by calling the smart contract.
[0052] When a user needs to store target data on the blockchain, on the one hand, the user can store the data content of the target data in an external data source connected to the blockchain through the client; on the other hand, the user can also generate a data storage record based on the metadata corresponding to the target data through the client, and then send the data storage record to the connected blockchain node, which will further submit the data storage record to the smart contract as a call parameter to initiate a contract call for the smart contract to complete the storage processing of the target data.
[0053] For example, in actual applications, the user can package the data notarization record into a contract call transaction for the above-mentioned smart contract through the client, and submit it to the blockchain node with which a connection has been established. The blockchain node executes the contract call transaction to initiate a contract call for the above-mentioned smart contract.
[0054] Since when data is stored by calling a smart contract deployed on the blockchain, users only need to provide the metadata of the data to the smart contract, and no longer need to provide the data content of the data to the smart contract, the efficiency of data storage can be significantly improved.
[0055] It should be noted that, in actual applications, the operation of storing the data content of the target data in the above-mentioned external data source and the operation of sending the data evidence record to the connected blockchain node can be completed by the user on the client, or the user can further provide the data content of the target data and the metadata of the target data to a service deployed outside the chain through the client, and the service can complete it.
[0056] For example, see Figure 2 In one embodiment shown, a proof record management service that is connected to any blockchain node in the blockchain system can also be deployed outside the chain. The proof record management service can be connected to the above external data source.
[0057] In this case, the user may provide the data record corresponding to the target data to the evidence record management service through the client, and the data record may specifically include the data content of the target data and the metadata of the target data.
[0058] After obtaining the data record of the target data provided by the user, the evidence record management service can, on the one hand, further store the data record in the above-mentioned external data source that is connected; on the other hand, it can generate a data evidence record based on the metadata corresponding to the target data contained in the data record, and then further send the data evidence record to the blockchain node that is connected to it.
[0059] In this way, in a complete data notarization process, the user only needs to perform one operation to provide the data record corresponding to the target data to the above-mentioned notarization record management service, thereby reducing the user's operation complexity.
[0060] Among them, the above-mentioned evidence record management service can be a centralized service or a decentralized service.
[0061] For example, on the one hand, if the evidence record management service is a centralized service, the service can be deployed on a blockchain service platform (such as a Baas platform). In this case, the service can be connected to all blockchain nodes in the blockchain system.
[0062] On the other hand, if the evidence record management service is a decentralized service, the service may include multiple distributed sub-services, which may be deployed on each blockchain node in the blockchain system. In this case, each of the multiple sub-services may be connected to a blockchain node in the blockchain system.
[0063] Step 104: calling the evidence management logic contained in the smart contract and sending the metadata to the oracle; wherein the oracle is used to obtain data for the smart contract from the external data source;
[0064] Please continue to see Figure 2 In addition to deploying a smart contract on the blockchain for data evidence management, you can also deploy an oracle for obtaining data for the smart contract from an external data source connected to the blockchain.
[0065] It should be noted that, in actual applications, the oracle can be deployed on the chain in the form of an oracle contract, or deployed off the chain in the form of an oracle service. For example, if the oracle is deployed on the chain in the form of an oracle contract, the oracle can specifically include an oracle contract deployed on the blockchain and an oracle service program deployed off the chain to connect to the external data source. If the oracle is deployed off the chain in the form of an oracle service, then there is no need to deploy an oracle contract on the blockchain, only an oracle service needs to be deployed off the chain.
[0066] After obtaining the above-mentioned data evidence record, the blockchain node in the blockchain system can call the evidence management logic contained in the smart contract, and continue to send the metadata of the target data contained in the data evidence record to the oracle. The oracle queries the data content of the target data from the above-mentioned external data source based on the metadata, and generates an evidence certificate corresponding to the target data based on the queried data content of the target data, and then returns the evidence certificate to the above-mentioned smart contract.
[0067] In one embodiment shown, the external data source may be a data source registered by a user on an external data platform connected to the blockchain. In this case, the external data source is usually a private data source registered by the user. When the smart contract sends the metadata to the oracle, it may first obtain the detailed data of the external data source registered by the user on the external data platform, and then send the metadata and the retrieved detailed data to the oracle. The oracle then queries the data content of the target data from the external data source based on the metadata and the detailed data.
[0068] For example, in actual applications, the oracle can determine the data source registered by the user on the external data platform based on the detailed data. After determining the data source registered by the user, it can further query the data content of the target data from the data source based on the metadata.
[0069] Since the above-mentioned external data sources are usually private data sources registered by users themselves, there may be certain differences in the data sources registered by different users on the external data platform. Therefore, in this way, it can be ensured that the oracle can query the data content of the target data from the correct data source, avoiding the performance overhead caused by the oracle traversing various data sources to find data when it cannot determine the data source registered by the user.
[0070] It should be noted that the specific method by which the above-mentioned smart contract obtains the detailed data of the external data source registered by the user on the above-mentioned external data platform in advance is not specifically limited in this specification.
[0071] In one embodiment shown, the data source registered by the user on the external data platform can be used to uniformly store the data content of the data stored by the user on the blockchain. That is, the data type of the data stored on the blockchain can be uniformly stored in the data source registered by the user without distinguishing the data type. In the above smart contract, the detailed data of the data source registered by each user on the external data platform can be maintained in advance.
[0072] In this case, the metadata in the above-mentioned data notarization record may specifically include the user identifier of the user; when the above-mentioned smart contract obtains the detailed data of the external data source registered by the user on the external data platform, it may specifically query the detailed data of the external data source registered by the user on the external data platform from the detailed data maintained by the smart contract based on the user identifier of the user contained in the metadata.
[0073] For example, in one example, the details data of the external data source may specifically include the user ID of the user who registered the external data source. In this case, when the smart contract queries the details data of the external data source registered by the user on the external data platform from the details data maintained by the smart contract based on the user ID of the user included in the metadata, the smart contract may specifically query the details data including the user ID of the user from the details data maintained by the smart contract.
[0074] In another example, the details data of the external data source may not specifically include the user ID of the user who registered the external data source, but the corresponding relationship between the user ID of the user who registered the external data source and the details data of the external data source is maintained in the smart contract. In this case, when the smart contract queries the details data of the external data source registered by the user on the external data platform from the details data maintained by the smart contract based on the user ID of the user included in the metadata, the smart contract may specifically query the details data that has established a corresponding relationship with the user ID of the user from the details data maintained by the smart contract.
[0075] In one embodiment shown, in order to facilitate the management of the data stored by the user on the blockchain, the data content of the data stored by the user on the blockchain can be stored in different data sources registered by the user on the external data platform according to different data types. At this time, the different data sources registered by the user on the external data platform can be used to store the data content of the specified type of data stored by the user on the blockchain.
[0076] In this case, the metadata in the data notarization record may specifically include the user ID of the user and the data type identifier corresponding to the target data type of the target data. When the smart contract obtains the detailed data of the external data source registered by the user on the external data platform, it may specifically query the detailed data of the external data source registered by the user on the external data platform from the detailed data maintained by the smart contract based on the user ID and the data type identifier corresponding to the target data type of the target data.
[0077] For example, in one example, the details data of the external data source may specifically include the user identifier of the user who registered the external data source and the data type identifier of the data type specified for the data source. When the smart contract queries the details data of the external data source registered by the user on the external data platform from the details data maintained by the smart contract based on the user identifier of the user contained in the metadata and the data type identifier corresponding to the target data type of the target data, the smart contract may specifically query the details data including the user identifier of the user and the data type identifier corresponding to the target data type of the target data from the details data maintained by the smart contract.
[0078] In another example, the details data of the external data source may not specifically include the user identifier of the user who registered the external data source, but the corresponding relationship between the user identifier of the user who registered the external data source and the details data of the external data source is maintained in the smart contract. When the smart contract queries the details data of the external data source registered by the user on the external data platform from the details data maintained by the smart contract based on the user identifier of the user contained in the metadata and the data type identifier corresponding to the target data type of the above-mentioned target data, the smart contract may first query the details data that has established a corresponding relationship with the user identifier of the user from the details data maintained by the smart contract. After the details data that has established a corresponding relationship with the user identifier of the user is queried, the details data containing the data type identifier corresponding to the target data type of the above-mentioned target data is further queried from the queried details data.
[0079] In another example, the details data of the external data source may not include the user identifier of the user who registered the external data source, and may not include the data type identifier of the data type specified for the data source. Instead, the corresponding relationship between the user identifier of the user who registered the external data source and the data type identifier of the data type specified for the data source and the details data of the external data source is maintained in the smart contract. When the smart contract queries the details data of the external data source registered by the user on the external data platform from the details data maintained by the smart contract based on the user identifier of the user contained in the metadata and the data type identifier corresponding to the target data type of the above-mentioned target data, the smart contract may specifically query the details data that has established a corresponding relationship with the user identifier of the user and the data type identifier corresponding to the target data type of the above-mentioned target data from the details data maintained by the smart contract.
[0080] In another embodiment shown, the detailed data of the external data source registered by the user on the external data platform may also be included in the data evidence record together with the metadata of the target data. That is, the detailed data of the external data source registered by the user on the external data platform may be provided by the user to the smart contract together with the metadata of the target data.
[0081] In this case, when the above-mentioned smart contract obtains the detailed data of the external data source registered by the user on the external data platform, it can directly read the detailed data contained in the data notarization record.
[0082] It should be noted that the detailed data of the external data source may specifically include any form of attribute information related to the external data source.
[0083] For example, in one embodiment shown, the external data source may be a data table registered by a user on an external data platform connected to the blockchain; in this case, the detailed data may specifically include information such as the platform identifier of the external data platform, the user identifier of the user who registered the data table, and the data type identifier of the data type specified for the data table.
[0084] The specific type of the above data table is not particularly limited in this specification.
[0085] For example, in one example, the database carried by the external data platform may specifically include an SQL database; and the data table may specifically be an SQL data table contained in the SQL database.
[0086] Of course, in practical applications, the above data tables may also be data tables in other forms other than SQL data tables, which will not be listed one by one in this specification. Figure 2 The above-mentioned oracle may specifically include an oracle contract deployed on the blockchain and an oracle service program deployed outside the chain and connected to an external data source. The oracle service program is also called an oracle node, which is responsible for monitoring the external data acquisition event generated by the oracle contract, and responding to the external data acquisition event to obtain data from the external data source.
[0087] In this scenario, when the smart contract sends the metadata of the target data and the detailed data of the external data source to the oracle, it can specifically use the metadata and the detailed data as call parameters to further call the oracle contract to generate an external data acquisition event containing the metadata and the detailed data.
[0088] The oracle service program can monitor the external data acquisition events generated by the oracle contract. For example, in actual applications, the external data acquisition events generated by the oracle contract are usually saved in the log of the blockchain system, and the oracle service program can timely obtain and respond to the external data acquisition events generated by the oracle contract by monitoring the external data acquisition events saved in the log in real time.
[0089] When the oracle service program monitors the external data acquisition event generated by the oracle contract, it indicates that the oracle contract has the need to obtain data from an external data source outside the chain. At this time, it can respond to the external data acquisition event, query the data content of the target data from the external data source based on the metadata and the detailed data, and generate an evidence certificate corresponding to the target data outside the chain based on the queried data content of the target data, and then return the evidence certificate to the oracle contract, and the oracle contract further returns the evidence certificate to the above-mentioned smart contract.
[0090] By entrusting the action of generating a storage certificate corresponding to the target data based on the data content of the queried target data to the oracle service program deployed outside the chain, it is possible to avoid placing the calculation process of the data content of the target data on the blockchain for execution as much as possible, thereby protecting the data privacy of the data content of the target data to the greatest extent.
[0091] Of course, in actual applications, if the data content of the target data does not involve data privacy, or the data privacy requirements for the data content of the target data are not high, the action of generating a storage certificate corresponding to the target data based on the data content of the queried target data can also be performed by an oracle contract deployed on the blockchain, and is not specifically limited in this specification.
[0092] It should be noted that the above-mentioned oracle can be a centralized oracle or a decentralized oracle, which is not particularly limited in this specification.
[0093] For example, see Figure 3 In an example, assuming that the above oracle is a centralized oracle, the oracle may include an oracle contract deployed on the blockchain and an oracle service program centrally deployed outside the chain. Figure 3 As shown, in this case, the oracle service program can specifically be a centralized service program deployed on a blockchain service platform (such as a Baas platform) that is connected to the blockchain. Through the oracle service program, multiple different external data platforms (i.e., external data sources) can be connected at the same time.
[0094] See also Figure 4 In another example, assuming that the above oracle is a decentralized oracle, the oracle can include an oracle contract deployed on the blockchain and multiple oracle service programs deployed decentralized outside the chain. Figure 4As shown, in this case, the oracle service program may specifically include multiple decentralized oracle service programs that are deployed on various external data platforms connected to the blockchain. At this time, each oracle service program can be connected to an independent external data platform.
[0095] In one embodiment shown, the smart contract can also support the user to customize the data type of the data that needs to be stored on the blockchain. In this case, when the user needs to customize the data type, the definition data for customizing the data type can be sent to the connected blockchain node to submit the data storage record as a call parameter to the smart contract.
[0096] For example, in actual applications, users can use the client to package the definition data used to customize the data type into a contract call transaction for the above-mentioned smart contract, and submit it to the blockchain node that has established a connection with it.
[0097] The definition data may specifically include any form of data for defining a data type; for example, the definition data may specifically include a data type identifier of the data type defined by a user, and a data specification corresponding to the target data type, and so on.
[0098] After obtaining the definition data provided by the user for customizing the data type, the blockchain node in the blockchain system can call the data type definition logic contained in the above smart contract, generate a definition record corresponding to the data type, and maintain the definition record in the smart contract to complete the definition process for the data type. The data content contained in the definition record can be consistent with the above definition data; for example, the definition record can also include the data type identifier of the user-defined data type and the data specification corresponding to the data type.
[0099] The specific content of the above data specifications usually depends on the user's customized requirements and is not particularly limited in this specification.
[0100] In one embodiment shown, the above data specification may specifically include field design specifications related to numeric fields contained in the data content of data corresponding to the user-defined data type.
[0101] For example, in actual applications, the field design specifications may specifically include field naming specifications corresponding to the digital fields contained in the data content of the target data, field value numerical size specifications, field value numerical type specifications, field description specifications, field index specifications, etc., which will not be listed one by one in this manual.
[0102] In one embodiment shown, if the data type of the target data that the user needs to store on the blockchain is a user-defined target data type, then when the oracle generates a storage voucher corresponding to the target data based on the acquired data content of the target data, the oracle can specifically obtain the data specification corresponding to the target data type maintained in the smart contract, and then verify whether the acquired data content of the target data meets the user-defined data specification for the target data type based on the data verification capability of the oracle itself;
[0103] For example, it is possible to verify whether the data fields contained in the data content of the target data comply with the field design specifications customized by the user for the target data type; for example, it is possible to check whether the naming of the data fields contained in the data content of the target data complies with the field naming specifications, check whether the size of the field value of the data field complies with the numerical size specifications, check whether the type of the field value of the data field complies with the numerical type specifications, check whether the field description of the data field complies with the field description specifications, check whether the field index of the data field complies with the field index specifications, and so on.
[0104] If it is determined through verification that the data content of the target data complies with the data specification, then a storage certificate corresponding to the target data can be further generated based on the data content of the target data.
[0105] Of course, if it is determined through verification that the data content of the target data does not conform to the data specification, the process of generating a storage certificate corresponding to the target data based on the data content of the target data can be terminated at this time, and a prompt indicating that the storage of the target data has failed can be returned to the above-mentioned smart contract.
[0106] It should be noted that the specific method by which the oracle obtains the data specification corresponding to the target data type maintained in the above-mentioned smart contract is not specifically limited in this specification.
[0107] In one example, when calling the oracle contract, the smart contract can include the data specification corresponding to the target data type maintained by the smart contract in the call parameters and pass them to the oracle contract. In this case, the oracle can obtain the data specification corresponding to the target data type contained in the call parameters.
[0108] For example, in actual applications, calls between smart contracts usually adopt the message call (MessageCall) method. When the above-mentioned smart contract uses the message call method to call the oracle contract, it can usually send a call message to the oracle contract; wherein, the call message can usually include call parameters that need to be passed to the oracle contract. In addition to the above-mentioned metadata and the above-mentioned detailed data, these call parameters can also include data specifications corresponding to the target data type. That is, the above-mentioned smart contract can also include the data specifications corresponding to the target data type in these call parameters and pass them to the oracle contract.
[0109] After receiving the call message, the oracle contract can read the call parameters contained in the call message, obtain the above-mentioned metadata, the above-mentioned detailed data and the data specification corresponding to the target data type from these call parameters, and then execute the contract method contained in the oracle contract to generate an external data acquisition event containing the metadata, the detailed data and the data specification corresponding to the target data type.
[0110] After the oracle service program monitors the external data acquisition event generated by the oracle contract, it can respond to the external data acquisition event, query the data content of the target data from the external data source based on the metadata and the detailed data contained in the external data acquisition event, and further verify whether the data content of the queried target data complies with the above data specification contained in the external data acquisition event; if so, it can continue to generate a storage certificate corresponding to the target data outside the chain, and then return the storage certificate to the oracle contract, and the oracle contract further returns the storage certificate to the above smart contract. In another example, the oracle can also specifically query the data specification corresponding to the target data type from the data specification corresponding to the user-defined data type maintained in the smart contract based on the data type identifier corresponding to the target data type contained in the above data.
[0111] It should be emphasized that in actual applications, since the oracle itself has a certain data verification capability, after the oracle obtains the data content of the target data from the external data source, in addition to obtaining the data specification corresponding to the target data type maintained in the above-mentioned smart contract, and verifying whether the data content of the obtained target data conforms to the data specification customized by the user for the target data type of the target data, it can also perform some other security verifications to ensure that the target data obtained for the smart contract in the oracle's external data source is safe and reliable data.
[0112] For example, the oracle can also verify the data source of the data content of the target data, verify the integrity of the data content of the target data, verify the timeliness of the data content of the target data, and so on.
[0113] The specific form of the evidence certificate corresponding to the target data generated by the oracle based on the data content of the target data is not specifically limited in this specification.
[0114] In one embodiment shown, the above-mentioned evidence certificate can specifically be a certificate generated by calculating the data content of the target data based on a cryptographic algorithm.
[0115] For example, in one example, the evidence voucher corresponding to the target data may specifically be a hash value obtained by performing a hash calculation on the data content of the target data.
[0116] Of course, in actual applications, the above-mentioned evidence certificate can be not only a certificate generated by calculation based on the data content of the target data based on a cryptographic algorithm, but also obviously can be in other forms; for example, directly using the data content of the target data as an evidence certificate, extracting some specified data fragments from the data content of the target data as an evidence certificate, etc., which will not be listed one by one in this manual.
[0117] In one embodiment shown, if the target data is a data set consisting of several data records, when the oracle generates a voucher based on the data content of the target data, it can calculate the data content contained in the data set to obtain a voucher corresponding to the data set. That is, in this case, the voucher finally generated may only include one voucher corresponding to the data set.
[0118] Among them, in the process of calculating based on the data content contained in the data set to obtain a proof certificate corresponding to the data set, the oracle can calculate the data content contained in the data set as a whole to obtain a proof certificate corresponding to the data set, or it can first calculate each data record contained in the data set separately to obtain multiple proof certificates, and then further generate a proof certificate corresponding to the data set based on the multiple proof certificates.
[0119] For example, taking the above-mentioned evidence certificate as a hash value, in one example, the oracle can perform hash calculation on the data content contained in the data set as a whole to obtain a hash value corresponding to the data set. In another example, the oracle can also perform hash calculation on each data record contained in the data set to obtain multiple hash values, and then organize the multiple hash values into a Merkle tree structure, and then use the hash value corresponding to the root node of the Merkle tree as the evidence certificate corresponding to the data set.
[0120] In one embodiment shown, if the target data is a data set consisting of several data records, when the oracle generates a voucher based on the data content of the target data, it can also perform calculations for each data record contained in the data set to obtain multiple vouchers corresponding to each data record. That is, in this case, a voucher will eventually be generated for each data record in the data set.
[0121] For example, still taking the above-mentioned evidence certificate as a hash value as an example, the oracle can perform hash calculations on the data content of each data record contained in the data set, and generate a hash value for each data record as the evidence certificate corresponding to the data record.
[0122] Step 106: In response to the evidence certificate corresponding to the target data returned by the oracle to the smart contract, further call the evidence logic contained in the smart contract to add the evidence certificate to the data evidence record; wherein the evidence certificate is the evidence certificate generated by the oracle based on the data content of the target data; the data content of the target data is the data content queried by the oracle from the external data source based on the metadata.
[0123] Step 108: publish the data evidence record with the evidence certificate added to the blockchain for evidence storage.
[0124] After the oracle has queried the data content of the target data from the external data source based on the metadata of the target data sent by the smart contract, and has generated a certificate corresponding to the target data based on the queried data content of the target data, the certificate can be returned to the smart contract. For example, the certificate can be returned to the smart contract through the message passing mechanism between the oracle contract and the smart contract.
[0125] After receiving the evidence certificate returned by the oracle, the smart contract can respond to the evidence certificate, further call the evidence logic contained in the smart contract, add the evidence certificate to the above-mentioned data evidence record, and then further publish the data evidence record with the added evidence certificate to the blockchain for evidence storage. Since the evidence certificate added by the smart contract to the above-mentioned data evidence record is a certificate generated based on the data content of the target data obtained from the external data source after the oracle has verified the data content of the target data based on its own data verification capabilities; therefore, in this way, secure and reliable data evidence can be achieved for large-capacity data stored in external data sources.
[0126] It should be noted that if the above-mentioned target data is a data set consisting of several data records, and the oracle generates a corresponding evidence certificate for each data record in the data set, then when the smart contract adds these evidence certificates to the data evidence record, it can specifically add the evidence certificate of each data record and the data record identifier of each data record to the above-mentioned data evidence record; for example, a correspondence between the evidence certificate of each data record and the data record identifier of each data record can be established, and then the correspondence can be added to the above-mentioned data evidence record.
[0127] In this way, it is easy to search and query the stored evidence of each data record.
[0128] In an illustrated implementation manner, if the external data source supports managing the stored data content according to data versions, in this case, the metadata may further include a data version identifier corresponding to the target data.
[0129] When a user first stores the target data, a default data version identifier may be assigned to the target data. At this time, the metadata in the data storage record provided by the user may include the default data version identifier.
[0130] After the target data is first notified, if the target data is further modified, the user can reset a new data version identifier for the modified target data. At this time, the metadata in the data notification record provided by the user can include the new data version identifier, and then the new version of the target data can be re-notified according to the notification process shown above.
[0131] For example, the data content of the modified target data can first be stored in an external data source connected to the blockchain, and then a data evidence record can be generated based on the metadata corresponding to the target data (including the new data version identifier), and the data evidence record can be further submitted to the above-mentioned smart contract as a call parameter to initiate a contract call for the smart contract to complete the evidence storage of the modified target data. The specific execution process will not be repeated here.
[0132] In this way, the data stored on the blockchain can be managed according to the data version, so that every modification of the data can be traced on the blockchain.
[0133] After the above-mentioned target data has been stored on the blockchain, any subsequent third party that needs to use the data content of the target data stored in the external data source can verify the data content of the target data stored in the external data source based on the data storage record of the target data stored on the blockchain as the data verifier.
[0134] When the data verifier verifies the target data, it can generate a data verification record based on the metadata corresponding to the target data, and send the data verification record to the connected blockchain node. The blockchain node further submits the data notarization record to the smart contract as a call parameter.
[0135] For example, in actual applications, the data verifier can generate a data verification record based on the metadata corresponding to the target data, and then package the data verification record into a contract call transaction for the above-mentioned smart contract, and submit it to the blockchain node with which a connection has been established.
[0136] After obtaining the data evidence record provided by the data verifier, the blockchain node can call the data verification logic contained in the smart contract, query the data evidence record corresponding to the target data stored on the blockchain based on the metadata, and obtain the detailed data of the external data source registered by the user on the external data platform. The metadata and the detailed data are used as calling parameters to further call the above-mentioned oracle contract, and the oracle contract generates a evidence record verification event containing the metadata and the detailed data.
[0137] The oracle service program can monitor the evidence record verification event generated by the oracle contract. When the oracle contract generates the evidence record verification event, it indicates that the oracle contract has the need to obtain data from an external data source outside the chain. At this time, it can respond to the evidence record verification event and further query the data content of the target data from the external data source based on the metadata and the detailed data. The specific query process will not be repeated here.
[0138] Then, the oracle service program can regenerate the evidence certificate corresponding to the target data based on the data content of the queried target data, and verify outside the chain whether the regenerated evidence certificate is the same as the evidence certificate contained in the queried data evidence record, and return the verification result to the oracle contract, which further returns the verification result to the smart contract to complete the verification of the data evidence record.
[0139] For example, in actual applications, the smart contract can specifically save the verification result in the form of an event in the log of the blockchain system, and the above-mentioned data verifier can obtain and respond to the verification result in a timely manner by monitoring the events saved in the log stored on the blockchain node in real time.
[0140] In a verification scenario shown, if the target data is a data set consisting of several data records, and the oracle generates a corresponding evidence voucher for each data record in the data set, the data verifier can specify one or more data records from the data set based on specific verification requirements when verifying the data content of the target data stored in the external data source, and then only perform data verification on the specified one or more data records. At this time, the metadata provided by the data verifier can also include the data record identifier of the specified one or more data records.
[0141] In this case, based on the verification process shown above, when verifying the data content of the specified one or more data records stored in the external data source outside the chain, the data evidence record corresponding to the target data stored on the blockchain can be queried first, and based on the data record identifier of the specified one or more data records contained in the metadata, the evidence certificate corresponding to the specified one or more data records contained in the data evidence record is queried, and then the data content of the specified one or more data records is queried from the external data source, and the evidence certificate corresponding to the target data is regenerated based on the queried data content of the target data. Finally, it can be verified outside the chain whether the regenerated evidence certificate is the same as the queried evidence certificate corresponding to the specified one or more data records, and the verification result is returned to the oracle contract, and the oracle contract further returns the verification result to the above-mentioned smart contract to complete the verification of the data evidence record.
[0142] In another verification scenario shown, if the above-mentioned external data source supports the management of stored data content according to data versions, in this case, when the above-mentioned data verifier verifies the data content of the target data stored in the external data source, it can, based on specific verification requirements, only verify one or more specified data versions of the target data stored in the external data source, or it can verify all data versions of the target data stored in the external data source separately.
[0143] If the data verifier only verifies one or more specified data versions of the target data stored in the external data source, the metadata provided by the data verifier may also include a data version identifier of the specified data version to be verified.
[0144] In this case, based on the verification process shown above, when verifying the data content of the target data of the specified data version stored in the external data source outside the chain, it is specifically possible to query the data evidence record corresponding to the target data of the specified data version stored on the blockchain based on the metadata, and query the data content of the target data of the specified data version from the external data source, and then regenerate the evidence certificate corresponding to the target data based on the queried data content of the target data, and verify outside the chain whether the regenerated evidence certificate is the same as the evidence certificate contained in the queried data evidence record, and return the verification result to the oracle contract, and the oracle contract further returns the verification result to the above-mentioned smart contract to complete the verification of the data evidence record.
[0145] Of course, if the data verifier needs to verify all data versions of the target data stored in the external data source respectively, then the data version identifier may not be included in the metadata provided by the data verifier by default.
[0146] In this case, based on the verification process shown above, the data content of each version of the target data stored in the external data source can be verified separately outside the chain, and the specific verification process will not be repeated here.
[0147] The above technical solution is described in detail below through a specific embodiment.
[0148] See also Figure 5 , Figure 5 This is an interactive diagram of storing evidence data on a blockchain as shown in this specification.
[0149] like Figure 5As shown, in this embodiment, the smart contract for data evidence management deployed on the blockchain can be split into two different smart contracts according to their functions, specifically including a data evidence contract for data evidence and a data management contract for data management.
[0150] Among them, users can customize the data type of data to be stored by calling the data type definition logic contained in the data management contract, and maintain the definition record corresponding to the user-defined data type in the data management contract; the definition record can specifically include the data specification customized by the user for the data type. In addition, the data management contract can also maintain the detailed data of the data source registered by each user on the external data platform.
[0151] The oracle deployed on the blockchain may specifically include the oracle contract deployed on the blockchain and the oracle service program deployed outside the chain. Among them, the oracle service program can connect to the external data source registered by the user on the external data platform.
[0152] Furthermore, a proof record management service that is connected to the blockchain node in the blockchain system can be deployed outside the chain. The proof record management service can also be connected to the above external data source.
[0153] Please continue to see Figure 5 When a user needs to store target data on the blockchain, the user can provide the data record corresponding to the target data to the evidence record management service through the client. The data record can specifically include the data content of the target data and the metadata of the target data.
[0154] After obtaining the data record of the target data provided by the user, the evidence record management service can, on the one hand, further store the data record in the above-mentioned external data source that is connected, and on the other hand, generate a data evidence record based on the metadata corresponding to the target data contained in the data record, and then further send the data evidence record to the blockchain node that is connected to it.
[0155] Please continue to see Figure 5 After obtaining the data evidence record sent by the evidence record management service, the blockchain node can call the evidence management logic contained in the data evidence contract to further obtain the detailed data of the external data source registered by the user on the above-mentioned external data platform maintained by the above-mentioned data source management contract.
[0156] For example, in actual applications, calls between smart contracts usually use the message call method.
[0157] When the data storage contract calls the data source management contract by using a message call, it can usually send a call message to the data source management contract; wherein, the call message can usually include call parameters that need to be passed to the oracle contract. Among these call parameters, the user ID of the user can be specifically included.
[0158] After receiving the call message, the data source management contract can read the call parameters contained in the call message, obtain the user ID from these call parameters, and then execute the contract method contained in the data source management contract. Based on the user ID of the user, the detailed data of the external data source registered by the user on the external data platform is queried from the maintained detailed data, and then the queried detailed data is returned to the data storage contract. Of course, if the data content of the data stored by the user on the blockchain is stored in different data sources registered by the user on the external data platform according to different data types, the external data source that needs to be queried at this time is specifically the external data source registered by the user on the external data platform for storing the data content corresponding to the target data type of the target data.
[0159] In this case, the call parameters contained in the call message may include, in addition to the user ID of the user, a data type identifier corresponding to the target data type of the target data. After receiving the call message, the data source management contract may read the call parameters contained in the call message, obtain the user ID and the target data type identifier from these call parameters, and then execute the contract method contained in the data source management contract, query the details data of the external data source registered by the user on the external data platform from the maintained details data based on the user ID and the target data type identifier, and then return the queried details data to the data storage contract.
[0160] After obtaining the detailed data of the external data source registered by the user on the above-mentioned external data platform, the data notarization contract can use the above-mentioned metadata and the obtained detailed data as calling parameters to further call the above-mentioned oracle contract, and the oracle contract generates an external data acquisition event containing the metadata and the detailed data.
[0161] The above-mentioned oracle service program can monitor the external data acquisition event generated by the oracle contract, and respond to the monitored external data acquisition event, query the data content of the target data from the external data source based on the metadata and the detailed data, and obtain the data specification customized by the user for the target data type of the target data maintained in the above-mentioned data management contract, and then verify whether the data content of the queried target data meets the data specification defined by the user for the target data type of the target data; if it is verified that the data content of the target data meets the data specification, then it can further generate a storage certificate corresponding to the target data based on the data content of the target data, and then return the storage certificate to the oracle contract. After receiving the storage certificate returned by the above-mentioned oracle service program, the oracle contract can further return the storage certificate to the above-mentioned data storage contract.
[0162] Please continue to see Figure 5 After receiving the evidence certificate returned by the oracle contract, the data evidence contract can respond to the evidence certificate and further call the evidence logic contained in the data evidence contract to add the evidence certificate to the data evidence record. Then, the data evidence record with the evidence certificate added is further published to the blockchain for evidence storage, thereby completing the data evidence storage of the target data on the blockchain.
[0163] See also Figure 6 , Figure 6 This is an interaction diagram for verifying target data stored in an external data source, as shown in this specification.
[0164] like Figure 6 As shown, after the above-mentioned target data has been stored on the blockchain, when the data verifier needs to use the data content of the target data stored in the external data source, the data verifier can verify the data content of the target data stored in the external data source based on the data storage record of the target data stored on the blockchain.
[0165] Please continue to see Figure 6 When the data verifier verifies the target data, the metadata corresponding to the target data can be provided to the evidence record management service through the client. After obtaining the metadata of the target data provided by the user, the evidence record management service can generate a data verification record based on the metadata corresponding to the target data, and send the data verification record to the connected blockchain node.
[0166] After obtaining the data evidence record provided by the data verifier, the blockchain node can call the data verification logic contained in the above-mentioned data evidence contract, query the data evidence record corresponding to the target data stored on the blockchain based on the metadata, and obtain the detailed data of the external data source registered by the user on the above-mentioned external data platform maintained by the above-mentioned data source management contract, and then use the metadata and the detailed data as calling parameters to further call the above-mentioned oracle contract, and the oracle contract generates a evidence record verification event containing the metadata and the detailed data.
[0167] Please continue to see Figure 6 , the oracle service program can monitor the verification event of the evidence record generated by the oracle contract, and respond to the monitored verification event of the evidence record, and further query the data content of the target data from the external data source based on the metadata and the detailed data. Then, the oracle service program can regenerate the evidence certificate corresponding to the target data based on the data content of the queried target data, and verify outside the chain whether the regenerated evidence certificate is the same as the evidence certificate contained in the queried data evidence record, and return the verification result to the oracle contract, and the oracle contract further returns the verification result to the data evidence contract.
[0168] The data evidence contract can specifically save the verification result in the form of an event in the log of the blockchain system, and the log can be stored on the blockchain node. The above-mentioned evidence record management service can obtain the verification result in a timely manner by monitoring the events saved in the log stored on the blockchain node in real time, and return the verification result to the user's client to complete the verification of the data evidence record.
[0169] Corresponding to the embodiments of the aforementioned method, this specification also provides embodiments of an apparatus, an electronic device, and a storage medium.
[0170] Figure 7 is a schematic structural diagram of an electronic device provided by an exemplary embodiment. Figure 7 At the hardware level, the device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and may also include other required hardware. One or more embodiments of this specification may be implemented based on software, such as the processor 702 reading the corresponding computer program from the non-volatile memory 710 into the memory 708 and then running it. Of course, in addition to the software implementation, one or more embodiments of this specification do not exclude other implementations, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but may also be hardware or logic devices.
[0171] like Figure 8 As shown, Figure 8 This is a block diagram of a data storage based on blockchain according to an exemplary embodiment of the present specification. The device can be applied to Figure 7 In the electronic device shown, the technical solution of this specification is implemented. Wherein, a smart contract for data evidence management is deployed on the blockchain; the device 800 includes:
[0172] Acquisition module 801, acquiring a data evidence record provided by a user; wherein the data evidence record contains metadata corresponding to the target data; the data content of the target data is stored in an external data source connected to the blockchain;
[0173] The sending module 802 calls the evidence management logic contained in the smart contract to send the metadata to the oracle; wherein the oracle is used to obtain data for the smart contract from the external data source;
[0174] The adding module 803 further calls the evidence logic contained in the smart contract in response to the evidence certificate corresponding to the target data returned by the oracle to the smart contract, and adds the evidence certificate to the data evidence record; wherein the evidence certificate is the evidence certificate generated by the oracle based on the data content of the target data; the data content of the target data is the data content queried by the oracle from the external data source based on the metadata;
[0175] The evidence storage module 804 publishes the data evidence storage record with the evidence storage certificate added to the blockchain for evidence storage.
[0176] Accordingly, the present specification also provides an electronic device, which includes a processor; a memory for storing instructions executable by the processor; wherein the processor is configured to implement the steps in all the method flows described above.
[0177] Accordingly, the present specification also provides a computer-readable storage medium on which executable computer program instructions are stored; wherein, when the instructions are executed by a processor, the steps in all the method flows described above are implemented.
[0178] Accordingly, the present specification also provides a computer program product having executable computer program instructions stored thereon; wherein, when the computer program instructions are executed by a processor, the steps in all the method flows described above are implemented.
[0179] In the 1990s, improvements to a technology could be clearly distinguished as hardware improvements (for example, improvements to the circuit structure of diodes, transistors, switches, etc.) or software improvements (improvements to the method flow). However, with the development of technology, many improvements to the method flow today can be regarded as direct improvements to the hardware circuit structure. Designers almost always obtain the corresponding hardware circuit structure by programming the improved method flow into the hardware circuit. Therefore, it cannot be said that an improvement in a method flow cannot be implemented using a hardware entity module. For example, a programmable logic device (PLD) (such as a field programmable gate array (FPGA)) is such an integrated circuit whose logical function is determined by the user's programming of the device. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to ask a chip manufacturer to design and produce a dedicated integrated circuit chip. Moreover, nowadays, instead of manually making integrated circuit chips, this kind of programming is mostly implemented by "logic compiler" software, which is similar to the software compiler used when developing and writing programs, and the original code before compilation must also be written in a specific programming language, which is called hardware description language (HDL). There is not only one HDL, but many kinds, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used ones are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art should also know that it is only necessary to program the method flow slightly in the above-mentioned hardware description languages and program it into the integrated circuit, and then it is easy to obtain the hardware circuit that implements the logic method flow.
[0180] The controller can be implemented in any appropriate manner, for example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing a computer-readable program code (such as software or firmware) that can be executed by the (micro)processor, a logic gate, a switch, an application-specific integrated circuit (ASIC), a programmable logic controller, and an embedded microcontroller. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art also know that in addition to implementing the controller in a purely computer-readable program code manner, the controller can be implemented in the form of a logic gate, a switch, an application-specific integrated circuit, a programmable logic controller, and an embedded microcontroller by logically programming the method steps. Therefore, this controller can be considered as a hardware component, and the devices included therein for implementing various functions can also be regarded as structures within the hardware component. Or even, the devices for implementing various functions can be regarded as both software modules for implementing the method and structures within the hardware component.
[0181] The systems, devices, modules or units described in the above embodiments may be implemented by computer chips or entities, or by products with certain functions. A typical implementation device is a server system. Of course, the present application does not exclude that with the development of computer technology in the future, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, a vehicle-mounted human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0182] Although one or more embodiments of the present specification provide method operation steps as described in the embodiments or flow charts, more or less operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps, and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "include", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not explicitly listed, or also includes elements inherent to such a process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any specific order.
[0183] For the convenience of description, the above devices are described in various modules according to their functions. Of course, when implementing one or more of the present specification, the functions of each module can be implemented in the same or more software and / or hardware, or the module implementing the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0184] The present invention is described with reference to flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0185] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0186] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0187] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0188] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0189] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0190] It should be understood by those skilled in the art that one or more embodiments of the present specification may be provided as a method, system or computer program product. Therefore, one or more embodiments of the present specification may take the form of a complete hardware embodiment, a complete software embodiment or an embodiment combining software and hardware. Moreover, one or more embodiments of the present specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0191] One or more embodiments of the present specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform specific tasks or implement specific abstract data types. One or more embodiments of the present specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules may be located in local and remote computer storage media, including storage devices.
[0192] Each embodiment in this specification is described in a progressive manner, and the same and similar parts between the embodiments can be referred to each other, and each embodiment focuses on the differences from other embodiments. In particular, for the system embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment. In the description of this specification, the description of the reference terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representation of the above terms does not necessarily target the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art can combine and combine the different embodiments or examples described in this specification and the features of different embodiments or examples without contradiction.
[0193] The above description is only an example of one or more embodiments of this specification and is not intended to limit one or more embodiments of this specification. For those skilled in the art, one or more embodiments of this specification may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of this specification shall be included in the scope of the claims.
Claims
1. A data storage method based on blockchain, wherein: A smart contract for data evidence management is deployed on the blockchain; the method includes: Obtaining a data evidence record provided by a user; wherein the data evidence record contains metadata corresponding to the target data; the data content of the target data is stored in an external data source connected to the blockchain; Calling the evidence management logic contained in the smart contract to send the metadata to the oracle; wherein the oracle is used to obtain data for the smart contract from the external data source; In response to the evidence certificate corresponding to the target data returned by the oracle to the smart contract, the evidence logic contained in the smart contract is further called to add the evidence certificate to the data evidence record; wherein the evidence certificate is the evidence certificate generated by the oracle based on the data content of the target data; the data content of the target data is the data content queried by the oracle from the external data source based on the metadata; The data evidence record with the evidence certificate added is published to the blockchain for evidence storage.
2. The method according to claim 1, wherein the external data source is a data source registered by a user on an external data platform connected to the blockchain; Sending the metadata to the oracle includes: Obtaining detailed data of the external data source registered by the user on the external data platform; The metadata and the detail data are sent to the oracle.
3. The method as claimed in claim 2, wherein the oracle comprises an oracle contract deployed on the blockchain and an oracle service program deployed outside the chain and connected to the external data source; Sending the metadata and the detail data to the oracle, so that the oracle queries the data content of the target data from the external data source based on the metadata and the detail data, includes: Using the metadata and the detail data as call parameters, further calling the oracle contract, generating an external data acquisition event including the metadata and the detail data, and obtaining the evidence certificate corresponding to the target data returned by the oracle contract; Among them, the evidence certificate is the evidence certificate generated by the oracle service program based on the data content of the target data; the data content of the target data is the data content queried from the external data source by the oracle service program based on the metadata and the detailed data in response to the monitored external data acquisition event.
4. The method according to claim 3, wherein the target data type is the user-defined data type; and the smart contract further maintains a data specification corresponding to the user-defined data type; Generating the evidence voucher based on the data content of the target data includes: Obtaining a data specification corresponding to the target data type maintained in the smart contract; Verify whether the data content of the target data complies with the data specification; if so, further generate an evidence certificate corresponding to the target data based on the data content of the target data.
5. According to the method of claim 4, the external data source supports management of stored data content according to data version; and the metadata also includes a data version identifier corresponding to the target data.
6. According to the method of claim 1, the evidence voucher is a hash value obtained by performing a hash calculation on the data content of the target data.
7. A data storage device based on blockchain, wherein: A smart contract for data evidence management is deployed on the blockchain; the device includes: An acquisition module is used to acquire a data evidence record provided by a user; wherein the data evidence record includes metadata corresponding to the target data; and the data content of the target data is stored in an external data source connected to the blockchain; A sending module, calling the evidence management logic contained in the smart contract, and sending the metadata to the oracle; wherein the oracle is used to obtain data for the smart contract from the external data source; The adding module further calls the evidence logic contained in the smart contract in response to the evidence certificate corresponding to the target data returned by the oracle to the smart contract, and adds the evidence certificate to the data evidence record; wherein the evidence certificate is the evidence certificate generated by the oracle based on the data content of the target data; the data content of the target data is the data content queried by the oracle from the external data source based on the metadata; The evidence storage module publishes the data evidence record with the evidence storage certificate added to the blockchain for evidence storage.
8. A computer 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 computer program, the steps of the method according to any one of claims 1 to 6 are implemented.
9. A computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 6 are implemented.
Citation Information
Cited By
Highway engineering electronic file credible evidence storage method and system based on block chain
CN120951386A