Blockchain data storage and reading method, blockchain data access system

By setting up chain storage outside the blockchain and associated with data abstracts and identification information on the blockchain, the performance problems caused by the blockchain node due to excessive data storage have been solved. The effect of use value.

CN114356236BActive Publication Date: 2025-01-28HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202111672146.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-31
Publication Date
2025-01-28
Estimated Expiration
2041-12-31

AI Technical Summary

Technical Problem

Since the data storage volume of blockchain nodes reaches the order of TB, their performance is affected, and the existing technology is difficult to effectively alleviate the pressure on blockchain data storage.

Method used

By setting at least one chain outside memory outside the blockchain to store data blocks generated on the blockchain, and the data abstract of the data abstract on the blockchain and the identification information of the outside chain memory, realize the multiple backup storage of the data block Essence

Benefits of technology

It greatly alleviates the storage pressure of the blockchain, solves the problem of insufficient storage capacity, and enhances the value of the blockchain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114356236B_ABST
    Figure CN114356236B_ABST
Patent Text Reader

Abstract

The present application relates to a blockchain data storage and reading method and a blockchain data access system, wherein the blockchain data storage method includes: obtaining a data block to be stored on the blockchain and a data summary corresponding to the data block; when it is determined that the data block meets the off-chain storage conditions, determining at least one off-chain storage for storing the data block; storing the data block in the at least one off-chain storage, and associating the data summary and identification information of the at least one off-chain storage on the blockchain.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a blockchain data storage and reading method and a blockchain data access system. Background Art

[0002] Blockchain has the characteristic of consensus. Therefore, after data is generated on the blockchain, it needs to be synchronized to each blockchain node based on the consensus characteristic. As the amount of data increases, the data storage pressure of each blockchain is very large. Studies have shown that when the data storage capacity of blockchain nodes reaches the TB level, the performance of blockchain nodes is affected. However, there is no way to effectively alleviate the data storage pressure of blockchain in related technologies. Summary of the invention

[0003] The embodiments of the present application provide a blockchain data storage and reading method and a blockchain data access system to at least solve the problem of insufficient storage capacity in the blockchain in the related art.

[0004] In a first aspect, an embodiment of the present application provides a blockchain data storage method, comprising:

[0005] Obtaining a data block to be stored on the blockchain and a data summary corresponding to the data block;

[0006] In the case where it is determined that the data block meets the off-chain storage condition, determining at least one off-chain storage device for storing the data block;

[0007] The data block is stored in the at least one off-chain storage, and the data summary and identification information of the at least one off-chain storage are associated on the blockchain.

[0008] The blockchain data storage method provided in each embodiment of the present application is to set at least one off-chain storage device outside the blockchain to store the data blocks generated on the blockchain, and associate the data summary with the identification information of the at least one off-chain storage device on the blockchain, so that the corresponding data block can be queried according to the data summary when needed. Based on the above data storage mechanism, the storage pressure of the blockchain can be greatly alleviated, the problem of insufficient storage capacity in the blockchain can be alleviated, and the use value of the blockchain can be further improved.

[0009] Optionally, in one embodiment of the present application, the off-chain storage condition includes: the data block is greater than a first preset threshold, and / or the importance of the data block is less than a second preset threshold.

[0010] Optionally, in one embodiment of the present application, determining at least one off-chain storage for storing the data block includes:

[0011] The number of off-chain memories used to store the data block is determined according to the importance of the data block, and the number of the off-chain memories is positively correlated with the importance of the data block.

[0012] Optionally, in one embodiment of the present application, determining at least one off-chain storage for storing the data block includes:

[0013] Obtaining a storage cost budget for the data block and a storage cost of each off-chain storage registered on the blockchain;

[0014] According to the storage cost budget and the storage costs of each off-chain storage, at least one off-chain storage is selected from the registered off-chain storages to store the data block, and the number of times the data block is stored in the at least one off-chain storage is determined.

[0015] Optionally, in one embodiment of the present application, storing the data block in the at least one off-chain storage includes:

[0016] Call at least one oracle to store the data block in the at least one off-chain memory, wherein each oracle stores the data block in at least one of the at least one off-chain memory.

[0017] Optionally, in one embodiment of the present application, associating the data summary and the identification information of the at least one off-chain storage on the blockchain includes:

[0018] The data summary and identification information of at least one off-chain storage are stored in association with each other on the smart contract corresponding to the blockchain, wherein the identification information of the off-chain storage is associated with the access interface information of the off-chain storage.

[0019] In a second aspect, an embodiment of the present application provides a blockchain data reading method, comprising:

[0020] Get the summary of the data to be queried;

[0021] When it is determined that the data block corresponding to the data summary is stored in at least one off-chain storage, obtaining identification information of the at least one off-chain storage;

[0022] According to the identification information of the at least one off-chain storage, a data block corresponding to the data summary is obtained.

[0023] Optionally, in one embodiment of the present application, acquiring the data block corresponding to the data summary according to the identification information of the at least one off-chain storage includes:

[0024] Determine access interface information of the at least one off-chain storage according to the identification information;

[0025] According to the access interface information, a data block corresponding to the data summary is obtained.

[0026] Optionally, in an embodiment of the present application, when the off-chain storage includes multiple off-chain storages, acquiring the data block corresponding to the data summary according to the identification information of the at least one off-chain storage includes:

[0027] According to the identification information of the multiple off-chain storages, obtain the data blocks corresponding to the data digest from multiple of the multiple off-chain storages;

[0028] Performing consistency check on the acquired multiple data blocks;

[0029] The data block that passes the consistency check is used as the data block corresponding to the data summary.

[0030] Optionally, in one embodiment of the present application, acquiring the data block corresponding to the data summary according to the identification information of the at least one off-chain storage includes:

[0031] Obtaining a read cost budget of the data summary and a read cost of the at least one off-chain storage;

[0032] According to the read cost budget and the read cost of the at least one off-chain storage, at least one target off-chain storage is selected from the at least one off-chain storage, and the number of times the data block is read from the at least one target off-chain storage is determined;

[0033] The data block corresponding to the data summary is read from the at least one target off-chain storage according to the number of times.

[0034] Optionally, in an embodiment of the present application, obtaining the data block corresponding to the data summary includes:

[0035] Invoke at least one oracle to read the data block corresponding to the data summary from the at least one off-chain storage, wherein each oracle reads the data block from at least one of the at least one off-chain storage. In a second aspect, an embodiment of the present application further provides a blockchain data storage device, comprising:

[0036] In a third aspect, an embodiment of the present application provides a blockchain data access system, the system comprising a blockchain, at least one oracle, and at least one off-chain storage, wherein:

[0037] The blockchain is used to store data using the blockchain data storage method, and to read data using the blockchain data reading method;

[0038] The at least one oracle is bridged between the blockchain and the at least one off-chain storage, and is used to transmit data between the blockchain and the off-chain storage;

[0039] The at least one off-chain storage is used to store the data block.

[0040] In a fourth aspect, an embodiment of the present application provides a processing device, comprising a memory and a processor, wherein the memory stores a computer program, and the processor is configured to run the computer program to execute the blockchain data storage method and the blockchain data reading method.

[0041] In a fifth aspect, a non-volatile computer-readable storage medium having computer program instructions stored thereon, wherein the computer program instructions, when executed by a processor, implement the blockchain data storage method and the blockchain data reading method.

[0042] In a sixth aspect, a computer program product comprises a computer-readable code, or a non-volatile computer-readable storage medium carrying a computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the blockchain data storage method and the blockchain data reading method.

[0043] In the seventh aspect, a chip comprises at least one processor, which is used to run a computer program or computer instructions stored in a memory to execute the blockchain data storage method and the blockchain data reading method.

[0044] Details of one or more embodiments of the present application are set forth in the following drawings and description to make other features, objects, and advantages of the present application more readily apparent. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0046] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0047] Figure 2 This is a method flow chart of the blockchain data storage method provided by an embodiment of the present application;

[0048] Figure 3This is a schematic diagram of an application scenario provided by an embodiment of the present application;

[0049] Figure 4 This is a schematic diagram of the module structure of the blockchain data storage device provided in an embodiment of the present application;

[0050] Figure 5 It is a schematic diagram of the module structure of the processing device provided in the embodiment of the present application;

[0051] Figure 6 It is a schematic diagram of the module structure of the computer program product provided in the embodiment of the present application. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is described and illustrated below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. Based on the embodiments provided in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application. In addition, it can also be understood that although the efforts made in this development process may be complex and lengthy, for ordinary technicians in the field related to the contents disclosed in the present application, some changes such as design, manufacturing or production based on the technical contents disclosed in the present application are only conventional technical means, and should not be understood as insufficient contents disclosed in the present application.

[0053] Reference to "embodiments" in this application means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.

[0054] Unless otherwise defined, the technical terms or scientific terms involved in this application should be understood by people with ordinary skills in the technical field to which this application belongs. The words "one", "a", "a", "the" and the like involved in this application do not indicate a quantity limitation, and may indicate the singular or plural. The terms "include", "comprise", "have" and any of their variations involved in this application are intended to cover non-exclusive inclusions; for example, a process, method, system, product or device that includes a series of steps or modules (units) is not limited to the listed steps or units, but may also include steps or units that are not listed, or may also include other steps or units inherent to these processes, methods, products or devices. The words "connect", "connected", "coupled" and the like involved in this application are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. The "multiple" involved in this application means greater than or equal to two. "And / or" describes the association relationship of associated objects, indicating that there can be three relationships. For example, "A and / or B" can mean: A exists alone, A and B exist at the same time, and B exists alone. The terms "first", "second", "third" and the like involved in the present application are merely used to distinguish similar objects and do not represent a specific ordering of the objects.

[0055] In addition, in order to better illustrate the present application, numerous specific details are given in the following specific embodiments. It should be understood by those skilled in the art that the present application can also be implemented without certain specific details. In some examples, devices, means, components and circuits well known to those skilled in the art are not described in detail in order to highlight the subject matter of the present application.

[0056] In order to clearly illustrate the technical solutions of various embodiments of the present application, Figure 1 The blockchain access system shown illustrates the application scenarios of the blockchain data access methods provided in various embodiments of the present application.

[0057] See also Figure 1 , Figure 1 Schematic diagram of the module structure of the blockchain access system 100 provided in the embodiment of the present application. Figure 1As shown, the blockchain access system may include a blockchain 101, a prophet 103, and an off-chain storage 105. The blockchain may include multiple blockchain nodes, each of which may include a processing node with autonomous processing capabilities, such as a server, a cloud processor, a server cluster, etc. The multiple blockchain nodes may be distributed anywhere in the world and connected together through a network. Each blockchain node in the blockchain is considered equal, and generally synchronizes and stores all copies of data in the blockchain. The smart contract is a protocol set in the blockchain for defining events in the blockchain and monitoring and triggering events. For example, the blockchain data storage method and the blockchain data reading method provided in each embodiment of the present application are stored in the smart contract in the form of code. The prophet 103 is a middleware serving the blockchain, and its function is to realize data intercommunication within and outside the blockchain chain.

[0058] In an embodiment of the present application, it is proposed to use the off-chain memory to store the data generated by the blockchain. The off-chain memory may include a device with data storage capabilities, such as a client, a server, a server cluster, a cloud storage, etc., which is not limited in this application. In the proposed blockchain storage system, each oracle can access multiple off-chain memories. Based on the above system architecture, in the blockchain data access mechanism, for data storage, it can be set to store the same data block in multiple off-chain memories at the same time to achieve multiple backup storage of data blocks. For data reading, it can be set to read the same data from multiple off-chain memories, and perform consistency checks on the same data read to prevent the data in the off-chain memory from being tampered with and causing the wrong data to be read, so as to verify the security of the data.

[0059] The blockchain data storage method described in this application is described in detail below with reference to the accompanying drawings. Figure 2 It is a flowchart of an embodiment of the blockchain data storage method provided by the present application. Although the present application provides the method operation steps as shown in the following embodiments or drawings, more or fewer operation steps may be included in the method based on routine or no creative labor. In the steps where there is no necessary causal relationship logically, the execution order of these steps is not limited to the execution order provided in the embodiment of the present application. The method can be executed in the actual blockchain data storage process or when the method is executed, in the method sequence shown in the embodiment or drawings or in parallel (for example, in a parallel processor or multi-threaded processing environment).

[0060] Specifically, an implementation of the blockchain data storage method provided by the present application is as follows: Figure 2 As shown, the method may include:

[0061] S201: Obtain a data block to be stored on the blockchain and a data summary corresponding to the data block.

[0062] In the blockchain, the smart contract needs to store not only the smart contract source code, smart contract instance and other data, but also the transaction data generated by the execution of the smart contract instance. The transaction data mainly includes transaction input data and transaction output data for transaction resources. The transaction resources include, for example, pictures, videos and any data objects with use value. The transaction input data includes, for example, the source information of the transaction resources, and the transaction output data includes, for example, the destination information of the transaction resources. Of course, the transaction data may also include the version number of the blockchain, the transaction lock time and other information. In smart contracts, the transaction data is usually stored based on storage variables, and storage storage is a permanent storage method.

[0063] In an embodiment of the present application, the data block may include at least one transaction data. In the blockchain, the data block may have a corresponding data summary, and the data summary may be generated based on the keywords of the data block. For example, the data summary may be determined based on keywords such as transaction time or transaction items. In terms of data structure, the data summary and the data block may be constructed into an object storage structure based on a key-value pair (Key-Value), wherein the Key value is the data summary and the Value value is the data block. In order to facilitate data query, in the blockchain, an index for the Value value may also be constructed based on the Key value. The index structure may include, for example, tree structures such as MPT (Merkle Patricia Tree), prefix tree, red-black tree, Merkle tree, etc., which are not limited in this application.

[0064] S203: When it is determined that the data block meets the off-chain storage condition, determine at least one off-chain storage device for storing the data block.

[0065] In the embodiment of the present application, since the data block is data generated in real time, the size and importance of the data block are different. Based on this, it is possible to first measure whether the data block meets the off-chain storage condition. In one embodiment of the present application, the off-chain storage condition includes: the data block is larger than the first preset threshold, and / or the importance of the data block is less than the second preset threshold. That is to say, data blocks with large storage space and / or low importance can be stored outside the chain. In some embodiments, the first preset threshold can be set to 1TB, 1ZB, etc. The importance of the data block can be determined according to the importance of the data content in the data block, and the importance can include the importance level, for example, the importance can be divided according to the level of primary, secondary, etc. If the data block involves a lot of content of a preset business item, the data block can be set to a data block with a higher importance level. For example, in the case of large transaction data, it can be considered that such a data block has a higher importance level. Of course, the off-chain storage condition is not limited to the above embodiment, for example, it can also be considered from the perspective of storage cost, etc., and the present application is not limited here.

[0066] In an embodiment of the present application, when it is determined that the data block meets the off-chain storage conditions, the data block can be stored in an off-chain memory. In an embodiment of the present application, the data block can be stored in at least one off-chain memory. In the case of storing the data block in multiple off-chain memories, multiple backups of the data block can be achieved to ensure the storage security of the data. In an embodiment of the present application, the number of off-chain memories used to store the data block can be determined based on the importance of the data block, and the number of off-chain memories is positively correlated with the importance of the data block. That is to say, when it is determined that the more important the data block is, the more off-chain memories are stored, further ensuring the security of data storage.

[0067] It should be noted that before using the off-chain storage to store the data blocks generated by the blockchain, it is necessary to complete the registration of the off-chain storage on the blockchain to achieve the blockchain's trust in the off-chain storage. Figure 3A schematic diagram of registering the off-chain storage in the blockchain is shown. In the process of registering the off-chain storage, the access interface information of the off-chain storage can be obtained, and the access interface information of the off-chain storage can be stored in the smart contract. Among them, the access interface of the off-chain storage includes, for example, an application programming interface (Application Programming Interface, API), specifically including HTTP interface, etc. Of course, in the smart contract, the identification information of each of the off-chain storage can also be set, and the identification information can be associated with the access interface information, and the identification information is used to identify the unique identity of the off-chain storage.

[0068] In practical applications, data storage requires computing resources and storage resources. Therefore, data storage has a certain cost. In the business application of blockchain technology, users often have a certain cost budget. Based on this, in one embodiment of the present application, at least one off-chain storage for storing the data block can be determined based on the storage cost budget for the data block. Specifically, the determination of at least one off-chain storage for storing the data block includes:

[0069] S301: Obtain a storage cost budget for the data block and a storage cost of each off-chain storage registered on the blockchain;

[0070] S303: According to the storage cost budget and the storage costs of each off-chain storage, select at least one off-chain storage for storing the data block from the registered off-chain storages, and determine the number of times the data block is stored in the at least one off-chain storage.

[0071] In an embodiment of the present application, first, the storage cost budget of the data block and the storage cost of each off-chain storage registered on the blockchain can be obtained. In the process of registering the off-chain storage on the smart contract, the storage cost of the off-chain storage can be obtained. The storage cost can be calculated according to the number of storage times and / or size of the data block. For example, a cost q is required for storage once. Of course, the storage cost of each off-chain storage can be the same or different, and this application does not limit this. After determining the storage cost budget and the storage cost of the registered off-chain storage, at least one off-chain storage for storing the data block can be selected from the registered off-chain storages, and the number of times the data block is stored on the at least one off-chain storage can be determined. It should be noted that the same data block can be stored multiple times on the same off-chain storage, which is particularly suitable for storing the data block through the oracle. In one example, the storage cost budget of data block 1 is 100, and it is required to store data block 1 in at least two off-chain storages, where the storage cost of off-chain storage 1 is 30 / time, the storage cost of off-chain storage 2 is 60 / time, the storage cost of off-chain storage 3 is 80 / time, and the storage cost of off-chain storage 4 is 100 / time. Based on this, data block 1 can be stored in off-chain storage 1 and off-chain storage 2, and the storage times of each off-chain storage are 1 time.

[0072] In the embodiment of the present application, by selecting the off-chain storage and the number of storage times according to the storage cost budget, the storage of the data block can be made to meet the user's budget and optimize the user's storage experience.

[0073] S205: Storing the data block in the at least one off-chain storage, and associating the data summary with identification information of the at least one off-chain storage on the blockchain.

[0074] In an embodiment of the present application, after determining the at least one off-chain storage, the data block can be stored in the at least one off-chain storage. Specifically, after determining the at least one off-chain storage, identification information corresponding to the at least one off-chain storage can be obtained respectively, and access interface information corresponding to the off-chain storage can be obtained according to the identification information. According to the access interface information, the data block can be stored in the corresponding off-chain storage through the access interface information.

[0075] In the present application embodiment, Figure 1As shown, at least one oracle can be called to store the data block in the at least one off-chain storage, wherein each oracle stores the data block in at least one of the at least one off-chain storage. Since different oracles belong to different entities, each oracle can have its own data transmission mechanism, and the use of multiple different oracles to transmit the data block can further ensure the security of data storage. In addition, the number of off-chain storages connected to the oracle can be set according to demand, and there is no limit here.

[0076] Not only that, in order to be able to query the data block later, the data summary and the identification information of the at least one off-chain storage can also be associated on the blockchain. Specifically, in one embodiment of the present application, the data summary and the identification information of the at least one off-chain storage are associated and stored on the smart contract corresponding to the blockchain, wherein the identification information of the off-chain storage is associated with the access interface information of the off-chain storage. In a specific example, a data list can be set for the data block, and the identification information of the at least one off-chain storage can be stored in the data list. The present application does not limit the storage method of the identification information of the at least one off-chain storage.

[0077] In an embodiment of the present application, there may be multiple ways to associate the data summary with the identification information of the at least one off-chain storage. In one embodiment, the association may be in the form of a data table, for example, the data table includes two columns, the first column is used to store the data summary, and the second column is used to store the identification information of the at least one storage. In another embodiment of the present application, in order to reduce the storage space and query efficiency of the data summary, a tree data structure may be used to store the data summary and the identification information of the at least one storage, and the data summary and the identification information of the at least one storage are stored at each node of the tree structure. The tree structure includes MPT (Merkle Patricia Tree), prefix tree, red-black tree, Merkel tree, etc., and the present application does not limit this.

[0078] It should be noted that, since multiple data blocks may be stored in the off-chain memory, in order to distinguish the storage locations of different data blocks, the off-chain memory may send the storage location of the data block in the off-chain memory to the blockchain after storing the data block. For example, the storage location may include the storage first address. In this way, after receiving the storage location, the blockchain may associate the storage location and the identification information of the off-chain memory with the data summary. Of course, in another embodiment, the off-chain memory may also locally associate the data block with the storage address of the data block. For example, the blockchain may send the data block together with the data summary to the off-chain memory, so that the off-chain memory may locally associate the data summary with the storage address of the data block.

[0079] Corresponding to the blockchain data storage methods proposed in the above embodiments, the present application also proposes a blockchain data storage method. Specifically, an implementation example of the blockchain data reading method provided by the present application is as follows: Figure 4 As shown, the method may include:

[0080] S401: Obtaining a summary of the data to be queried;

[0081] S403: When it is determined that the data block corresponding to the data summary is stored in at least one off-chain storage, obtain identification information of the at least one off-chain storage;

[0082] S405: Obtain a data block corresponding to the data summary according to the identification information of the at least one off-chain storage.

[0083] In an embodiment of the present application, in the process of determining the data block corresponding to the data summary according to the data summary, first, it can be determined whether the data block is stored in the smart contract or in an off-chain storage according to the data summary. In the case where it is determined that the data block is stored in at least one off-chain storage, the identification information of the at least one off-chain storage can be obtained. In some examples, the data summary can be retrieved from the data table or the tree storage structure to obtain the identification information of the at least one off-chain storage.

[0084] Optionally, in one embodiment of the present application, acquiring the data block corresponding to the data summary according to the identification information of the at least one off-chain storage includes:

[0085] S501: Determine access interface information of the at least one off-chain storage according to the identification information;

[0086] S503: Acquire a data block corresponding to the data summary according to the access interface information.

[0087] In the above embodiment, it has been explained that the identification information of the off-chain storage is associated with the access interface information. Then, based on the identification information, the access interface information of at least one off-chain storage can be determined, and based on the access interface information, the data block corresponding to the data summary can be obtained. For the specific association method of the identification information and the access interface information, and how to locate the data block in the off-chain storage, please refer to the description of the above embodiment, which will not be repeated here.

[0088] In one embodiment of the present application, when the off-chain storage includes multiple off-chain storages, acquiring the data block corresponding to the data summary according to the identification information of the at least one off-chain storage includes:

[0089] S601: Acquire a data block corresponding to the data summary from multiple of the multiple off-chain storages according to the identification information of the multiple off-chain storages;

[0090] S603: performing consistency check on the acquired multiple data blocks;

[0091] S605: Use the data block that passes the consistency check as the data block corresponding to the data summary.

[0092] In an embodiment of the present application, the data block corresponding to the data summary can be obtained from multiple of the multiple off-chain storage devices. For example, if data block 1 is stored in 5 off-chain storage devices, then data block 1 can be obtained from 3 of them. After obtaining the multiple data blocks, a consistency check can be performed on the obtained multiple data blocks. Only when multiple data blocks pass the consistency check can the data block be used as the data block corresponding to the data summary.

[0093] In an embodiment of the present application, by obtaining multiple data blocks and performing consistency checks on the multiple data blocks to obtain the data block corresponding to the data summary, it is possible to prevent the data in the off-chain storage from being tampered with and obtaining incorrect data, thereby ensuring the security of the blockchain data.

[0094] In one embodiment of the present application, acquiring the data block corresponding to the data summary according to the identification information of the at least one off-chain storage may include:

[0095] S701: Obtain a read cost budget of the data summary and a read cost of the at least one off-chain storage;

[0096] S703: Select at least one target off-chain storage from the at least one off-chain storage according to the read cost budget and the read cost of the at least one off-chain storage, and determine the number of times the data block is read from the at least one target off-chain storage respectively;

[0097] S705: Read the data block corresponding to the data summary from the at least one target off-chain storage according to the number of times.

[0098] In the embodiment of the present application, similar to data storage, data reading also consumes certain resources. Based on this, a read cost budget for the data summary can also be set. According to the read cost budget, at least one target off-chain storage is selected from the at least one off-chain storage, and the number of times the data block is read from the at least one target off-chain storage is determined. Here, it can be set to read the data block multiple times from the same target off-chain storage. This is because outside the blockchain, there may be a risk of data blocks being tampered with during the transmission of data blocks. Therefore, reading the data block multiple times can further ensure the security of the data.

[0099] In one embodiment of the present application, obtaining the data block corresponding to the data summary may include:

[0100] At least one oracle is called to read a data block corresponding to the data summary from the at least one off-chain memory, wherein each oracle reads the data block from at least one of the at least one off-chain memory.

[0101] In the present application embodiment, Figure 1 As shown, multiple oracles are used to read the data block from at least one of the at least one off-chain storage, which has room for expansion in both the number of oracles and the number of data readings, further enhancing the security of data reading.

[0102] The blockchain data storage method provided in each embodiment of the present application is to set at least one off-chain storage device outside the blockchain to store the data blocks generated on the blockchain, and associate the data summary with the identification information of the at least one off-chain storage device on the blockchain, so that the corresponding data block can be queried according to the data summary when needed. Based on the above data storage mechanism, the storage pressure of the blockchain can be greatly alleviated, the problem of insufficient storage capacity in the blockchain can be alleviated, and the use value of the blockchain can be further improved.

[0103] The embodiment of the present application further provides a processing device 700, which can be a physical device or a cluster of physical devices, or a virtualized cloud device, such as at least one cloud computing device in a cloud computing cluster. For ease of understanding, the present application uses the processing device 700 as an independent physical device to illustrate the structure of the processing device 700.

[0104] like Figure 5 As shown, the processing device 700 includes: a processor and a memory for storing processor executable instructions; wherein the processor is configured to implement the above-mentioned apparatus when executing the instructions. The processing device 700 includes a memory 701, a processor 703, a bus 705 and a communication interface 707. The memory 701, the processor 703 and the communication interface 707 communicate with each other through the bus 705. The bus 705 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 5 Only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus. The communication interface 707 is used for communicating with the outside.

[0105] The processor 703 may be a central processing unit (CPU). The memory 701 may include a volatile memory, such as a random access memory (RAM). The memory 701 may also include a non-volatile memory, such as a read-only memory (ROM), a flash memory, a HDD or a SSD.

[0106] The memory 701 stores executable codes, and the processor 703 executes the executable codes to perform the aforementioned test scenario construction method.

[0107] An embodiment of the present application provides a non-volatile computer-readable storage medium on which computer program instructions are stored. When the computer program instructions are executed by a processor, the above method is implemented.

[0108] An embodiment of the present application provides a computer program product, including a computer-readable code, or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the above method.

[0109] A computer-readable storage medium may be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium may be, for example, but not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. More specific examples (a non-exhaustive list) of computer-readable storage media include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disc (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the foregoing.

[0110] The computer-readable program instructions or codes described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmissions, wireless transmissions, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in the computer-readable storage medium in each computing / processing device.

[0111] The computer program instructions for performing the operation of the present application may be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-related instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as "C" language or similar programming languages. Computer-readable program instructions may be executed entirely on a user's computer, partially on a user's computer, as an independent software package, partially on a user's computer, partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., using an Internet service provider to connect via the Internet). In some embodiments, by utilizing the state information of computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA) or a programmable logic array (PLA), the electronic circuit can execute the computer-readable program instructions to implement various aspects of the present application.

[0112] In some embodiments, the disclosed methods may be implemented as computer program instructions encoded in a machine-readable format on a computer-readable storage medium or on other non-transitory media or articles of manufacture. Figure 6 Schematically illustrates a conceptual partial view of an example computer program product arranged according to at least some embodiments presented herein, the example computer program product comprising a computer program for executing a computer process on a computing device. In one embodiment, the example computer program product 800 is provided using a signal bearing medium 801. The signal bearing medium 801 may include one or more program instructions 802, which when executed by one or more processors may provide the above-described Figure 1 The functions or parts of the functions described. In addition, Figure 6 Program instructions 802 in also describe example instructions.

[0113] In some examples, the signal-bearing medium 801 may include a computer-readable medium 803, such as, but not limited to, a hard drive, a compact disk (CD), a digital video disk (DVD), a digital tape, a memory, a read-only memory (ROM) or a random access memory (RAM), etc. In some embodiments, the signal-bearing medium 801 may include a computer-recordable medium 804, such as, but not limited to, a memory, a read / write (R / W) CD, a R / W DVD, etc. In some embodiments, the signal-bearing medium 801 may include a communication medium 805, such as, but not limited to, a digital and / or analog communication medium (e.g., a fiber optic cable, a waveguide, a wired communication link, a wireless communication link, etc.). Thus, for example, the signal-bearing medium 801 may be communicated by a wireless form of communication medium 805 (e.g., a wireless communication medium that complies with the IEEE 802.11 standard or other transmission protocol). One or more program instructions 802 may be, for example, computer executable instructions or logic implementation instructions. In some examples, such as for Figure 2 The computing device of the computing device described can be configured to provide various operations, functions, or actions in response to the program instructions 802 communicated to the computing device by one or more of the computer-readable medium 803, the computer-recordable medium 804, and / or the communication medium 805. It should be understood that the arrangement described here is only for the purpose of example. Thus, it will be understood by those skilled in the art that other arrangements and other elements (e.g., machines, interfaces, functions, sequences, and functional groups, etc.) can be used instead, and some elements can be omitted together according to the desired results. In addition, many of the elements described are functional entities that can be implemented as discrete or distributed components or in any appropriate combination and position in conjunction with other components.

[0114] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the device, system, method and computer program product according to multiple embodiments of the present application. In this regard, each square frame in the flow chart or block diagram can represent a part of a module, program segment or instruction, and a part of the module, program segment or instruction includes one or more executable instructions for realizing the logical function of the specification. In some alternative implementations, the functions marked in the square frame can also occur in a sequence different from that marked in the accompanying drawings. For example, two continuous square frames can actually be executed substantially in parallel, and they can also be executed in reverse order sometimes, depending on the functions involved.

[0115] It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart, can be implemented by hardware (such as a circuit or ASIC (Application Specific Integrated Circuit)) that performs the corresponding function or action, or can be implemented by a combination of hardware and software, such as firmware.

[0116] Although the present invention is described herein in conjunction with various embodiments, in the process of implementing the claimed invention, those skilled in the art may understand and implement other variations of the disclosed embodiments by viewing the drawings, the disclosure, and the appended claims. In the claims, the word "comprising" does not exclude other components or steps, and "one" or "an" does not exclude multiple situations. A single processor or other unit may implement several functions listed in the claims. Certain measures are recorded in different dependent claims, but this does not mean that these measures cannot be combined to produce good results.

[0117] The embodiments of the present application have been described above, and the above description is exemplary, not exhaustive, and is not limited to the disclosed embodiments. Many modifications and changes will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The selection of terms used herein is intended to best explain the principles of the embodiments, practical applications, or improvements to the technology in the market, or to enable other persons of ordinary skill in the art to understand the embodiments disclosed herein.

Claims

1. A blockchain data storage method, characterized in that: include: Obtaining a data block to be stored on the blockchain and a data summary corresponding to the data block; The data summary is generated based on the keywords of the data block; The keywords at least include transaction time and transaction matters; The data block is data generated in real time; In the case where it is determined that the data block meets the off-chain storage condition, determining at least one off-chain storage device for storing the data block; Storing the data block in the at least one off-chain storage, and associating the data summary with identification information of the at least one off-chain storage on the blockchain; The step of determining at least one off-chain storage device for storing the data block comprises: Determine the number of off-chain storage devices used to store the data block according to the importance of the data block, the number of off-chain storage devices is positively correlated with the importance of the data block, and the importance of the data block is determined according to the importance of the data content in the data block; The determining of at least one off-chain storage for storing the data block comprises: Obtaining a storage cost budget for the data block and a storage cost of each off-chain storage registered on the blockchain; According to the storage cost budget and the storage costs of each off-chain storage, at least one off-chain storage is selected from the registered off-chain storages to store the data block, and the number of times the data block is stored in the at least one off-chain storage is determined.

2. The blockchain data storage method according to claim 1, characterized in that: The off-chain storage condition includes: the data block is greater than a first preset threshold, and / or the importance of the data block is less than a second preset threshold.

3. The blockchain data storage method according to claim 1, characterized in that: The storing the data block in the at least one off-chain storage comprises: Call at least one oracle to store the data block in the at least one off-chain memory, wherein each oracle stores the data block in at least one of the at least one off-chain memory.

4. The blockchain data storage method according to claim 1, characterized in that: The associating the data summary and the identification information of the at least one off-chain storage on the blockchain includes: The data summary and identification information of at least one off-chain storage are stored in association with each other on the smart contract corresponding to the blockchain, wherein the identification information of the off-chain storage is associated with the access interface information of the off-chain storage.

5. A blockchain data reading method, characterized in that: include: Get the summary of the data to be queried; In the case where it is determined that the data block corresponding to the data summary is stored in at least one off-chain storage, the identification information of the at least one off-chain storage is obtained; the data summary is generated according to the keywords of the data block; the keywords at least include transaction time and transaction items; the data block is data generated in real time; the importance of the data block determines the number of off-chain storages used to store the data block, the number of the off-chain storages is positively correlated with the importance of the data block, and the importance of the data block is determined according to the importance of the data content in the data block; Acquire a data block corresponding to the data summary according to the identification information of the at least one off-chain storage; The acquiring, according to the identification information of the at least one off-chain storage, a data block corresponding to the data summary comprises: Obtaining a read cost budget of the data summary and a read cost of the at least one off-chain storage; According to the read cost budget and the read cost of the at least one off-chain storage, at least one target off-chain storage is selected from the at least one off-chain storage, and the number of times the data block is read from the at least one target off-chain storage is determined; The data block corresponding to the data summary is read from the at least one target off-chain storage according to the number of times.

6. The blockchain data reading method according to claim 5, characterized in that: The acquiring, according to the identification information of the at least one off-chain storage, a data block corresponding to the data summary comprises: Determine access interface information of the at least one off-chain storage according to the identification information; According to the access interface information, a data block corresponding to the data summary is obtained.

7. The blockchain data reading method according to claim 5, characterized in that: In the case where the off-chain storage includes a plurality of off-chain storages, acquiring the data block corresponding to the data summary according to the identification information of the at least one off-chain storage includes: According to the identification information of the multiple off-chain storages, obtain the data block corresponding to the data summary from multiple of the multiple off-chain storages; Performing consistency check on the acquired multiple data blocks; The data block that passes the consistency check is used as the data block corresponding to the data summary.

8. The blockchain data reading method according to claim 5, characterized in that: The obtaining of the data block corresponding to the data summary includes: At least one oracle is called to read a data block corresponding to the data summary from the at least one off-chain memory, wherein each oracle reads the data block from at least one of the at least one off-chain memory.

9. A blockchain data access system, characterized in that: The system includes a blockchain, at least one oracle, and at least one off-chain storage, wherein: The blockchain is used to store data using the method described in any one of claims 1 to 4, and to read data using the method described in any one of claims 5 to 8; The at least one oracle is bridged between the blockchain and the at least one off-chain storage, and is used to transmit data between the blockchain and the off-chain storage; The at least one off-chain storage is used to store the data block.

10. A processing device, comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to run the computer program to perform the method according to any one of claims 1 to 8.

11. A non-volatile computer-readable storage medium having computer program instructions stored thereon, characterized in that: When the computer program instructions are executed by a processor, the method according to any one of claims 1 to 8 is implemented.

12. A computer program product, characterized in that The method comprises a computer-readable code or a non-volatile computer-readable storage medium carrying the computer-readable code. When the computer-readable code runs in a processor of an electronic device, the processor in the electronic device executes the method described in any one of claims 1 to 8.

13. A chip, characterized in that: The device comprises at least one processor, wherein the processor is used to run a computer program or computer instruction stored in a memory to execute the method according to any one of claims 1 to 8.

Citation Information

Patent Citations

  • Replica selection method based on access cost and transmission time

    CN102223404A

  • Data processing method and equipment for block chain as well as computer readable storage medium

    CN108566420A

  • Block chain large file copy site selection method, system and device and storage medium

    CN112637330A

  • Product tracing method and system based on block chain and identifier analysis

    CN113469716A

  • Data credible storage method and system, medium, equipment and terminal

    CN113806443A