CN113297214B - Snapshot processing method, equipment and storage medium based on DAG block chain - Google Patents

Snapshot processing method, equipment and storage medium based on DAG block chain Download PDF

Info

Publication number
CN113297214B
CN113297214B CN202110491562.0A CN202110491562A CN113297214B CN 113297214 B CN113297214 B CN 113297214B CN 202110491562 A CN202110491562 A CN 202110491562A CN 113297214 B CN113297214 B CN 113297214B
Authority
CN
China
Prior art keywords
snapshot
block
current
block number
node
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
CN202110491562.0A
Other languages
Chinese (zh)
Other versions
CN113297214A (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.)
Hunan Chenhan Technology Co ltd
Original Assignee
Hunan Zhaowuxin Chain Technology Group 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 Hunan Zhaowuxin Chain Technology Group Co ltd filed Critical Hunan Zhaowuxin Chain Technology Group Co ltd
Priority to CN202110491562.0A priority Critical patent/CN113297214B/en
Publication of CN113297214A publication Critical patent/CN113297214A/en
Application granted granted Critical
Publication of CN113297214B publication Critical patent/CN113297214B/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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2255Hash tables
    • 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/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2272Management thereof

Abstract

The invention discloses a snapshot processing method, equipment and a storage medium based on a DAG block chain. The method comprises the steps of obtaining a preset snapshot height, determining an ending block of a current snapshot according to the preset snapshot height, determining a consensus sequence from an initial block to the ending block according to a consensus result of a DAG block chain, recording block numbers of all blocks into a linked list according to the consensus sequence, reading a current block number from the linked list, obtaining transaction information of the current block number, constructing a current node according to the transaction information and a directional relation between the current node and a previous node to obtain a snapshot of the current block number, and returning to the step of reading the current block number from the linked list to obtain the current snapshot. The snapshot storage structure is designed according to the characteristics of the DAG block chain, so that the structure is consistent with the structure of the DAG block chain diagram, the transaction information on the DAG block chain is stored based on the snapshot storage structure, and the filing storage efficiency is effectively improved.

Description

Snapshot processing method, equipment and storage medium based on DAG block chain
Technical Field
The present invention relates to the field of block chaining technologies, and in particular, to a snapshot processing method and device based on a DAG block chaining, and a storage medium.
Background
In order to recover the data of the blockchain under a specific condition (such as a system crash), the blockchain usually takes the form of snapshot to archive the data on the chain at regular time, that is, at intervals, the data of the blockchain at the current time is packed and stored in the medium. When a special case triggers, the blockchain data can be restored by inverting the snapshot data.
The current block chain snapshot mechanism is oriented to a traditional block chain with a chain structure (such as bitcoin, ether house, Fabric block chain, etc.), however, the current block chain structure of a Directed Acyclic Graph (DAG) is mainly based on the Directed Acyclic Graph structure, and the archiving and storing efficiency is low because the existing block chain snapshot storing structure is not adapted to the Graph structure of DAG.
Disclosure of Invention
The invention mainly aims to provide a snapshot processing method, equipment and a storage medium based on a DAG (demand oriented architecture) block chain, and aims to solve the technical problem that the existing block chain snapshot storage structure in the prior art is not suitable for a DAG graph structure, so that the archiving and storage efficiency is low.
In order to achieve the above object, a first aspect of the present invention provides a snapshot processing method based on a DAG blockchain, including the following steps:
acquiring a preset snapshot height;
determining a termination block of the current snapshot according to a preset snapshot height;
determining a consensus sequence from the initial block to the termination block according to the consensus result of the DAG block chain;
recording the block numbers of all blocks into a linked list according to the consensus sequence;
reading the current block number from the linked list and acquiring the transaction information of the current block number;
constructing a current node and a direction relation between the current node and a previous node according to the transaction information to obtain a snapshot of a current block number;
and returning to the step of reading the current block number from the linked list to obtain the current snapshot.
Optionally, the initial block is a created block or a terminated block of a previous snapshot.
Optionally, constructing the current node according to the transaction information includes:
correspondingly storing the transaction information and the current node based on a preset list; wherein the parameters in the preset list include transaction, sender, recipient, time and amount.
Optionally, the method further comprises:
after the current snapshot is obtained, calculating the hash value of the current snapshot;
reading a starting block number and an ending block number from the current snapshot;
constructing data to be identified according to the hash value, the starting block number and the ending block number of the current snapshot;
and sending the data to be identified to a DAG block chain so as to perform identification processing on the data to be identified.
Optionally, the method further comprises:
after the starting block number and the ending block number are read from the current snapshot, searching consensus data of which the type is the snapshot in the DAG block chain according to the starting block number and the ending block number to obtain the consensus data matched with the starting block number and the ending block number;
and acquiring the hash value of the consensus data, and verifying the current snapshot according to the hash value of the current snapshot and the hash value of the consensus data.
Optionally, the method further comprises:
when the current snapshot passes verification, detecting whether the starting block number is the block number of the created block or not to obtain a detection result;
deleting the block data of the node corresponding to the current snapshot according to the detection result;
and restoring the block data according to the current snapshot.
Optionally, deleting the block data of the node corresponding to the current snapshot according to the detection result, including:
when the starting block number is the block number of the founding block, deleting all block data of the node corresponding to the current snapshot;
when the starting block number is not the block number of the founding block, block data subsequent to the block having the starting block number in the node corresponding to the current snapshot is deleted.
Optionally, restoring the block data according to the current snapshot includes:
obtaining a node subsequent to the node of the starting block number from the current snapshot;
and writing the transaction information and the pointing relationship of the latter node into the node.
A second aspect of the present invention provides a snapshot processing apparatus, including: the snapshot processing system comprises a memory, a processor and a snapshot processing program stored on the memory and capable of running on the processor, wherein the snapshot processing program is configured to realize the steps of the snapshot processing method.
A third aspect of the present invention provides a storage medium, on which a snapshot processing program is stored, where the snapshot processing program, when executed by a processor, implements the steps of the snapshot processing method as above.
According to the scheme provided by the embodiment of the invention, the preset snapshot height is obtained, the termination block of the current snapshot is determined according to the preset snapshot height, the consensus sequence from the initial block to the termination block is determined according to the consensus result of the DAG block chain, the block numbers of all the blocks are recorded into the linked list according to the consensus sequence, the current block number is read from the linked list, the transaction information of the current block number is obtained, the current node and the direction relation between the current node and the previous node are established according to the transaction information to obtain the snapshot of the current block number, and the step of reading the current block number from the linked list is returned to obtain the current snapshot. The snapshot storage structure is designed according to the characteristics of the DAG block chain, so that the structure is consistent with the structure of the DAG block chain diagram, the transaction information on the DAG block chain is stored based on the snapshot storage structure, and the filing storage efficiency is effectively improved.
Drawings
FIG. 1 is a schematic diagram of a snapshot processing apparatus of a hardware operating environment according to an embodiment of the present invention;
FIG. 2 is a flowchart illustrating a snapshot processing method according to a first embodiment of the present invention;
FIG. 3 is a flowchart illustrating a snapshot processing method according to a second embodiment of the present invention;
FIG. 4 is a flowchart illustrating a snapshot processing method according to a third embodiment of the present invention;
FIG. 5 is a flowchart illustrating a snapshot processing method according to a fourth embodiment of the present invention;
the implementation, functional features and advantages of the present invention will be further described with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Referring to fig. 1, fig. 1 is a schematic structural diagram of a snapshot processing device of a hardware operating environment according to an embodiment of the present invention.
As shown in fig. 1, the snapshot processing apparatus may include: a processor 1001, such as a CPU, a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may comprise a display screen, an input unit such as a keyboard, and the optional user interface 1003 may also comprise a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high speed RAM memory or a stable memory such as a disk memory. The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the configuration shown in fig. 1 does not constitute a limitation of the snapshot processing apparatus and may include more or fewer components than those shown, or some components in combination, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a snapshot processing program.
In the snapshot processing apparatus shown in fig. 1, the network interface 1004 is mainly used for data communication with an external network; the user interface 1003 is mainly used for receiving input instructions of a user; the snapshot processing apparatus calls the snapshot processing program stored in the memory 1005 by the processor 1001, and performs the following operations:
acquiring a preset snapshot height;
determining a termination block of the current snapshot according to a preset snapshot height;
determining a consensus sequence from the initial block to the termination block according to the consensus result of the DAG block chain;
recording the block numbers of all blocks into a linked list according to the consensus sequence;
reading the current block number from the linked list and acquiring the transaction information of the current block number;
constructing a current node and a direction relation between the current node and a previous node according to the transaction information to obtain a snapshot of a current block number;
and returning to the step of reading the current block number from the linked list to obtain the current snapshot.
Further, the processor 1001 may call the snapshot handler stored in the memory 1005, and further perform the following operations:
correspondingly storing the transaction information and the current node based on a preset list; wherein the parameters in the preset list include transaction, sender, recipient, time and amount.
Further, the processor 1001 may call the snapshot handler stored in the memory 1005, and further perform the following operations:
after the current snapshot is obtained, calculating the hash value of the current snapshot;
reading a starting block number and an ending block number from the current snapshot;
constructing data to be identified according to the hash value, the starting block number and the ending block number of the current snapshot;
and sending the data to be identified to a DAG block chain so as to perform identification processing on the data to be identified.
Further, the processor 1001 may call the snapshot handler stored in the memory 1005, and further perform the following operations:
after the starting block number and the ending block number are read from the current snapshot, searching consensus data with the type of the snapshot in a DAG block chain according to the starting block number and the ending block number to obtain the consensus data matched with the starting block number and the ending block number;
and acquiring the hash value of the consensus data, and verifying the current snapshot according to the hash value of the current snapshot and the hash value of the consensus data.
Further, the processor 1001 may call the snapshot handler stored in the memory 1005, and further perform the following operations:
when the current snapshot passes verification, detecting whether the starting block number is the block number of the created block or not to obtain a detection result;
deleting the block data of the node corresponding to the current snapshot according to the detection result;
and restoring the block data according to the current snapshot.
Further, the processor 1001 may call the snapshot handler stored in the memory 1005, and further perform the following operations:
when the starting block number is the block number of the founding block, deleting all block data of the node corresponding to the current snapshot;
and when the starting block number is not the block number of the created block, deleting the block data after the block with the starting block number in the node corresponding to the current snapshot.
Further, the processor 1001 may call the snapshot handler stored in the memory 1005, and further perform the following operations:
obtaining a node subsequent to the node of the starting block number from the current snapshot;
and writing the transaction information and the pointing relationship of the latter node into the node.
According to the scheme, the current snapshot is obtained by obtaining the preset snapshot height, determining the termination block of the current snapshot according to the preset snapshot height, determining the consensus sequence from the initial block to the termination block according to the consensus result of the DAG block chain, recording the block numbers of all the blocks into the linked list according to the consensus sequence, reading the current block number from the linked list, obtaining the transaction information of the current block number, constructing the current node according to the transaction information and the pointing relation between the current node and the previous node to obtain the snapshot of the current block number, and returning to the step of reading the current block number from the linked list. The snapshot storage structure is designed according to the characteristics of the DAG block chain, so that the structure is consistent with the structure of the DAG block chain diagram, the transaction information on the DAG block chain is stored based on the snapshot storage structure, and the filing storage efficiency is effectively improved.
Based on the above hardware structure, an embodiment of the snapshot processing method of the present invention is provided.
Referring to fig. 2, fig. 2 is a flowchart illustrating a snapshot processing method according to a first embodiment of the present invention.
In a first embodiment, a snapshot processing method includes the steps of:
s10: acquiring a preset snapshot height;
it should be understood that the preset snapshot height refers to a snapshot height that is declared by a user or set by a system, and the value of the preset snapshot height is different according to a mode of the snapshot.
The snapshot mode can be generally divided into a full snapshot and an incremental snapshot, and the full snapshot refers to a snapshot generated by all transactions in a created block to a certain block according to a transaction sequence. The incremental snapshot is to snapshot all the transactions in a non-created block to another block according to a transaction sequence.
S20: determining a termination block of the current snapshot according to a preset snapshot height;
in a specific implementation, when the current block height of the DAG block chain reaches a preset snapshot height, a snapshot generating mechanism is started, and a termination block of the current snapshot is positioned according to the preset snapshot height.
S30: determining a consensus sequence from the initial block to the termination block according to the consensus result of the DAG block chain;
wherein, the initial block is a created block or a terminated block of a previous snapshot.
In one embodiment, when the initial block is a created block, the full-snapshot generating mechanism is started, and the consensus sequence from the created block to the terminated block is determined according to the consensus result.
In another embodiment, when the initial block is the end block of the previous snapshot, the incremental snapshot generating mechanism is started, and the consensus sequence from the end block of the last snapshot to the end block of the current snapshot is determined according to the consensus result.
S40: recording the block numbers of all blocks into a linked list according to the consensus sequence;
it should be understood that all blocks refer to all blocks from the initial block to the end block, and in order to sequentially obtain transaction information from the DAG block chain, the block numbers of all blocks are recorded in the linked list in the present embodiment.
S50: reading the current block number from the linked list and acquiring the transaction information of the current block number;
it should be noted that, since reading the block number from the linked list is a continuous process, that is, in order to obtain the transaction information of all the block numbers, the block number is continuously read for a period of time, and thus the current block number can be understood as the block number being read.
And after taking out the current block number, reading all transaction information of the block number from the block corresponding to the current block number in the DAG block chain, and storing the transaction information according to a preset snapshot storage structure.
S60: constructing a current node and a direction relation between the current node and a previous node according to the transaction information to obtain a snapshot of a current block number;
in the prior art, the blockchain snapshot is generated based on a traditional blockchain with a chain structure, however, the DAG blockchain is mainly based on a directed acyclic graph structure, and if a blockchain snapshot mechanism in the prior art is used, the following limitations will be present:
(1) the snapshot storage structure is not suitable for the graph structure of the DAG block chain, and can not be archived and stored efficiently;
(2) the DAG block chain generally adopts an asynchronous consensus mechanism, and at a certain time, account book data of each accounting node may be different, so how to take account of different account books when taking a snapshot is also a problem that is not considered by the current snapshot mechanism.
In this embodiment, a snapshot storage structure of a graph structure is designed for the problem that a DAG block chain structure is different from a directed acyclic graph and an account book. Let the snapshot of the DAG blockchain be DAGSS ═ (V, E), where V represents a node of the graph, E represents an edge of the graph, V corresponds to a block of the DAG blockchain, E corresponds to a relationship between DAG blockchain blocks, and E is a directed edge. The specific structure in V is (type, sender, receiver, timestamp, cont), wherein type represents type, sender represents sender, receiver represents receiver, timestamp represents time, and cont represents content.
In a specific implementation, after obtaining the transaction information, the transaction information may be stored in correspondence with the current node based on a preset list, that is, the transaction information of the current block number is stored in the current node V in a form of (trans, sender, receiver, timestamp, account) list1(ii) a Wherein trans represents type of transaction, sender represents sender, receiver represents receiver, timetag represents time, and amount represents amount. When the transaction information is stored in the current node V1Then, the former node V is needed0And the current node V1Connect and connect the previous node V0Point to current node V1To generate edge E of the snapshot of the current block number1Thus, the two elements of the snapshot of the current block number: current node V1And edge E of the snapshot1It is determined that a snapshot of the current block number is obtained.
S70: and returning to the step of reading the current block number from the linked list to obtain the current snapshot.
And after the snapshot of the current block number is generated, continuously reading the next block number from the linked list until the block numbers in the linked list are completely read, and generating the current snapshot according to the snapshots of all the block numbers in the linked list.
It should be noted that the current snapshot generation mode can be used for a full snapshot generation mode and an incremental snapshot generation mode, which fully meets the actual conditions, the full snapshot generation time is relatively slow, but the data is full, and the full snapshot can be used for overall recovery when no data exists; the incremental snapshot is relatively small, and the generation and recovery speed is high, but the incremental snapshot must be established on the basis of the existing block chain. In practical application, the two can be used in a matched mode, namely, incremental snapshot generation is carried out at intervals of small sections, so that snapshots can be stored quickly, and system time is not occupied; the full snapshot generation mode may be employed when the system is idle. The flexible generation mode can lead the system to obtain better performance.
According to the scheme, the snapshot storage structure is designed according to the characteristics of the DAG block chain, so that the structure is consistent with the structure of the DAG block chain diagram, the transaction information on the DAG block chain is stored based on the snapshot storage structure, and the archiving and storing efficiency is effectively improved.
Further, as shown in fig. 3, a second embodiment of the snapshot processing method according to the present invention is proposed based on the first embodiment, and in this embodiment, after the current snapshot is obtained, consensus processing may also be performed on the current snapshot, and the specific steps include:
s80: calculating the hash value of the current snapshot;
it should be understood that, because the account book consensus state of each accounting node at the same time is different due to the asynchronous consensus of the DAG blockchain, the embodiment designs that the snapshot information is also used as a part of the consensus content, and the snapshot point of each accounting node is recorded as the consensus.
After a snapshot is generated by an accounting node a in the DAG block chain, a hash value is taken from the current snapshot of the node a, where the calculation method of the hash value is not limited in this embodiment.
S90: reading a starting block number and an ending block number from the current snapshot;
s100: constructing data to be identified according to the hash value, the starting block number and the ending block number of the current snapshot;
in a specific implementation, the data to be identified can be constructed according to a format (Snapshot, a starting block number of a current Snapshot of the node a, an ending block number of a current Snapshot of the node a, timestamp, HDS); the Snapshot represents that the type is a Snapshot, the timestamp represents time, and the HDS represents a hash value of the current Snapshot.
S110: and sending the data to be identified to the DAG block chain so as to perform identification processing on the data to be identified.
It should be understood that after the current snapshot of a certain node is processed and then sent to the DAG block chain as the data to be identified, other nodes in the DAG block chain can identify the data to be identified, so that the credibility of the snapshot is guaranteed.
In this embodiment, a snapshot point consensus scheme is designed for the characteristic that account book consensus states of DAG block chains are not uniform at the same time, and a current snapshot of an accounting node is subjected to consensus after taking a hash value, so that a snapshot state link of the node is stored, and specific recovery for a certain node in a later period is facilitated.
Further, as shown in fig. 4, a third embodiment of the snapshot processing method according to the present invention is proposed based on the second embodiment, and in this embodiment, after step S90 and before restoring the block data based on the snapshot, to verify whether the obtained snapshot is correct, the step of verifying the current snapshot is as follows:
s120: searching consensus data with the type of the snapshot in the DAG block chain according to the starting block number and the ending block number to obtain the consensus data matched with the starting block number and the ending block number;
taking the case that the node A needs to recover from the current snapshot as an example, the node A takes the hash value of the current snapshot to obtain the hash value HDS of the current snapshot1And the traversal type of the consensus data with Snapshot in the block chain from the node A to the DAG is searched for whether matched consensus data exists or not according to the starting block number and the ending block number of the current Snapshot, and whether verification passes or not is determined according to a matching result.
S130: and acquiring the hash value of the consensus data, and verifying the current snapshot according to the hash value of the current snapshot and the hash value of the consensus data.
In an embodiment, when the matched common data is found, namely the matching is successful, the hash value HDS of the current snapshot is used1And a hash value HDS of the consensus data2Making a comparison when HDS1And HDS2When they are equal, the verification is determined to be passed, and when the HDS is equal1And HDS2And if the two are not equal, judging that the verification is not passed.
In another embodiment, when no matching known data is found, i.e. the matching fails, the verification is determined not to pass.
According to the method and the device, the node verifies the acquired current snapshot before the node is restored based on the current snapshot, and the snapshot which passes the verification is adopted for restoration, so that snapshot tampering can be effectively prevented, attacks by using the snapshot are avoided, and the safety of snapshot restoration is improved.
Further, as shown in fig. 5, a fourth embodiment of the snapshot processing method according to the present invention is proposed based on the third embodiment, and in this embodiment, the step of restoring the block data based on the current snapshot that passes the verification specifically includes:
s140: when the current snapshot passes verification, detecting whether the starting block number is the block number of the created block or not to obtain a detection result;
taking the example that the node a needs to restore the block data of the node a, it is assumed that the current snapshot of the node a passes verification, and the node a reads the start block number and the end block number in the current snapshot and determines the start block number.
S150: deleting the block data of the node corresponding to the current snapshot according to the detection result;
further, when the starting block number is the block number of the founding block, deleting all block data of the node corresponding to the current snapshot; and when the starting block number is not the block number of the created block, deleting the block data after the block with the starting block number in the node corresponding to the current snapshot.
S160: and restoring the block data according to the current snapshot.
Specifically, a node subsequent to the node of the starting block number is obtained from the current snapshot; and writing the transaction information and the pointing relationship of the latter node into the node.
When the starting block number is the block number of the created block, the current snapshot is a full snapshot, at this time, the node A discards all current block data, and then reads a later node V of the graph node of the starting block number in the current snapshot2. If the node V is2Not empty, from this node V2Obtaining the transaction information, writing the transaction information according to the internal structure of the DAG block chain, and pointing to the node V if the DAG block chain has chain pointing2Node A along node V2And acquiring side information E, if the E is not empty, constructing a chain direction in the DAG block chain, continuing to read the next node until the reading is finished, and recovering the block data.
When the starting block number is not the block number of the created block, the current snapshot is an incremental snapshot, at this time, the node A discards all the block data from the block of the starting block number, and then reads a later node V of the graph node of the starting block number in the current snapshot2. If the node V is2Not empty, from this node V2Obtaining the transaction information, writing the transaction information according to the internal structure of the DAG block chain, and pointing to the node V if the DAG block chain has chain pointing2Node A along node V2And acquiring side information E, if the E is not empty, constructing a chain direction in the DAG block chain, continuing to read the next node until the reading is finished, and recovering the block data.
In this embodiment, because the snapshot storage structure of the DAG block chain is consistent with the structure of the DAG block chain map, when block data is restored according to the current snapshot, the block data can be seamlessly docked with the DAG block chain structure, so that the restoration speed and the restoration efficiency are effectively improved, and the problem of low efficiency when the chain snapshot is used for restoring the DAG block chain in the prior art is solved.
In addition, an embodiment of the present invention further provides a computer-readable storage medium, where a snapshot processing program is stored on the computer-readable storage medium, and when the control program is executed by the processor, the processor is enabled to execute the snapshot processing method.
The specific embodiment of the computer-readable storage medium of the present invention is substantially the same as the embodiments of the control method described above, and is not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention or portions thereof contributing to the prior art may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) as above and includes instructions for enabling a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method of the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (10)

1. A snapshot processing method based on DAG block chains is characterized by comprising the following steps:
acquiring a preset snapshot height;
determining a termination block of the current snapshot according to the preset snapshot height;
determining a consensus sequence from the initial block to the termination block according to a consensus result of the DAG block chain;
recording the block numbers of all the blocks into a linked list according to the consensus sequence;
reading a current block number from the linked list and acquiring transaction information of the current block number;
constructing a current node and a direction relation between the current node and a previous node according to the transaction information so as to obtain a snapshot of the current block number;
and returning to the step of reading the current block number from the linked list to obtain the current snapshot.
2. The snapshot processing method of claim 1 wherein the initial block is a created block or an end block of a previous snapshot.
3. The snapshot processing method of claim 2, wherein said constructing a current node based on said transaction information comprises:
correspondingly storing the transaction information and the current node based on a preset list; wherein the parameters in the preset list include transaction, sender, recipient, time and amount.
4. The snapshot processing method of claim 3, further comprising:
after the current snapshot is obtained, calculating a hash value of the current snapshot;
reading a starting block number and an ending block number from the current snapshot;
constructing data to be identified in common according to the hash value of the current snapshot, the starting block number and the ending block number;
and sending the data to be identified to the DAG block chain so as to carry out identification processing on the data to be identified.
5. The snapshot processing method of claim 4, further comprising:
after reading a starting block number and an ending block number from the current snapshot, searching consensus data with the type of the snapshot in the DAG block chain according to the starting block number and the ending block number to obtain the consensus data matched with the starting block number and the ending block number;
and acquiring the hash value of the shared data, and verifying the current snapshot according to the hash value of the current snapshot and the hash value of the shared data.
6. The snapshot processing method of claim 5, further comprising:
when the current snapshot passes verification, detecting whether the starting block number is the block number of the created block or not to obtain a detection result;
deleting the block data of the node corresponding to the current snapshot according to the detection result;
and restoring the block data according to the current snapshot.
7. The snapshot processing method according to claim 6, wherein the deleting block data of the node corresponding to the current snapshot according to the detection result includes:
deleting all block data of the node corresponding to the current snapshot when the starting block number is the block number of the founding block;
and when the starting block number is not the block number of the founding block, deleting the block data after the block with the starting block number in the node corresponding to the current snapshot.
8. The snapshot processing method of claim 6, wherein the restoring the block data according to the current snapshot comprises:
acquiring a node subsequent to the node of the starting block number from the current snapshot;
and writing the transaction information and the pointing relationship of the latter node into the node.
9. A snapshot processing apparatus characterized by comprising: memory, a processor and a snapshot handling program stored on the memory and executable on the processor, the snapshot handling program being configured to implement the steps of the snapshot handling method of any one of claims 1 to 8.
10. A storage medium, characterized in that said storage medium has stored thereon a snapshot processing program, which, when executed by a processor, implements the steps of the snapshot processing method according to one of claims 1 to 8.
CN202110491562.0A 2021-05-06 2021-05-06 Snapshot processing method, equipment and storage medium based on DAG block chain Active CN113297214B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110491562.0A CN113297214B (en) 2021-05-06 2021-05-06 Snapshot processing method, equipment and storage medium based on DAG block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110491562.0A CN113297214B (en) 2021-05-06 2021-05-06 Snapshot processing method, equipment and storage medium based on DAG block chain

Publications (2)

Publication Number Publication Date
CN113297214A CN113297214A (en) 2021-08-24
CN113297214B true CN113297214B (en) 2022-06-10

Family

ID=77321730

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110491562.0A Active CN113297214B (en) 2021-05-06 2021-05-06 Snapshot processing method, equipment and storage medium based on DAG block chain

Country Status (1)

Country Link
CN (1) CN113297214B (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7895666B1 (en) * 2006-09-01 2011-02-22 Hewlett-Packard Development Company, L.P. Data structure representation using hash-based directed acyclic graphs and related method
CN106844523A (en) * 2016-12-29 2017-06-13 北京瑞卓喜投科技发展有限公司 The generation method and system of the block chain that sequence type multidimensional is expanded
CN106909605A (en) * 2016-12-29 2017-06-30 北京瑞卓喜投科技发展有限公司 The generation method and system of the block chain transversely expanded
CN111209346A (en) * 2020-04-24 2020-05-29 腾讯科技(深圳)有限公司 Block chain data archiving method and device and computer readable storage medium
CN111767337A (en) * 2019-05-24 2020-10-13 北京沃东天骏信息技术有限公司 Block verification method, device and equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20200143372A1 (en) * 2018-11-02 2020-05-07 Vite Labs Limited Methods for decentralized digital asset transfer and smart contract state transition

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7895666B1 (en) * 2006-09-01 2011-02-22 Hewlett-Packard Development Company, L.P. Data structure representation using hash-based directed acyclic graphs and related method
CN106844523A (en) * 2016-12-29 2017-06-13 北京瑞卓喜投科技发展有限公司 The generation method and system of the block chain that sequence type multidimensional is expanded
CN106909605A (en) * 2016-12-29 2017-06-30 北京瑞卓喜投科技发展有限公司 The generation method and system of the block chain transversely expanded
CN111767337A (en) * 2019-05-24 2020-10-13 北京沃东天骏信息技术有限公司 Block verification method, device and equipment
CN111209346A (en) * 2020-04-24 2020-05-29 腾讯科技(深圳)有限公司 Block chain data archiving method and device and computer readable storage medium

Also Published As

Publication number Publication date
CN113297214A (en) 2021-08-24

Similar Documents

Publication Publication Date Title
CN109660356B (en) Data uplink method, device, equipment and computer readable storage medium
CN109359091B (en) File management method, device, terminal and computer readable storage medium
US9778998B2 (en) Data restoration method and system
CN106354884B (en) Data object deleting method and device based on distributed file system
CN110019873B (en) Face data processing method, device and equipment
CN109522160B (en) Method and system for comparing and backing up file directory by saving file information abstract
CN111382123A (en) File storage method, device, equipment and storage medium
CN109033313B (en) Method and terminal equipment for realizing full-disk scanning function by using USN
CN111414362A (en) Data reading method, device, equipment and storage medium
US10122803B2 (en) Network data transmission method, device and system
CN110650164A (en) File uploading method and device, terminal and computer storage medium
CN102298546B (en) Method and computer for restoring deleted joint picture group (JPG) file from disk
US10318385B2 (en) Service recovery using snapshots and interservice messages
CN113535226B (en) Application downloading method, terminal, server, computer device and storage medium
CN114637611A (en) Information processing method and device based on message queue and computer equipment
CN113297214B (en) Snapshot processing method, equipment and storage medium based on DAG block chain
CN108196975B (en) Data verification method and device based on multiple checksums and storage medium
US20230205637A1 (en) Backup Recovery System and Method for Modern Application
CN112000321A (en) Method and device for realizing undo and/or redo of three-dimensional detection software
CN114282913B (en) Multi-main-body online signing method and device
CN112286457A (en) Object deduplication method and device, electronic equipment and machine-readable storage medium
CN115809200A (en) Method and device for calling UI (user interface) automatic use case based on python
CN108228813B (en) Method and device for deleting duplicate database in distributed system
CN114756624A (en) Data processing method, device and equipment for full-scale nodes and storage medium
CN111625500A (en) File snapshot method and device, electronic equipment and storage medium

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
TR01 Transfer of patent right

Effective date of registration: 20240401

Address after: 410003 No. 816, Hemei building, building 1, No. 189, Sany Avenue, wujialing street, Kaifu District, Changsha City, Hunan Province

Patentee after: Hunan Chenhan Technology Co.,Ltd.

Country or region after: China

Address before: 410000 room g0190, headquarters building, Changsha Zhongdian Software Park, No. 39, Jianshan Road, high tech Development Zone, Changsha, Hunan

Patentee before: Hunan zhaowuxin Chain Technology Group Co.,Ltd.

Country or region before: China