Cross-chain evidence storage method, device, terminal equipment and storage medium

By obtaining the transaction hash to be cross-chained on the sub-chain and converting it into a cross-chain transaction hash, the problem of user privacy leakage caused by cross-chain certificate storage in the existing technology is solved, and the protection of user privacy is achieved.

CN112632619BActive Publication Date: 2024-08-30HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202011618442.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-30
Publication Date
2024-08-30
Estimated Expiration
2040-12-30

AI Technical Summary

Technical Problem

The existing cross-chain certificate storage method will expose the specific content of the certificate information, leading to the leakage of user privacy.

Method used

By obtaining N transaction hashes to be cross-chain that are certified on the sub-chain, determine the cross-chain transaction hash, and send it to the main chain to convert the certified transaction hash into a cross-chain transaction hash, thereby converting The cross-chain transaction hash is transferred from the sub-chain to the main chain, without exposing the transaction hash stored on the sub-chain, protecting user privacy.

Benefits of technology

It effectively protects the privacy of users in cross-chain certificate storage and avoids the leakage of certificate information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112632619B
    Figure CN112632619B
Patent Text Reader

Abstract

The present application is applicable to the field of blockchain technology, and in particular to a cross-chain evidence storage method, device, terminal device and storage medium. The method obtains N transaction hashes to be cross-chained stored on the subchain, determines the cross-chain transaction hash according to the N transaction hashes to be cross-chained, sends the cross-chain transaction hash to the main chain, realizes the conversion of the stored transaction hash into the cross-chain transaction hash, and transfers the cross-chain transaction hash from the subchain to the main chain, without exposing the transaction hash stored on the subchain, which is conducive to the protection of user privacy in cross-chain evidence storage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of blockchain technology, and in particular relates to a cross-chain evidence storage method, apparatus, terminal device and storage medium. Background Art

[0002] At present, in order to ensure the authenticity and integrity of documents, contracts and other data, it is necessary to store the hashes corresponding to these data on the blockchain. In order to ensure the reliability of the information stored in the blockchain, in some cases it is necessary to store the information stored on the blockchain in another more authoritative blockchain, i.e., cross-chain storage. However, directly transferring the stored information across chains to another blockchain will expose the specific content of the stored information, which is not conducive to the protection of user privacy. Summary of the invention

[0003] The embodiments of the present application provide a cross-chain evidence storage method, apparatus, terminal device and storage medium, which can solve the problem of user privacy leakage caused by existing cross-chain evidence storage methods.

[0004] In a first aspect, an embodiment of the present application provides a cross-chain evidence storage method, which is applied to a cross-chain evidence storage device, wherein the cross-chain evidence storage device connects a main chain and a sub-chain, and the cross-blockchain evidence storage method includes:

[0005] Obtain N transaction hashes to be cross-chain stored on the subchain, where N is an integer greater than zero;

[0006] Determine a cross-chain transaction hash according to the N transaction hashes to be cross-chained;

[0007] Send the cross-chain transaction hash to the main chain.

[0008] According to the node configuration parameters, the nodes deployed in the target blockchain host are opened and configured.

[0009] In a second aspect, an embodiment of the present application provides a cross-chain evidence storage device, wherein the cross-chain evidence storage device connects a main chain and a sub-chain, and the cross-blockchain evidence storage device includes:

[0010] A hash acquisition module, used to obtain N transaction hashes to be cross-chain stored on the subchain, where N is an integer greater than zero;

[0011] A hash determination module, used to determine a cross-chain transaction hash according to the N cross-chain transaction hashes;

[0012] The cross-chain evidence storage module is used to send the cross-chain transaction hash to the main chain.

[0013] In a third aspect, an embodiment of the present application provides a terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the cross-chain evidence storage method as described in the first aspect is implemented.

[0014] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the cross-chain evidence storage method as described in the first aspect is implemented.

[0015] In a fifth aspect, an embodiment of the present application provides a computer program product. When the computer program product is run on a terminal device, the terminal device executes the cross-chain evidence storage method described in the first aspect above.

[0016] Compared with the prior art, the embodiments of the present application have the following beneficial effects: the present application obtains N transaction hashes to be cross-chain stored on the sub-chain, determines the cross-chain transaction hash based on the N transaction hashes to be cross-chain, sends the cross-chain transaction hash to the main chain, realizes the conversion of the stored transaction hash into the cross-chain transaction hash, and transfers the cross-chain transaction hash from the sub-chain to the main chain, without exposing the transaction hash stored on the sub-chain, which is beneficial to the protection of user privacy in cross-chain storage. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0018] Figure 1 This is a flowchart of a cross-chain evidence storage method provided in Example 1 of the present application;

[0019] Figure 2 This is a schematic diagram of the interaction relationship between a main chain and a sub-chain provided in Example 1 of the present application;

[0020] Figure 3 This is a flow chart of a cross-chain evidence storage method provided in Example 2 of the present application;

[0021] Figure 4 This is a schematic diagram of constructing a Merkle tree provided in Example 2 of the present application;

[0022] Figure 5 This is a flowchart of a cross-chain evidence storage method provided in Example 3 of the present application;

[0023] Figure 6It is a structural diagram of a cross-chain evidence storage device provided in Example 4 of the present application;

[0024] Figure 7 This is a structural diagram of a terminal device provided in Example 5 of the present application. DETAILED DESCRIPTION

[0025] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.

[0026] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or combinations thereof.

[0027] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.

[0028] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.

[0029] In addition, in the description of the present application specification and the appended claims, the terms "first", "second", "third", etc. are only used to distinguish the descriptions and cannot be understood as indicating or implying relative importance.

[0030] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.

[0031] The cross-chain evidence storage method provided in the embodiment of the present application can be applied to terminal devices such as PDAs, desktop computers, laptops, ultra-mobile personal computers (UMPCs), netbooks, cloud servers, personal digital assistants (PDAs), etc. The embodiment of the present application does not impose any restrictions on the specific type of terminal devices.

[0032] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0033] In order to illustrate the technical solution of the present application, a specific embodiment is provided below for illustration.

[0034] See also Figure 1 , is a flow chart of a cross-chain evidence storage method provided in Example 1 of the present application. The cross-chain evidence storage method can be used for a cross-chain evidence storage device. The cross-chain evidence storage device connects the main chain and the sub-chain. The cross-chain evidence storage device can run in the sub-chain as a cross-chain gateway of the sub-chain. The cross-chain evidence storage method includes the following steps:

[0035] Step S101, obtain N transaction hashes to be cross-chain stored on the sub-chain.

[0036] Among them, N is an integer greater than zero. The transaction hash to be cross-chain may refer to the hash value of the transaction that needs to be cross-chain stored. The hash value is the storage of the transaction that needs to be cross-chain stored on the sub-chain. Whether the transaction needs to be cross-chain stored can be determined based on the type of transaction.

[0037] For example, for the production link, main chain A is used to coordinate the evidence storage of the entire production link. The transactions stored on sub-chain B include the sales records of the production link and the sales records of non-production links. The sales records in the production link stored on sub-chain B are transactions that require cross-chain evidence storage.

[0038] Optionally, obtaining N cross-chain transaction hashes stored on the subchain includes:

[0039] Monitor M blocks of the subchain, where M is an integer greater than or equal to 1;

[0040] Get the transaction list of M blocks within the preset time;

[0041] Based on the transaction list, determine all transaction hashes stored in each of the M blocks;

[0042] Check whether there is a transaction hash with the cross-chain evidence type among all the transaction hashes stored on M blocks;

[0043] If it is detected that there is a transaction hash with the evidence type of cross-chain evidence on the block, the transaction hash is determined to be the transaction hash to be cross-chain stored on the block, and N transaction hashes to be cross-chain stored on M blocks are obtained.

[0044] Among them, there can be one block or multiple blocks in the subchain. If there is one block in the subchain, obtaining the N transaction hashes to be cross-chain stored on the subchain is to obtain the transaction hash to be cross-chain stored in the block. Since not all transaction hashes in the block are transaction hashes to be cross-chain, it is necessary to detect all transaction hashes stored on the block, determine the transaction hash with the cross-chain storage type among all transaction hashes, and use the transaction hash as the transaction hash to be cross-chain; if there are multiple blocks in the subchain, determine the transaction hash with the cross-chain storage type among all transaction hashes of each block.

[0045] The preset time can be set according to needs. The preset time may refer to tracing back from the current time point to the time point corresponding to the preset time to the current time point. For example, the preset time may be from the time point when the block was generated to the current time point; the transaction list may refer to table data including all transaction hashes within the preset time. Extracting the transaction hashes from the table data determines all transaction hashes stored on the block.

[0046] Optionally, after determining all transaction hashes stored in each block in the M blocks according to the transaction list, it also includes:

[0047] Analyze the transaction list and determine the evidence type corresponding to all transaction hashes stored on M blocks;

[0048] Accordingly, if it is detected that there is a transaction hash with a cross-chain evidence type on the block, the transaction hash is determined to be the transaction hash to be cross-chain stored on the block, and the N transaction hashes to be cross-chain stored on M blocks include:

[0049] The transaction hash of the evidence type stored on each block is cross-chain evidence, forming a target transaction list, and determining M target transaction lists;

[0050] According to the M target transaction lists, obtain the N transaction hashes to be cross-chain stored on the M blocks.

[0051] Among them, for a transaction list of a block, the transaction list also includes the evidence type of each transaction hash in all transaction hashes stored on the block. By analyzing the transaction list, the evidence type corresponding to each transaction hash can be determined. The transaction hash of the evidence type stored on each block is cross-chain evidence, forming a target transaction list, so that M blocks can determine M target transaction lists, and the evidence type of all transaction hashes in the target transaction list is cross-chain evidence.

[0052] Step S102: Determine the cross-chain transaction hash according to the N transaction hashes to be cross-chained.

[0053] Among them, the cross-chain transaction may refer to the transaction generated when N cross-chain transaction hashes to be forwarded from the sub-chain to the main chain, and the cross-chain transaction hash may refer to the hash value corresponding to the transaction, which may be calculated based on the N cross-chain transaction hashes to be calculated.

[0054] For example, N cross-chain transaction hashes are combined into a file, and the hash value calculated for the file is the cross-chain transaction hash.

[0055] Step S103, sending the cross-chain transaction hash to the main chain.

[0056] Among them, in the cross-chain scenario, there is a main chain A to record the evidence information on all sub-chains, for example, Figure 2 As shown, it is a schematic diagram of the interaction relationship between a main chain and sub-chains provided in Example 1 of the present application. All sub-chains include sub-chain B, sub-chain C, and sub-chain D, among which sub-chain B is responsible for the evidence of raw material procurement, sub-chain C is responsible for the evidence of order management, and sub-chain D is responsible for the evidence of sales records. The main chain A is responsible for the evidence of raw material procurement, order management, and sales records. Sub-chains B, sub-chains C, and sub-chains D all need to transfer their own evidence to the main chain A.

[0057] Optionally, according to N transaction hashes to be cross-chained, determining the cross-chain transaction hash includes:

[0058] Determine M cross-chain transaction hashes based on the N cross-chain transaction hashes stored on M blocks;

[0059] Accordingly, sending the cross-chain transaction hash to the main chain includes:

[0060] Send M cross-chain transaction hashes to the main chain.

[0061] Among them, if there is one block in the subchain, the transaction hashes with the evidence type of cross-chain evidence in all transaction hashes stored on the block are determined to be N transaction hashes to be cross-chain; if there are multiple blocks in the subchain, the transaction hashes with the evidence type of cross-chain evidence in all transaction hashes stored on each block in the multiple blocks are combined to form N transaction hashes to be cross-chain. At this time, according to the transaction hash with the evidence type of cross-chain evidence in all transaction hashes stored on a block, one transaction hash to be cross-chain is determined. Therefore, M blocks can determine M transaction hashes to be cross-chain.

[0062] Taking the production link as an example, the entire process is briefly as follows: the records of raw material procurement in the production link are chained to sub-chain B for evidence, the records of order management in the production link are chained to sub-chain C for evidence, and the sales records are chained to sub-chain D for evidence. The information on the chain is all transaction hashes. Then, sub-chain B, sub-chain C, and sub-chain D use the method of this application to forward the transaction hashes stored on their own blockchains to the main chain A in a cross-chain manner, so as to achieve double evidence or supervision and avoid the leakage of information stored on the sub-chains.

[0063] The embodiment of the present application obtains N transaction hashes to be cross-chained that are stored on the sub-chain, determines the cross-chain transaction hash based on the N transaction hashes to be cross-chained, sends the cross-chain transaction hash to the main chain, realizes the conversion of the stored transaction hash into the cross-chain transaction hash, and transfers the cross-chain transaction hash from the sub-chain to the main chain, without exposing the transaction hash stored on the sub-chain, which is beneficial to the protection of user privacy in cross-chain storage.

[0064] See also Figure 3 , is a flow chart of a cross-chain evidence storage method provided in the second embodiment of the present application. The cross-chain evidence storage method can be used for a cross-chain evidence storage device. The cross-chain evidence storage device connects the main chain and the sub-chain. The cross-chain evidence storage device can run in the sub-chain as a cross-chain gateway of the sub-chain, such as Figure 3 As shown, the cross-chain evidence storage method may include the following steps:

[0065] Step S301, obtain N transaction hashes to be cross-chain stored on the sub-chain.

[0066] Among them, the content of step S301 is the same as that of the above-mentioned step S101, and the description of the above-mentioned step S101 may be referred to, and will not be repeated here.

[0067] Step S302: construct a Merkle tree based on the N transaction hashes to be cross-chained.

[0068] Among them, the Merkle tree is a binary tree or a multi-branch tree, which includes leaf nodes, intermediate nodes and root nodes. Each leaf node contains a transaction hash to be cross-chained, each intermediate node is formed by the hash of its two child nodes, and the root node is formed by the hash of its two child nodes. The root node represents the "top" or root of the Merkle tree. For example, Figure 4 As shown, it is a schematic diagram of the construction of a Merkle tree provided in Example 2 of the present application, wherein the four transaction hashes to be cross-chain are h1, h2, h3 and h4, respectively. h1, h2, h3 and h4 constitute four leaf nodes, h1 and h2 are combined into h12 to form an intermediate node, h3 and h4 are combined into h34 to form an intermediate node, and the two intermediate nodes h12 and h34 are combined to form a root node.

[0069] When N transaction hashes to be cross-chain belong to one block of the blockchain, only one Merkle tree is constructed. If N transaction hashes to be cross-chain belong to M blocks of the blockchain, a Merkle tree is determined according to the transaction hashes to be cross-chain of each block, that is, M Merkle trees.

[0070] Step S303, determine the cross-chain transaction hash according to the Merkle tree.

[0071] Among them, the cross-chain transaction hash may refer to a hash value determined according to the constructed Merkle tree, and the hash value may be a hash value corresponding to the root node of the Merkle tree or a hash value corresponding to an intermediate node.

[0072] When N cross-chain transaction hashes belong to a block of the blockchain, only one Merkle tree is constructed to determine one cross-chain transaction hash. If the N cross-chain transaction hashes correspond to M blocks of the blockchain, a Merkle tree is determined based on the cross-chain transaction hash of each block, that is, M Merkle trees, and then M cross-chain transaction hashes can be determined.

[0073] Step S304, sending the cross-chain transaction hash to the main chain.

[0074] Among them, the content of step S304 is the same as that of the above-mentioned step S103, and the description of the above-mentioned step S103 may be referred to, and will not be repeated here.

[0075] For example, the cross-chain evidence storage process is as follows:

[0076] The cross-chain evidence storage method of the present application is used in the four sub-chains, namely sub-chain B, sub-chain C and sub-chain D. The cross-chain evidence storage device relied on by the cross-chain evidence storage method connects the main chain A with sub-chain B, sub-chain C and sub-chain D respectively, and deploys evidence storage systems on the main chain A, sub-chain B, sub-chain C and sub-chain D respectively. The evidence storage system may refer to a system capable of storing evidence on a single blockchain chain, wherein the main chain A, as the main chain evidence storage system, needs to record the information stored on other sub-chains. Users can store evidence on each sub-chain according to their own needs, and the sub-chains do not interfere with each other.

[0077] The cross-chain evidence storage device is used to continuously monitor the transaction hash of each sub-chain that requires cross-chain evidence storage, and forward the transaction hash to the main chain A after processing. The processing here refers to determining the cross-chain transaction hash in step S303.

[0078] Optionally, the cross-chain evidence storage method also includes:

[0079] Get query instructions for the target file;

[0080] According to the query instruction, obtain the first hash corresponding to the target file and the target transaction list to which the first hash belongs from the subchain, and obtain the cross-chain transaction hash corresponding to the target file from the main chain;

[0081] Get other hashes in the target transaction list to which the first hash belongs, where the other hashes are hashes other than the first hash in the target transaction list;

[0082] Based on the first hash and other hashes, a Merkle tree is constructed to determine the target cross-chain transaction hash;

[0083] Detect whether the hash of the target file is the same as the first hash, and detect whether the cross-chain transaction hash corresponding to the target file is the same as the target cross-chain transaction hash;

[0084] If the hash of the target file is the same as the first hash, and the cross-chain transaction hash corresponding to the target file is the same as the target cross-chain transaction hash, it is determined that the target file has not been tampered with.

[0085] For example, the process of a user querying a stored certificate is as follows:

[0086] The user stores a rental contract on subchain B, and puts the hash of the rental contract in the transaction Tx1 he sent. Subchain B transfers the processed values ​​of transaction Tx1 and other transactions h2, h3, and h4 to mainchain A for evidence storage. When the user needs to query the evidence, if the hash h1 corresponding to the evidence transaction Tx1 can be found in subchain B, the subchain B evidence hash h1 can be used to prove the authenticity of the rental contract.

[0087] A simple payment verification (SPV) is constructed through transaction Tx1 and other transactions in subchain B, that is, h2, h3, h4 and h1 are obtained in subchain B to calculate the value of the root node of a Merkle tree, and the value of the root node is compared with the value stored in the main chain A. The value stored in the main chain A can further prove the authenticity of the rental contract.

[0088] The embodiment of the present application determines the cross-chain transaction hash by constructing a Merkle tree for N transaction hashes to be cross-chain, which can effectively perform privacy processing on the transaction hash in the sub-chain and avoid leakage of the transaction hash of the sub-chain.

[0089] See also Figure 5 , is a flow chart of a cross-chain evidence storage method provided in Example 3 of the present application. The cross-chain evidence storage method can be used for a cross-chain evidence storage device. The cross-chain evidence storage device connects the main chain and the sub-chain. The cross-chain evidence storage device can run in the sub-chain as a cross-chain gateway of the sub-chain, such as Figure 5 As shown, the cross-chain evidence storage method may include the following steps:

[0090] Step S501, obtain N transaction hashes to be cross-chain stored on the sub-chain.

[0091] Among them, the content of step S501 is the same as that of the above-mentioned step S101, and the description of the above-mentioned step S101 may be referred to, and will not be repeated here.

[0092] Step S502: construct a Merkle tree based on the N transaction hashes to be cross-chained.

[0093] Among them, the content of step S501 is the same as that of the above-mentioned step S302, and the description of the above-mentioned step S302 may be referred to, and will not be repeated here.

[0094] Step S503, determine that the hash value corresponding to the root of the Merkle tree is the cross-chain transaction hash.

[0095] Among them, in order to minimize the amount of stored data, the hash value corresponding to the root node of the Merkle tree (i.e., the root of the tree) is used as the cross-chain transaction hash, that is, a cross-chain transaction hash is generated based on the transaction hash to be crossed across the chain of a block.

[0096] Step S504, sending the cross-chain transaction hash to the main chain.

[0097] Among them, the content of step S504 is the same as that of the above-mentioned step S103, and the description of the above-mentioned step S103 may be referred to, and will not be repeated here.

[0098] The embodiment of the present application uses the hash value corresponding to the root node of the Merkle tree as the cross-chain transaction hash, compresses the data volume of the transaction hash in the sub-chain to the maximum extent, and then sends it to the main chain for evidence storage, which can be applied to cross-chain evidence storage scenarios with large data volumes.

[0099] Corresponding to the cross-chain evidence storage method in the above embodiment, Figure 6 A structural block diagram of a cross-chain evidence storage device provided in Example 4 of the present application is shown. For ease of explanation, only the parts related to the example of the present application are shown.

[0100] This cross-chain evidence storage device connects the main chain and the sub-chain, see Figure 6 , the cross-chain evidence storage device includes:

[0101] The hash acquisition module 61 is used to obtain N transaction hashes to be cross-chain stored on the subchain, where N is an integer greater than zero;

[0102] A hash determination module 62, used to determine a cross-chain transaction hash according to N cross-chain transaction hashes;

[0103] The cross-chain evidence storage module 63 is used to send the cross-chain transaction hash to the main chain.

[0104] Optionally, the hash determination module 62 includes:

[0105] The construction unit is used to construct a Merkle tree based on N transaction hashes to be cross-chained;

[0106] The first cross-chain hash determination unit is used to determine the cross-chain transaction hash according to the Merkle tree.

[0107] Optionally, the first cross-chain hash determination unit is specifically used to:

[0108] Determine that the hash value corresponding to the root of the Merkle tree is the cross-chain transaction hash.

[0109] Optionally, the hash acquisition module 61 includes:

[0110] The monitoring unit is used to monitor M blocks of the subchain, where M is an integer greater than or equal to 1;

[0111] A list acquisition unit, used to acquire a transaction list of M blocks within a preset time;

[0112] A hash acquisition unit is used to determine all transaction hashes stored in each of the M blocks based on the transaction list;

[0113] A type detection unit, used to detect whether there is a transaction hash with a cross-chain evidence storage type among all transaction hashes stored on M blocks;

[0114] The unit for determining the hash to be cross-chain is used to determine that if a transaction hash with a storage type of cross-chain storage exists on a block, the transaction hash is determined to be the transaction hash to be cross-chain stored on the block, and obtain N transaction hashes to be cross-chain stored on M blocks.

[0115] Optionally, the cross-chain evidence storage device further includes:

[0116] A type determination unit is used to determine all transaction hashes stored in each block of the M blocks according to the transaction list, and then analyze the transaction list to determine the types of evidence corresponding to all transaction hashes stored in the M blocks;

[0117] Accordingly, the to-be-crossed-chain hash determination unit is specifically used for:

[0118] The transaction hash of the evidence type stored on each block is cross-chain evidence, forming a target transaction list, and determining M target transaction lists;

[0119] According to the M target transaction lists, obtain the N transaction hashes to be cross-chain stored on the M blocks.

[0120] Optionally, the cross-chain evidence storage device further includes:

[0121] An instruction acquisition module is used to acquire query instructions for a target file;

[0122] A query hash acquisition module is used to obtain the first hash corresponding to the target file and the target transaction list to which the first hash belongs from the subchain according to the query instruction, and obtain the cross-chain transaction hash corresponding to the target file from the main chain;

[0123] Other hash acquisition module, used to acquire other hashes in the target transaction list to which the first hash belongs, where the other hashes are hashes other than the first hash in the target transaction list;

[0124] A target hash determination module, used to construct a Merkle tree based on the first hash and other hashes to determine the target cross-chain transaction hash;

[0125] A hash detection module, used to detect whether the hash of the target file is the same as the first hash, and to detect whether the cross-chain transaction hash corresponding to the target file is the same as the target cross-chain transaction hash;

[0126] The result determination module is used to determine that the target file has not been tampered with if the hash of the target file is the same as the first hash, and the cross-chain transaction hash corresponding to the target file is the same as the target cross-chain transaction hash.

[0127] Optionally, the hash determination module 62 includes:

[0128] The second cross-chain hash determination unit is used to determine M cross-chain transaction hashes according to the N cross-chain transaction hashes stored on the M blocks;

[0129] Accordingly, the cross-chain evidence storage module 63 is specifically used for:

[0130] Send M cross-chain transaction hashes to the main chain.

[0131] It should be noted that the information interaction, execution process and other contents between the above-mentioned modules are based on the same concept as the method embodiment of the present application. Their specific functions and technical effects can be found in the method embodiment part and will not be repeated here.

[0132] Figure 7 This is a schematic diagram of the structure of a terminal device provided in Embodiment 4 of the present application. Figure 7 As shown, the terminal device 7 of this embodiment includes: M processors 70 ( Figure 7 Only one processor, a memory 71, and a computer program 72 stored in the memory 71 and executable on M processors 70 are shown. When the processor 70 executes the computer program 72, the steps in any of the above-mentioned cross-chain evidence storage method embodiments are implemented.

[0133] The terminal device may include, but is not limited to, a processor 70 and a memory 71. Those skilled in the art will appreciate that Figure 7 It is only an example of the terminal device 7 and does not constitute a limitation on the terminal device 7. It may include more or fewer components than shown in the figure, or a combination of certain components, or different components. For example, it may also include input and output devices, network access devices, etc.

[0134] The processor 70 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor, etc.

[0135] In some embodiments, the memory 71 may be an internal storage unit of the terminal device 7, such as a hard disk or memory of the terminal device 7. In other embodiments, the memory 71 may also be an external storage device of the terminal device 7, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the terminal device 7. Further, the memory 71 may also include both an internal storage unit and an external storage device of the terminal device 7. The memory 71 is used to store an operating system, an application program, a boot loader (BootLoader), data, and other programs, such as program codes of a computer program. The memory 71 may also be used to temporarily store data that has been output or is to be output.

[0136] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated into a processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned device can refer to the corresponding process in the above-mentioned method embodiment, which will not be repeated here. If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on such understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned method embodiment when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device capable of carrying computer program code, recording medium, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal and software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.

[0137] The present application implements all or part of the processes in the above-mentioned embodiment method, and may also be completed through a computer program product. When the computer program product runs on a terminal device, the terminal device implements the steps in the above-mentioned method embodiment when executing the computer program product.

[0138] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0139] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0140] In the embodiments provided in the present application, it should be understood that the disclosed devices / terminal equipment and methods can be implemented in other ways. For example, the device / terminal equipment embodiments described above are only schematic, for example, the division of modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0141] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0142] The above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.

Claims

1. A cross-chain evidence storage method, characterized in that: The cross-chain evidence storage method is applied to a cross-chain evidence storage device, the cross-chain evidence storage device connects the main chain and the sub-chain, and the cross-chain evidence storage method includes: Obtain N transaction hashes to be cross-chain stored on the subchain, where N is an integer greater than zero; Determine a cross-chain transaction hash according to the N transaction hashes to be cross-chained; Sending the cross-chain transaction hash to the main chain; Determining the cross-chain transaction hash according to the N cross-chain transaction hashes includes: Construct a Merkle tree based on the N transaction hashes to be cross-chained; Determine the cross-chain transaction hash according to the Merkle tree; Determining the cross-chain transaction hash according to the Merkle tree includes: Determine that the hash value corresponding to the root of the Merkle tree is the cross-chain transaction hash; The step of obtaining N cross-chain transaction hashes stored on the subchain includes: Monitor M blocks of the subchain, where M is an integer greater than or equal to 1; Obtain the transaction list of the M blocks within a preset time; According to the transaction list, determine all transaction hashes stored in each block of the M blocks; Detect whether there is a transaction hash with a cross-chain evidence storage type among all the transaction hashes stored on each of the M blocks; If it is detected that there is a transaction hash with a cross-chain evidence type on the block, the transaction hash is determined to be the transaction hash to be cross-chain stored on the block, and the N transaction hashes to be cross-chain stored on the M blocks are obtained; Determining the cross-chain transaction hash according to the N cross-chain transaction hashes includes: Determine M cross-chain transaction hashes according to the N cross-chain transaction hashes stored on the M blocks; Accordingly, sending the cross-chain transaction hash to the main chain includes: Send the M cross-chain transaction hashes to the main chain.

2. The cross-chain evidence storage method according to claim 1, characterized in that: After determining all transaction hashes of each block in the M blocks for re-storage according to the transaction list, the method further includes: Analyze the transaction list to determine the evidence type corresponding to all transaction hashes stored on the M blocks; Correspondingly, if it is detected that there is a transaction hash with a storage type of cross-chain storage on the block, the transaction hash is determined to be the transaction hash to be stored on the block, and the N transaction hashes to be stored on the M blocks include: The transaction hash of the evidence type stored on each block is cross-chain evidence, forming a target transaction list, and determining M target transaction lists; According to the M target transaction lists, the N transaction hashes to be cross-chain stored on the M blocks are obtained.

3. The cross-chain evidence storage method according to claim 2, characterized in that: The cross-chain evidence storage method further includes: Get query instructions for the target file; According to the query instruction, obtain from the subchain the first hash corresponding to the target file and the target transaction list to which the first hash belongs, and obtain from the main chain the cross-chain transaction hash corresponding to the target file; Obtain other hashes in the target transaction list to which the first hash belongs, where the other hashes are hashes in the target transaction list other than the first hash; Construct a Merkle tree based on the first hash and the other hashes to determine the target cross-chain transaction hash; Detecting whether the hash of the target file is the same as the first hash, and detecting whether the cross-chain transaction hash corresponding to the target file is the same as the target cross-chain transaction hash; If the hash of the target file is the same as the first hash, and the cross-chain transaction hash corresponding to the target file is the same as the target cross-chain transaction hash, it is determined that the target file has not been tampered with.

4. A cross-chain evidence storage device, characterized in that: The cross-chain evidence storage device connects the main chain and the sub-chain, and the cross-chain evidence storage device includes: A hash acquisition module, used to obtain N transaction hashes to be cross-chain stored on the subchain, where N is an integer greater than zero; A hash determination module, used to determine a cross-chain transaction hash according to the N cross-chain transaction hashes; A cross-chain evidence storage module, used to send the cross-chain transaction hash to the main chain; The hash determination module comprises: A construction unit, used to construct a Merkle tree according to the N transaction hashes to be cross-chained; A first cross-chain hash determination unit, configured to determine the cross-chain transaction hash according to the Merkle tree; The first cross-chain hash determination unit is specifically used for: Determine that the hash value corresponding to the root of the Merkle tree is the cross-chain transaction hash; The hash acquisition module includes: A monitoring unit, used to monitor M blocks of the subchain, where M is an integer greater than or equal to 1; A list acquisition unit, used to acquire a transaction list of the M blocks within a preset time; A hash acquisition unit, used to determine all transaction hashes stored in each block of the M blocks according to the transaction list; A type detection unit, used to detect whether there is a transaction hash with a storage type of cross-chain storage among all transaction hashes stored on each of the M blocks; The unit for determining the hash to be cross-chain is used to determine that if a transaction hash with a storage type of cross-chain storage exists on a block, the transaction hash is the transaction hash to be cross-chain stored on the block, and obtain the N transaction hashes to be cross-chain stored on the M blocks; The hash determination module comprises: A second cross-chain hash determination unit, configured to determine M cross-chain transaction hashes according to the N to-be-cross-chain transaction hashes stored on the M blocks; The cross-chain evidence storage module is specifically used for: Send the M cross-chain transaction hashes to the main chain.

5. A terminal device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the cross-chain evidence storage method as described in any one of claims 1 to 3 is implemented.

6. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the cross-chain evidence storage method as described in any one of claims 1 to 3 is implemented.

Citation Information

Patent Citations

  • Block chain cross-chain communication method and system, electronic device and storage medium

    CN109934592A

  • Parallel chain main chain transaction state synchronization method and device, and storage medium

    CN110084601A