Evidence verification method, system, device, equipment and readable storage medium
The hash aggregation algorithm is used to hash the contract set, generate the first hash value and compare it with the pre-stored second hash value, which solves the problem of heavy communication and transmission burden on the blockchain platform and achieves rapid evidence verification.
Patent Information
- Application Number
- CN201910783390.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2019-08-23
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2039-08-23
AI Technical Summary
In financial business, because the blockchain platform has no central structure, each write operation requires a complex communication cost, resulting in heavy communication and transmission burden.
The hash aggregation algorithm is used to hash the contract set, generate the first hash value, and compare it with the pre-stored second hash value to verify the integrity of the evidence.
It reduces the communication and transmission burden of the blockchain platform and achieves rapid evidence verification.
Smart Images

Figure CN110490599B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of blockchain in financial technology (Fintech), and particularly relates to a method, system, device, equipment and readable storage medium for verifying evidence. Background Art
[0002] With the development of computer technology, more and more technologies (big data, distributed, blockchain, artificial intelligence, etc.) are applied in the financial field, and traditional finance is gradually transforming into financial technology (Fintech).
[0003] In financial operations, when users conduct transactions, they usually store the contracts signed by the users on the blockchain for preservation. When arbitration disputes occur, the corresponding contracts are retrieved from the blockchain as needed. Due to the immutability of the blockchain, the effective integrity of the contracts can be ensured, and the verification platform (arbitration institution) makes a ruling on the case based on the contracts; this preservation method performs a hash preservation for each piece of evidence. Since a business scenario often involves multiple document contracts, separately storing each document on the blockchain will undoubtedly increase the communication and storage burden on the blockchain platform. Especially for the blockchain platform with a decentralized peer-to-peer structure, each write operation incurs a complex communication cost. Summary of the Invention
[0004] The main objective of the present invention is to propose a method, system, device, equipment and readable storage medium for verifying evidence, aiming to solve the technical problem of heavy communication and transmission burdens in the current verification process.
[0005] To achieve the above objective, the present invention provides a method for verifying evidence. The method for verifying evidence is applied to a verification platform and includes the following steps:
[0006] When receiving a verification request triggered by evidence information, obtain the evidence information, where the evidence information includes: a contract set and a chain address;
[0007] Perform hash calculation on each transaction contract in the contract set to obtain a first hash value corresponding to each transaction contract, and process each first hash value according to a preset hash aggregation algorithm to obtain a first root hash;
[0008] Obtain a pre-stored second root hash according to the chain address, and compare the first root hash with the second root hash;
[0009] If the first root hash is the same as the second root hash, determine that the evidence verification is passed.
[0010] Optionally, the hash aggregation algorithm includes a first aggregation algorithm and a second aggregation algorithm;
[0011] The step of processing each of the first hash values according to a preset hash aggregation algorithm to obtain a first root hash includes:
[0012] Sorting the transaction contracts corresponding to each of the first hash values to form a contract sequence;
[0013] Iteratively merging each of the first hash values according to the first aggregation algorithm in accordance with the contract sequence to obtain a first root hash; or,
[0014] Uniformly merging each of the first hash values according to the second aggregation algorithm in accordance with the contract sequence to obtain a first root hash.
[0015] Optionally, the step of iteratively merging each of the first hash values according to the first aggregation algorithm in accordance with the contract sequence to obtain a first root hash includes:
[0016] Initializing an array according to the first aggregation algorithm, where n is the number of contracts in the contract sequence;
[0017] Taking the first hash value corresponding to each transaction contract in the contract sequence as an element and inputting it into the array, and iterating the elements in the array to obtain a first root hash, where the number of iterations
[0018] Optionally, the step of uniformly merging each of the first hash values according to the second aggregation algorithm in accordance with the contract sequence to obtain a first root hash includes:
[0019] Obtaining the first hash value of each transaction contract in the contract sequence, and processing each of the first hash values according to the second aggregation algorithm to obtain a first root hash;
[0020] Wherein, the second aggregation algorithm is: h0 = hash(h1||h2…||hn);
[0021] In the second aggregation algorithm, h0 represents the first root hash, h1 represents the first hash value of the first transaction contract sorted in the contract sequence; h2 represents the first hash value of the second transaction contract sorted in the contract sequence, and so on, hn represents the first hash value of the last transaction contract sorted in the contract sequence.
[0022] Optionally, the method for verifying the evidence further includes:
[0023] If the first root hash is different from the second root hash, when receiving an analysis request, obtaining each of the first hash values corresponding to the first root hash, and obtaining each of the second hash values corresponding to the second root hash;
[0024] Compare the first hash value and the second hash value of the same transaction contract, obtain the modified target transaction contract, and output it.
[0025] Optionally, the step of comparing the first hash value and the second hash value of the same transaction contract, obtaining the modified target transaction contract, and outputting it includes:
[0026] If the preset hash aggregation algorithm is the first aggregation algorithm, perform hash value comparison according to the iteration order of the first aggregation algorithm, use the transaction contract with different first hash value and second hash value as the modified target transaction contract, and output the target transaction contract;
[0027] If the preset hash aggregation algorithm is the second aggregation algorithm, compare the first hash value and the second hash value of the same transaction contract in the contract set, use the transaction contract with different first hash value and second hash value as the modified target transaction contract, and output the target transaction contract.
[0028] In addition, to achieve the above object, the present invention also provides a method for verifying evidence. The method for verifying evidence is applied to a trading platform. The method for verifying evidence includes the following steps:
[0029] When receiving a transaction deposit request, obtain the transaction identifier corresponding to the transaction deposit request and the contract set corresponding to the transaction identifier;
[0030] Determine the hash aggregation algorithm according to the transaction identifier, perform hash calculation on each transaction contract in the contract set to obtain the second hash value corresponding to each transaction contract, and process each second hash value according to the hash aggregation algorithm to obtain the second root hash;
[0031] Use each second hash value and the second root hash as the content to be chained, and initiate a chaining preservation request based on the content to be chained, so that the blockchain platform saves the content to be chained;
[0032] When receiving the chain address feedback from the blockchain platform, save the chain address and the contract set as evidence information;
[0033] When receiving a verification request, obtain the evidence information corresponding to the verification request, and send the evidence information to a verification platform to verify the evidence information on the verification platform.
[0034] Optionally, the step of determining the hash aggregation algorithm according to the transaction identifier includes:
[0035] Acquire transaction scenario information and transaction user information corresponding to the transaction identifier, and determine a transaction risk value corresponding to the transaction scenario information and a user risk value corresponding to the transaction user information according to a preset risk assessment rule;
[0036] Taking the sum of the transaction risk value and the user risk value as a comprehensive risk value, and comparing the comprehensive risk value with a preset risk threshold;
[0037] If the comprehensive risk value is greater than or equal to the preset risk threshold, the preset first aggregation algorithm is used as the hash aggregation algorithm;
[0038] If the comprehensive risk value is less than the preset risk threshold, the preset second aggregation algorithm is used as the hash aggregation algorithm.
[0039] In addition, to achieve the above-mentioned purpose, the present invention also provides an evidence verification system, the evidence verification system comprising a transaction platform, a blockchain platform and a verification platform that are communicatively connected, and the evidence verification system implements the following steps:
[0040] When the trading platform receives the transaction evidence storage request, the trading platform obtains the transaction identifier corresponding to the transaction evidence storage request and the contract set corresponding to the transaction identifier;
[0041] The trading platform determines a hash aggregation algorithm according to the transaction identifier, performs hash calculation on each transaction contract in the contract set, and obtains a second hash value corresponding to each transaction contract. The trading platform processes each second hash value according to the hash aggregation algorithm to obtain a second root hash.
[0042] The trading platform uses each of the second hash values and the second root hash as on-chain content, and the trading platform initiates an on-chain preservation request based on the on-chain content;
[0043] The blockchain platform receives the on-chain preservation request initiated by the trading platform, saves the on-chain content, and sends the on-chain address guaranteed by the on-chain content to the trading platform;
[0044] When the trading platform receives the on-chain address fed back by the blockchain platform, the trading platform saves the on-chain address and the contract set as evidence information;
[0045] When the trading platform receives the verification request, the trading platform obtains the evidence information corresponding to the verification request and sends the evidence information to the verification platform;
[0046] When the verification platform receives a verification request triggered by evidence information, the verification platform obtains the evidence information, wherein the evidence information includes: a contract set and an on-chain address;
[0047] The verification platform calculates the hash of each transaction contract in the contract set to obtain the first hash value corresponding to each transaction contract. The verification platform processes each of the first hash values according to a preset hash aggregation algorithm to obtain the first root hash;
[0048] The verification platform obtains the pre-stored second root hash according to the on-chain address, and the verification platform compares the first root hash and the second root hash;
[0049] If the first root hash is the same as the second root hash, the verification platform determines that the evidence verification has passed.
[0050] In addition, to achieve the above object, the present invention further provides an evidence verification device, which is set on the verification platform. The evidence verification device includes:
[0051] A request receiving module, configured to obtain the evidence information when receiving a verification request triggered based on the evidence information, where the evidence information includes: a contract set and an on-chain address;
[0052] A hash processing module, configured to calculate the hash of each transaction contract in the contract set to obtain the first hash value corresponding to each transaction contract, and process each of the first hash values according to a preset hash aggregation algorithm to obtain the first root hash;
[0053] An obtaining and comparing module, configured to obtain the pre-stored second root hash according to the on-chain address, and compare the first root hash and the second root hash;
[0054] A result output module, configured to determine that the evidence verification has passed if the first root hash is the same as the second root hash.
[0055] In addition, to achieve the above object, the present invention further provides an evidence verification device, which is set on the trading platform. The evidence verification device includes:
[0056] A first obtaining module, configured to obtain the transaction identifier corresponding to the transaction deposit evidence request and the contract set corresponding to the transaction identifier when receiving the transaction deposit evidence request;
[0057] A determining and processing module, configured to determine the hash aggregation algorithm according to the transaction identifier, calculate the hash of each transaction contract in the contract set to obtain the second hash value corresponding to each transaction contract, and process each of the second hash values according to the hash aggregation algorithm to obtain the second root hash;
[0058] A request module, configured to use each of the second hash values and the second root hash as the on-chain content, and initiate an on-chain preservation request based on the on-chain content, so that the blockchain platform saves the on-chain content;
[0059] A saving module, configured to save the on-chain address and the contract set as evidence information when receiving the on-chain address fed back by the blockchain platform;
[0060] A second obtaining module, configured to obtain the evidence information corresponding to the verification request and send the evidence information to a verification platform to verify the evidence information on the verification platform when receiving the verification request.
[0061] In addition, to achieve the above object, the present invention further provides a verification device for evidence, where the verification device for evidence includes: a memory, a processor, and an evidence verification program stored on the memory and executable on the processor. When the evidence verification program is executed by the processor, the steps of the above-mentioned evidence verification method are implemented.
[0062] In addition, to achieve the above object, the present invention further provides a computer-readable storage medium, on which an evidence verification program is stored. When the evidence verification program is executed by a processor, the steps of the above-mentioned evidence verification method are implemented.
[0063] The present invention provides an evidence verification method, system, device, equipment, and readable storage medium. When receiving a verification request, obtain the evidence information corresponding to the verification request, where the evidence information includes: a contract set and an on-chain address; perform a hash calculation on each transaction contract in the contract set to obtain a first hash value corresponding to each transaction contract, and process each first hash value according to a preset hash aggregation algorithm to obtain a first root hash; obtain a pre-stored second root hash according to the on-chain address, and compare the first root hash and the second root hash; if the first root hash is the same as the second root hash, determine that the evidence verification passes. In the embodiments of the present invention, a hash aggregation method is adopted to collect and upload evidence, and at the same time, the communication and transmission burden can be reduced. When the verification platform needs to perform verification, fast verification can be achieved. Description of the Drawings
[0064] Figure 1 is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment solution of the present invention;
[0065] Figure 2 is a schematic flowchart of the first embodiment of the evidence verification method of the present invention;
[0066] Figure 3 is a schematic flowchart of the third embodiment of the evidence verification method of the present invention;
[0067] Figure 4 is a schematic diagram of the functional modules of an embodiment of the evidence verification device of the present invention;
[0068] Figure 5 Schematic diagram of functional modules of another embodiment of the verification device for the evidence of the present invention.
[0069] The implementation, functional features and advantages of the object of the present invention will be further described in conjunction with embodiments with reference to the accompanying drawings. Specific embodiments
[0070] It should be understood that the specific embodiments described herein are only used to explain the present invention and are not used to limit the present invention.
[0071] As Figure 1 shown, Figure 1 is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment solution of the present invention.
[0072] The verification device for the evidence in the embodiment of the present invention may be a terminal or a server. As Figure 1 shown, the verification device for the evidence may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between these components. The user interface 1003 may include a display screen (Display) and an input unit such as a keyboard (Keyboard). Optionally, the user interface 1003 may further include a standard wired interface and a wireless interface. The network interface 1004 may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface). The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0073] Those skilled in the art can understand that Figure 1 the device structure shown in
[0074] As Figure 1 shown, the memory 1005, as a computer storage medium, may include an operating system, a network communication module, a user interface module, and a verification program for the evidence, that is, a computer program corresponding to the verification of the evidence.
[0075] In Figure 1In the device shown, the network interface 1004 is mainly used to connect to the background server and communicate data with the background server; the user interface 1003 is mainly used to connect to the client (user side) and communicate data with the client; and the processor 1001 can be used to call the evidence verification program stored in the memory 1005 and execute the operations in the following evidence verification method.
[0076] The computer-readable storage medium of the present invention stores an evidence verification program, and the method implemented when executed can refer to each embodiment of the evidence verification method of the present invention, which will not be elaborated here.
[0077] Based on the above hardware structure, an embodiment of the evidence verification method of the present invention is proposed.
[0078] Refer to Figure 2 , Figure 2 is a schematic flowchart of the first embodiment of the evidence verification method of the present invention, and the method includes:
[0079] Step S10, when receiving a verification request triggered based on evidence information, obtain the evidence information, where the evidence information includes: a contract set and a chain address;
[0080] The evidence verification method in this embodiment is applied to an evidence verification device, which is the hardware carrier of the verification platform. The verification platform receives the verification request, and the triggering method of the verification request is not specifically limited. That is, the verification request can be actively triggered. For example, a customer clicks "Verify" on the trading platform to actively trigger the verification request, and the trading platform sends the verification request to the verification platform; in addition, the verification request can also be automatically triggered. For example, when a preset transaction fails in the trading platform, the verification request is automatically triggered. When the trading platform detects a transaction failure, the verification request is automatically triggered, and the trading platform sends the verification request to the verification platform.
[0081] When the verification platform receives the verification request, the verification platform obtains the evidence information corresponding to the verification request, where the evidence information includes: a contract set and a chain address.
[0082] Step S20, perform a hash calculation on each transaction contract in the contract set to obtain a first hash value corresponding to each transaction contract, and process each first hash value according to a preset hash aggregation algorithm to obtain a first root hash.
[0083] The verification platform sorts each transaction contract in the contract set. The sorting method of the transaction contracts in this embodiment is not specifically limited. For example, sorting is performed according to the size of the transaction contract, sorting is performed according to the signing date of the transaction contract, etc. After sorting each transaction contract in the contract set, the verification platform calculates the first hash value corresponding to each sorted transaction contract. The verification platform processes each first hash value according to the hash aggregation algorithm (the hash aggregation algorithm includes the first aggregation algorithm and the second aggregation algorithm) to obtain the first root hash. Specifically, it includes:
[0084] Step a1, sort the transaction contracts corresponding to each first hash value to form a contract sequence;
[0085] Step a2, iteratively merge each first hash value according to the first aggregation algorithm according to the contract sequence to obtain the first root hash (according to the first aggregation algorithm, initialize an array, where n is the number of contracts in the contract sequence; input the first hash values corresponding to each transaction contract in the contract sequence as elements into the array, and iterate the elements in the array to obtain the first root hash, where the number of iterations ); or,
[0086] Step a3, uniformly merge each first hash value according to the second aggregation algorithm according to the contract sequence to obtain the first root hash (obtain the first hash values of each transaction contract in the contract sequence, and process each first hash value according to the second aggregation algorithm to obtain the first root hash; where the second aggregation algorithm is: h0 = hash(h1||h2…||hn); in the second aggregation algorithm, h0 represents the first root hash, h1 represents the first hash value of the first transaction contract sorted in the contract sequence; h2 represents the first hash value of the second transaction contract sorted in the contract sequence, and so on, hn represents the first hash value of the last transaction contract sorted in the contract sequence).
[0087] That is, the verification platform obtains each transaction contract in the contract set, sorts each transaction contract to form a contract sequence, calculates the first hash value of each transaction contract in the contract sequence, and then processes each first hash value according to the contract sequence and the hash aggregation algorithm to obtain the first root hash. Specifically:
[0088] Implementation method 1: When the hash aggregation algorithm is the first aggregation algorithm, the verification platform iteratively merges each first hash value to calculate the final first root hash. For example, for n files, iterations are required. If stored in a one-dimensional array, elements are required. For element i, use node iIt is represented, and its value is represented as hi (with the subscript starting from 0). If each iteration is regarded as a layer, then the first element in the l-th layer is The last element is (The layer number starts from 1, and the first layer is node0), and for each element node i The value of is calculated from the value of element node 2i+1 and the value of element node 2i+2 .
[0089] For n files (n >= 2), the specific aggregation calculation process is as follows:
[0090] Step 1: Initialize an array containing elements, with all values set to empty. Sort the n files in descending order of size, calculate the hash values in sequence, and fill them in starting from element in sequence. Leave the unfilled ones empty, and set the remaining number of iterations
[0091] Step 2: Calculate for the l-th layer. For each node from node to node perform the following operations in sequence: If the value of node i is non-empty and the value of node 2i+1 is non-empty: Calculate the value h 2i+2 of node i = hash(h i || h 2i+1 || h 2i+2 ); If the value of node 2i+1 is non-empty and the value of node 2i+2 is empty: Calculate the value h i of node i = hash(h 2i+1 ); If the value of node 2i+1 is empty and the value of node 2i+2 is non-empty: Calculate the value h i of node i = hash(h 2i+2 ); If the value of node 2i+1 is empty and the value of node 2i+2 is empty: Set the value h i of node i to be empty.
[0092] Step 3: The number of iterations l = l - 1; If l = 0, output the result: the value of node0; Otherwise, jump back to Step 2.
[0093] In this embodiment, the first aggregation algorithm is used for aggregation calculation, which facilitates evidence verification and traceability during verification. For example, for two given arrays to be verified, the following operations are performed:
[0094] a. Set i = 0. If h i = h' i , output: Verification passed, terminate.
[0095] b. Assign 2i + 1 and 2i + 2 to i respectively for the following judgments:
[0096] If h i ≠ h' i and output: The file corresponding to node i has changed;
[0097] If h i ≠ h' i and re - iterate step b;
[0098] If h i = h' i , terminate and return.
[0099] Implementation method two: When the hash aggregation algorithm is the second aggregation algorithm, calculate the hash for each contract file, and then uniformly merge according to the calculation results to calculate the aggregation result h0 = hash(h1||h2…||hn).
[0100] In this embodiment, the second aggregation algorithm is used for aggregation calculation. The algorithm is relatively simple, but it is not conducive to traceability. For example, for two given arrays to be verified, if h0 = h’0, the verification passes; otherwise, traverse and compare their hash values in turn. If they are inconsistent, the file has been modified.
[0101] Step S30, obtain the pre - stored second root hash according to the on - chain address, and compare the first root hash and the second root hash.
[0102] The verification platform obtains the pre - stored second root hash according to the on - chain address, that is, the verification platform queries the blockchain platform to obtain the second root hash saved by the on - chain address. The verification platform compares the first root hash and the second root hash to determine whether the transaction contracts in the contract set have been modified.
[0103] Step S40, if the first root hash is the same as the second root hash, determine that the evidence verification passes.
[0104] If the first root hash is the same as the second root hash, the verification platform determines that none of the transaction contracts in the contract set have been modified, and the verification platform determines that the evidence verification has passed. In the embodiments of the present invention, the hash aggregation method is adopted to collect and chain the evidence, which is applicable to the scenario of multiple writes and few reads of the arbitration chain, and can reduce the communication and transmission burden of the arbitration chain at the same time. When the verification platform needs to perform verification, fast verification can be realized.
[0105] It can be understood that the combined use of the first aggregation algorithm and the second aggregation algorithm in this embodiment makes the calculation and storage overhead perform well on the one hand, and ensures the efficiency of evidence traceability verification on the other hand.
[0106] Furthermore, based on the first embodiment of the evidence verification method of the present invention, a second embodiment of the evidence verification method of the present invention is proposed.
[0107] This embodiment is the step after step S30 in the first embodiment. The difference between this embodiment and the first embodiment is as follows:
[0108] If the first root hash is different from the second root hash, when receiving an analysis request, obtain each first hash value corresponding to the first root hash, and obtain each second hash value corresponding to the second root hash;
[0109] Compare the first hash value and the second hash value of the same transaction contract, and obtain and output the modified target transaction contract.
[0110] That is, if the first root hash is different from the second root hash, the verification platform determines that the transaction contracts in the contract set have been modified, and the verification platform outputs a verification result of verification failure.
[0111] When the verification platform receives an analysis request triggered by a verification result of verification failure, the verification platform obtains each first hash value corresponding to the first root hash, and the verification platform obtains each second hash value corresponding to the second root hash; the verification platform sequentially compares the first hash value and the second hash value corresponding to the same contract identifier. That is, if the preset hash aggregation algorithm is the first aggregation algorithm, the hash value comparison is performed according to the iteration order of the first aggregation algorithm, and the transaction contract with different first hash value and second hash value is used as the modified target transaction contract, and the target transaction contract is output; if the preset hash aggregation algorithm is the second aggregation algorithm, compare the first hash value and the second hash value of the same transaction contract in the contract set, and use the transaction contract with different first hash value and second hash value as the modified target transaction contract, and output the target transaction contract for the user to query.
[0112] In this embodiment, the verification platform traces back based on the first hash, each first hash value corresponding to the first hash, the second hash, and each second hash value corresponding to the second hash, so as to quickly determine the modified transaction contract.
[0113] Further, referring to Figure 3 , Figure 3 is a schematic flowchart of the third embodiment of the verification method for the evidence of the present invention. The method includes:
[0114] Step S50, when receiving a transaction deposit evidence request, obtain the transaction identifier corresponding to the transaction deposit evidence request and the contract set corresponding to the transaction identifier.
[0115] The verification method of the evidence in this embodiment is applied to an evidence verification device. The evidence verification device is a hardware carrier of a transaction platform (or also called a deposit evidence platform). The transaction platform receives a transaction deposit evidence request. The triggering method of the transaction deposit evidence request is not specifically limited. That is, the transaction deposit evidence request can be actively triggered. For example, a customer clicks "save" on a terminal to actively trigger a transaction deposit evidence request, and the terminal sends the transaction deposit evidence request to the transaction platform. In addition, the transaction deposit evidence request can also be automatically triggered. For example, when a preset transaction in the transaction platform is updated, the transaction deposit evidence request is automatically triggered, or when the transaction platform detects a transaction change, the transaction deposit evidence request is automatically triggered.
[0116] When the transaction platform receives a transaction deposit evidence request, the transaction platform obtains the transaction identifier corresponding to the transaction deposit evidence request (the transaction identifier refers to the identification information that uniquely identifies a transaction, such as a transaction number), and the contract set corresponding to the transaction identifier. The number of transaction contracts included in the contract set is multiple, and the specific number is not limited.
[0117] Step S60, determine a hash aggregation algorithm according to the transaction identifier, perform hash calculation on each transaction contract in the contract set to obtain a second hash value corresponding to each transaction contract, and process each second hash value according to the hash aggregation algorithm to obtain a second root hash.
[0118] The transaction platform determines a hash aggregation algorithm according to the transaction identifier. For example, a mapping table between transaction identifiers and aggregation algorithms is preset in the transaction platform. The transaction platform queries the preset mapping table between transaction identifiers and aggregation algorithms to obtain the hash aggregation algorithm corresponding to the transaction identifier. The transaction platform first performs individual hash calculation on each transaction contract in the contract set to obtain a second hash value corresponding to each transaction contract. Then, the transaction platform processes each second hash value according to the hash aggregation algorithm to obtain a second root hash. The specific implementation manner of the transaction platform processing each second hash value according to the hash aggregation algorithm to obtain a second root hash can refer to the first embodiment, and will not be elaborated in this embodiment.
[0119] Step S70: Use each of the second hash values and the second root hash as the content to be uploaded to the blockchain. Initiate an on-chain preservation request based on the content to be uploaded to the blockchain, so that the blockchain platform saves the content to be uploaded to the blockchain.
[0120] The trading platform uses each of the second hash values and the second root hash as the content to be uploaded to the blockchain. The trading platform initiates an on-chain preservation request based on the content to be uploaded to the blockchain, that is, the trading platform sends an on-chain preservation request to the blockchain platform, so that the blockchain platform saves the content to be uploaded to the blockchain.
[0121] The blockchain platform receives the on-chain preservation request sent by the trading platform, obtains the content to be uploaded to the blockchain corresponding to the on-chain preservation request and saves it. When the content to be uploaded to the blockchain is saved, the blockchain platform sends the saved on-chain address to the trading platform, so that the trading platform can query the saved content to be uploaded to the blockchain according to the on-chain address.
[0122] It can be understood that in this embodiment, the second hash values corresponding to each trading contract and the aggregated second root hash are saved in the blockchain platform. Generally, saving the second root hash can achieve judgment. However, ensuring the second hash values corresponding to each trading contract helps with traceability. If it is not necessary to trace specific trading contracts, only the second root hash can be saved without saving the second hash values corresponding to each trading contract, so as to reduce the occupation of the storage space of the blockchain platform.
[0123] Step S80: When receiving the on-chain address feedback from the blockchain platform, save the on-chain address and the contract set as evidence information.
[0124] When the trading platform receives the on-chain address feedback from the blockchain platform, the trading platform saves the on-chain address and the trading identifier, so that when a verification request appears, the on-chain address can be fed back to the verification platform. In the embodiment of the present invention, the hash aggregation method is used to collect and upload evidence, which is applicable to the scenario of multiple writes and few reads of the arbitration chain, and can also reduce the communication and transmission burden of the arbitration chain. Specifically:
[0125] Step S90: When receiving a verification request, obtain the evidence information corresponding to the verification request and send the evidence information to the verification platform for the verification platform to verify the evidence information.
[0126] The trading platform receives a verification request. The triggering method of the verification request is not specifically limited. The trading platform obtains the evidence information corresponding to the verification request. The evidence information includes the contract set and the on-chain address; the trading platform also sends the evidence information to the verification platform for verification on the verification platform.
[0127] In this embodiment, when the trading platform receives a trading operation initiated by a customer, it signs the relevant contract to initiate evidence preservation, and guarantees the evidence information to the trading platform and the blockchain platform. By effectively preserving the evidence information, on the one hand, it is convenient for query, and on the other hand, it can ensure the fairness and openness of the transaction.
[0128] Further, based on the third embodiment of the evidence verification method of the present invention, a fourth embodiment of the evidence verification method of the present invention is proposed.
[0129] This embodiment is a refinement of step S60 in the third embodiment. In this embodiment, a specific implementation method for determining the hash aggregation algorithm according to the transaction identifier is given, including:
[0130] Obtain the transaction scenario information and transaction user information corresponding to the transaction identifier, and determine the transaction risk value corresponding to the transaction scenario information and the user risk value corresponding to the transaction user information according to the preset risk assessment rules.
[0131] Take the sum of the transaction risk value and the user risk value as the comprehensive risk value, and compare the comprehensive risk value with the preset risk threshold.
[0132] If the comprehensive risk value is greater than or equal to the preset risk threshold, then use the first aggregation algorithm as the hash aggregation algorithm;
[0133] If the comprehensive risk value is less than the preset risk threshold, then use the second aggregation algorithm as the hash aggregation algorithm.
[0134] That is, in the trading platform, there are preset risk assessment rules. The risk assessment rules are rules for trading risk assessment, and the risk assessment rules can be flexibly set according to specific scenarios. For example, if the trading amount is greater than 100,000, the risk value is 1 point, and if the user level is less than level three, the risk value is 1 point.
[0135] The trading platform obtains the transaction scenario information and transaction user information corresponding to the transaction identifier. Among them, the transaction scenario information includes but is not limited to the trading amount, trading type, and trading time; the transaction user information includes but is not limited to the user name, user level, user score, user contact information, and user account. The trading platform determines the transaction risk value corresponding to the transaction scenario information and the user risk value corresponding to the transaction user information according to the preset risk assessment rules.
[0136] The trading platform takes the sum of the transaction risk value and the user risk value as the comprehensive risk value. The trading platform compares the size of the comprehensive risk value with the preset risk threshold. Among them, the preset risk threshold refers to the pre-set risk assessment benchmark value. If the comprehensive risk value is greater than or equal to the preset risk threshold, it means that the risk of the transaction is relatively large. If the comprehensive risk value is less than the preset risk threshold, it means that the risk of the transaction is relatively small.
[0137] If the trading platform determines that the comprehensive risk value is greater than or equal to the preset risk threshold, the trading platform will use the first aggregation algorithm as the hash aggregation algorithm; if the trading platform determines that the comprehensive risk value is less than the preset risk threshold, the trading platform will use the second aggregation algorithm as the hash aggregation algorithm.
[0138] In this embodiment, a comprehensive risk value is determined according to the transaction scenario information and transaction user information corresponding to the transaction identifier, and an aggregation algorithm is determined according to the comprehensive risk value. If the comprehensive risk value is high, it means that there is a high possibility of verification occurring later. In this case, the first aggregation algorithm is adopted. The first aggregation algorithm has larger computing and storage overhead than merge aggregation, but is better in tracing verification calculation and can support branch verification. If the comprehensive risk value is low, it means that there is a low possibility of verification occurring later. In this case, the second aggregation algorithm is adopted. The second aggregation algorithm generates root hashes and operations more simply and quickly, and occupies less storage, but is slightly less efficient in tracing verification calculation.
[0139] In this embodiment, the corresponding hash aggregation algorithm is selected according to the risk value of the assessed transaction. The combination of the first aggregation algorithm and the second aggregation algorithm has a better performance in computing and storage overheads on the one hand, and ensures the efficiency of evidence tracing and verification on the other hand.
[0140] The present invention also provides an embodiment of a system for verifying evidence.
[0141] The evidence verification system includes a transaction platform, a blockchain platform and a verification platform that are in communication connection, and the evidence verification system implements the following steps:
[0142] When the trading platform receives the transaction evidence storage request, the trading platform obtains the transaction identifier corresponding to the transaction evidence storage request and the contract set corresponding to the transaction identifier;
[0143] The trading platform determines a hash aggregation algorithm according to the transaction identifier, performs hash calculation on each transaction contract in the contract set, and obtains a second hash value corresponding to each transaction contract. The trading platform processes each second hash value according to the hash aggregation algorithm to obtain a second root hash.
[0144] The trading platform uses each of the second hash values and the second root hash as on-chain content, and the trading platform initiates an on-chain preservation request based on the on-chain content;
[0145] The blockchain platform receives the on-chain preservation request initiated by the trading platform, saves the on-chain content, and sends the on-chain address guaranteed by the on-chain content to the trading platform;
[0146] When the trading platform receives the on-chain address fed back by the blockchain platform, the trading platform saves the on-chain address and the contract set as evidence information;
[0147] When the trading platform receives a verification request, the trading platform obtains the evidence information corresponding to the verification request and sends the evidence information associated with the verification request to the verification platform;
[0148] When the verification platform receives a verification request, the verification platform obtains the evidence information corresponding to the verification request, wherein the evidence information includes: a contract set and a chain address;
[0149] The verification platform performs a hash calculation on each trading contract in the contract set to obtain a first hash value corresponding to each trading contract, and the verification platform processes each first hash value according to a preset hash aggregation algorithm to obtain a first root hash;
[0150] The verification platform obtains a pre-stored second root hash according to the chain address, and the verification platform compares the first root hash and the second root hash;
[0151] If the first root hash is the same as the second root hash, the verification platform determines that the evidence verification is passed.
[0152] The method executed by the above evidence verification system may refer to each embodiment of the evidence verification method of the present invention, which will not be elaborated here.
[0153] Refer to Figure 4 , an embodiment of the present invention further provides an evidence verification device, the evidence verification device is set on the verification platform, and the evidence verification device includes:
[0154] A request receiving module 10, configured to obtain the evidence information corresponding to the verification request when receiving a verification request, wherein the evidence information includes: a contract set and a chain address;
[0155] A hash processing module 20, configured to perform a hash calculation on each trading contract in the contract set to obtain a first hash value corresponding to each trading contract, and process each first hash value according to a preset hash aggregation algorithm to obtain a first root hash;
[0156] An obtaining and comparing module 30, configured to obtain a pre-stored second root hash according to the chain address, and compare the first root hash and the second root hash;
[0157] A result output module 40, configured to determine that the evidence verification is passed if the first root hash is the same as the second root hash.
[0158] In an embodiment, the hash processing module 20 includes:
[0159] A sorting and calculating unit, configured to sort the trading contracts corresponding to each first hash value to form a contract sequence;
[0160] The first aggregation unit is configured to iteratively merge each of the first hash values according to the first aggregation algorithm in accordance with the contract sequence to obtain a first root hash; or,
[0161] The second aggregation unit is configured to uniformly merge each of the first hash values according to the second aggregation algorithm in accordance with the contract sequence to obtain a first root hash.
[0162] In one embodiment, the first aggregation unit is configured to:
[0163] Initialize an array according to the first aggregation algorithm, where n is the number of contracts in the contract sequence;
[0164] Input the first hash value corresponding to each transaction contract in the contract sequence as an element into the array, and iterate on the elements in the array to obtain a first root hash, where the number of iterations
[0165] In one embodiment, the second aggregation unit is configured to:
[0166] Obtain the first hash value of each transaction contract in the contract sequence, and process each of the first hash values according to the second aggregation algorithm to obtain a first root hash;
[0167] Wherein, the second aggregation algorithm is: h0 = hash(h1||h2…||hn);
[0168] In the second aggregation algorithm, h0 represents the first root hash, h1 represents the first hash value of the first transaction contract in the contract sequence; h2 represents the first hash value of the second transaction contract in the contract sequence, and so on, hn represents the first hash value of the last transaction contract in the contract sequence.
[0169] In one embodiment, the evidence verification device includes:
[0170] A second output module, configured to output a verification result of failed verification if the first root hash is different from the second root hash;
[0171] A result analysis module, configured to, when receiving an analysis request triggered by the verification result of failed verification, obtain each first hash value corresponding to the first root hash, and obtain each second hash value corresponding to the second root hash;
[0172] A comparison and output module, configured to compare the first hash value and the second hash value of the same transaction contract, and obtain and output the modified target transaction contract.
[0173] In one embodiment, the comparison output module includes:
[0174] A first comparison unit, configured to, if the preset hash aggregation algorithm is the first aggregation algorithm, perform hash value comparison according to the iteration order of the first aggregation algorithm, and use the transaction contracts with different first hash values and second hash values as the modified target transaction contracts, and output the target transaction contracts;
[0175] A second comparison unit, configured to, if the preset hash aggregation algorithm is the second aggregation algorithm, compare the first hash value and the second hash value of the same transaction contract in the contract set, and use the transaction contracts with different first hash values and second hash values as the modified target transaction contracts, and output the target transaction contracts.
[0176] The methods executed by the above program modules can refer to the embodiments of the evidence verification method of the present invention, which will not be elaborated here.
[0177] Refer to Figure 5 , the embodiment of the present invention further provides another evidence verification device. The evidence verification device is set in a trading platform. The evidence verification device includes:
[0178] A first acquisition module 50, configured to, when receiving a transaction deposit request, acquire the transaction identifier corresponding to the transaction deposit request and the contract set corresponding to the transaction identifier;
[0179] A determination processing module 60, configured to determine a hash aggregation algorithm according to the transaction identifier, perform hash calculation on each transaction contract in the contract set to obtain a second hash value corresponding to each transaction contract, and process each second hash value according to the hash aggregation algorithm to obtain a second root hash;
[0180] A request module 70, configured to use each second hash value and the second root hash as the content to be uploaded, and initiate an upload preservation request based on the content to be uploaded, so that the blockchain platform saves the content to be uploaded;
[0181] A saving module 80, configured to, when receiving the on-chain address feedback by the blockchain platform, save the on-chain address and the contract set as evidence information;
[0182] A second acquisition module 90, configured to, when receiving a verification request, acquire the evidence information corresponding to the verification request, and send the evidence information and the verification request in an associated manner to a verification platform for verification; wherein, the evidence information includes a contract set and an on-chain address.
[0183] In one embodiment, the determination processing module includes:
[0184] An acquisition and determination unit is configured to acquire the transaction scenario information and transaction user information corresponding to the transaction identifier, and determine the transaction risk value corresponding to the transaction scenario information and the user risk value corresponding to the transaction user information according to a preset risk assessment rule;
[0185] A scoring and comparison unit is configured to use the sum of the transaction risk value and the user risk value as the comprehensive risk value, and compare the comprehensive risk value with a preset risk threshold;
[0186] A first determination unit is configured to, if the comprehensive risk value is greater than or equal to the preset risk threshold, use a first aggregation algorithm as the hash aggregation algorithm;
[0187] A second determination unit is configured to, if the comprehensive risk value is less than the preset risk threshold, use a second aggregation algorithm as the hash aggregation algorithm.
[0188] The methods executed by the above program modules can refer to the various embodiments of the evidence verification method of the present invention, which will not be elaborated here.
[0189] It should be noted that in this article, the terms "include", "comprise" or any other variant thereof are intended to cover non-exclusive inclusion, so that a process, method, article or system including a series of elements not only includes those elements, but also includes other elements not expressly listed, or further includes elements inherent to such process, method, article or system. Without further limitation, an element defined by the statement "including one..." does not exclude the existence of additional identical elements in the process, method, article or system including that element.
[0190] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages and disadvantages of the embodiments.
[0191] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus a necessary general hardware platform. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0192] The above are only the preferred embodiments of the present invention, and do not limit the patent scope of the present invention accordingly. Any equivalent structure or equivalent process transformation made by using the content of the specification and drawings of the present invention, or directly or indirectly applied in other related technical fields, shall be similarly included in the patent protection scope of the present invention.
Claims
1. A method for verifying evidence, characterized in that, The verification method of the evidence is applied to a verification platform, and the verification method of the evidence includes the following steps: When receiving a verification request triggered by evidence information, obtain the evidence information, where the evidence information includes: a contract set and a blockchain address; Perform hash calculation on each transaction contract in the contract set to obtain a first hash value corresponding to each transaction contract, and process each first hash value according to a preset hash aggregation algorithm to obtain a first root hash; the preset hash aggregation algorithm is determined according to a transaction identifier; Obtain a pre-stored second root hash according to the blockchain address, and compare the first root hash and the second root hash; If the first root hash is the same as the second root hash, determine that the evidence verification is passed; The step of determining the hash aggregation algorithm according to the transaction identifier includes: Obtain the transaction scenario information and transaction user information corresponding to the transaction identifier, and determine the transaction risk value corresponding to the transaction scenario information and the user risk value corresponding to the transaction user information according to a preset risk assessment rule; where the transaction scenario information includes but is not limited to transaction amount, transaction type, and transaction time; the transaction user information includes but is not limited to user name, user level, user score, user contact information, and user account; Use the sum of the transaction risk value and the user risk value as the comprehensive risk value, and compare the comprehensive risk value with a preset risk threshold; If the comprehensive risk value is greater than or equal to the preset risk threshold, use a preset first aggregation algorithm as the hash aggregation algorithm; If the comprehensive risk value is less than the preset risk threshold, use a preset second aggregation algorithm as the hash aggregation algorithm; Wherein, the hash aggregation algorithm includes a first aggregation algorithm and a second aggregation algorithm; The step of processing each first hash value according to the preset hash aggregation algorithm to obtain a first root hash includes: Sort the transaction contracts corresponding to each first hash value to form a contract sequence; Iteratively merge each first hash value according to the first aggregation algorithm according to the contract sequence to obtain a first root hash; or, Unify and merge each first hash value according to the second aggregation algorithm according to the contract sequence to obtain a first root hash; The step of iteratively merging each first hash value according to the first aggregation algorithm according to the contract sequence to obtain a first root hash includes: Step 1: Initialize an array with elements, all values are set to empty. Sort the n transaction contracts in descending order of size, calculate the hash values in sequence, and fill them in starting from element in sequence. Leave the unfilled positions empty, and set the remaining number of iterations where n is the number of contracts in the contract sequence; Step 2: Calculate for layer l, from node to node For each node node i perform the following operations in sequence: If the value of node 2i+1 is not empty and the value of node 2i+2 is not empty: Calculate the value h i of node i = hash(h 2i+1 || h 2i+2 ); If the value of node 2i+1 is not empty and the value of node 2i+2 is empty: Calculate the value h i of node i = hash(h 2i+1 ); If the value of node 2i+1 is empty and the value of node 2i+2 is not empty: Calculate the value h i of node i = hash(h 2i+2 ); If the value of node 2i+1 is empty and the value of node 2i+2 is empty: Set the value h i of node i to be empty; Step 3: The iteration number l = l - 1; if l = 0, output the result: the value of node node0; otherwise, jump back to step 2; where the value of node node0 is the first root hash; The step of unifying and merging each first hash value according to the second aggregation algorithm according to the contract sequence to obtain a first root hash includes: Obtain the first hash values of each transaction contract in the contract sequence, and process each first hash value according to the second aggregation algorithm to obtain a first root hash; Wherein, the second aggregation algorithm is: h0 = hash(h1||h2…||hn); In the second aggregation algorithm, h0 represents the first root hash, h1 represents the first hash value of the first transaction contract in the contract sequence; h2 represents the first hash value of the second transaction contract in the contract sequence, and so on until hn represents the first hash value of the last transaction contract in the contract sequence.
2. The verification method of the evidence as described in claim 1, characterized in that, The method for verifying the evidence further includes: If the first root hash is different from the second root hash, when receiving an analysis request, obtain each first hash value corresponding to the first root hash and each second hash value corresponding to the second root hash; Compare the first hash value and the second hash value of the same transaction contract to obtain the modified target transaction contract and output it.
3. The verification method of the evidence according to claim 2, characterized in that, The step of comparing the first hash value and the second hash value of the same transaction contract to obtain the modified target transaction contract and output it includes: If the preset hash aggregation algorithm is the first aggregation algorithm, perform hash value comparison according to the iteration order of the first aggregation algorithm, and use the transaction contract with different first hash value and second hash value as the modified target transaction contract, and output the target transaction contract; If the preset hash aggregation algorithm is the second aggregation algorithm, compare the first hash value and the second hash value of the same transaction contract in the contract set, and use the transaction contract with different first hash value and second hash value as the modified target transaction contract, and output the target transaction contract.
4. A method for verifying evidence, characterized in that, The method for verifying the evidence is applied to a trading platform, and the method for verifying the evidence includes the following steps: When receiving a transaction deposit request, obtain the transaction identifier corresponding to the transaction deposit request and the contract set corresponding to the transaction identifier; Determine the hash aggregation algorithm according to the transaction identifier, perform hash calculation on each transaction contract in the contract set to obtain each second hash value corresponding to the transaction contract, and process each second hash value according to the hash aggregation algorithm to obtain the second root hash; Use each second hash value and the second root hash as the content to be chained, and initiate a chaining preservation request based on the content to be chained, so that the blockchain platform saves the content to be chained; When receiving the on-chain address feedback from the blockchain platform, save the on-chain address and the contract set as evidence information; When receiving a verification request, obtain the evidence information corresponding to the verification request and send the evidence information to the verification platform to verify the evidence information on the verification platform; Among them, the step of determining the hash aggregation algorithm according to the transaction identifier includes: Obtain the transaction scenario information and transaction user information corresponding to the transaction identifier, and determine the transaction risk value corresponding to the transaction scenario information and the user risk value corresponding to the transaction user information according to the preset risk assessment rules; among them, the transaction scenario information includes but is not limited to transaction amount, transaction type and transaction time; the transaction user information includes but is not limited to user name, user level, user score, user contact information and user account; Use the sum of the transaction risk value and the user risk value as the comprehensive risk value, and compare the comprehensive risk value with the preset risk threshold; If the comprehensive risk value is greater than or equal to the preset risk threshold, the preset first aggregation algorithm is used as the hash aggregation algorithm; If the comprehensive risk value is less than the preset risk threshold, the preset second aggregation algorithm is used as the hash aggregation algorithm; The step of processing each of the second hash values according to the hash aggregation algorithm to obtain the second root hash includes: Sorting the transaction contracts corresponding to each of the second hash values to form a contract sequence; Iteratively merging each of the second hash values according to the first aggregation algorithm according to the contract sequence to obtain the second root hash; or, Uniformly merging each of the second hash values according to the second aggregation algorithm according to the contract sequence to obtain the second root hash; The step of iteratively merging each of the second hash values according to the first aggregation algorithm according to the contract sequence to obtain the second root hash includes: Step 1: Initialize an array containing elements, with all values set to empty. Sort the n transaction contracts in descending order of size, calculate the hash values in sequence, and fill them in starting from element in sequence. Leave the unfilled positions empty, and set the remaining number of iterations where n is the number of contracts in the contract sequence; Step 2: Calculate for layer l, from node to node For each node node i perform the following operations in sequence: If the value of node 2i+1 is non-empty and the value of node 2i+2 is non-empty: Calculate the value h i of node i = hash(h 2i+1 || h 2i+2 ); If the value of node 2i+1 is non-empty and the value of node 2i+2 is empty: Calculate the value h i of node i = hash(h 2i+1 ); If the value of node 2i+1 is empty and the value of node 2i+2 is non-empty: Calculate the value h i of node i = hash(h 2i+2 ); If the value of node 2i+1 is empty and the value of node 2i+2 is empty: Set the value h i of node i to be empty; Step 3: The number of iterations l = l - 1; if l = 0, output the result: the value of node node0; otherwise, jump back to step 2; where the value of node node0 is the first root hash; The step of uniformly merging each of the second hash values according to the second aggregation algorithm according to the contract sequence to obtain the second root hash includes: Obtaining the second hash values of the transaction contracts in the contract sequence, and processing each of the second hash values according to the second aggregation algorithm to obtain the second root hash; Wherein, the second aggregation algorithm is: h0 = hash(h1||h2…||hn); In the second aggregation algorithm, h0 represents the second root hash, h1 represents the second hash value of the first transaction contract sorted in the contract sequence; h2 represents the second hash value of the second transaction contract sorted in the contract sequence, and so on, until hn represents the second hash value of the last transaction contract sorted in the contract sequence.
5. A verification system for evidence, characterized in that, The verification system for the evidence includes a transaction platform, a blockchain platform, and a verification platform that are communicatively connected. The verification system for the evidence implements the following steps: When the transaction platform receives a transaction deposit evidence request, the transaction platform obtains the transaction identifier corresponding to the transaction deposit evidence request and the contract set corresponding to the transaction identifier; The transaction platform obtains the transaction scenario information and transaction user information corresponding to the transaction identifier, and determines the transaction risk value corresponding to the transaction scenario information and the user risk value corresponding to the transaction user information according to the preset risk assessment rules; wherein, the transaction scenario information includes but is not limited to the transaction amount, transaction type, and transaction time; the transaction user information includes but is not limited to the user name, user level, user score, user contact information, and user account; The transaction platform takes the sum of the transaction risk value and the user risk value as the comprehensive risk value, and compares the comprehensive risk value with the preset risk threshold; if the comprehensive risk value is greater than or equal to the preset risk threshold, the preset first aggregation algorithm is used as the hash aggregation algorithm; if the comprehensive risk value is less than the preset risk threshold, the preset second aggregation algorithm is used as the hash aggregation algorithm; The trading platform performs hash calculations on each trading contract in the contract set according to the determined hash aggregation algorithm to obtain the second hash value corresponding to each trading contract. The trading platform processes each of the second hash values according to the hash aggregation algorithm to obtain the second root hash; The trading platform takes each of the second hash values and the second root hash as the content to be uploaded to the chain. The trading platform initiates a request for on-chain preservation based on the content to be uploaded to the chain; The blockchain platform receives the on-chain preservation request initiated by the trading platform. The blockchain platform stores the content to be uploaded to the chain and sends the on-chain address guaranteed by the content to be uploaded to the chain to the trading platform; When the trading platform receives the on-chain address fed back by the blockchain platform, the trading platform stores the on-chain address and the contract set as evidence information; When the trading platform receives a verification request, the trading platform obtains the evidence information corresponding to the verification request and sends the evidence information to the verification platform; When the verification platform receives a verification request triggered based on evidence information, the verification platform obtains the evidence information, where the evidence information includes: a contract set and an on-chain address; The verification platform performs hash calculations on each trading contract in the contract set to obtain the first hash value corresponding to each trading contract. The verification platform processes each of the first hash values according to a preset hash aggregation algorithm to obtain the first root hash; The verification platform obtains the pre-stored second root hash according to the on-chain address, and the verification platform compares the first root hash and the second root hash; If the first root hash is the same as the second root hash, the verification platform determines that the evidence verification is passed; The step of the verification platform processing each of the first hash values according to a preset hash aggregation algorithm to obtain the first root hash includes: Sorting the trading contracts corresponding to each first hash value to form a contract sequence; Iteratively merging each of the first hash values according to the first aggregation algorithm according to the contract sequence to obtain the first root hash; or, Unifying and merging each of the first hash values according to the second aggregation algorithm according to the contract sequence to obtain the first root hash; The step of iteratively merging each of the first hash values according to the first aggregation algorithm according to the contract sequence to obtain the first root hash includes: Step 1: Initialize an array containing elements, with all values set to empty. Sort the n transaction contracts in descending order of size, calculate the hash values in sequence, and fill them in starting from element in sequence. Leave the unfilled positions empty, and set the remaining number of iterations where n is the number of contracts in the contract sequence; Step 2: Calculate for layer l, from node to node For each node node i perform the following operations in sequence: If the value of node 2i+1 is not empty and the value of node 2i+2 is not empty: Calculate the value h i of node i = hash(h 2i+1 || h 2i+2 ); If the value of node 2i+1 is not empty and the value of node 2i+2 is empty: Calculate the value h i of node i = hash(h 2i+1 ); If the value of node 2i+1 is empty and the value of node 2i+2 is not empty: Calculate the value h i of node i = hash(h 2i+2 ); If the value of node 2i+1 is empty and the value of node 2i+2 is empty: Set the value h i of node i to be empty; Step 3: The iteration number l = l - 1; if l = 0, output the result: the value of node node0; otherwise, jump back to step 2; where the value of node node0 is the first root hash; The step of unifying and merging each of the first hash values according to the second aggregation algorithm according to the contract sequence to obtain the first root hash includes: Obtaining the first hash value of each trading contract in the contract sequence, and processing each of the first hash values according to the second aggregation algorithm to obtain the first root hash; Wherein, the second aggregation algorithm is: h0 = hash(h1||h2…||hn); In the second aggregation algorithm, h0 represents the first root hash, h1 represents the first hash value of the first transaction contract in the contract sequence; h2 represents the first hash value of the second transaction contract in the contract sequence, and so on, until hn represents the first hash value of the last transaction contract in the contract sequence.
6. An evidence verification device, characterized in that, The verification device for the evidence is set on the verification platform, and the verification device for the evidence includes: A request receiving module, configured to obtain the evidence information when receiving a verification request triggered based on the evidence information, where the evidence information includes: a contract set and a chain address; A hash processing module, configured to perform hash calculation on each transaction contract in the contract set to obtain the first hash value corresponding to each transaction contract, and process each of the first hash values according to a preset hash aggregation algorithm to obtain the first root hash; the preset hash aggregation algorithm is determined by the trading platform according to the transaction identifier; An obtaining and comparing module, configured to obtain a pre-stored second root hash according to the chain address, and compare the first root hash and the second root hash; A result output module, configured to determine that the evidence verification is passed if the first root hash is the same as the second root hash; The hash processing module is configured to obtain the transaction scenario information and transaction user information corresponding to the transaction identifier, and determine the transaction risk value corresponding to the transaction scenario information and the user risk value corresponding to the transaction user information according to a preset risk assessment rule; where the transaction scenario information includes but is not limited to the transaction amount, transaction type, and transaction time; the transaction user information includes but is not limited to the user name, user level, user score, user contact information, and user account; use the sum of the transaction risk value and the user risk value as the comprehensive risk value, and compare the comprehensive risk value with a preset risk threshold; if the comprehensive risk value is greater than or equal to the preset risk threshold, use the preset first aggregation algorithm as the hash aggregation algorithm; if the comprehensive risk value is less than the preset risk threshold, use the preset second aggregation algorithm as the hash aggregation algorithm; The hash processing module is configured to sort the transaction contracts corresponding to the first hash values to form a contract sequence; iteratively merge each of the first hash values according to the first aggregation algorithm according to the contract sequence to obtain the first root hash; or, uniformly merge each of the first hash values according to the second aggregation algorithm according to the contract sequence to obtain the first root hash; Step 1: Initialize an array with elements, all values are set to empty. Sort the n transaction contracts in descending order of size, calculate the hash values in sequence, and fill them in starting from element in sequence. Leave the unfilled positions empty, and set the remaining number of iterations where n is the number of contracts in the contract sequence; Step 2: Calculate for layer l, from node to node For each node node i perform the following operations in sequence: If the value of node 2i+1 is not empty and the value of node 2i+2 is not empty: Calculate the value h i of node i = hash(h 2i+1 || h 2i+2 ); If the value of node 2i+1 is not empty and the value of node 2i+2 is empty: Calculate the value h i of node i = hash(h 2i+1 ); If the value of node 2i+1 is empty and the value of node 2i+2 is not empty: Calculate the value h i of node i = hash(h 2i+2 ); If the value of node 2i+1 is empty and the value of node 2i+2 is empty: Set the value h i of node i to be empty; Step 3: The number of iterations l = l - 1; If l = 0, output the result: the value of node node0; Otherwise, jump back to Step 2; where the value of node node0 is the first root hash; Obtain the first hash value of each transaction contract in the contract sequence, and process each of the first hash values according to the second aggregation algorithm to obtain the first root hash; where the second aggregation algorithm is: h0 = hash(h1||h2…||hn); in the second aggregation algorithm, h0 represents the first root hash, h1 represents the first hash value of the first transaction contract in the contract sequence; h2 represents the first hash value of the second transaction contract in the contract sequence, and so on, until hn represents the first hash value of the last transaction contract in the contract sequence.
7. An evidence verification device, characterized in that, The verification device for the evidence is set in a trading platform. The verification device for the evidence includes: A first acquisition module, configured to, when receiving a transaction deposit request, acquire the transaction identifier corresponding to the transaction deposit request and the contract set corresponding to the transaction identifier; A determination processing module, configured to determine a hash aggregation algorithm according to the transaction identifier, perform hash calculation on each transaction contract in the contract set to obtain a second hash value corresponding to each transaction contract, and process each of the second hash values according to the hash aggregation algorithm to obtain a second root hash; A request module, configured to use each of the second hash values and the second root hash as the content to be uploaded, and initiate an on-chain preservation request based on the content to be uploaded, so that the blockchain platform saves the content to be uploaded; A preservation execution module, configured to, when receiving the on-chain address fed back by the blockchain platform, save the on-chain address and the contract set as evidence information; A second acquisition module, configured to, when receiving a verification request, acquire the evidence information corresponding to the verification request and send the evidence information to a verification platform to verify the evidence information on the verification platform; The determination processing template is configured to obtain the transaction scenario information and transaction user information corresponding to the transaction identifier, determine the transaction risk value corresponding to the transaction scenario information and the user risk value corresponding to the transaction user information according to a preset risk assessment rule; wherein, the transaction scenario information includes but is not limited to transaction amount, transaction type and transaction time; the transaction user information includes but is not limited to user name, user level, user score, user contact information and user account; use the sum of the transaction risk value and the user risk value as the comprehensive risk value, and compare the comprehensive risk value with a preset risk threshold; if the comprehensive risk value is greater than or equal to the preset risk threshold, use a preset first aggregation algorithm as the hash aggregation algorithm; if the comprehensive risk value is less than the preset risk threshold, use a preset second aggregation algorithm as the hash aggregation algorithm; The said determination processing template is used to sort the transaction contracts corresponding to each second hash value to form a contract sequence; iterate and merge each of the second hash values according to the contract sequence by the first aggregation algorithm to obtain a second root hash; or, uniformly merge each of the second hash values according to the contract sequence by the second aggregation algorithm to obtain a second root hash; Step 1: Initialize an array containing elements, with all values set to empty. Sort the n transaction contracts in descending order of size, calculate the hash values in sequence, and fill them in starting from element . Leave the unfilled positions empty, and set the remaining number of iterations . Wherein, the n is the number of contracts in the contract sequence; Step 2: Calculate for the l-th layer. From node to node , for each node node i , perform the following operations in sequence: If the value of node 2i+1 is non-empty and the value of node 2i+2 is non-empty: Calculate the value h i of node i = hash(h 2i+1 || h 2i+2 ); If the value of node 2i+1 is non-empty and the value of node 2i+2 is empty: Calculate the value h i of node i = hash(h 2i+1 ); If the value of node 2i+1 is empty and the value of node 2i+2 is non-empty: Calculate the value h i of node i = hash(h 2i+2 ); If the value of node 2i+1 is empty and the value of node 2i+2 is empty: Set the value h i of node i to be empty; Step 3: The number of iterations l = l - 1; If l = 0, output the result: the value of node node0; Otherwise, jump back to Step 2; Among them, the value of node node0 is the first root hash; Acquire the second hash value of each transaction contract in the contract sequence, and process each of the second hash values according to the second aggregation algorithm to obtain a second root hash; wherein, the second aggregation algorithm is: h0 = hash(h1||h2…||hn); in the second aggregation algorithm, h0 represents the second root hash, h1 represents the second hash value of the first transaction contract sorted in the contract sequence; h2 represents the second hash value of the second transaction contract sorted in the contract sequence, and so on, until hn represents the second hash value of the last transaction contract sorted in the contract sequence.
8. An evidence verification device, characterized in that, The verification device for the evidence includes: a memory, a processor, and an evidence verification program stored on the memory and executable on the processor. When the evidence verification program is executed by the processor, the steps of the evidence verification method as described in any one of claims 1 to 3 and / or 4 are implemented.
9. A computer-readable storage medium, characterized in that, A verification program for evidence is stored on the computer-readable storage medium. When the verification program for evidence is executed by a processor, it implements the steps of the evidence verification method according to any one of claims 1 to 3 and / or 4.
Citation Information
Patent Citations
Data checking method and device and computer storage medium
CN107392764A
Multi-segment electronic transaction risk real-time monitoring method and system
CN108230153A
Evidence verification method and device
CN108921552A