CN111177277B - Data storage method, transaction storage method and device - Google Patents

Data storage method, transaction storage method and device Download PDF

Info

Publication number
CN111177277B
CN111177277B CN202010277408.9A CN202010277408A CN111177277B CN 111177277 B CN111177277 B CN 111177277B CN 202010277408 A CN202010277408 A CN 202010277408A CN 111177277 B CN111177277 B CN 111177277B
Authority
CN
China
Prior art keywords
transaction
data
node
target
block chain
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010277408.9A
Other languages
Chinese (zh)
Other versions
CN111177277A (en
Inventor
张渊
俞本权
李亿泽
杨新颖
闫文远
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alipay Hangzhou Information Technology Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202010277408.9A priority Critical patent/CN111177277B/en
Priority to CN202010976525.4A priority patent/CN112182099A/en
Publication of CN111177277A publication Critical patent/CN111177277A/en
Application granted granted Critical
Publication of CN111177277B publication Critical patent/CN111177277B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3827Use of message hashing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/40Authorisation, e.g. identification of payer or payee, verification of customer or shop credentials; Review and approval of payers, e.g. check credit lines or negative lists
    • G06Q20/401Transaction verification

Landscapes

  • Engineering & Computer Science (AREA)
  • Business, Economics & Management (AREA)
  • Theoretical Computer Science (AREA)
  • Accounting & Taxation (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Finance (AREA)
  • Strategic Management (AREA)
  • General Business, Economics & Management (AREA)
  • Computer Security & Cryptography (AREA)
  • Databases & Information Systems (AREA)
  • Computing Systems (AREA)
  • Data Mining & Analysis (AREA)
  • General Engineering & Computer Science (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The specification provides a data storage method, a transaction storage method and a device; the data storage method is applied to the data storage node, and the method can comprise the following steps: 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 a blockchain in the blockchain storage area.

Description

Data storage method, transaction storage method and device
Technical Field
The present disclosure relates to the field of storage, and in particular, to a data storage method, a transaction storage method, and a device.
Background
The traditional storage technology stores all data into a unified data center, and due to the adoption of a centralized data storage mode, the problems of easy tampering, low reliability and the like exist.
The blockchain technique (also referred to as a distributed ledger technique) is a decentralized distributed database technique proposed based on the problems of the conventional storage technique. Due to the adoption of a decentralized network structure, a consensus mechanism and a chain block structure, the block chain technology has the characteristics of decentralized, public transparency, no tampering, trustiness and the like, and is suitable for a plurality of application scenes with high requirements on data reliability. In the block chain technology, all block chain nodes need to store data of a block chain, and each block in the block chain is used for recording original data of a plurality of packaged transactions and the like.
Disclosure of Invention
In view of this, the present specification provides a data storage method, a transaction storage method and a device.
The technical scheme provided by the specification is as follows:
according to a first aspect of the present specification, a data storage method is provided, which is applied to a data storage node, and the method includes:
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 a blockchain in the blockchain storage area.
According to a second aspect of the present specification, there is provided a transaction storage method applied to a blockchain node, the method comprising:
receiving a transaction to be stored;
storing the original data of the transaction to a down-link storage space;
and carrying out consensus on the transaction or the identification information of the transaction with other block chain link points in a block chain network, and adding a target block to the tail end of the block chain when the consensus passes, wherein the block of the target block is used for recording the identification information of the transaction.
According to a third aspect of the present specification, there is provided a data storage device comprising:
a data storage area for storing the received data;
and the block chain storage area is used for storing the identification information of the data, the identification information is added into the blocks, and the blocks are sequentially linked according to the blocking sequence to form a block chain stored in the block chain storage area.
According to a fourth aspect of the present specification, there is provided a data storage apparatus, applied to a data storage node, the apparatus comprising:
a receiving unit that receives data to be stored;
a saving unit that saves the data to a data storage area in the data storage node;
an adding unit that adds identification information of the data to a target block and saves the target block to a block chain storage area in the data storage node so that the target block is added to an end of a block chain in the block chain storage area.
According to a fifth aspect of the present specification, there is provided a transaction storage device for use with a blockchain node, the device comprising:
a receiving unit that receives a transaction to be stored;
the storage unit is used for storing the original data of the transaction to a down-link storage space;
and the adding unit is used for carrying out consensus on the transaction or the identification information of the transaction with other block chain link points in the block chain network and adding a target block to the tail end of the block chain under the condition that the consensus passes, wherein the block of the target block is used for recording the identification information of the transaction.
According to a sixth aspect of the present specification, there is provided an electronic apparatus comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor implements the method as in any of the above embodiments by executing the executable instructions.
According to a sixth aspect of the present description, there is provided a computer readable storage medium having stored thereon computer instructions which, when executed by a processor, implement the steps of the method as in any one of the above embodiments.
Drawings
FIG. 1 is a schematic diagram of a data storage device shown in an exemplary embodiment of the present description.
Fig. 2A is a flow chart illustrating a data storage method according to an exemplary embodiment of the present disclosure.
FIG. 2B is a flow chart illustrating another method of data storage according to an exemplary embodiment of the present description.
FIG. 3 is a flow chart illustrating a transaction storage method in an exemplary embodiment of the present description.
FIG. 4 is a flow chart illustrating yet another method of data storage in an exemplary embodiment of the present description.
Fig. 5 is a process diagram of data storage according to an exemplary embodiment of the present disclosure.
FIG. 6 is a flow chart illustrating a method of data validation in an exemplary embodiment of the present description.
FIG. 7 is an interaction diagram illustrating a transaction storage method in accordance with an exemplary embodiment of the present specification.
FIG. 8 is an interaction diagram illustrating a transaction verification method in accordance with an exemplary embodiment of the present description.
FIG. 9 is an interaction diagram illustrating another transaction storage method, according to an exemplary embodiment of the present description.
FIG. 10 is a flow chart of a transaction verification method shown in an exemplary embodiment of the present description.
Fig. 11 is a schematic structural diagram of an electronic device according to an exemplary embodiment of the present disclosure.
Fig. 12 is a block diagram illustrating a data storage device according to an exemplary embodiment of the present description.
Fig. 13 is a schematic structural diagram of another electronic device shown in an exemplary embodiment of the present specification.
FIG. 14 is a block diagram of a transaction storage device, shown in an exemplary embodiment of the present description.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the specification, as detailed in the appended claims.
The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the description. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information, without departing from the scope of the present specification. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
Referring to fig. 1, fig. 1 illustrates a data storage device according to an exemplary embodiment of the present specification, where as shown in fig. 1, the data storage device may include:
a data storage area 102 for storing the received data.
And the block chain storage area 104 is used for storing identification information of the data, the identification information is added into the blocks, and the blocks are sequentially linked according to a blocking sequence to form a block chain stored in the block chain storage area.
Based on the data storage device, the received data can be stored in a data storage area; and storing the identification information of the data into the block chain in the block chain storage area. The block chain storage area stores the identification information in the form of the block chain, so that the identification information is tightly connected and cannot be easily tampered; the identification information corresponds to the data in the data storage area, and once the data is tampered, the corresponding identification information cannot be found, so that whether the data in the data storage area is tampered or not can be easily verified.
Next, a data storage method proposed in the present specification will be described with reference to the storage structure of the above-described data storage device.
Fig. 2A is a flow chart illustrating a data storage method according to an exemplary embodiment of the present disclosure. The method is applied to a data storage node, and as shown in fig. 2A, the method may include the steps of:
step 202A, data to be stored is received.
The data storage node in this specification may be an electronic device having a storage function, such as a PC, a mobile terminal (a smartphone, a tablet computer, and the like), a server, and the like, or may be a data center including a plurality of electronic devices, which is not limited in this specification.
The data storage node comprises two storage areas, namely a data storage area and a block chain storage area. It should be noted that the two storage areas are logically divided, and the actual locations of the two storage areas may be located in the same physical area or in different physical areas. The block chain storage area adopts a storage structure of a block chain, namely, all blocks are sequentially linked according to a blocking sequence to form the block chain stored in the storage area. Unlike existing blockchains, the blockchain in the storage area may not save parameters in the blocks of the existing blockchain, such as timestamps, merkel (Merkle) roots, etc., but only keep the hash value of the last block, i.e., the parent hash, at the head of the block.
In this specification, the data storage area and the block chain storage area may both store data or identification information by using the storage technology of the streaming database. The storage technology of the streaming database should satisfy the following conditions: 1. the data is stored in a certain order; 2. previously stored data is not overwritten by subsequently stored data; 3. the stored data cannot be updated or modified.
Step 204A, saving the data to a data storage area in the data storage node.
The data storage area is used for storing the received data per se, and in one case, the data storage area can store the received data into the data storage area every time one data is received; in another case, when the received amount reaches a preset amount, the preset amount of data may be saved to the data storage area.
Step 206A, adding the identification information of the data to a target block, and saving the target block to a block chain storage area in the data storage node, so that the target block is added to the end of a block chain in the block chain storage area.
The blockchain storage area is used for storing 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 further 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: the data does not contain relevant information of the data per se, and the specific content can be determined by a person skilled in the art according to actual needs, which is not limited by the description. In one case, the identification information may include only a hash value or index number of the data, and the identification information may be used to look up the corresponding data in the data store. In another case, the identification information includes a hash value and an index number of the data, and the identification information may also be used to verify the data, for example, when a user needs to verify any data, the data may be determined as target data, and a verification request may be sent to the data storage node. After receiving the verification request, the data storage node may obtain the hash value of the target data stored in the block chain storage area and the target data stored in the data storage area based on the index number of the target data included in the verification request; and verifying the obtained target data based on the hash value of the target data. In this case, the corresponding relationship between the hash value of the data and the index number is stored in the block chain of the block chain storage area, and the user can acquire the corresponding relationship from the block chain of the block chain storage area, and further initiate verification for any data to the data storage node; or in the process of storing the data, a corresponding relation table of the index number and the hash value of the stored data can be generated so that the user can inquire the data to be acquired or verified.
In this embodiment, when the data is stored in the data storage area, the data may be numbered according to a certain order, and the number is used as an index number of the data. For example, the numbering may be done in chronological order in which the data is saved to the data storage area. Of course, this example is only illustrative, and those skilled in the art can determine the index number in different ways according to the actual situation, and the description does not limit this.
In this embodiment, the operation of saving the data to the data storage area and the operation of saving the identification information to the block chain storage area are sequentially performed. In other words, the received data is preferentially saved to the data storage area, and then the identification information of the data is saved to the blockchain storage area.
In one case, each time a data is saved to the data storage area, the identification information of the data can be saved to the blockchain storage area. In another case, the identification information of the data stored in the data storage area is only stored in the blockchain storage area (i.e. the identification information of the multiple data is stored in a unified manner) when the data stored in the data storage area satisfies a preset condition, for example, the preset condition may be: the number of data saved to the data storage area reaches a preset value, or the time for storing the data passes a preset time period. In actual operation, in order to simplify the operation and further reduce the occupation of processing resources, a manner of uniformly storing a plurality of identification information is generally adopted, and the identification information of a plurality of data meeting the preset condition is stored in the same block.
The identification information can be stored in the block chain of the block chain storage area in various ways. In one case, a block chain including a plurality of empty blocks is created in advance in the block chain storage area, and in this case, only the empty block after the block in which the identification information has been stored needs to be determined as a target block, and the identification information to be stored is stored in the target block. In another case, after determining the identification information to be stored, a block needs to be created to serve as a target block for storing the identification information to be stored, and the target block is added to the end of the blockchain storage area.
According to the technical scheme, the data storage node in the specification comprises a data storage area and a block chain storage area. The data storage area is used for storing received data; and the block chain storage area is used for storing identification information of the data. Because the block chain storage area adopts the block chain to store the identification information, the stored identification information is closely connected and cannot be easily tampered. And the identification information is in one-to-one correspondence with the data, once the data in the data storage area is tampered, the identification information corresponding to the data cannot be acquired, and then the change of the data is discovered. In other words, the storage mode of the present specification does not have the problems of data hiding, easy tampering, low reliability and the like in the conventional centralized storage technology.
Secondly, in this specification, only data is saved in a local data storage area, and data is not saved to other data storage nodes, so that the storage manner of this specification does not have the data redundancy problem caused by the fact that all block chain nodes need to save data of a block chain in the block chain technology, and the waste of storage resources is avoided.
In the above-described embodiment, the operation of saving data to the data storage area and the operation of saving identification information to the block chain storage area are sequentially performed. In another case, the operation of saving data to the data storage area and the operation of saving the identification information to the blockchain storage area may be performed asynchronously. The data storage method in this case will be described with reference to fig. 2B. In this case, the principle of the technical solution is similar to the above embodiments, and the implementation details such as the operation of saving data to the data storage area and the manner of obtaining the index number can be referred to the above embodiments, and therefore, will not be described in detail below.
Referring to fig. 2B, fig. 2B is a flow chart illustrating another data storage method according to an exemplary embodiment of the present disclosure. The method is applied to a data storage node, and as shown in fig. 2B, the method may include the steps of:
step 202B, receive data to be stored.
As described above, the data storage node may be an electronic device having a storage function, such as a PC, a mobile terminal (smart phone, tablet computer), or a server, or may be a data center including a plurality of electronic devices. This is not a limitation of the present specification.
As described above, the data storage node includes two storage areas, namely, a data storage area and a block chain storage area. The data storage area and the block chain storage area can both store the received data or the identification information by adopting the storage technology of a streaming database.
Step 204B, saving the data to a data storage area in the data storage node.
As described above, the data storage area is used to store the received data itself, and in one case, it may be saved to the data storage area every time a data is received; in another case, the received number may be saved to the data storage area when the received number reaches a preset value.
Step 206B, adding the identification information of the data to a target block, and saving the target block to a block chain storage area in the data storage node, so that the target block is added to the end of a block chain in the block chain storage area.
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 further include other information related to the data, such as summary information of the data.
As described above, when storing data in the data storage area, the data may be numbered in a certain order, and the number may be used as an index number of the data.
As described above, the block chain storage area may use a pre-created empty block as a target block, or may create a corresponding block after determining the identification information to be stored as a target block.
Unlike the previous embodiment, in the present embodiment, the operation of saving data to the data storage area and the operation of saving identification information to the block chain 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 data to be stored, on the one hand, the data may be saved to a data storage area; on the other hand, the corresponding identification information may be determined based on the data, for example, a hash value of the data is calculated, and the hash value is saved to the blockchain storage area in the manner described above. The two processes do not have a precedence relationship, and the identification information can be determined firstly and stored in the block chain storage area, or the data can be stored in the data storage area firstly. Certainly, in the process, because the two are not in a sequential relationship, when the index number is established, the data can be numbered according to the receiving sequence, so that the number is used as the index number of the data.
Compared with the previous embodiment, the storage sequence of the data and the identification information is not limited in the embodiment, so that two storage operations can be performed in parallel under most conditions, and the storage efficiency is greatly improved.
In addition to the above technical solution of storing data in a single storage node, the present specification further provides an improvement to the existing blockchain technology, and fig. 3 illustrates a transaction storage method according to an exemplary embodiment of the present specification. The principle of the technical solution is similar to the above embodiments, and all the related parts such as the operation of storing the original data of the transaction and the manner of obtaining the identification information can refer to the above embodiments. It should be noted that this solution combines the existing blockchain technology, rather than only using the existing blockchain structure. Therefore, the data storage area is replaced by the down-link storage space, and the data is replaced by the transaction; accordingly, the identification information is not stored only in the local blockchain, but is uploaded to the blockchain network.
Referring to fig. 3, fig. 3 illustrates a transaction storage method applied to a blockchain node according to an exemplary embodiment of the present disclosure, where the method may include the following steps:
at step 302, a transaction to be stored is received.
Similar to the data storage node, the block link point in this embodiment may also be an electronic device with a storage function, such as a PC, a mobile terminal (smart phone, tablet computer), a server, and the like, which is not limited in this specification.
In this embodiment, when there is a transaction to be stored, a request for storing the transaction may be sent to the block link point, so that the block link point stores the transaction to be stored.
Unlike the above-described embodiment, in the present embodiment, two different storage areas are not locally divided, but raw data and identification information of a transaction are stored under and on a chain, respectively. The judgment criteria of the chain down and the chain up in the present specification are: whether the block chain is issued to the block chain network through a block chain consensus mechanism; if yes, storing on the chain; if not, storing under the chain. Similar to the above embodiments, both the down-link storage space and the blockchain may employ storage technology of the streaming database to store transaction or identification information.
Step 304, storing the raw data of the transaction to a down-link storage space.
The down-link storage space is used for storing the original data of the received transaction, and in one case, the original data of the transaction can be stored in the down-link storage space every time the transaction is received; in another case, the received raw data of the transaction may be saved to the down-link storage space when the received amount reaches the preset amount.
And step 306, performing consensus on the transaction or the identification information of the transaction with other block link points in the block chain network, and adding a target block to the tail end of the block chain when the consensus passes, wherein the block of the target block is used for recording the identification information of the transaction.
The identification information in this embodiment is stored to the blockchain network; the identification information is similar to the identification information in the above embodiments, and may also 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. In one case, the identification information includes only a hash value or index number of the data, which can be used to look up the corresponding transaction in the down-link storage space. In another case, the identification information includes a hash value of original data of the transaction and an index number of the transaction, and in this case, the identification information may also be used to verify the data, for example, when a user needs to verify any data, the data may be determined as a target transaction, and the verification transaction is sent to the block link node. After receiving the verification transaction, the blockchain node can call an intelligent contract for searching the hash value based on the index number of the target transaction contained in the verification transaction so as to obtain the hash value corresponding to the target transaction and stored in the blockchain; the original data of the target transaction stored in the storage space under the chain can be obtained according to the index number; and verifying the obtained original data based on the hash value corresponding to the target transaction. In this case, the correspondence between the hash value and the index number of the transaction is stored in the blockchain, and the user can acquire the correspondence from the blockchain and initiate verification for any transaction to the blockchain node.
It should be noted that the user may initiate a verification transaction to any one of the blockchain nodes in the blockchain network, in other words, the blockchain node storing the target transaction and the blockchain node verifying the target transaction may be different nodes in the same blockchain network. In one case, the operations of storage and verification are performed by the same block node, and at this time, after receiving the verification transaction, the block node can acquire the original data of the target transaction from the local under-link storage space and verify the original data; in another case, the storage and verification operations are performed by different blockchain nodes, and at this time, after a certain blockchain node receives a verification transaction, it needs to determine a target node in which the target transaction is stored according to the index number, initiate a request for acquiring original data of the target transaction to the certain blockchain node, and after receiving returned original data, verify the certain blockchain node based on the acquired hash value. In this case, the validation request may also be forwarded to the determined target node for validation of the target transaction by the target node. The specific way to verify the target transaction based on the verification transaction can be determined by those skilled in the art according to practical situations, and the application is not limited to this.
In this embodiment, the manner of obtaining the index number is similar to that in the above embodiments, and reference may be made to the description of step 206A, which is not repeated herein.
Next, the conditions for storing the identification information in the present embodiment are similar to those in the above-described embodiments. In one case, whenever a transaction is saved to the down-link storage space, the identification information of the transaction may be saved to the blockchain through the consensus mechanism. In another case, only when the transactions saved in the storage space under the chain satisfy a preset condition, the identification information of the transactions is saved in the blockchain (i.e. the identification information of multiple transactions is uniformly stored), for example, the preset condition may be: the number of transactions saved to the down-link storage space reaches a preset value, or the time to store the transactions passes a preset time period. In actual operation, in order to simplify the operation and further reduce the occupation of processing resources, a manner of uniformly storing a plurality of identification information is generally adopted, and the manner is to store a plurality of transactions meeting the preset conditions to the same block.
It should be noted that, because the storage space occupied by the identification information is small, the identification information may be stored in the chunk header together with the parent hash, or may be stored in the chunk.
Since the embodiment stores the identification information to the block chain through the consensus mechanism, the process of storing the identification information is related to the adopted consensus mechanism.
In one case, the specification can employ a common consensus mechanism like POW to save the identification information to the blockchain. In this case, the block link point first creates a new block locally to save the identification information into the block; then, the block stored with the identification information may be sent to other nodes in the blockchain network, so that the other nodes perform consensus on the block, and after the consensus passes, the other nodes may add the block to the end of their respective blockchains, and further store the identification information in the blockchains of the respective nodes.
In another case, the specification can employ a PBFT-like consensus mechanism to save the identification information to the blockchain. In this case, the blockchain network includes a master node, when any blockchain node needs to store the identification information of the transaction to the blockchain, the transaction or the identification information of the transaction may be sent to the master node to be identified by the master node, after the transaction or the identification information of the transaction passes the identification, the identification information of the transaction may be sent to other nodes in the blockchain network, and after the other nodes receive the identification information, a new block may be created to store the received identification information, and the block in which the identification information is stored is added to the end of each blockchain.
In the case of storing identification information to a block chain by using a common identification mechanism similar to PBFT, information related to the original data of the transaction stored by each node may be stored in the master node due to the common identification operation performed by the master node. On the basis, when any block chain node receives a verification transaction of original data aiming at any transaction, whether the original data of the transaction is stored in a local chain storage space or not can be judged preferentially, if yes, the original data of the target transaction stored in the local chain storage space can be obtained according to an index number in the verification transaction; otherwise, a target node acquisition request can be sent to the main node to acquire the relevant information of the target node storing the original data of the target transaction, and then the original data acquisition request is sent to the target node according to the returned relevant information of the target node, so that the target node searches the stored original data of the target transaction according to the index number and returns the original data.
Notably, in one case, each blockchain node in the blockchain network, upon receiving a transaction, stores its raw data in its respective down-chain storage space. In this case, if the index numbers of the transactions are determined only according to the respective storage sequences of the respective blocks, a plurality of transactions with the same index number exist in the whole block chain network. Therefore, in this embodiment, in the process of storing the received original data of the transaction in the storage space under the chain, each partition link point needs to determine the index number of the transaction stored in the partition chain, and determine the index number of the transaction to be stored next by using the last stored index number as the starting point. Taking the number as an index number as an example, assume that transactions numbered 1-7 have been stored in the current block chain; then when any block chain node receives a transaction to be stored, the transaction should be numbered starting at 8 and not continuing with the numbers 1-7.
In this specification, an operation of saving the original data of the transaction to the down-chain storage space and an operation of storing the identification information to the blockchain may be sequentially performed; the operations of saving the raw data of the transaction to the down-chain storage space and saving the identification information to the blockchain may also be performed asynchronously. In other words, steps 304 and 306 may be performed sequentially or asynchronously. The sequential execution case can be described with reference to fig. 2A, and the asynchronous execution case can be described with reference to fig. 2B, which is not described herein again.
According to the technical scheme, the original data of the transaction are stored in the storage space under the block chain, only the identification information of the transaction is stored in the block chain, and data redundancy caused by the fact that a large amount of original data are stored in a plurality of backup blocks in the block chain is avoided. Second, since the identification information of the transaction is saved to the blockchain, it cannot be tampered with. And the identification information of the transaction is in one-to-one correspondence with the original data, so that the original data of the transaction cannot be tampered. Therefore, by the technical scheme of the specification, on the basis of ensuring the safety of the original data of the transaction, the waste of block chain storage resources caused by data redundancy can be avoided.
For convenience of understanding, the technical solutions in the present specification are described below with reference to specific embodiments.
Fig. 4 illustrates yet another data storage method in an exemplary embodiment of the present specification. In the method, when the number of the data to be stored reaches a preset number, the identification information of the data with the preset number is stored in the block chain storage area. As shown in fig. 4, the method may include the steps of:
step 401, receiving data to be stored.
Step 402, saving the data to be stored to the data storage area.
In this embodiment, each time data is received, the data may be saved in the data storage area according to the received time sequence, and the data saved in the data storage area may not be overwritten by the data stored later, and may not be modified or updated.
And 403, numbering the data to be stored according to the storage sequence.
In this embodiment, the number of data is used as the index number of the data. This step may number the data already stored to the data storage area in the order of the storage in step 402. It is noted that although this step is described separately from step 402, it is also possible to number the data during saving to the data store.
At step 404, a hash value of the data to be stored is calculated.
In this embodiment, the step of calculating the hash value may also be performed during the process of saving the data to the data storage area. It should be understood that, in the present embodiment, the corresponding relationship between the hash value and the number is used as the identification information of the data, and it is only necessary to obtain the hash value and the number of the data before storing the identification information, and the specific step in which to calculate may be determined by those skilled in the art according to the actual situation, which is not limited in this specification.
Step 405, determining whether the number of the data to be stored reaches a preset number. If yes, go to step 406; otherwise, jump to step 409.
In this embodiment, whether the number reaches the preset number is used as a preset condition for whether to store the identification information of the data in the block chain storage area. It should be noted that, in this embodiment, the storing the identification information into the blockchain storage area when the number reaches the preset number refers to: and storing the identification information of the part of data into the blockchain storage area when the number of the data of which the data is stored into the data storage area and the identification information is not stored into the blockchain storage area reaches a preset number.
The process may refer to fig. 5, and in the case shown in fig. 5, the preset number is set to 3. At this time, 8 data, i.e., data 1 to 8, are held in the data storage area. In this case, the identification information of every 3 data is packed into a block to be stored in the block chain of the block chain storage area, as shown in fig. 5, the identification information of data 1-3 and data 4-6 are packed into blocks 1 and 2, respectively, and the identification information of data 7 and 8 is not packed into a block to be stored in the block chain storage area because the number of the data has not reached 3.
Step 406, creating a new block;
in this embodiment, each time it is determined that the amount of data to be stored reaches a preset value, a new block can be created as a target block for storing the identification information of the data.
Step 407, storing the corresponding relationship between the hash value and the number of the data to be stored into the created new block.
In this embodiment, the identification information of the preset amount of data is stored in a unified manner. Therefore, after the step is executed, the target block should have a preset number of hash value-number correspondence stored therein.
In step 408, a block containing the corresponding relationship between the hash value and the number is added to the end of the block chain storage area.
After the corresponding relation between the hash value and the number is stored in the target block, the target block can be added to the tail end of the block chain storage area, so that the storage of the identification information of the data to be stored is completed.
In step 409, the operation of saving the identification information to the block chain storage area is not performed.
According to the technical scheme, the identification information of the data is stored in the block chain of the block chain storage area, so that the identification information of the data is associated with each other (the association relation between the identification information is established through parent hash), and the identification information is not easy to be tampered. Furthermore, because the identification information is in one-to-one correspondence with the data, once the data stored in the data storage area is tampered, the identification information corresponding to the data cannot be found, so that the stored data is difficult to be tampered, and the safety of the data is further ensured.
Fig. 6 illustrates a data verification method according to an exemplary embodiment of the present disclosure. The method is used to verify data stored using the method shown in figure 4. As shown in fig. 5, the method may include the steps of:
step 601, receiving a verification request.
In this embodiment, when a user needs to use a certain data, the data may be verified, and at this time, the data storage node may be instructed to verify the target data to be verified by sending a verification request including a number of the data to be verified to the data storage node.
In this embodiment, a correspondence table between a number and a hash value may be generated based on a stored process in a storage stage, so that a user may search for a number of target data to be verified when the user needs to verify any stored data. Of course, the user may also retrieve the number from the data storage area or the blockchain storage area.
Step 602, the hash value of the target data to be verified is obtained from the block chain storage area according to the number in the verification request.
Step 603, acquiring target data to be verified from the data storage area according to the number in the verification request.
And step 604, verifying the target data to be verified based on the obtained hash value.
In this embodiment, the hash value of the acquired target data may be recalculated based on an algorithm that calculates the hash value at the time of storage, and the calculated hash value may be compared with the acquired hash value to verify whether the target data is tampered.
According to the technical scheme, the storage mode shown in fig. 4 uses the corresponding relationship between the serial number of the data and the hash value as the identification information, so that a user can acquire the target data to be verified and the hash value thereof from the data storage area and the block chain storage area respectively by sending the serial number to the data storage node, and then verify the target data based on the hash value, thereby ensuring the security of the data.
FIG. 7 is an interaction diagram illustrating a transaction storage method in accordance with an exemplary embodiment of the present specification. The method adopts a PBFT consensus mechanism to perform consensus on the hash value of the transaction. As shown in fig. 7, the method may include the steps of:
in step 701, a block link node receives a transaction to be stored.
In this embodiment, the block link point refers to all nodes in the block link network, in other words, receiving the transaction to be stored in this step refers to: all nodes in the blockchain network receive the respectively received transactions to be stored, for example, as in fig. 7, the blockchain nodes A, B, C are all nodes in the blockchain network, and then the blockchain nodes A, B, C receive the respectively received transactions. Next, the present embodiment takes block link point A, B, C as an example to describe the above transaction storage method. For convenience of description, the block chain node A, B, C will be referred to hereinafter simply as node a, node B, and node C, respectively. It should be understood that although only A, B, C blockchain nodes are included in fig. 7, a substantial number of nodes should be included in a blockchain network.
In step 702, the block nodes store the received raw data of the transaction in their respective down-link storage spaces.
Each blockchain network node can store the transaction to the respective down-link storage space after receiving the transaction. For example, assume that node a as in fig. 7 receives transactions a, b, c; the node B receives the transactions m and n; node C receives transactions x, y. Then, the node a will store the original data of the transactions a, b, c in the down-link storage space of the node a; the node B stores the original data of the transactions m and n in the down-link storage space of the node B; node C will save the raw data of transaction x, y in node C's down-chain storage space.
At step 703, the block nodes calculate the hash value of the raw data of the transaction to be stored.
In the above example, in this step, the node a calculates its hash value based on the original data of the transactions a, b, and c; the node B respectively calculates the hash values of the original data of the transactions m and n; node C will calculate its hash value based on the raw data of transactions x, y, respectively.
In step 704, the non-master node in the blockchain network sends the computed hash value to the master node.
In this embodiment, the hash values of the transactions may be identified to determine which transaction identification information is to be uplinked. Since the PBFT consensus mechanism is adopted in this embodiment, a master node is included in the blockchain network, and the master node is responsible for consensus on the transaction to be stored. Therefore, the non-master nodes in the blockchain network need to send the hash values of the respective received transactions to the master node, so that the master node can identify the hash values of the transactions to be stored.
Taking the above example, assuming that the master node in the current blockchain network is node B, node a needs to send hash values corresponding to transactions a, B, and c to node B; node C needs to send the hash values corresponding to transactions x, y to node B.
In step 705, the primary node numbers the hash values that need to be uplinked.
After receiving the hash values of the transactions to be stored sent by other nodes in the blockchain network, the main node numbers the hash values needing to be linked up, and takes the numbers as the index numbers of the transactions corresponding to the hash values. Further, the corresponding relation between the number and the hash value is used as the identification information of the corresponding transaction.
For example, if the hash value to be linked is determined to be the hash value corresponding to the transaction c, m, n, x, the number of the hash value can be determined to be 1, 2, 3, 4. For convenience, the hash value of the transaction c is hereinafter referred to as hash c, and other transactions are similar, and are not described herein.
Of course, it should be noted that when the master node numbers the hash value, it is necessary to determine the number information that is currently used. For example, assuming that the numbers saved to blockchain nodes already include 1-7, this number should start at 8.
In step 706, the primary node broadcasts the hash value and the corresponding number of the uplink to all nodes in the blockchain network.
Taking advantage of the above example, the node B may send the corresponding relationship of the hash c-1, the hash m-2, the hash n-3, and the hash x-4 to all other nodes in the blockchain network.
In step 707, the block link points form a block based on the correspondence between the hash value and the number.
In this embodiment, after the block link point determines the identification information to be linked, i.e. the corresponding relationship between the number to be linked and the hash value, a new block can be created, and the determined identification information is stored in the block.
Taking the above example, all nodes including node A, B, C create a new block, and store four sets of corresponding relationships of hash c-1, hash m-2, hash n-3, and hash x-4 into the block.
It is noted that in this step, the numbering of the transactions stored in the respective down-link memory spaces is also included. Taking over the above example, if node a should number transaction c stored in the local storage space under the local chain to 1; the node B should number the transaction m stored in the storage space under the local chain to be 2 and the transaction n to be 3; node C should number transaction x, which is stored in the local chain down memory space, as 4.
At step 708, the block link point saves the formed block to the end of the local block chain.
In this step, each block link point stores the respective formed block to the end of the respective block chain.
In the embodiment, the to-be-stored transactions received by each block chain node are stored in the respective storage space under the block chain, so that data redundancy caused by the fact that the transaction original data needs to be stored in each block chain node of the existing block chain is avoided, and waste of storage resources is reduced.
Secondly, the serial number and the hash value of the transaction are used as identification information, and the identification information is stored in the block chain, so that the identification information cannot be tampered. Furthermore, the identification information corresponds to the original data of the transaction one by one, so that the original data of the transaction cannot be tampered.
Therefore, compared with the existing block chain technology, the method and the device have the advantages that the problem of data redundancy is avoided under the condition that the data are not tampered, and further the waste of storage resources is avoided.
Fig. 8 is an interaction diagram illustrating a transaction verification method in accordance with an exemplary embodiment of the present disclosure. The method is used to validate transactions stored using the method shown in figure 7. As shown in fig. 8, the method may include the steps of:
in step 801, a block link node receives a verification transaction.
In this embodiment, the blockchain node refers specifically to the blockchain node that receives the verification transaction, rather than all nodes in the blockchain network in the previous embodiment.
In this embodiment, the block chain node point receiving the verification transaction may be the same node as the block chain node point storing the target transaction to be verified, or may be a different node.
In step 802, the chunk nexus determines a hash value for the target transaction to be verified based on the index number in the verification transaction.
In this embodiment, a hash value corresponding to the target transaction may be searched for in the local blockchain based on the index number, and further, a hash verification transaction may be sent to other nodes in the blockchain network to verify that the hash value has not been tampered with.
Step 803, the block link points judge whether the target transaction to be verified is stored in the storage space under the local link according to the index numbers; if yes, jumping to step 804A; otherwise, the process jumps to 804B.
Step 804A, obtaining the target transaction from the local under-link storage space based on the index number.
Step 804B, the blockchain node sends a target node query request to the master node in the blockchain network.
In the above embodiment, the stored transactions are identified through a similar PBFT identifying mechanism, and the record of which blockchain node stores the original data of any stored transaction is stored in the host node, so that the target node storing the target transaction can be determined by sending a query request including an index number to the host node.
Of course, in another case, the information of the blockchain node where the corresponding transaction is stored may be stored in the blockchain during the storing process. In this case, when any transaction needs to be verified, it is only necessary to search for the block chain node in which the transaction is stored, without sending an inquiry request to the master node.
In step 805, the master node determines the target node based on the index number in the target node query request.
In step 806, the master node returns the information of the target node to the blockchain node.
In step 807, the blockchain node sends a target transaction acquisition request to the target node.
In this embodiment, the verification operation is performed by the node that receives the verification transaction, and therefore, an acquisition request needs to be initiated to the target node to obtain the original data of the target transaction and verify the original data.
In another case, the node storing the original data of the target transaction may also perform the verification operation, at this time, the blockchain node receiving the verification transaction may forward the verification transaction or the index number of the target transaction to the determined target node, so that the target node verifies the target transaction, and the blockchain node receiving the verification transaction only needs to receive the verification result of the target node.
At step 808, the target node queries the raw data of the target transaction based on the index number.
Step 809, the target node returns the raw data of the target transaction to the blockchain node.
At step 810, the block nodes verify the raw data of the target transaction based on the hash value of the target transaction.
According to the technical scheme, in the case that the verification transaction is received, the target node in which the target transaction is stored is determined based on the index number included in the verification transaction, and then the original data of the target transaction is obtained, so that the target transaction is verified based on the hash value stored in the block chain. In this way, a user can verify the authenticity of the raw data of any transaction when it is required to use it.
FIG. 9 is an interaction diagram illustrating another transaction storage method, according to an exemplary embodiment of the present description. The method adopts a POW consensus mechanism to perform consensus on the original data of the transaction. As shown in fig. 9, the method may include the steps of:
in step 901, a block chain node receives a transaction to be stored.
Similar to the embodiment shown in fig. 7, the blockchain node in this embodiment also specifically refers to all nodes in the blockchain network, in other words, receiving the transaction to be stored in this step refers to: all nodes in the block chain network respectively receive the received transactions to be stored.
Next, the transaction storage method proposed in this embodiment is described by taking the node A, B, C in the blockchain network as an example. Unlike the transaction storage method shown in fig. 7, the present embodiment employs a POW consensus mechanism, and therefore, in the blockchain network of the present embodiment, there is no concept of a master node, i.e., all nodes are in the same status.
In step 902, the blockchain node broadcasts the received raw data of the transaction in the blockchain network.
In this embodiment, the received raw data of the transaction is used as the basis for consensus. After any node receives the transaction to be stored, the original data of the transaction is broadcasted to all nodes in the blockchain network.
This is illustrated by block link point A, B, C shown in fig. 9. Still assume that node a receives transactions a, b, c; the node B receives the transactions m and n; node C receives transactions x, y. Then node a will send the raw data of transactions a, B, C to nodes B and C; the node B sends the original data of the transactions m and n to the nodes A and C; node C will send the raw data for transaction x, y to nodes a and B.
In other words, in the embodiment, any node in the blockchain network stores the original data of the transaction to be stored, which is received by all nodes in the blockchain network. I.e., block link points A, B, C as in fig. 9, each hold the raw data for transactions a, b, c, m, n, x, y.
In step 903, the block nodes compete for accounting based on a predetermined rule.
After the original data of the transaction to be stored is broadcasted, each node in the blockchain network can compete for the accounting right according to a preset rule. For example, the attribution of the billing right may be determined by conventional means of calculating a mathematical problem.
In step 904, the block link points that have acquired the accounting rights determine the transaction to be linked.
In connection with the above example, assuming that the node B acquires the accounting right in the blockchain network, the node B may determine the transaction to be linked according to a certain rule. Suppose that the determined pending uplink transaction is still the transaction c, m, n, x.
Step 905, the block link points with the accounting right number the transaction to be linked.
In this step, the node B may determine the numbers of the pending uplink transactions c, m, n, and x as 1, 2, 3, and 4, respectively.
Step 906, the blockchain node that obtained the accounting right broadcasts the transaction to be linked and its number in the blockchain network.
Taking advantage of the above example, the determined correspondence between the to-be-linked transaction and the number, i.e., C-1, m-2, n-3, and x-4, may be sent to other nodes in the blockchain network, such as nodes a and C.
In step 907, the block link stores the mapping relationship between the original data of the transaction to be linked and the serial number in the storage space under the link.
In this embodiment, since the original data of the transaction is stored in the down-link storage space of all the blockchain nodes, the corresponding relationship between the transaction and the serial number only needs to be stored in the down-link storage space in this step, so as to be used for searching the original data of the transaction in the following step.
In the step, four sets of corresponding relationships, c-1, m-2, n-3 and x-4, can be stored in the down-link storage space.
In step 908, the block nodes calculate a hash of the raw data of the transaction to be linked.
Following the above example, in this step, the node A, B, C may calculate hash values for the transactions c, m, n, and x, respectively.
In step 909, the block link points form a block based on the hash value and number correspondence of the transaction to be linked.
Taking the above example as a support, after calculating the hash values of the transactions c, m, n, and x, the node A, B, C may create new blocks respectively, and store four sets of corresponding relationships, namely hash c-1, hash m-2, hash n-3, and hash x-4, in the created blocks.
At step 910, a block link point adds the formed block to the end of the block chain.
Taking the above example as a support, the node A, B, C may add the created blocks storing four sets of correspondences, i.e., hash c-1, hash m-2, hash n-3, and hash x-4, to the block chains.
In the embodiment, the original data of the transaction is stored in the down-link storage space of each node in the block chain network, so that cross-node search is not needed in the process of searching the original data of the transaction, and the occupation of transmission resources is reduced.
Secondly, the hash value and the number of the transaction are stored to the chain as identification information, so that the hash value and the number cannot be tampered. Furthermore, the identification information corresponds to the original data of the transaction one by one, so that the original data of the transaction cannot be tampered.
FIG. 10 is a flow chart illustrating a method of transaction verification in accordance with an exemplary embodiment of the present description. The method is used to validate transactions stored using the method shown in figure 9, which is applied to blockchain nodes. As shown in fig. 10, the method may include the steps of:
at step 1001, a verification transaction is received.
In this embodiment, any node in the blockchain network can be used as the blockchain node that receives the verification transaction.
Step 1002, determining a hash value of the target transaction to be verified based on the index number in the verification transaction.
In this embodiment, because the storage manner shown in fig. 9 stores the corresponding relationship between the index number and the hash value in the block chain of each node, the hash value corresponding to the index number can be searched in the local block chain according to the index number. Of course, the intelligent contract for obtaining the hash value may also be invoked to obtain the hash value corresponding to the index number.
Further, after the hash value is obtained, a hash value verification request may be sent to other nodes in the blockchain network, so as to ensure that the hash value in the local blockchain is consistent with the hash values stored in the blockchains of the other nodes.
Step 1003, obtaining original data of the target transaction to be verified from the local link down storage space based on the index number in the verification transaction.
In this embodiment, since all the blockchain nodes store the original data of all transactions in the blockchain network, only the original data of the target transaction needs to be searched in the storage space under the local chain according to the index number.
And 1004, verifying the acquired original transaction based on the determined hash value.
Compared with the verification method shown in fig. 8, because the block chain link points in the embodiment store the original data of all transactions in the block chain network, the embodiment does not need to search across nodes in the verification process, and the occupation of transmission resources is reduced.
Fig. 11 is a schematic structural diagram illustrating an electronic device according to an exemplary embodiment of the present disclosure. Referring to fig. 11, at 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 storage 1110, but may also include hardware required for other services. The processor 1102 reads corresponding computer programs from the non-volatile memory 1110 into the memory 1108 and then runs them, forming a data storage device on a logical level. Of course, besides the software implementation, the present specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
Referring to fig. 12, in a software implementation, the data storage device may include:
a receiving unit 1201 that receives data to be stored;
a saving unit 1202 that saves the data to a data storage area in the data storage node;
an adding unit 1203 adds the identification information of the data to a target block, and stores the target block to a block chain storage area in the data storage node, so that the target block is added to the end of a block chain in the block chain storage area.
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.
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 configured to receive a verification request, where the verification request includes an index number of target data;
the device further comprises:
an obtaining unit 1204, configured to obtain, according to the index number, a hash value of the target data stored in the block chain storage area and the target data stored in the data storage area;
a verification unit 1205 verifies the acquired target data based on the hash value of the target data.
Optionally, the data storage area and the block chain storage area in the data storage node both store data or identification information by using a storage technology of a streaming database.
Optionally, the operation of saving the data to the data storage area and the operation of saving the identification information to the block chain storage area are sequentially performed; or
And asynchronously executing the operation of saving the data to the data storage area and the operation of saving the identification information to the block chain storage area.
Fig. 13 is a schematic structural diagram illustrating another electronic device according to an exemplary embodiment of the present specification. Referring to 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, but may also include other hardware required for services. Processor 1302 reads corresponding computer programs from non-volatile memory 1310 into memory 1308 and then runs, forming a transactional memory device at a logical level. Of course, besides the software implementation, the present specification does not exclude other implementations, such as logic devices or a combination of software and hardware, and the like, that is, the execution subject of the following processing flow is not limited to each logic unit, and may be hardware or logic devices.
Referring to fig. 14, in a software implementation, the transaction storage device may include:
a receiving unit 1401 that receives a transaction to be stored;
a saving unit 1402, for saving the original data of the transaction to a down-link storage space;
an adding unit 1403, which performs consensus on the transaction or the identification information of the transaction with other block link points in the block chain network, and adds a target block to the end of the block chain if the consensus passes, where the block of the target block is used for recording the identification information of the transaction.
Optionally, the identification information of the transaction includes a hash value of the raw data and/or an index number of the raw data in the down-link storage space.
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 downlink storage space, and the receiving unit 1401 is further configured to receive a verification transaction, where the verification transaction includes the index number of the target transaction;
the device further comprises:
the invoking unit 1404 invokes an intelligent contract for searching for a hash value to obtain the hash value stored in the block chain and corresponding to the target transaction according to the index number;
an obtaining unit 1405, obtaining the original data of the target transaction stored in the storage space under the chain according to the index number;
a verification unit 1406 verifies the acquired original data based on the hash value corresponding to the target transaction.
Optionally, the obtaining unit is further configured to:
judging whether the target transaction is stored in a local link storage space or not based on the index number;
if so, acquiring the original data of the target transaction stored in the local link storage space according to the index number;
otherwise, sending a target node acquisition request to a main node in the block chain network to which the block chain link point belongs based on the index number so that the main node returns the related information of the target node according to the index number; and sending an original data acquisition request to the target node based on the related information so as to enable the target node to return the original data of the target transaction according to the index number.
Optionally, the down-link storage space and the block link both store transaction or identification information by using a storage technology of a streaming database.
Optionally, the operation of saving the original data of the transaction to the down-chain storage space and the operation of storing the identification information to the block chain are sequentially performed; or
And asynchronously executing the operation of saving the original data of the transaction to the down-chain storage space and the operation of storing the identification information to the block chain.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in the specification. One of ordinary skill in the art can understand and implement it without inventive effort.
In an exemplary embodiment, there is also provided a non-transitory computer readable storage medium, for example a memory, comprising instructions executable by a processor of a data storage device, a transaction storage device, to implement a method as described in any of the above embodiments, such as a data storage method may comprise: 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 a blockchain in the blockchain storage area.
The non-transitory 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, and the like, which are not limited in this specification.
The above description is only a preferred embodiment of the present disclosure, and should not be taken as limiting the present disclosure, and any modifications, equivalents, improvements, etc. made within the spirit and principle of the present disclosure should be included in the scope of the present disclosure.

Claims (6)

1. A transaction storage method applied to a blockchain node, the method comprising:
receiving a transaction to be stored;
storing the original data of the transaction to a down-link storage space;
performing consensus on the transaction or the hash value of the transaction with other block chain link points in a block chain network, and adding a target block to the tail end of the block chain when the consensus passes, wherein the block of the target block is used for recording identification information of the transaction; the identification information of the transaction comprises a hash value and an index number, wherein the index number is obtained by numbering the hash value according to an uplink sequence by a main node in the block chain network; the main node also stores the related information of the original data of the stored transaction of each node in the block chain network;
the method further comprises the following steps:
receiving a verification transaction, wherein the verification transaction comprises an index number of a target transaction;
calling an intelligent contract used for searching a hash value to acquire the hash value which is stored in the block chain and corresponds to the target transaction according to the index number;
judging whether the target transaction is stored in a local link storage space or not based on the index number; if so, acquiring the original data of the target transaction stored in the local link storage space according to the index number; otherwise, sending a target node acquisition request to a main node in the block chain network to which the block chain link point belongs based on the index number so that the main node returns the related information of the target node according to the index number; sending an original data acquisition request to the target node based on the relevant information so that the target node returns original data of the target transaction according to the index number;
and verifying the obtained original data based on the hash value corresponding to the target transaction.
2. The method of claim 1, the down-chain storage space and the blockchain each employing storage technology of a streaming database to store transaction or identification information.
3. The method of claim 1, wherein the first and second light sources are selected from the group consisting of,
sequentially executing an operation of saving the original data of the transaction to the down-chain storage space and an operation of saving the identification information to the block chain; or
And asynchronously executing the operation of saving the original data of the transaction to the down-chain storage space and the operation of saving the identification information to the block chain.
4. A transaction storage device for use with a blockchain node, the device comprising:
a receiving unit that receives a transaction to be stored;
the storage unit is used for storing the original data of the transaction to a down-link storage space;
the adding unit is used for carrying out consensus on the transaction or the hash value of the transaction with other block chain link points in a block chain network, and adding a target block to the tail end of a block chain under the condition that the consensus passes, wherein the block body of the target block is used for recording the identification information of the transaction; the identification information of the transaction comprises a hash value and an index number, wherein the index number is obtained by numbering the hash value according to an uplink sequence by a main node in the block chain network; the main node also stores the related information of the original data of the stored transaction of each node in the block chain network;
the receiving unit is further configured to: receiving a verification transaction, wherein the verification transaction comprises an index number of a target transaction;
the device further comprises:
the calling unit is used for calling an intelligent contract used for searching a hash value so as to obtain the hash value which is stored in the block chain and corresponds to the target transaction according to the index number;
the acquisition unit is used for judging whether the target transaction is stored in a local link lower storage space or not based on the index number; if so, acquiring the original data of the target transaction stored in the local link storage space according to the index number; otherwise, sending a target node acquisition request to a main node in the block chain network to which the block chain link point belongs based on the index number so that the main node returns the related information of the target node according to the index number; sending an original data acquisition request to the target node based on the relevant information so that the target node returns original data of the target transaction according to the index number;
and the verification unit is used for verifying the acquired original data based on the hash value corresponding to the target transaction.
5. An electronic device, comprising:
a processor;
a memory for storing processor-executable instructions;
wherein the processor implements the method of any one of claims 1-3 by executing the executable instructions.
6. A computer readable storage medium having stored thereon computer instructions which, when executed by a processor, carry out the steps of the method according to any one of claims 1-3.
CN202010277408.9A 2020-04-10 2020-04-10 Data storage method, transaction storage method and device Active CN111177277B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN202010277408.9A CN111177277B (en) 2020-04-10 2020-04-10 Data storage method, transaction storage method and device
CN202010976525.4A CN112182099A (en) 2020-04-10 2020-04-10 Transaction verification method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010277408.9A CN111177277B (en) 2020-04-10 2020-04-10 Data storage method, transaction storage method and device

Related Child Applications (1)

Application Number Title Priority Date Filing Date
CN202010976525.4A Division CN112182099A (en) 2020-04-10 2020-04-10 Transaction verification method and device

Publications (2)

Publication Number Publication Date
CN111177277A CN111177277A (en) 2020-05-19
CN111177277B true CN111177277B (en) 2020-08-04

Family

ID=70655180

Family Applications (2)

Application Number Title Priority Date Filing Date
CN202010976525.4A Pending CN112182099A (en) 2020-04-10 2020-04-10 Transaction verification method and device
CN202010277408.9A Active CN111177277B (en) 2020-04-10 2020-04-10 Data storage method, transaction storage method and device

Family Applications Before (1)

Application Number Title Priority Date Filing Date
CN202010976525.4A Pending CN112182099A (en) 2020-04-10 2020-04-10 Transaction verification method and device

Country Status (1)

Country Link
CN (2) CN112182099A (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220004647A1 (en) * 2020-07-06 2022-01-06 International Business Machines Corporation Blockchain implementation to securely store information off-chain
CN112819617B (en) * 2020-08-21 2022-06-07 支付宝(杭州)信息技术有限公司 Data uplink method and device, electronic equipment and storage medium
CN113127562A (en) * 2021-03-30 2021-07-16 河南九域腾龙信息工程有限公司 Low-redundancy block chain data storage and retrieval method and system
CN113064900A (en) * 2021-04-06 2021-07-02 北京瑞卓喜投科技发展有限公司 Method and device for generating index of transaction data on chain and electronic equipment
CN113064901A (en) * 2021-04-06 2021-07-02 北京瑞卓喜投科技发展有限公司 Method and device for forming data micro-index in contract on chain and electronic equipment
CN113064902A (en) * 2021-04-06 2021-07-02 北京瑞卓喜投科技发展有限公司 Method and device for retrieving transaction data on chain and electronic equipment
CN112988334B (en) * 2021-05-06 2021-08-31 云宏信息科技股份有限公司 Method and readable medium for managing multiple hosts in virtualized environment
CN113055156A (en) * 2021-05-29 2021-06-29 苏州智能交通信息科技股份有限公司 Configuration service method, system and terminal based on content addressing and block chain
CN116993505B (en) * 2023-09-25 2024-01-16 腾讯科技(深圳)有限公司 Transaction processing method, device, electronic equipment and storage medium

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107273410B (en) * 2017-05-03 2020-07-07 上海点融信息科技有限责任公司 Block chain based distributed storage
CN108537063A (en) * 2018-02-26 2018-09-14 阿里巴巴集团控股有限公司 A kind of method, apparatus and equipment of data storage
CN108924130B (en) * 2018-07-02 2021-05-07 上海达家迎信息科技有限公司 Block data verification method, device, equipment and storage medium
BR112019015208A2 (en) * 2018-12-13 2021-07-27 Alibaba Group Holding Limited computer-implemented methods, non-transient computer-readable storage media, and systems
CN110061838B (en) * 2019-04-28 2022-07-19 广州大学 Decentralized storage system for DNS resource records and implementation method thereof

Also Published As

Publication number Publication date
CN112182099A (en) 2021-01-05
CN111177277A (en) 2020-05-19

Similar Documents

Publication Publication Date Title
CN111177277B (en) Data storage method, transaction storage method and device
CN110602148B (en) Method and device for generating state tree of block and verifying data on chain
EP3678346B1 (en) Blockchain smart contract verification method and apparatus, and storage medium
CN109242500B (en) Block chain transaction validity verification method and device and storage medium
EP3446272B1 (en) Method and system for an efficient consensus mechanism for permissioned blockchains using audit guarantees
CN110737664B (en) Method and device for synchronizing block chain link points
CN109391645B (en) Block chain lightweight processing method, block chain node and storage medium
CN110147204B (en) Metadata disk-dropping method, device and system and computer-readable storage medium
CN109298835B (en) Data archiving processing method, device, equipment and storage medium of block chain
CN110096522B (en) Block chain data processing method, device and equipment supporting relational retrieval
CN108121827A (en) A kind of synchronous method and device of full dose data
CN110209714A (en) Report form generation method, device, computer equipment and computer readable storage medium
CN110837505A (en) State data storage method, state data synchronization device and storage medium
CN114219477B (en) Block chain data storage expansion method based on-chain storage
CN102724301B (en) Cloud database system and method and equipment for reading and writing cloud data
CN116756253B (en) Data storage and query methods, devices, equipment and media of relational database
CN114372058A (en) Spatial data management method and device, storage medium and block chain system
WO2019024631A1 (en) Blockchain lightweight processing method, blockchain node and storage medium
CN110196786B (en) Method and equipment for controlling memory in database rollback synchronization
CN114127707A (en) System, computing node and method for processing write requests
CN116578627A (en) Method and device for providing data support for multi-service platform, medium and equipment
CN116775712A (en) Method, device, electronic equipment, distributed system and storage medium for inquiring linked list
CN106599326B (en) Recorded data duplication eliminating processing method and system under cloud architecture
CN116107801A (en) Transaction processing method and related product
CN110569221A (en) file system management method, device, equipment and storage medium with version function

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant