A blockchain oracle-based matching transaction method and system
By using a blockchain oracle to call an off-chain computing system to match and process transaction information, and combining this with hash value verification, the security and speed issues of blockchain-based transaction matching are resolved, enabling secure and fast transaction matching.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA THREE GORGES CORPORATION
- Filing Date
- 2022-08-26
- Publication Date
- 2026-06-05
AI Technical Summary
Current technologies, such as blockchain, cannot achieve secure and fast transaction matching due to issues like high gas consumption and the possibility of transaction tampering.
A blockchain oracle-based transaction matching method is adopted, which uses the oracle to call the off-chain computing system to match transaction information and perform final verification on the blockchain. The verification is carried out using the first incremental hash value and the second incremental hash value to ensure the security and reliability of the matching result.
This reduces the risk of transaction information being tampered with, improves data security, reduces gas consumption, and enables a fast transaction matching process.
Smart Images

Figure CN115358825B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of energy trading technology, specifically to a matching trading method and system based on a blockchain oracle. Background Technology
[0002] Based on current technology and development, blockchain-based matching transactions generally take two implementation paths: one is to implement sorting and matching transactions within smart contracts, and the other is to establish an application-layer exchange, with the blockchain only serving as a storage medium. The drawbacks of each method are: the first method consumes significant gas and is slow when dealing with large amounts of data, affecting subsequent transactions and even causing contract call failures, leading to transaction failure. The second method allows transactions to be tampered with in upper-layer applications, and blockchain storage may not be effective in preserving evidence. Therefore, current technologies cannot achieve secure and fast matching transactions using blockchain. Summary of the Invention
[0003] Therefore, the technical problem to be solved by the present invention is to overcome the shortcomings of the prior art in that it is impossible to achieve secure and fast matching transactions through blockchain, thereby providing a matching transaction method and system based on blockchain oracle.
[0004] The first aspect of this invention provides a transaction matching method based on a blockchain oracle, comprising: each buyer and seller sequentially uploading transaction information to the blockchain; sequentially updating a first incremental hash value in a smart contract according to the hash value of the transaction information; calling an off-chain computing system through an oracle, so that the off-chain computing system calculates a second incremental hash value based on the hash value of each transaction information, the calculation method of the second incremental hash value being the same as that of the first incremental hash value; matching and matching the buyer's transaction information and the seller's transaction information according to a preset matching rule to obtain a matching result to be verified; uploading the matching result to be verified and the second incremental hash value to the blockchain; and verifying the matching result to be verified through a smart contract using the first incremental hash value, the second incremental hash value, and the preset matching rule, and if the verification is successful, determining the matching result to be verified as the matching result.
[0005] Optionally, in the blockchain oracle-based matching transaction method provided by the present invention, the nth transaction information uploaded to the blockchain includes a pre-hash value, where the pre-hash value is the hash value of the (n-1)th transaction information uploaded to the blockchain, and n is an integer greater than 1.
[0006] Optionally, in the blockchain oracle-based matching transaction method provided by the present invention, when the off-chain computing system is called through the oracle, the pre-hash value in the last transaction information is sent to the off-chain computing system through the oracle, so that the off-chain computing system can obtain multiple transaction information based on the pre-hash value in the last transaction information.
[0007] Optionally, in the blockchain oracle-based matching transaction method provided by the present invention, when the first transaction information is uploaded to the blockchain, the first incremental hash value in the smart contract is calculated based on the hash value of the current transaction information; when the nth transaction information is uploaded to the blockchain, the first incremental hash value in the smart contract is calculated based on the hash value of the nth transaction information and the first incremental hash value corresponding to the (n-1)th transaction information uploaded to the blockchain.
[0008] Optionally, in the blockchain oracle-based matching transaction method provided by the present invention, the matching result to be verified is verified using a first incremental hash value, a second incremental hash value, and a preset matching rule. If the verification passes, the matching result to be verified is determined as the matching result. This includes: comparing the second incremental hash value with the first incremental hash value; if the second incremental hash value is the same as the first incremental hash value, verifying the matching result to be verified according to the preset matching rule to obtain a verification result; if the verification result determines that the matching result to be verified meets the preset matching rule, the matching result to be verified is determined as the matching result.
[0009] Optionally, in the blockchain oracle-based matching transaction method provided by the present invention, the transaction information includes a quoted price and a transaction type. The types of transaction information include quoted price information and withdrawn quoted price information. After each buyer and seller sequentially uploads the transaction information to the blockchain and before the step of calling the off-chain computing system through the oracle, the method further includes: when the transaction information is quoted price information, incrementing the transaction frequency of the transaction corresponding to the transaction information by 1; when the transaction information is withdrawn quoted price information, decrementing the transaction frequency of the transaction corresponding to the transaction information by 1.
[0010] Optionally, in the blockchain oracle-based matching transaction method provided by the present invention, the matching result to be verified includes multiple valid transactions. The matching result to be verified is verified using a first incremental hash value, a second incremental hash value, and a preset matching rule. If the verification is successful, before the step of determining the matching result to be verified as a matching result, the method further includes: traversing each valid transaction and decrementing the transaction frequency of the transaction corresponding to the valid transaction by 1; after completing the traversal of all valid transactions in the matching result to be verified, if the transaction frequency of each transaction is 0, the step of determining the matching result to be verified as a matching result is executed.
[0011] A second aspect of this invention provides a matching transaction system based on a blockchain oracle, comprising: an off-chain computing system, and a first incremental hash value calculation node, an off-chain computing system calling node, a verification node, multiple buyer nodes and seller nodes located on the same blockchain. Each buyer node and seller node is used to sequentially upload transaction information to the blockchain. The first incremental hash value calculation node is used to sequentially update the first incremental hash value in the smart contract according to the hash value of the transaction information. The off-chain computing system calling node is used to call the off-chain computing system through the oracle, so that the off-chain computing system calculates a second incremental hash value according to the hash value of each transaction information. The calculation method of the second incremental hash value is the same as that of the first incremental hash value. The buyer's transaction information and the seller's transaction information are matched and matched according to a preset matching rule to obtain a matching result to be verified. The matching result to be verified and the second incremental hash value are uploaded to the blockchain. The verification node is used to verify the matching result to be verified through the smart contract using the first incremental hash value, the second incremental hash value, and the preset matching rule. If the verification is successful, the matching result to be verified is determined as the matching result.
[0012] A third aspect of the present invention provides a computer device comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, the instructions being executed by the at least one processor to perform a matching transaction method based on a blockchain oracle as provided in the first aspect of the present invention.
[0013] A fourth aspect of the present invention provides a computer-readable storage medium storing computer instructions for causing a computer to execute a matching transaction method based on a blockchain oracle as provided in the first aspect of the present invention.
[0014] The technical solution of this invention has the following advantages:
[0015] The present invention provides a matching transaction method and system based on a blockchain oracle. After each buyer and seller uploads transaction information to the blockchain, an off-chain computing system is invoked via an oracle. In the off-chain computing system, the buyer's and seller's transaction information are matched according to preset matching rules to obtain a result to be verified. This result is then uploaded to the blockchain. In the blockchain, a smart contract verifies the result to obtain the final matching result. Through this embodiment of the invention, uploading transaction information to the blockchain reduces the risk of transaction information tampering and improves data security. Furthermore, during the matching transaction, the off-chain computing system is invoked via an oracle, and the matching transaction is performed in the off-chain computing system. The smart contract only verifies the result to be verified, resulting in lower gas consumption and faster matching speed. Furthermore, in the blockchain oracle-based matching transaction method and system provided by this invention, while the off-chain computing system matches and matches transaction information, it calculates the second incremental hash value in the same way as it calculates the first incremental hash value. When the smart contract verifies the matching result to be verified, it combines the first incremental hash value and the second incremental hash value for verification, ensuring that the matching transaction result to be verified is obtained by matching all transaction information uploaded to the blockchain, thereby further improving the reliability of the matching result. Attached Figure Description
[0016] To more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0017] Figure 1 This is a flowchart illustrating a specific example of a blockchain oracle-based transaction matching method in an embodiment of the present invention.
[0018] Figure 2 This is a flowchart illustrating a specific example of a matching transaction method employing a multi-voting mechanism in an embodiment of the present invention.
[0019] Figure 3 The matching result is obtained by executing the matching transaction method based on a blockchain oracle provided in this embodiment of the invention.
[0020] Figure 4 This is a schematic diagram illustrating a specific example of a blockchain oracle-based matching transaction system in an embodiment of the present invention.
[0021] Figure 5 This is a schematic diagram illustrating a specific example of a computer device in an embodiment of the present invention. Detailed Implementation
[0022] The technical solution of the present invention will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0023] In the description of this invention, it should be noted that the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance.
[0024] Furthermore, the technical features involved in the different embodiments of the present invention described below can be combined with each other as long as they do not conflict with each other.
[0025] This invention provides a transaction matching method based on a blockchain oracle, such as... Figure 1 As shown, it includes:
[0026] Step S11: Each buyer and seller uploads the transaction information to the blockchain in turn.
[0027] Step S12: Update the first incremental hash value in the smart contract sequentially according to the hash value of the transaction information.
[0028] In one alternative embodiment, each time a transaction is uploaded to the blockchain, the first incremental hash value in the smart contract is updated based on the current transaction information.
[0029] Step S13: Call the off-chain computing system through the oracle so that the off-chain computing system calculates the second incremental hash value based on the hash value of each transaction information. The calculation method of the second incremental hash value is the same as that of the first incremental hash value. Match the transaction information of the buyer and the transaction information of the seller according to the preset matching rules to obtain the matching result to be verified. Upload the matching result to be verified and the second incremental hash value to the blockchain.
[0030] In one alternative embodiment, the off-chain computing system can be any type of computer device with computing capabilities, and is not limited thereto in this embodiment of the invention.
[0031] In one optional embodiment, the calculation formula used when calculating the second incremental hash value is the same as the formula used when calculating the first incremental hash value, and the calculation order of the transaction information is also the same. For example, if the first incremental hash value in the smart contract is updated once for each transaction information uploaded to the blockchain, it indicates that the first incremental hash value is calculated by calculating the hash value of the transaction information according to the order in which the transaction information is uploaded to the blockchain. At this time, when calculating the second incremental hash value, the hash value of each transaction information is also calculated according to the order in which each transaction information is uploaded to the blockchain, thereby obtaining the second incremental hash value.
[0032] In an optional embodiment, the preset matching rules can be set according to actual needs. For example, the preset matching rules can be: the buyer's price is not less than the seller's price.
[0033] Step S14: Through the smart contract, the first incremental hash value, the second incremental hash value, and the preset matching rules are used to verify the matching result to be verified. If the verification is successful, the matching result to be verified is determined as the matching result.
[0034] The blockchain oracle-based matching transaction method provided in this invention involves buyers and sellers uploading transaction information to the blockchain. The oracle then calls an off-chain computing system, which matches the buyer's and seller's transaction information according to preset matching rules. This results in a pending verification result, which is then uploaded to the blockchain. A smart contract on the blockchain verifies the pending verification result, resulting in the final matching outcome. This invention reduces the risk of transaction information tampering by uploading it to the blockchain, improving data security. Furthermore, by using an oracle to call the off-chain computing system during matching transactions, and with the smart contract only verifying the pending verification result, gas consumption is low, and the matching speed is fast. Furthermore, in the blockchain oracle-based matching transaction method provided in this embodiment of the invention, while the off-chain computing system matches and matches transaction information, it calculates the second incremental hash value in the same way as it calculates the first incremental hash value. When the smart contract verifies the matching result to be verified, it combines the first incremental hash value and the second incremental hash value for verification, ensuring that the matching transaction result to be verified is obtained by matching all transaction information uploaded to the blockchain, thereby further improving the reliability of the matching result.
[0035] In an optional embodiment, in the blockchain oracle-based matching transaction method provided in this embodiment of the invention, the nth transaction information uploaded to the blockchain includes a pre-hash value, where the pre-hash value is the hash value of the (n-1)th transaction information uploaded to the blockchain, and n is an integer greater than 1.
[0036] In an alternative embodiment, the hash value of the last transaction information can be recorded in a smart contract.
[0037] In this embodiment of the invention, a preceding hash value is written into the transaction information, thereby realizing chained storage of the transaction information. This allows for traversing backwards using the hash value of the last transaction information to obtain all the transaction information.
[0038] In an optional embodiment, the transaction information further includes (price, type, currentTimestamp, info, preHash), where price represents the transaction price, type represents the transaction type, currentTimestamp represents the current transaction time, and info represents business information, which includes transaction participant information, transaction type, transaction remarks, etc.
[0039] In an optional embodiment, in the blockchain oracle-based matching transaction method provided in this embodiment of the invention, when the off-chain computing system is called through the oracle, the pre-hash value in the last transaction information is sent to the off-chain computing system through the oracle, so that the off-chain computing system can obtain multiple transaction information based on the pre-hash value in the last transaction information, thereby enabling the off-chain computing system to complete the matching transaction based on all the transaction information.
[0040] In an optional embodiment, in the blockchain oracle-based matching transaction method provided in this embodiment of the invention, when the first transaction information is uploaded to the blockchain, the first incremental hash value in the smart contract is calculated based on the hash value of the current transaction information; when the nth transaction information is uploaded to the blockchain, the first incremental hash value in the smart contract is calculated based on the hash value of the nth transaction information and the first incremental hash value corresponding to the (n-1)th transaction information uploaded to the blockchain.
[0041] For example, if there are four transactions A, B, C, and D, with hash values w, x, y, and z respectively, then the process of updating the first hash value h is as follows:
[0042] h1 = hash(w) (The first transaction has no preceding hash value)
[0043] h2 = hash(x + h1)
[0044] h3 = hash(y + h2)
[0045] h4 = hash(z + h3), where h is h4 inside the contract.
[0046] Finally, h4 is stored on the blockchain, and the off-chain computing system can obtain all previous transaction information through h4.
[0047] In an optional embodiment, step S14 specifically includes the following steps:
[0048] First, compare the second incremental hash value with the first incremental hash value.
[0049] If the second incremental hash value is the same as the first incremental hash value, the matching result to be verified is verified according to the preset matching rules to obtain the verification result.
[0050] Since the second incremental hash value is calculated in the same way as the first incremental hash value, if the second incremental hash value is different from the first incremental hash value, it means that the transaction information used to calculate the second incremental hash value is different from the transaction information used to calculate the first incremental hash value. This indicates that the matching result to be verified is not obtained based on the transaction information in the blockchain. At this time, there is no need to further verify the matching result to be verified according to the matching rules, and it can be determined that the matching result to be verified is incorrect.
[0051] If the verification results determine that the matching result to be verified meets the preset matching rules, the matching result to be verified will be determined as the matching result.
[0052] In an optional embodiment, in the blockchain oracle-based matching transaction method provided in this embodiment of the invention, the transaction information includes the quoted price and the transaction type, and the type of transaction information includes quote information and withdrawal quote information.
[0053] In one optional embodiment, the smart contract has three core methods: Add, Revoke, and Calculate, corresponding to the functions of quoting, revoking quotations, and matching transactions. The oracle calls the external method Match for matching transactions. All three methods are implemented on the same smart contract. Both parties quoting and revoking quotations use the add and revoke methods. After the transaction stops, the matching party calls the calculate interface to complete the matching. Specifically, when the seller or buyer calls the add method, the transaction information uploaded to the blockchain is of the quotation type; when the seller or buyer calls the revoke method, the transaction information uploaded to the blockchain is of the revoked quotation type.
[0054] The `add(price, type, info)` method quotes a price. `price` is the quoted price, including the price and quantity; `type` is the transaction type; and `info` typically contains business information such as trader information, transaction type, and transaction notes. The `revoke(price, type, info)` method cancels the corresponding quote based on the given price, type, and info.
[0055] After the steps of each buyer and seller sequentially uploading transaction information to the blockchain and before the step of calling the off-chain computing system via an oracle, the method provided in this embodiment of the invention further includes:
[0056] When the transaction information is a quote, the transaction frequency of the corresponding transaction will be incremented by 1; when the transaction information is a canceled quote, the transaction frequency of the corresponding transaction will be decremented by 1.
[0057] In this embodiment of the invention, a data statistics map is added inside the contract to count the frequency of quotes, so that when verifying the data, it can be checked whether there are missing or redundant data.
[0058] The pseudocode for the add method is:
[0059]
[0060] Implementation of the revoke method:
[0061] When a transaction is cancelled during the matching process, it's equivalent to removing that quote from the pending transactions. Similar to the `add` method, the cancellation information is first sent on the blockchain, and then the frequency of the quote is decremented by one in the map. In implementation, the transaction can be marked as cancelled in the transaction body. During off-chain matching, since quotes are read in order, this will not result in an empty deletion. Furthermore, because cancelled transactions exist in pairs, only a single increment / decrement operation is performed on the frequency, without affecting the overall frequency table.
[0062] The pseudocode for the revoke method is:
[0063]
[0064] In an optional embodiment, in the blockchain oracle-based matching transaction method provided by this invention, the matching result to be verified includes multiple valid transactions. A valid transaction refers to an offer that has not been withdrawn. In this embodiment, when executing step S14, the matching result to be verified is verified using a first incremental hash value, a second incremental hash value, and a preset matching rule. If the verification passes, before determining the matching result to be verified as the matching result, the method further includes:
[0065] Iterate through each valid transaction and decrement the transaction frequency of the transaction corresponding to the valid transaction by 1. After completing the iteration of all valid transactions in the matching results to be verified, if the transaction frequency of each transaction is 0, proceed to the step of determining the matching results to be verified as matching results.
[0066] In an alternative embodiment, if it is necessary to further enhance the acceptance of external matchmaking, such as... Figure 2As shown, a multi-party voting mechanism can be adopted, which involves calling multiple external interfaces to calculate simultaneously and verifying the matching results obtained from each external interface. If the matching results are consistent and the verification results are also consistent, then the nodes in the blockchain (including but not limited to buyers and sellers) vote on the matching result. Once the number of votes in favor reaches a preset value, the matching result is determined as the final matching result. If the matching results are inconsistent or the verification results are inconsistent, no voting is required, and other third parties are used to match the results and conduct a new round of voting.
[0067] The pseudocode for the calculate method is:
[0068]
[0069] In one specific embodiment, if the transactions are sorted according to the transaction prices in the transaction information, and then matched according to the rule that the seller's offer is not lower than the seller's offer, the result is as follows: Figure 3 The results shown Figure 3 The lines in the table represent successfully matched transactions. In this embodiment of the invention, matching mainly involves sorting. After sorting, verifying data integrity simply requires statistically analyzing the frequency of prices for both buyers and sellers. For example, for a buyer's price of 10.5 and a quantity of 100, the price is combined and incremented by one in the frequency statistics table.
[0070] After sorting, within the contract, it only needs to start matching and traversing based on the highest price of both buyers and sellers. If the buyer's price is greater than or equal to the seller's price, then it matches the number of buyers, matching the transactions with the maximum possible volume. For example, in... Figure 3 In the table shown, 10.1 has the largest seller volume of 600, and the remaining 200 are traded from the seller's offer of 10. It can be seen that in this embodiment of the invention, only the buyers and sellers need to be matched from top to bottom. Each offer is traversed at most once, so the overall complexity of verification in the blockchain is linear O(n).
[0071] In terms of time complexity, the most complex operation in the three methods in this embodiment of the invention is the operation on the hash table (hashmap). If all add and revoke operations for both the buyer and seller are performed n times, then the total time complexity is O(n). This avoids introducing the complexity of the sorting algorithm, and the external sorting can be freely optimized, thus achieving logical decoupling.
[0072] In the verification of matched transactions in caculate's checkMatchResult, it is only necessary to scan both the buyer and seller sides simultaneously to verify the size and prefix sum relationship. Let the number of operations for the buyer and seller be a and b, then we know that a + b = n, so the total complexity is O(mac(a,b)) = O(n).
[0073] To verify the correctness of the sorting, we only need to compare the elements one by one. The correctness of the sorting can be proven by mathematical induction.
[0074] In terms of time complexity verification, given the frequency of all quotes as f, subtract the frequency of the corresponding element in f from the sorted sequence one by one. If the frequency of all elements in f is 0, it means that all elements have participated in the sorting without repetition or omission, thus proving the completeness of the matched transactions.
[0075] Therefore, by implementing this invention, not only can the matching of transactions be completed and the security of data be guaranteed, but the computational cost in the blockchain can also be effectively reduced.
[0076] This invention provides a matching transaction system based on a blockchain oracle, such as... Figure 4 As shown, it includes: an off-chain computing system 21, and a first incremental hash value calculation node 24, an off-chain computing system calling node 25, a verification node 26, multiple buyer nodes 22, and a seller node 23 located on the same blockchain, wherein,
[0077] Each buyer node 22 and seller node 23 is used to upload transaction information to the blockchain in sequence. For details, please refer to the description of step S11 in the above embodiment, which will not be repeated here.
[0078] The first incremental hash value calculation node 24 is used to update the first incremental hash value in the smart contract sequentially according to the hash value of the transaction information. For details, please refer to the description of step S12 in the above embodiment, which will not be repeated here.
[0079] The off-chain computing system calling node 25 is used to call the off-chain computing system 21 through the oracle, so that the off-chain computing system 21 calculates the second incremental hash value based on the hash value of each transaction information. The calculation method of the second incremental hash value is the same as that of the first incremental hash value. The transaction information of the buyer and the transaction information of the seller are matched and matched according to the preset matching rules to obtain the matching result to be verified. The matching result to be verified and the second incremental hash value are uploaded to the blockchain. For details, please refer to the description of step S13 in the above embodiment, which will not be repeated here.
[0080] Verification node 26 is used to verify the matching result to be verified through a smart contract using the first incremental hash value, the second incremental hash value, and the preset matching rules. If the verification is successful, the matching result to be verified is determined as the matching result. For details, please refer to the description of step S14 in the above embodiment, which will not be repeated here.
[0081] This invention provides a computer device, such as... Figure 5 As shown, the computer device mainly includes one or more processors 31 and a memory 32. Figure 5Take a processor 31 as an example.
[0082] The computer device may also include an input device 33 and an output device 34.
[0083] The processor 31, memory 32, input device 33, and output device 34 can be connected via a bus or other means. Figure 5 Taking the example of a connection between China and Israel via a bus.
[0084] Processor 31 can be a Central Processing Unit (CPU). Processor 31 can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or combinations thereof. The general-purpose processor can be a microprocessor or any conventional processor. Memory 32 can include a program storage area and a data storage area. The program storage area can store the operating system and at least one application program required for a given function; the data storage area can store data created based on the use of the blockchain oracle-based matching system. Furthermore, memory 32 can include high-speed random access memory and non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory 32 may optionally include memory remotely located relative to processor 31, which can be connected to the blockchain oracle-based matching system via a network. Input device 33 can receive user-inputted calculation requests (or other numerical or character information) and generate key signal inputs related to the blockchain oracle-based matching transaction system. Output device 34 may include a display screen or other display device for outputting the calculation results.
[0085] This invention provides a computer-readable storage medium that stores computer instructions. The computer-executable instructions can execute the blockchain oracle-based matching transaction method described in any of the above method embodiments. The storage medium can be a magnetic disk, optical disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk drive (HDD), or solid-state drive (SSD), etc.; the storage medium may also include combinations of the above types of memory.
[0086] Obviously, the above embodiments are merely illustrative examples for clear explanation and are not intended to limit the implementation. Those skilled in the art will recognize that other variations or modifications can be made based on the above description. It is neither necessary nor possible to exhaustively list all possible implementations here. However, obvious variations or modifications derived therefrom are still within the scope of protection of this invention.
Claims
1. A transaction matching method based on a blockchain oracle, characterized in that, include: Each buyer and seller uploads their transaction information to the blockchain in turn; The first incremental hash value in the smart contract is updated sequentially based on the hash value of the transaction information. The off-chain computing system is invoked through an oracle, so that the off-chain computing system calculates a second incremental hash value based on the hash value of each transaction information. The calculation method of the second incremental hash value is the same as that of the first incremental hash value. The transaction information of the buyer and the transaction information of the seller are matched according to the preset matching rules to obtain the matching result to be verified. The matching result to be verified and the second incremental hash value are uploaded to the blockchain; The matching result to be verified is verified by using the first incremental hash value, the second incremental hash value, and the preset matching rules through a smart contract. If the verification is successful, the matching result to be verified is determined as the matching result. The nth transaction information uploaded to the blockchain includes a pre-hash value, where the pre-hash value is the hash value of the (n-1)th transaction information uploaded to the blockchain, and n is an integer greater than 1. When calling the off-chain computing system through an oracle, the pre-hash value of the last transaction information is sent to the off-chain computing system through the oracle, so that the off-chain computing system can obtain multiple transaction information based on the pre-hash value of the last transaction information. When the first transaction information is uploaded to the blockchain, the first incremental hash value in the smart contract is calculated based on the hash value of the current transaction information. When the nth transaction information is uploaded to the blockchain, the first incremental hash value in the smart contract is calculated based on the hash value of the nth transaction information and the first incremental hash value corresponding to the (n-1)th transaction information uploaded to the blockchain.
2. The matching transaction method based on a blockchain oracle according to claim 1, characterized in that, The matching result to be verified is verified using the first incremental hash value, the second incremental hash value, and a preset matching rule. If the verification passes, the matching result to be verified is determined as the matching result, including: The second incremental hash value is compared with the first incremental hash value; if the second incremental hash value is the same as the first incremental hash value, the matching result to be verified is verified according to the preset matching rule to obtain a verification result; if the matching result to be verified is determined to meet the preset matching rule according to the verification result, the matching result to be verified is determined to be a matching result.
3. The matching transaction method based on a blockchain oracle according to claim 1, characterized in that, Transaction information includes quoted prices and transaction types. The types of transaction information include quoted prices and withdrawn quotes. After each buyer and seller sequentially uploads the transaction information to the blockchain, and before the step of calling the off-chain computing system via an oracle, the method further includes: When the transaction information is a quote, the transaction frequency of the transaction corresponding to the quote is incremented by 1; when the transaction information is a canceled quote, the transaction frequency of the transaction corresponding to the quote is decremented by 1.
4. The matching transaction method based on a blockchain oracle according to claim 3, characterized in that, The matching results to be verified include multiple valid transactions. The matching results to be verified are then verified using the first incremental hash value, the second incremental hash value, and a preset matching rule. If the verification passes, before determining the matching results to be verified as a matching result, the method further includes: Iterate through each of the valid transactions and decrement the transaction frequency of the transaction corresponding to the valid transaction by 1; after completing the iteration of all valid transactions in the matching results to be verified, if the transaction frequency of each transaction is 0, execute the step of determining the matching results to be verified as matching results.
5. A matching transaction system based on a blockchain oracle, characterized in that, include: The off-chain computing system, along with the first incremental hash value calculation node, the off-chain computing system calling node, the verification node, multiple buyer nodes, and seller nodes located on the same blockchain, Each buyer node and seller node is used to upload transaction information to the blockchain in sequence; the first incremental hash value calculation node is used to update the first incremental hash value in the smart contract in sequence according to the hash value of the transaction information; The off-chain computing system calling node is used to call the off-chain computing system through the oracle, so that the off-chain computing system can calculate the second incremental hash value based on the hash value of each transaction information. The calculation method of the second incremental hash value is the same as the calculation method of the first incremental hash value. The transaction information of the buyer and the transaction information of the seller are matched according to the preset matching rules to obtain the matching result to be verified. The matching result to be verified and the second incremental hash value are uploaded to the blockchain; The verification node is used to verify the matching result to be verified through a smart contract using the first incremental hash value, the second incremental hash value, and the preset matching rules. If the verification is successful, the matching result to be verified is determined as the matching result. The nth transaction information uploaded to the blockchain includes a pre-hash value, where the pre-hash value is the hash value of the (n-1)th transaction information uploaded to the blockchain, and n is an integer greater than 1. When calling the off-chain computing system through an oracle, the pre-hash value of the last transaction information is sent to the off-chain computing system through the oracle, so that the off-chain computing system can obtain multiple transaction information based on the pre-hash value of the last transaction information. When the first transaction information is uploaded to the blockchain, the first incremental hash value in the smart contract is calculated based on the hash value of the current transaction information. When the nth transaction information is uploaded to the blockchain, the first incremental hash value in the smart contract is calculated based on the hash value of the nth transaction information and the first incremental hash value corresponding to the (n-1)th transaction information uploaded to the blockchain.
6. A computer device, characterized in that, include: At least one processor; The system also includes a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, which are executed by the at least one processor to perform the blockchain oracle-based matching transaction method as described in any one of claims 1-4.
7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing the computer to execute the blockchain oracle-based matching transaction method as described in any one of claims 1-4.