Transaction verification method and device

By storing the original data and hash values ​​of transactions in the blockchain network, the problems of easy tampering and low credibility in traditional storage technology are solved, and the decentralized storage and high reliability of data are achieved.

CN112182099BActive Publication Date: 2025-02-21ANT BLOCKCHAIN TECHNOLOGY (SHANGHAI) CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202010976525.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-04-10
Publication Date
2025-02-21
Estimated Expiration
2040-04-10

AI Technical Summary

Technical Problem

Traditional storage technology has problems such as tampering and low credibility, especially in application scenarios where data requires high reliability.

Method used

A decentralized distributed database using blockchain technology ensures the immutability and trustworthiness of the data by storing the original data and hash values ​​of transactions on each node in the blockchain network.

Benefits of technology

Decentralized storage of data is realized, data security and reliability are improved, and data concealment, easy tampering and low credibility are avoided in traditional storage technologies.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112182099B_ABST
    Figure CN112182099B_ABST
Patent Text Reader

Abstract

The present specification provides a transaction verification method and device; the transaction verification method can, upon receiving a verification transaction, obtain a hash value corresponding to the target transaction from the blockchain and the original data of the target transaction from the off-chain storage space based on the index number of the target transaction contained in the verification transaction, so as to verify the original data of the target transaction through the obtained hash value.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of storage, and in particular to a transaction verification method and device. Background Art

[0002] Traditional storage technology stores all data in a unified data center. Due to the centralized data storage method, there are problems such as easy tampering and low credibility.

[0003] Blockchain technology (also known as distributed ledger technology) is a decentralized distributed database technology proposed based on the problems of traditional storage technology. Due to the use of decentralized network structure, consensus mechanism and chain block structure, blockchain technology has many characteristics such as decentralization, openness, transparency, immutability and trustworthiness, and is suitable for many application scenarios with high requirements for data reliability. In blockchain technology, all blockchain nodes need to save blockchain data, and each block in the blockchain is used to record the original data of several packaged transactions. Summary of the invention

[0004] In view of this, this specification provides a transaction verification method and device.

[0005] This manual provides the following technical solutions:

[0006] According to a first aspect of the present specification, a transaction verification method is proposed, which is applied to a blockchain node in a blockchain network, wherein each blockchain node in the blockchain network stores only the original data of the transaction received by itself in its own off-chain storage space; the blockchain maintained by all blockchain nodes in the blockchain network stores the index number and hash value of all stored transactions; the master node in the blockchain network records the relevant information of the original data of the transaction stored in each blockchain node; the method comprises:

[0007] Receive verification transactions;

[0008] Based on the index number of the target transaction included in the verification transaction, determining whether the target transaction is stored in the local off-chain storage space;

[0009] When it is determined that the target transaction is stored in the local off-chain storage space, the original data of the target transaction is obtained from the local storage space according to the index number of the target transaction, and the hash value of the target transaction is obtained from the maintained blockchain; and the obtained original data is verified based on the obtained hash value;

[0010] When it is determined that the target transaction is not saved in the local off-chain storage space, a target node acquisition request is sent to the master node according to the index number of the target transaction, so that the master node returns the relevant information of the target node; the original data of the target transaction is verified based on the index number of the target transaction and the relevant information of the target node.

[0011] According to a second aspect of the present specification, a transaction verification device is proposed, which is applied to a blockchain node in a blockchain network, wherein each blockchain node in the blockchain network stores only the original data of the transaction received by itself in its own off-chain storage space; the blockchain maintained by all blockchain nodes in the blockchain network stores the index number and hash value of all stored transactions; the master node in the blockchain network records the relevant information of the original data of the transaction stored in each blockchain node; the device comprises:

[0012] A receiving unit, receiving and verifying the transaction;

[0013] A judgment unit, based on the index number of the target transaction included in the verification transaction, judges whether the target transaction is stored in the local off-chain storage space;

[0014] The first verification unit, when determining that the target transaction is stored in the local off-chain storage space, obtains the original data of the target transaction from the local storage space according to the index number of the target transaction, and obtains the hash value of the target transaction from the maintained blockchain; and verifies the obtained original data based on the obtained hash value;

[0015] The second verification unit, when determining that the target transaction is not saved in the local off-chain storage space, sends a target node acquisition request to the master node according to the index number of the target transaction, so that the master node returns the relevant information of the target node; and verifies the original data of the target transaction based on the index number of the target transaction and the relevant information of the target node.

[0016] According to a third aspect of this specification, there is provided an electronic device, including:

[0017] processor;

[0018] a memory for storing processor-executable instructions;

[0019] The processor implements any of the methods described in the above embodiments by running the executable instructions.

[0020] According to a fourth aspect of the present specification, a computer-readable storage medium is provided, on which computer instructions are stored, and when the instructions are executed by a processor, the steps of the method described in any of the above embodiments are implemented. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] Figure 1 It is a schematic diagram of a data storage device shown in an exemplary embodiment of this specification.

[0022] Figure 2A It is a flow chart of a data storage method shown in an exemplary embodiment of this specification.

[0023] Figure 2B is a flow chart of another data storage method shown in an exemplary embodiment of this specification.

[0024] Figure 3 It is a flow chart of a transaction storage method shown in an exemplary embodiment of this specification.

[0025] Figure 4 It is a flowchart of another data storage method shown in an exemplary embodiment of this specification.

[0026] Figure 5 It is a process display diagram of data storage shown in an exemplary embodiment of this specification.

[0027] Figure 6 It is a flow chart of a data verification method shown in an exemplary embodiment of this specification.

[0028] Figure 7 It is an interaction diagram of a transaction storage method shown in an exemplary embodiment of this specification.

[0029] Figure 8 It is an interaction diagram of a transaction verification method shown in an exemplary embodiment of this specification.

[0030] Fig. 9 It is an interaction diagram of another transaction storage method shown in an exemplary embodiment of this specification.

[0031] Fig.10 It is a flow chart of a transaction verification method shown in an exemplary embodiment of this specification.

[0032] Fig.11 It is a schematic diagram of the structure of an electronic device shown in an exemplary embodiment of this specification.

[0033] Fig.12 It is a block diagram of a data storage device shown in an exemplary embodiment of this specification.

[0034] Fig.13 It is a schematic diagram of the structure of another electronic device shown in an exemplary embodiment of this specification.

[0035] Fig.14It is a block diagram of a transaction storage device shown in an exemplary embodiment of this specification. DETAILED DESCRIPTION

[0036] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The implementations described in the following exemplary embodiments do not represent all implementations consistent with this specification. Instead, they are merely examples of devices and methods consistent with some aspects of this specification as detailed in the appended claims.

[0037] The terms used in this specification are for the purpose of describing specific embodiments only and are not intended to limit this specification. The singular forms "a", "the" and "the" used in this specification and the appended claims are also intended to include plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used herein refers to and includes any or all possible combinations of one or more associated listed items.

[0038] It should be understood that although the terms first, second, third, etc. may be used in this specification to describe various information, this information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of this specification, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the word "if" as used herein may be interpreted as "at the time of" or "when" or "in response to determining".

[0039] refer to Figure 1 , Figure 1 A data storage device is shown as an exemplary embodiment of this specification. Figure 1 As shown, the data storage device may include:

[0040] The data storage area 102 is used to store received data.

[0041] The blockchain storage area 104 is used to store the identification information of the data. The identification information is added to the block, and each block is linked in sequence according to the block order to form a blockchain stored in the blockchain storage area.

[0042] Based on the above data storage device, the received data can be stored in the data storage area; the identification information of the data can be saved in the blockchain in the blockchain storage area. Since the blockchain storage area stores the identification information in the form of a blockchain, the identification information is closely connected and cannot be easily tampered with; and the identification information corresponds to the data in the data storage area. Once the data is tampered with, the corresponding identification information cannot be found, making it easy to verify whether the data in the data storage area has been tampered with.

[0043] Next, the data storage method proposed in this specification is introduced in combination with the storage structure of the above-mentioned data storage device.

[0044] Figure 2A is a flowchart of a data storage method shown in an exemplary embodiment of this specification. The method is applied to a data storage node, such as Figure 2A As shown, the method may include the following steps:

[0045] Step 202A, receiving data to be stored.

[0046] The data storage node in this specification can be a PC, a mobile terminal (smartphone, tablet computer, etc.), a server, or other electronic device with storage function, or it can be a data center including several electronic devices, which is not limited in this specification.

[0047] The data storage node contains two storage areas, namely the data storage area and the blockchain storage area. It should be noted that the two storage areas are logical divisions, and the actual locations of the two storages can be located in the same physical area or in different physical areas. Among them, the blockchain storage area adopts the storage structure of the blockchain, that is, each block is linked in sequence according to the block order to form a blockchain stored in the storage area. Unlike the existing blockchain, the blockchain in this storage area may not save the parameters in the blocks of the existing blockchain, such as timestamps, Merkle roots, etc., but only retain the hash value of the previous block in the block header, that is, the parent hash.

[0048] In this specification, both the data storage area and the blockchain storage area can use the storage technology of the streaming database to store data or identification information. The storage technology of the streaming database should meet the following conditions: 1. The data is stored in a certain order; 2. The data stored earlier will not be overwritten by the data stored later; 3. The stored data cannot be updated or modified.

[0049] Step 204A: Save the data to the data storage area in the data storage node.

[0050] The data storage area is used to store the received data itself. In one case, each data received can be saved to the data storage area; in another case, when the received amount reaches a preset amount, the preset amount of data can be saved to the data storage area.

[0051] Step 206A, adding the identification information of the data to the target block, and saving the target block to the blockchain storage area in the data storage node, so that the target block is added to the end of the blockchain in the blockchain storage area.

[0052] The blockchain storage area is used to store the identification information of the received data. The identification information may include the hash value of the data and / or the index number of the data in the data storage area, and may also include other information related to the data, such as summary information of the data. It should be understood that the identification information in this specification refers to: does not contain relevant information of the data itself, and its specific content can be determined by those skilled in the art according to actual needs, and this specification does not limit this. In one case, the identification information may only include the hash value or index number of the data, and the identification information can be used to find the corresponding data in the data storage area. In another case, the identification information includes the hash value and index number of the data, and the identification information can also be used to verify the data. For example, when a user needs to verify any data, the data can be determined as the target data and a verification request can be sent to the data storage node. After receiving the verification request, the data storage node can obtain the hash value of the target data stored in the blockchain storage area and the target data stored in the data storage area based on the index number of the target data contained in the verification request; and verify the acquired target data based on the hash value of the target data. In this case, it is equivalent to saving the correspondence between the hash value and the index number of the data in the blockchain of the blockchain storage area. The user can obtain the correspondence from the blockchain of the blockchain storage area, and then initiate verification of any data to the data storage node; or in the process of storing data, a correspondence table between the index number and the hash value of the stored data can be generated for the user to query the data to be obtained or verified.

[0053] In this embodiment, when the data is saved in the data storage area, the data may be numbered in a certain order, and the numbering may be used as the index number of the data. For example, the data may be numbered in the order of time when the data is saved in the data storage area. Of course, this example is only illustrative, and those skilled in the art may determine the index number in different ways according to the actual situation, and this specification does not limit this.

[0054] In this embodiment, the operation of saving the data to the data storage area and the operation of saving the identification information to the blockchain storage area are performed sequentially. In other words, the received data is saved to the data storage area first, and then the identification information of the data is saved to the blockchain storage area.

[0055] In one case, whenever a piece of data is saved in the data storage area, the identification information of the data can be saved in the blockchain storage area. In another case, the identification information of the data is saved in the blockchain storage area only when the data saved in the data storage area meets the preset conditions (that is, the identification information of multiple data is stored in a unified manner). For example, the preset conditions can be: the number of data saved in the data storage area reaches a preset value, or the time for storing the data has passed a preset time period. In actual operation, in order to simplify the operation and thus reduce the occupation of processing resources, a method of uniformly storing multiple identification information is usually adopted, which will save the identification information of multiple data that meet the above preset conditions in the same block.

[0056] The present application can save the identification information to the blockchain in the blockchain storage area in a variety of ways. In one case, a blockchain containing several empty blocks is pre-created in the blockchain storage area. In this case, it is only necessary to determine the empty block after the block in which the identification information has been stored as the target block, and save the identification information to be stored to the target block. In another case, after determining the identification information to be stored, it is necessary to create a block to use the block as the target block for storing the identification information to be stored, and then add the target block to the end of the blockchain in the blockchain storage area.

[0057] It can be seen from the above technical solution that the data storage node in this specification includes a data storage area and a blockchain storage area. Among them, the data storage area is used to store the received data; and the blockchain storage area is used to store the identification information of the data. Since the blockchain storage area uses blockchain to store the identification information, the stored identification information is closely connected and cannot be easily tampered with. There is a one-to-one correspondence between the identification information and the data. Once the data in the data storage area is tampered with, the corresponding identification information cannot be obtained, and the change of the data cannot be discovered. In other words, the storage method of this specification does not have the problems of data concealment, easy tampering, low credibility, etc. in traditional centralized storage technology.

[0058] Secondly, in this specification, data is only saved in the local data storage area, and the data is not saved in other data storage nodes, so that the storage method of this specification does not have the data redundancy problem caused by the need to save blockchain data in all blockchain technology, thereby avoiding the waste of storage resources.

[0059] In the above embodiment, the operation of saving data to the data storage area and the operation of saving identification information to the blockchain storage area are performed sequentially. In another case, the operation of saving data to the data storage area and the operation of saving identification information to the blockchain storage area can be performed asynchronously. Figure 2B In this case, the principle of the technical solution is similar to that of the above embodiment, and the implementation details involved, such as the operation of saving data to the data storage area and the method of obtaining the index number, can refer to the above embodiment, so they will not be described in detail below.

[0060] refer to Figure 2B , Figure 2B is a flowchart of another data storage method shown in an exemplary embodiment of this specification. The method is applied to a data storage node, such as Figure 2B As shown, the method may include the following steps:

[0061] Step 202B, receiving data to be stored.

[0062] As described above, the data storage node may be a PC, a mobile terminal (smartphone, tablet), a server or other electronic device with storage function, or a data center including several electronic devices, which is not limited in this specification.

[0063] As mentioned above, the data storage node includes two storage areas, namely the data storage area and the blockchain storage area. Both the data storage area and the blockchain storage area can use the storage technology of the streaming database to store the received data or identification information.

[0064] Step 204B: Save the data to the data storage area in the data storage node.

[0065] As described above, the data storage area is used to store the received data itself. In one case, each data received can be saved to the data storage area; in another case, when the received amount reaches a preset value, the received amount can be saved to the data storage area.

[0066] Step 206B, adding the identification information of the data to the target block, and saving the target block to the blockchain storage area in the data storage node, so that the target block is added to the end of the blockchain in the blockchain storage area.

[0067] As described above, the blockchain storage area is used to store identification information of the received data, and the identification information may include a hash value of the data and / or an index number of the data in the data storage area, and may also include other information related to the data, such as summary information of the data.

[0068] As described above, when data is saved in the data storage area, the data may be numbered in a certain order, and the numbers may be used as index numbers of the data.

[0069] As described above, a pre-created empty block in the blockchain storage area can be used as a target block, or a corresponding block can be created as a target block after determining the identification information to be stored.

[0070] Different from the previous embodiment, in this embodiment, the operation of saving data to the data storage area and the operation of saving identification information to the blockchain storage area are performed asynchronously. In other words, the operations of storing data and storing identification information are not related to each other. For example, after receiving the data to be stored, on the one hand, the data can be saved to the data storage area; on the other hand, the corresponding identification information can be determined based on the data, for example, the hash value of the data is calculated, and the hash value is saved to the blockchain storage area in the above manner. The two processes are not in order, and the identification information can be determined first and saved to the blockchain storage area, or the data can be saved to the data storage area first. Of course, in this process, since the two are not in order, when establishing the index number, the data can be numbered according to the order of reception, so that the number is used as the index number of the data.

[0071] Compared with the previous embodiment, this embodiment does not limit the storage order of data and identification information, so that in most cases, two storage operations can be performed in parallel, thereby greatly improving storage efficiency.

[0072] In addition to the above-mentioned technical solution of storing data in a single storage node, this specification also proposes an improvement solution to the existing blockchain technology. Figure 3 A transaction storage method is shown as an exemplary embodiment of this specification. The principle of this technical solution is similar to the above-mentioned embodiment, and some of the contents involved, such as the operation of storing the original data of the transaction and the method of obtaining the identification information, can refer to the above-mentioned embodiment. It is worth noting that since this technical solution combines the existing blockchain technology, rather than only adopting the existing blockchain structure. Therefore, the above-mentioned "data storage area" is replaced with "off-chain storage space", and the above-mentioned "data" is replaced with "transaction"; accordingly, the identification information is no longer only stored in the local blockchain, but uploaded to the blockchain network.

[0073] refer to Figure 3 , Figure 3 A transaction storage method is shown as an exemplary embodiment of this specification. The method is applied to a blockchain node. The method may include the following steps:

[0074] Step 302, receiving a transaction to be stored.

[0075] Similar to the above-mentioned data storage nodes, the blockchain node in this embodiment can also be a PC, a mobile terminal (smartphone, tablet computer), a server, or other electronic device with storage function, which is not limited in this specification.

[0076] In this embodiment, when a user has a transaction to be stored, a request for storing the transaction can be sent to a blockchain node so that the blockchain node stores the transaction to be stored.

[0077] Different from the above embodiment, in this embodiment, two different storage areas are not divided locally, but the original data and identification information of the transaction are stored off-chain and on-chain respectively. The basis for judging off-chain and on-chain in this specification is: whether it is published to the blockchain network through the consensus mechanism of the blockchain; if so, it is stored on the chain; if not, it is stored off-chain. Similar to the above embodiment, both the off-chain storage space and the blockchain can use the storage technology of the streaming database to store transactions or identification information.

[0078] Step 304: Save the original data of the transaction to the off-chain storage space.

[0079] The off-chain storage space is used to store the original data of received transactions. In one case, the original data of each transaction can be saved to the off-chain storage space each time it is received; in another case, the original data of the received transactions can be saved to the off-chain storage space when the number of received transactions reaches a preset number.

[0080] Step 306, reaching a consensus on the transaction or the identification information of the transaction with other blockchain nodes in the blockchain network, and adding the target block to the end of the blockchain if the consensus is passed, wherein the block body of the target block is used to record the identification information of the transaction.

[0081] The identification information in this embodiment is stored in the blockchain network; the identification information is similar to the identification information in the above embodiment, and may also include the hash value of the data and / or the index number of the data in the data storage area, and may also include other information related to the data, such as summary information of the data, etc. In one case, the identification information only includes the hash value or index number of the data, and the identification information can be used to find the corresponding transaction in the off-chain storage space. In another case, the identification information includes the hash value of the original data of the transaction and the index number of the transaction. In this case, the identification information can also be used to verify the data. For example, when a user needs to verify any data, the data can be determined as a target transaction and a verification transaction can be sent to the blockchain node. After receiving the verification transaction, the blockchain node can call the smart contract for finding the hash value based on the index number of the target transaction included in the verification transaction to obtain the hash value corresponding to the target transaction stored in the blockchain; it can also obtain the original data of the target transaction stored in the off-chain storage space according to the index number; and verify the obtained original data based on the hash value corresponding to the target transaction. In this case, it is equivalent to saving the correspondence between the hash value and index number of the transaction in the blockchain. The user can obtain the correspondence from the blockchain and then initiate verification of any transaction to the blockchain node.

[0082] It is worth noting that the user can initiate a verification transaction to any blockchain node in the blockchain network. In other words, the blockchain node that stores the target transaction and the blockchain node that verifies the target transaction can be different nodes in the same blockchain network. In one case, the storage and verification operations are performed by the same blockchain node. At this time, after receiving the verification transaction, the blockchain node can obtain the original data of the target transaction from the local off-chain storage space and verify it; in another case, the storage and verification operations are performed by different blockchain nodes. At this time, after receiving the verification transaction, a certain blockchain node needs to determine the target node that stores the target transaction according to the index number, and initiate a request to obtain the original data of the target transaction, and after receiving the returned original data, verify it based on the obtained hash value. In this case, the verification request can also be forwarded to the determined target node so that the target node can verify the target transaction. How to verify the target transaction based on the verification transaction can be determined by a person skilled in the art according to actual conditions, and this application does not limit this.

[0083] In this embodiment, the method of obtaining the index number is similar to that in the above embodiment, and reference may be made to the introduction of step 206A, which will not be described in detail here.

[0084] Secondly, the conditions for saving identification information in this embodiment are similar to those in the above embodiment. In one case, whenever a transaction is saved to the off-chain storage space, the identification information of the transaction can be saved to the blockchain through the consensus mechanism. In another case, the identification information of these transactions is saved to the blockchain (that is, the identification information of multiple transactions is stored uniformly) only when the transactions saved to the off-chain storage space meet the preset conditions. For example, the preset conditions can be: the number of transactions saved to the off-chain storage space reaches a preset value, or the time for storing transactions has passed a preset time period. In actual operation, in order to simplify the operation and thus reduce the occupation of processing resources, a method of uniformly storing multiple identification information is usually adopted, which saves multiple transactions that meet the above preset conditions to the same block.

[0085] It should be noted that since the identification information occupies a small storage space, it can be stored in the block header together with the parent hash, or it can be stored in the block body.

[0086] Since the present embodiment stores the identification information on the blockchain through a consensus mechanism, the process of saving the identification information is related to the consensus mechanism adopted.

[0087] In one case, the specification may use a consensus mechanism similar to POW to save the identification information to the blockchain. In this case, the blockchain node first creates a new block locally to save the identification information in the block; then, the block with the identification information can be sent to other nodes in the blockchain network so that other nodes can reach a consensus on the block. After the consensus is passed, other nodes can add the block to the end of their respective blockchains, and then save the identification information to the blockchain of each node.

[0088] In another case, this specification can use a consensus mechanism similar to PBFT to save the identification information to the blockchain. In this case, the blockchain network includes a master node. When any blockchain node needs to save the identification information of a transaction to the blockchain, the transaction or the identification information of the transaction can be sent to the master node for consensus by the master node. After the transaction or the identification information of the transaction passes the consensus, the identification information of the transaction can be sent to other nodes in the blockchain network. After receiving the identification information, other nodes can create a new block to save the received identification information and add the block with the identification information to the end of their respective blockchains.

[0089] When a consensus mechanism similar to PBFT is used to save identification information to the blockchain, since the consensus operation is performed by the master node, the master node can save relevant information about the original data of the transaction saved by each node. On this basis, when any blockchain node receives a verification transaction for the original data of any transaction, it can first determine whether the original data of the transaction is saved in the local off-chain storage space. If so, it can obtain the original data of the target transaction saved in the local off-chain storage space according to the index number in the verification transaction; otherwise, it can send a target node acquisition request to the master node to obtain relevant information about the target node that saves the original data of the target transaction, and then send a raw data acquisition request to the target node based on the returned relevant information of the target node, so that the target node can find the saved original data of the target transaction according to the index number and return it.

[0090] It is worth noting that in one case, after receiving a transaction, each blockchain node in the blockchain network saves its original data in its own off-chain storage space. In this case, if each block determines the index number of the transaction only according to its own storage order, it will cause multiple transactions with the same index number in the entire blockchain network. Therefore, in this embodiment, in the process of saving the original data of the received transaction to the off-chain storage space, each blockchain node needs to determine the index number of the transaction stored in the blockchain, and use the last index number stored as the starting point to determine the index number of the next transaction to be stored. Taking the number as the index number as an example, assuming that transactions numbered 1-7 have been stored in the current blockchain; then when any blockchain node receives a transaction to be stored, it should start numbering the transaction from 8, and cannot continue to use the numbering of 1-7.

[0091] In this specification, the operation of saving the original data of the transaction to the off-chain storage space and the operation of storing the identification information to the blockchain can be performed sequentially; the operation of saving the original data of the transaction to the off-chain storage space and the operation of saving the identification information to the blockchain can also be performed asynchronously. In other words, step 304 and step 306 can be performed sequentially or asynchronously. For the case of sequential execution, please refer to Figure 2A For asynchronous execution, please refer to Figure 2B The introduction of , I will not elaborate on it here.

[0092] It can be seen from the above technical solution that this specification stores the original data of the transaction in the off-chain storage space, and only stores the identification information of the transaction in the blockchain, thus avoiding data redundancy caused by storing multiple copies of a large amount of original data in the blockchain. Secondly, since the identification information of the transaction is stored in the blockchain, it cannot be tampered with. The identification information of the transaction corresponds one-to-one with the original data, and thus the original data of the transaction cannot be tampered with. It can be seen that through the technical solution of this specification, the waste of blockchain storage resources caused by data redundancy can be avoided on the basis of ensuring the security of the original data of the transaction.

[0093] For ease of understanding, the technical solution of this specification is introduced below in conjunction with specific embodiments.

[0094] Figure 4 Another data storage method is shown in an exemplary embodiment of this specification. In this method, whenever the amount of data to be stored reaches a preset amount, the identification information of the preset amount of data is saved to the blockchain storage area. Figure 4 As shown, the method may include the following steps:

[0095] Step 401, receiving data to be stored.

[0096] Step 402, saving the data to be stored to the data storage area.

[0097] In this embodiment, each time a piece of data is received, it can be saved in the data storage area in the order of the time of receipt, and the data saved in the data storage area will not be overwritten by the data stored later, and cannot be modified or updated.

[0098] Step 403: number the data to be stored according to the storage order.

[0099] In this embodiment, the number of the data is used as the index number of the data. In this step, the data stored in the data storage area can be numbered according to the storage order in step 402. It is worth noting that although this step is described separately from step 402, the data can also be numbered in the process of saving the data in the data storage area.

[0100] Step 404, calculating the hash value of the data to be stored.

[0101] In this embodiment, the step of calculating the hash value can also be performed in the process of saving the data to the data storage area. It should be understood that in this embodiment, the corresponding relationship between the hash value and the serial number is used as the identification information of the data. It is only necessary to obtain the hash value and serial number of the data before saving the identification information. The specific step of calculation can be determined by those skilled in the art according to the actual situation, and this specification does not limit this.

[0102] Step 405 , determine whether the amount of data to be stored reaches a preset amount. If yes, jump to step 406 ; otherwise, jump to step 409 .

[0103] In this embodiment, whether the number reaches a preset number is used as a preset condition for whether to save the identification information of the data to the blockchain storage area. It should be noted that in this embodiment, when the number reaches a preset number, the identification information is saved to the blockchain storage area, which means that whenever the number of data "has been stored in the data storage area but the identification information has not been stored in the blockchain storage area" reaches a preset number, the identification information of this part of the data is saved to the blockchain storage area.

[0104] This process can be referred to Figure 5 ,exist Figure 5 In the case shown, the preset number is set to 3. At this time, 8 data are stored in the data storage area, namely data 1-8. Among them, the identification information of every 3 data is packaged into a block to be saved in the blockchain of the blockchain storage area, such as Figure 5 In the example, the identification information of data 1-3 and data 4-6 are packaged into blocks 1 and 2 respectively, while data 7 and 8 have not yet reached the preset number 3, so their identification information will not be packaged into blocks and saved in the blockchain storage area.

[0105] Step 406, creating a new block;

[0106] In this embodiment, whenever it is determined that the amount of data to be stored reaches a preset value, a new block may be created as a target block for storing identification information of the data.

[0107] Step 407, save the corresponding relationship between the hash value and the serial number of the data to be stored in the created new block.

[0108] In this embodiment, since the identification information of the preset number of data is saved uniformly, after executing this step, the target block should store the preset number of corresponding relationships between hash values ​​and serial numbers.

[0109] Step 408, adding the block containing the correspondence between the hash value and the serial number to the end of the blockchain in the blockchain storage area.

[0110] After the correspondence between the hash value and the serial number is saved in the target block, the target block can be added to the end of the blockchain in the blockchain storage area to complete the storage of the identification information of the data to be stored.

[0111] Step 409: The operation of saving the identification information to the blockchain storage area is not performed.

[0112] It can be seen from the above technical solution that this specification stores the identification information of the data in the blockchain of the blockchain storage area, so that the identification information of the data is associated with each other (the association relationship between the identification information is established through the parent hash), thereby making the identification information difficult to be tampered with. Furthermore, since the identification information corresponds to the data one by one, once the data stored in the data storage area is tampered with, the corresponding identification information cannot be found, which makes the stored data difficult to be tampered with, thereby ensuring the security of the data.

[0113] Figure 6 A data verification method is shown as an exemplary embodiment of this specification. The method is used to verify the data using Figure 4 The data stored in the method shown is verified. Figure 5 As shown, the method may include the following steps:

[0114] Step 601: Receive a verification request.

[0115] In this embodiment, when a user needs to use certain data, the data can be verified. At this time, a verification request including the serial number of the data to be verified can be sent to the data storage node to instruct the data storage node to verify the target data to be verified.

[0116] In this embodiment, a corresponding relationship table between a number and a hash value can be generated based on the storage process during the storage phase, so that when a user needs to verify any stored data, he can find the number of the target data to be verified. Of course, the user can also obtain the number from the data storage area or the blockchain storage area.

[0117] Step 602: Obtain the hash value of the target data to be verified from the blockchain storage area according to the number in the verification request.

[0118] Step 603: Obtain the target data to be verified from the data storage area according to the number in the verification request.

[0119] Step 604: verify the target data to be verified based on the obtained hash value.

[0120] In this embodiment, the hash value of the acquired target data may be recalculated based on the algorithm for calculating the hash value during storage, and the calculated hash value may be compared with the acquired hash value to verify whether the target data has been tampered with.

[0121] It can be seen from the above technical solution that due to Figure 4The storage method shown uses the correspondence between the data number and the hash value as identification information, so that the user can obtain the target data to be verified and its hash value from the data storage area and the blockchain storage area respectively by sending the number to the data storage node, and then verify the target data based on the hash value, thereby ensuring the security of the data.

[0122] Figure 7 This is an interactive diagram of a transaction storage method shown in an exemplary embodiment of this specification. This method uses the PBFT consensus mechanism to reach consensus on the hash value of the transaction. Figure 7 As shown, the method may include the following steps:

[0123] Step 701: The blockchain node receives the transaction to be stored.

[0124] In this embodiment, the blockchain node specifically refers to all nodes in the blockchain network. In other words, receiving the transaction to be stored in this step means that all nodes in the blockchain network receive the transactions to be stored that they have received. For example, Figure 7 In the example, blockchain nodes A, B, and C are all nodes in the blockchain network, so blockchain nodes A, B, and C receive their own received transactions respectively. Below, this embodiment takes blockchain nodes A, B, and C as an example to introduce the above transaction storage method. For the convenience of description, blockchain nodes A, B, and C are referred to as nodes A, B, and C in the following text. It should be understood that although Figure 7 There are only three blockchain nodes A, B, and C in the blockchain network, but the actual blockchain network should contain a large number of nodes.

[0125] In step 702, the blockchain nodes save the received original transaction data to their respective off-chain storage spaces.

[0126] After receiving the transaction, each blockchain network node can save the transaction to its own off-chain storage space. Figure 7 Node A receives transactions a, b, c; Node B receives transactions m, n; Node C receives transactions x, y. Then, Node A will store the original data of transactions a, b, c in the off-chain storage space of Node A; Node B will store the original data of transactions m, n in the off-chain storage space of Node B; Node C will store the original data of transactions x, y in the off-chain storage space of Node C.

[0127] Step 703: The blockchain node calculates the hash value of the original data of the transaction to be stored.

[0128] Continuing with the above example, in this step, node A will calculate the hash values ​​of transactions a, b, and c based on their original data; node B will calculate the hash values ​​of transactions m and n based on their original data; and node C will calculate the hash values ​​of transactions x and y based on their original data.

[0129] Step 704: The non-master node in the blockchain network sends the calculated hash value to the master node.

[0130] In this embodiment, a consensus can be reached on the hash value of the transaction to determine which transaction identification information is to be uploaded to the chain. Since this embodiment adopts the PBFT consensus mechanism, a master node is included in the blockchain network, and the master node is responsible for reaching a consensus on the transactions to be stored. Therefore, the non-master nodes in the blockchain network need to send the hash values ​​of the transactions they receive to the master node, so that the master node can reach a consensus on the hash values ​​of the transactions to be stored.

[0131] Continuing with the above example, assuming that the master node in the current blockchain network is node B, then node A needs to send the hash values ​​corresponding to transactions a, b, and c to node B; node C needs to send the hash values ​​corresponding to transactions x and y to node B.

[0132] Step 705: The master node numbers the hash values ​​that need to be uploaded to the chain.

[0133] After receiving the hash value of the transaction to be stored sent by other nodes in the blockchain network, the master node numbers the hash value to be uploaded to the chain and uses the number as the index number of the transaction corresponding to the hash value. Furthermore, the correspondence between the number and the hash value is used as the identification information of the corresponding transaction.

[0134] Continuing with the above example, if the hash values ​​that need to be uploaded to the chain are determined to be the hash values ​​corresponding to transactions c, m, n, and x, they can be numbered 1, 2, 3, and 4 respectively. For the convenience of description, the hash value of transaction c will be referred to as hash c in the following text, and the same applies to other transactions, which will not be repeated here.

[0135] Of course, it is worth noting that when the master node numbers the hash value, it needs to determine the numbering information currently in use. For example, assuming that the numbers saved to the blockchain node already include 1-7, then this numbering should start from 8.

[0136] Step 706: The master node broadcasts the hash value that needs to be uploaded to the blockchain and the corresponding number to all nodes in the blockchain network.

[0137] Continuing with the above example, node B can send the correspondence between hash c-1, hash m-2, hash n-3, and hash x-4 to all other nodes in the blockchain network.

[0138] Step 707, the blockchain node forms a block based on the correspondence between the hash value and the serial number.

[0139] In this embodiment, after the blockchain node determines the identification information to be uploaded to the chain, that is, the correspondence between the number to be uploaded to the chain and the hash value, a new block can be created and the determined identification information can be saved in the block.

[0140] Continuing with the above example, all nodes including nodes A, B, and C create a new block and save the four corresponding relationships of hash c-1, hash m-2, hash n-3, and hash x-4 in the block.

[0141] It is worth noting that this step also includes numbering the transactions stored in each off-chain storage space. Continuing with the above example, node A should number transaction c stored in the local off-chain storage space as 1; node B should number transaction m stored in the local off-chain storage space as 2, and transaction n as 3; node C should number transaction x stored in the local off-chain storage space as 4.

[0142] In step 708, the blockchain node saves the formed block to the end of the local blockchain.

[0143] In this step, each blockchain node saves the blocks it has formed to the end of its own blockchain.

[0144] This embodiment stores the transactions to be stored received by each blockchain node in its own off-chain storage space, thereby avoiding data redundancy caused by the need for each blockchain node to store the original transaction data in the existing blockchain, and reducing the waste of storage resources.

[0145] Secondly, this embodiment uses the transaction number and hash value as identification information, and saves the identification information in the blockchain, so that the identification information cannot be tampered with. Furthermore, since the identification information corresponds one-to-one with the original data of the transaction, the original data of the transaction cannot be tampered with either.

[0146] It can be seen that compared with the existing blockchain technology, this application avoids the problem of data redundancy while ensuring that the data is not tampered with, thereby avoiding the waste of storage resources.

[0147] Figure 8 The interactive diagram of a transaction verification method shown in an exemplary embodiment of this specification is used to verify the transaction. Figure 7 The method shown is used to verify the stored transactions. Figure 8 As shown, the method may include the following steps:

[0148] Step 801, the blockchain node receives the verification transaction.

[0149] In this embodiment, the blockchain node specifically refers to the blockchain node that receives the verification transaction, rather than all nodes in the blockchain network in the previous embodiment.

[0150] In this embodiment, the blockchain node that receives the verification transaction may be the same node as the blockchain node that stores the target transaction to be verified, or may be a different node.

[0151] In step 802, the blockchain node determines the hash value of the target transaction to be verified based on the index number in the verification transaction.

[0152] In this embodiment, the hash value corresponding to the target transaction can be searched in the local blockchain based on the index number. Furthermore, a hash verification transaction can be sent to other nodes in the blockchain network to verify that the hash value has not been tampered with.

[0153] In step 803, the blockchain node determines whether the target transaction to be verified is stored in the local off-chain storage space based on the index number; if so, jump to step 804A; if not, jump to 804B.

[0154] Step 804A, obtain the target transaction from the local off-chain storage space based on the index number.

[0155] Step 804B, the blockchain node sends a target node query request to the master node in the blockchain network.

[0156] Since the transactions to be stored are agreed upon through a consensus mechanism similar to PBFT in the previous embodiment, the original data of any stored transaction is recorded in the master node by which blockchain node it is stored. Therefore, the target node storing the target transaction can be determined by sending a query request containing an index number to the master node.

[0157] Of course, in another case, during the storage process, the information of the blockchain node storing the corresponding transaction can also be stored in the blockchain. In this case, when any transaction needs to be verified, there is no need to send a query request to the master node, and it is only necessary to find the blockchain node storing the transaction in the blockchain.

[0158] Step 805: The master node determines the target node based on the index number in the target node query request.

[0159] Step 806: The master node returns the target node's information to the blockchain node.

[0160] Step 807: The blockchain node sends a target transaction acquisition request to the target node.

[0161] In this embodiment, the verification operation is performed by the node that receives the verification transaction. Therefore, it is necessary to initiate an acquisition request to the target node to obtain the original data of the target transaction and verify it.

[0162] In another case, the verification operation can also be performed by the node that stores the original data of the target transaction. At this time, the blockchain node that receives the verification transaction can forward the index number of the verification transaction or the target transaction to the determined target node, so that the target node can verify the target transaction, and the blockchain node that receives the verification transaction only needs to receive the verification result of the target node.

[0163] Step 808: The target node queries the original data of the target transaction based on the index number.

[0164] Step 809: The target node returns the original data of the target transaction to the blockchain node.

[0165] In step 810, the blockchain node verifies the original data of the target transaction based on the hash value of the target transaction.

[0166] It can be seen from the above technical solution that, in the case of receiving a verification transaction, this embodiment can determine the target node storing the target transaction based on the index number contained in the verification transaction, and then obtain the original data of the target transaction to verify it based on the hash value stored in the blockchain. In this way, the user can verify the reliability of the original data of any transaction when he needs to use the original data.

[0167] Fig. 9 This is an interactive diagram of another transaction storage method shown in an exemplary embodiment of this specification. This method uses the POW consensus mechanism to reach consensus on the original data of the transaction. Fig. 9 As shown, the method may include the following steps:

[0168] Step 901: The blockchain node receives the transaction to be stored.

[0169] and Figure 7 Similar to the embodiment shown, the blockchain nodes in this embodiment also specifically refer to all nodes in the blockchain network. In other words, receiving the transactions to be stored in this step means that all nodes in the blockchain network respectively receive the transactions to be stored that they have received.

[0170] Next, we will take nodes A, B, and C in the blockchain network as an example to introduce the transaction storage method proposed in this embodiment. Figure 7 Different from the transaction storage method shown, this embodiment adopts the POW consensus mechanism. Therefore, in the blockchain network of this embodiment, there is no concept of a master node, that is, all nodes have the same status.

[0171] Step 902: The blockchain node broadcasts the original data of the received transaction in the blockchain network.

[0172] In this embodiment, the original data of the received transaction is used as the basis for consensus. After any node receives the transaction to be stored, the original data of the transaction will be broadcast to all nodes in the blockchain network.

[0173] by Fig. 9 The blockchain nodes A, B, and C shown in the figure are used as an example for introduction. It is still assumed that node A receives transactions a, b, and c; node B receives transactions m and n; and node C receives transactions x and y. Then, node A will send the original data of transactions a, b, and c to nodes B and C; node B will send the original data of transactions m and n to nodes A and C; and node C will send the original data of transactions x and y to nodes A and B.

[0174] In other words, in the embodiment, any node in the blockchain network stores the original data of the transaction to be stored received by all nodes in the blockchain network. Fig. 9 The blockchain nodes A, B, and C all store the original data of transactions a, b, c, m, n, x, and y.

[0175] Step 903: Blockchain nodes compete for accounting rights based on preset rules.

[0176] After the original data of the transaction to be stored is broadcasted, each node in the blockchain network can compete for the right to record accounts according to the preset rules. For example, the ownership of the right to record accounts can be determined by solving traditional math problems.

[0177] Step 904: The blockchain node that obtains the bookkeeping right determines the transactions to be uploaded to the chain.

[0178] Continuing with the above example, assuming that in the blockchain network, node B obtains the right to record accounts, then node B can determine the transactions to be put on the chain according to certain rules. Assume that the transactions to be put on the chain are still transactions c, m, n, and x.

[0179] Step 905: The blockchain node that obtains the accounting right numbers the transactions to be uploaded to the chain.

[0180] Continuing with the above example, in this step, node B can determine the numbers of transactions c, m, n, and x to be on-chain as 1, 2, 3, and 4, respectively.

[0181] Step 906: The blockchain node that obtains the accounting right broadcasts the transaction to be uploaded and its number in the blockchain network.

[0182] Continuing with the above example, the correspondence between the determined transactions to be on-chain and the serial numbers, i.e., c-1, m-2, n-3, and x-4, can be sent to other nodes in the blockchain network, such as nodes A and C.

[0183] Step 907: The blockchain node saves the correspondence between the original data and the serial number of the transaction to be uploaded to the off-chain storage space.

[0184] In this embodiment, since the off-chain storage space of all blockchain nodes stores the original transaction data, this step only requires saving the correspondence between the transaction and the serial number to the off-chain storage space for subsequent search of the original transaction data.

[0185] Continuing with the above example, in this step, the four corresponding relationships of c-1, m-2, n-3, and x-4 can be saved to the off-chain storage space.

[0186] Step 908: The blockchain node calculates the hash value of the original data of the transaction to be uploaded to the chain.

[0187] Continuing with the above example, in this step, nodes A, B, and C can calculate the hash values ​​of transactions c, m, n, and x respectively.

[0188] Step 909: The blockchain node forms a block based on the correspondence between the hash value and the serial number of the transaction to be uploaded to the chain.

[0189] Continuing with the above example, after calculating the hash values ​​of transactions c, m, n, and x, nodes A, B, and C can create new blocks respectively, and save the four corresponding relationships of hash c-1, hash m-2, hash n-3, and hash x-4 in the blocks they created respectively.

[0190] In step 910, the blockchain node adds the formed block to the end of the blockchain.

[0191] Continuing with the above example, nodes A, B, and C can add the blocks they created that store the four corresponding relationships of hash c-1, hash m-2, hash n-3, and hash x-4 to their respective blockchains.

[0192] This embodiment saves the original data of the transaction to the off-chain storage space of each node in the blockchain network, so that there is no need to search across nodes when searching for the original data of the transaction, thereby reducing the occupation of transmission resources.

[0193] Secondly, this embodiment saves the hash value and number of the transaction as identification information on the chain, so that the hash value and number cannot be tampered with. Furthermore, since the identification information corresponds one-to-one with the original data of the transaction, the original data of the transaction cannot be tampered with either.

[0194] Fig.10The flowchart of a transaction verification method is shown as an exemplary embodiment of this specification. Fig. 9 The method shown in the figure verifies the stored transactions, which is applied to the blockchain nodes. Fig.10 As shown, the method may include the following steps:

[0195] Step 1001, receiving a verification transaction.

[0196] In this embodiment, any node in the blockchain network can serve as the blockchain node that receives the verification transaction.

[0197] Step 1002, determining a hash value of a target transaction to be verified based on an index number in the verification transaction.

[0198] In this embodiment, due to Fig. 9 The storage method shown saves the corresponding relationship between the index number and the hash value in the blockchain of each node. Therefore, the hash value corresponding to the index number can be found in the local blockchain according to the index number. Of course, the smart contract for obtaining the hash value can also be called to obtain the hash value corresponding to the index number.

[0199] Furthermore, after obtaining the hash value, a hash value verification request can be sent to other nodes in the blockchain network to ensure that the hash value in the local blockchain is consistent with the hash value stored in the blockchain of other nodes.

[0200] Step 1003, based on the index number in the verification transaction, obtain the original data of the target transaction to be verified from the local off-chain storage space.

[0201] In this embodiment, since all blockchain nodes store the original data of all transactions in the blockchain network, it is only necessary to search for the original data of the target transaction in the local off-chain storage space according to the index number.

[0202] Step 1004: verify the obtained original transaction based on the determined hash value.

[0203] Compared to Figure 8 The verification method shown, since the blockchain node in this embodiment stores the original data of all transactions in the blockchain network, this embodiment does not need to search across nodes during the verification process, thereby reducing the occupancy of transmission resources.

[0204] Fig.11 A schematic diagram of the structure of an electronic device is shown as an exemplary embodiment of this specification. Fig.11At the hardware level, the electronic device includes a processor 1102, an internal bus 1104, a network interface 1106, a memory 1108, and a non-volatile memory 1110, and may also include hardware required for other services. The processor 1102 reads the corresponding computer program from the non-volatile memory 1110 into the memory 1108 and then runs it, forming a data storage device at the logical level. Of course, in addition to the software implementation, this specification does not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is to say, the execution subject of the following processing flow is not limited to each logic unit, but can also be hardware or logic devices.

[0205] Please refer to Fig.12 In a software implementation, the data storage device may include:

[0206] A receiving unit 1201 receives data to be stored;

[0207] A saving unit 1202 saves the data to a data storage area in the data storage node;

[0208] The adding unit 1203 adds the identification information of the data to the target block, and saves the target block to the blockchain storage area in the data storage node, so that the target block is added to the end of the blockchain in the blockchain storage area.

[0209] Optionally, the identification information of the data includes a hash value of the data and / or an index number of the data in the data storage area.

[0210] Optionally, the identification information of the data includes a hash value of the data and an index number of the data in the data storage area; the receiving unit 1201 is further used to receive a verification request, wherein the verification request includes the index number of the target data;

[0211] The device also includes:

[0212] An acquiring unit 1204 acquires a hash value of the target data stored in the blockchain storage area and the target data stored in the data storage area according to the index number;

[0213] The verification unit 1205 verifies the acquired target data based on the hash value of the target data.

[0214] Optionally, the data storage area and the blockchain storage area in the data storage node both use streaming database storage technology to store data or identification information.

[0215] Optionally, an operation of saving the data to the data storage area and an operation of saving the identification information to the blockchain storage area are sequentially performed; or

[0216] Asynchronously executing an operation of saving the data to the data storage area and an operation of saving the identification information to the blockchain storage area.

[0217] Fig.13 This is a schematic structural diagram of another electronic device shown as an exemplary embodiment of this specification. Fig.13 At the hardware level, the electronic device includes a processor 1302, an internal bus 1304, a network interface 1306, a memory 1308, and a non-volatile memory 1310, and may also include hardware required for other services. The processor 1302 reads the corresponding computer program from the non-volatile memory 1310 into the memory 1308 and then runs it, forming a transaction storage device at the logical level. Of course, in addition to the software implementation, this specification does not exclude other implementation methods, 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 can also be hardware or logic devices.

[0218] Please refer to Fig.14 In a software implementation, the transaction storage device may include:

[0219] A receiving unit 1401 receives a transaction to be stored;

[0220] A storage unit 1402 saves the original data of the transaction to an off-chain storage space;

[0221] The adding unit 1403 reaches a consensus on the transaction or the identification information of the transaction with other blockchain nodes in the blockchain network, and adds the target block to the end of the blockchain if the consensus is passed, and the block body of the target block is used to record the identification information of the transaction.

[0222] Optionally, the identification information of the transaction includes a hash value of the original data and / or an index number of the original data in the off-chain storage space.

[0223] Optionally, the identification information of the transaction includes a hash value of the original data and an index number of the original data in the off-chain storage space, and the receiving unit 1401 is further used to receive a verification transaction, wherein the verification transaction includes an index number of a target transaction;

[0224] The device also includes:

[0225] The calling unit 1404 calls a smart contract for searching hash values, so as to obtain a hash value corresponding to the target transaction stored in the blockchain according to the index number;

[0226] The acquisition unit 1405 acquires the original data of the target transaction stored in the off-chain storage space according to the index number;

[0227] The verification unit 1406 verifies the obtained original data based on the hash value corresponding to the target transaction.

[0228] Optionally, the acquisition unit is further used for:

[0229] Determine whether the target transaction is stored in the local off-chain storage space based on the index number;

[0230] If yes, obtaining the original data of the target transaction stored in the local off-chain storage space according to the index number;

[0231] Otherwise, based on the index number, a target node acquisition request is sent to a master node in the blockchain network to which the blockchain node belongs, so that the master node returns relevant information of the target node according to the index number; based on the relevant information, an original data acquisition request is sent to the target node, so that the target node returns the original data of the target transaction according to the index number.

[0232] Optionally, both the off-chain storage space and the blockchain use streaming database storage technology to store transaction or identification information.

[0233] Optionally, sequentially performing an operation of saving the original data of the transaction to the off-chain storage space and an operation of storing the identification information to the blockchain; or

[0234] Asynchronously executing an operation of saving the original data of the transaction to the off-chain storage space and an operation of storing the identification information to the blockchain.

[0235] For the device embodiments, since they basically correspond to the method embodiments, the relevant parts can refer to the partial description of the method embodiments. The device embodiments described above are only schematic, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this specification. Ordinary technicians in this field can understand and implement it without paying creative work.

[0236] In an exemplary embodiment, a non-temporary computer-readable storage medium including instructions is also provided, such as a memory including instructions. The above instructions can be executed by a processor of a data storage device or a transaction storage device to implement a method as described in any of the above embodiments. For example, the data storage method may include: receiving data to be stored; saving the data to a data storage area in the data storage node; adding identification information of the data to a target block, and saving the target block to a blockchain storage area in the data storage node, so that the target block is added to the end of the blockchain in the blockchain storage area.

[0237] The non-temporary computer-readable storage medium may be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc., and this specification does not limit this.

[0238] The above description is only a preferred embodiment of this specification and is not intended to limit this specification. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of this specification should be included in the scope of protection of this specification.

Claims

1. A transaction verification method, applied to blockchain nodes in a blockchain network, wherein each blockchain node in the blockchain network stores only the original data of transactions received by itself in its own off-chain storage space; the blockchains maintained by all blockchain nodes in the blockchain network store index numbers and hash values ​​of all stored transactions; the master node in the blockchain network records relevant information of the original data of transactions stored in each blockchain node; Any relevant information is used to determine a node maintaining the original data of the corresponding stored transaction; the method comprising: Receive verification transactions; Based on the index number of the target transaction included in the verification transaction, determining whether the target transaction is stored in the local off-chain storage space; When it is determined that the target transaction is stored in the local off-chain storage space, the original data of the target transaction is obtained from the local storage space according to the index number of the target transaction, and the hash value of the target transaction is obtained from the maintained blockchain; and the obtained original data is verified based on the obtained hash value; When it is determined that the target transaction is not stored in the local off-chain storage space, a target node acquisition request is sent to the master node according to the index number of the target transaction, so that the master node returns the relevant information of the target node; and the original data of the target transaction is verified based on the index number of the target transaction and the relevant information of the target node; The returned relevant information is used to determine the target node, and the index number of the target transaction is used to determine the original data of the target transaction from the target node, so as to verify the determined original data based on the hash value of the target transaction.

2. According to the method of claim 1, the verifying the original data of the target transaction based on the index number of the target transaction and the relevant information of the target node comprises: Initiating a raw data acquisition request to the target node based on the relevant information and the index number of the target transaction, so that the target node returns the raw data of the target transaction according to the index number of the target transaction; Calling a smart contract for finding a hash value to obtain the hash value of the target transaction stored in the maintained blockchain according to the index number of the target transaction; The original data returned by the target node is verified based on the acquired hash value.

3. The method according to claim 1, wherein the verifying the original data of the target transaction based on the index number of the target transaction and the relevant information of the target node comprises: Forwarding the verification transaction to the target node, so that the target node obtains the original data of the target transaction from its own off-chain storage space based on the index number of the target transaction; the index number of the target transaction is also used by the target node to call a smart contract to obtain the hash value of the target transaction from the blockchain maintained by the target node; The obtained hash value is used by the target node to verify the obtained original data; Receive a verification result of the target node on the original data of the target transaction.

4. According to the method of claim 1, the index number of the stored transaction is obtained by the master node numbering the hash value of the stored transaction according to the chain order.

5. According to the method of claim 1, the off-chain storage space and the blockchain both use streaming database storage technology to store at least one of transactions, hash values, and index numbers.

6. The method according to claim 1, Sequentially executing the operation of saving the original data of the transaction to the off-chain storage space, and the operation of saving the hash value and index number to the blockchain; or Asynchronously executing the operation of saving the original data of the transaction to the off-chain storage space, and the operation of saving the hash value and index number to the blockchain.

7. A transaction verification device, applied to a blockchain node in a blockchain network, wherein each blockchain node in the blockchain network stores only the original data of the transaction received by itself in its own off-chain storage space; the blockchain maintained by all blockchain nodes in the blockchain network stores the index number and hash value of all stored transactions; the master node in the blockchain network records the relevant information of the original data of the transaction stored in each blockchain node; Any relevant information is used to determine a node maintaining the original data of the corresponding stored transaction; the apparatus comprises: A receiving unit, receiving and verifying the transaction; A judgment unit, based on the index number of the target transaction included in the verification transaction, judges whether the target transaction is stored in the local off-chain storage space; The first verification unit, when determining that the target transaction is stored in the local off-chain storage space, obtains the original data of the target transaction from the local storage space according to the index number of the target transaction, and obtains the hash value of the target transaction from the maintained blockchain; and verifies the obtained original data based on the obtained hash value; The second verification unit, when determining that the target transaction is not stored in the local off-chain storage space, sends a target node acquisition request to the master node according to the index number of the target transaction, so that the master node returns relevant information of the target node; and verifies the original data of the target transaction based on the index number of the target transaction and the relevant information of the target node; The returned relevant information is used to determine the target node, and the index number of the target transaction is used to determine the original data of the target transaction from the target node, so as to verify the determined original data based on the hash value of the target transaction.

8. An electronic device comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 6 by running the executable instructions.

9. A computer-readable storage medium having computer instructions stored thereon, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Block chain-based distributed storage

    CN107273410A

  • Block data verification method and apparatus, device and storage medium

    CN108924130A