Method and device for determining reliability of data source outside chain

The method and device for determining the reliability of off-chain data sources improve efficiency by using a random exchange mechanism to select a subset of data sources based on delay rates and direct on-chain verification, reducing computational overhead and enhancing real-time performance.

CN119128009APending Publication Date: 2024-12-13WEBANK (CHINA)
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411229737.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-03
Publication Date
2024-12-13

Smart Images

  • Figure CN119128009A_ABST
    Figure CN119128009A_ABST
Patent Text Reader

Abstract

The invention provides a method and device for determining reliability of an out-of-chain data source, the method is applied to an oracle contract on a block chain, and the method comprises the following steps: forming an initial data source sequence according to pre-configured M data sources; determining a random exchange mechanism through the identification of the set transaction of the set block, and obtaining an updated data source sequence through the random exchange mechanism; the random exchange mechanism is used for exchanging positions of two data sources in the initial data source sequence; determining N data sources meeting the delay rate requirement in the updated data source sequence as a to-be-verified data source sequence; the delay rate of the data source is determined according to the time when the data source submits the verification data; notifying each data source in the to-be-verified data source sequence to submit verification data for reliability verification of the round; and determining the reliability of each data source in the to-be-verified data source sequence through verification data submitted by each data source in the to-be-verified data source sequence. The method can improve the determination efficiency of the reliability of the data source.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of blockchain technology, and in particular to a method and device for determining the reliability of an off-chain data source. Background Art

[0002] With the development of computer technology, more and more computer technologies are applied in the financial field, which means that the traditional financial industry is gradually transforming to financial technology (Fintech). For example, blockchain technology is now applied in many financial fields.

[0003] The blockchain relies on distributed systems and related technologies to construct a certain on-chain world. Most of the information outside the chain is opaque to the blockchain, and this information cannot be trusted or used in the blockchain. If the blockchain wants to interact with external data, it can set up an oracle contract on the blockchain to call the oracle node connected to the blockchain outside the chain to complete the data interaction. The oracle node needs to perform reliability scoring on the data provider, that is, the data source, and transmit the reliability score of each data source to the oracle contract on the chain. The oracle contract will screen the data source according to the reliability score of each data source and select a more reliable data source to use its data.

[0004] However, when there are too many data sources, calculating the reliability score for each data source will lead to excessive computational pressure and low efficiency; therefore, how to improve the efficiency of data source reliability scoring is an issue that needs to be considered urgently. Summary of the invention

[0005] The present application provides a method and device for determining the reliability of an off-chain data source, so as to improve the efficiency of determining the reliability of an off-chain data source.

[0006] In a first aspect, the present application provides a method for determining the reliability of an off-chain data source, the method being applied to an oracle contract on a blockchain, the method comprising:

[0007] An initial data source sequence is formed according to the preconfigured M data sources; M is a positive integer;

[0008] By setting the identifier of the setting transaction of the block, a random exchange mechanism is determined, and an updated data source sequence is obtained through the random exchange mechanism; the random exchange mechanism is used to exchange the positions of two data sources in the initial data source sequence;

[0009] Determine N data sources that meet the delay rate requirement in the update data source sequence as a data source sequence to be verified; the delay rate of the data source is determined according to the time when the data source submits verification data; N is a positive integer and N is less than or equal to M;

[0010] Notify each data source in the sequence of data sources to be verified to submit verification data for this round of reliability verification;

[0011] The reliability of each data source in the sequence of data sources to be verified is determined through the verification data submitted by each data source in the sequence of data sources to be verified.

[0012] The method for determining the reliability of an off-chain data source provided by the present application does not need to determine the reliability of M data sources, but only requires selecting N data sources from the M data sources to determine the reliability. Before the selection, the present application first determines a random exchange mechanism, and exchanges the positions of the M data sources multiple times to ensure that the updated data source sequence has good randomness. Then, in the updated data source sequence, the N data sources that meet the delay rate requirements are used as the data source sequence to be verified. In this way, only N data sources are required to submit verification data, which reduces the amount of data interacting between the off-chain and on-chain, and improves the efficiency of determining reliability. In addition, the method for determining the reliability of an off-chain data source provided by the present application is performed on the chain, rather than the reliability of the data source being determined by an off-chain oracle node and then transmitted by the oracle node to the oracle contract on the chain. Therefore, the method has better real-time performance and faster update speed.

[0013] In a possible design, the delay rate of the data source is determined according to the time when the data source submits verification data, including:

[0014] Acquire the historical reliability verification record of the data source; the historical reliability verification record of the data source includes the time when the data source submitted verification data in the last round of reliability verification;

[0015] The delay rate of the data source is determined according to the time when the data source submits verification data in the last round of reliability verification and the time when the data source is notified to submit verification data in the last round of reliability verification.

[0016] Each data source has a historical reliability verification record, which includes the time when the data source submitted verification data in the previous round. The delay rate of the data source can be determined based on the time when the data source submitted verification data in the previous round and the time when the verification data was notified in the previous round for submission, which is used to determine the subsequent N data sources.

[0017] In one possible design, the blockchain node determines the random exchange mechanism by setting an identifier of a set transaction of a set block, including:

[0018] The blockchain node determines a first integer based on an identifier of a first transaction in a latest block on the blockchain;

[0019] The number of times the data source is exchanged for the initial data source sequence is randomly determined according to the first integer, and the exchange position of each data source exchange is determined by a random algorithm.

[0020] Each transaction on the blockchain has a unique transaction number, which is usually a binary number and can be used as a transaction identifier. When determining the random exchange mechanism, it can be determined based on the identifier of the set transaction in the set block. For example, the first integer is determined based on the identifier of the first transaction in the latest block on the blockchain. The first integer can be obtained by converting the binary identifier of the first transaction into an integer. Then, the number of data source exchanges required is determined based on the first integer. The data source exchange in this application mainly refers to the exchange of data source locations. After multiple data source exchanges, it can be guaranteed that the updated data source sequence has good randomness.

[0021] In a possible design, determining the reliability of each data source in the sequence of data sources to be verified by using verification data submitted by each data source in the sequence of data sources to be verified includes:

[0022] Determine a first score and a second score of each data source in the sequence of data sources to be verified according to the verification data submitted by each data source in the sequence of data sources to be verified for this round of reliability verification; the first score of any data source in the sequence of data sources to be verified is used to characterize the authenticity of the verification data submitted by the data source, and the second score of the data source is used to characterize the degree of deviation between the verification data submitted by the data source and the verification data submitted by other data sources in the sequence of data sources to be verified;

[0023] The third score of each data source in the sequence of data sources to be verified is determined according to the first score and the second score of each data source in the sequence of data sources to be verified; the third score of any data source in the sequence of data sources to be verified is used to characterize the reliability of the data source.

[0024] Based on the verification data submitted by the data source, the authenticity of the verification data and the degree of deviation between the verification data and the verification data submitted by other data sources can be determined. Compared with determining the reliability of the data source from a single dimension, the present application determines the reliability of the data source from multiple dimensions of the verification data, thereby improving the rationality of determining the reliability of the data source.

[0025] In a possible design, determining the delay rate of the data source according to the time when the data source submits verification data in the previous round of reliability verification and the time when the data source is notified to submit verification data in the previous round of reliability verification includes:

[0026] Get the duration of the last round of reliability verification;

[0027] Determine a first difference; the first difference is the difference between the time when the data source submitted the verification data in the previous round of reliability verification and the time when the data source to be verified was notified to submit the verification data in the previous round of reliability verification;

[0028] The delay rate of the data source is determined according to a ratio of the first difference to a duration of the previous round of reliability verification.

[0029] After notifying the data source in the sequence of data sources to be verified to submit verification data, if the data source responds quickly and submits the verification data, the interval between the time the data source submits the verification data and the time it is notified to submit the verification data is shorter, and the delay rate of the data source is lower. Therefore, the delay rate of the data source can reflect the response speed of the data source to a certain extent; accordingly, if the data source has a fast response speed and a low delay rate, it indicates that the load of the data source is lower and its health is better.

[0030] In a possible design, determining N data sources in the update data source sequence that meet the delay rate requirement as a data source sequence to be verified includes:

[0031] Determine the first K data sources in the updated data source sequence as the data source sequence to be selected, where K is equal to the number of data source exchanges performed on the initial data source sequence;

[0032] N data sources that meet the delay rate requirement in the to-be-selected data source sequence are determined as the to-be-verified data source sequence.

[0033] First, K data sources are selected from M data sources, reducing the number of data sources whose reliability needs to be determined from M to K. Then, the K data sources are screened according to the delay rate, reducing the number of data sources whose reliability needs to be determined from K to N, thereby improving the efficiency of determining the reliability of the data source.

[0034] In a possible design, any data source among the M data sources has a corresponding statistical value, an initial value of the statistical value corresponding to any data source is 0, and the statistical value of the data source is used to represent the number of times the data source skips reliability verification;

[0035] The step of determining N data sources that meet the delay rate requirement in the sequence of data sources to be selected as the sequence of data sources to be verified includes:

[0036] Calculating according to the delay rate of each data source in the sequence of data sources to be selected and the corresponding statistical value to obtain a first calculation result of each data source in the sequence of data sources to be selected;

[0037] If the first calculation result of the first data source is greater than or equal to the first random number, the first data source is added to the sequence of data sources to be verified; the first data source is any data source in the sequence of data sources to be selected; the first random number is obtained by the random algorithm, and the first random number is less than a preset value;

[0038] After determining the N data sources that meet the delay rate requirement in the to-be-selected data source sequence as the to-be-verified data source sequence, the method further includes:

[0039] The statistical values ​​corresponding to the data sources that do not belong to the sequence of data sources to be verified among the M data sources are all added with a set value.

[0040] If the first calculation result of the first data source is greater than or equal to the first random number, it indicates that the delay rate of the first data source is higher or the statistical value is larger. Generally speaking, a data source with a higher delay rate has poor reliability. A larger statistical value indicates that the first data source has skipped multiple rounds of historical reliability verification. In this case, the first data source should be added to the sequence of data sources to be verified. At the same time, the statistical values ​​of the data sources that do not belong to the sequence of data sources to be verified are all added to the set values. Timely updating of the statistical values ​​corresponding to the data sources can improve the accuracy of the first calculation result of the data source, thereby improving the accuracy of determining the N data sources.

[0041] In a possible design, if the verification data submitted by the second data source for the current round of reliability verification is obtained by calculating the data to be verified submitted by multiple sub-data sources through a data calculation template, then the verification data submitted by the second data source for the current round of reliability verification also includes an acquisition path of the data to be verified of each of the multiple sub-data sources and the data calculation template; the second data source is any one of the data sources in the sequence of data sources to be verified;

[0042] The determining, according to the verification data submitted by each data source in the sequence of data sources to be verified for the current round of reliability verification, a first score of each data source in the sequence of data sources to be verified comprises:

[0043] The first score of the second data source is determined according to the verification data submitted by the second data source for this round of reliability verification, the acquisition path of the data to be verified of each of the multiple sub-data sources, and the data calculation template.

[0044] When the verification data submitted by the data source is obtained by calculating the verification data submitted by multiple sub-data sources, the verification data submitted by the data source should also include the acquisition path of the data to be verified of each of the multiple sub-data sources and the data calculation template, so as to improve the accuracy of the first score.

[0045] In a second aspect, the present application further provides a device for determining the reliability of an off-chain data source, the device comprising: a transceiver unit and a processing unit;

[0046] The processing unit is used to form an initial data source sequence according to pre-configured M data sources; M is a positive integer; a random exchange mechanism is determined by setting an identifier of a set transaction of a set block, and an updated data source sequence is obtained through the random exchange mechanism; the random exchange mechanism is used to exchange the positions of two data sources in the initial data source sequence; N data sources that meet the delay rate requirements in the updated data source sequence are determined as a data source sequence to be verified; the delay rate of the data source is determined according to the time when the data source submits verification data; N is a positive integer and N is less than or equal to M;

[0047] The transceiver unit is used to notify each data source in the sequence of data sources to be verified to submit verification data for this round of reliability verification;

[0048] The processing unit is further configured to determine the reliability of each data source in the sequence of data sources to be verified through verification data submitted by each data source in the sequence of data sources to be verified.

[0049] In one possible design, the transceiver unit is specifically used to obtain the historical reliability verification record of the data source; the historical reliability verification record of the data source includes the time when the data source submitted verification data in the previous round of reliability verification; the processing unit is specifically used to determine the delay rate of the data source based on the time when the data source submitted verification data in the previous round of reliability verification and the time when the data source was notified to submit verification data in the previous round of reliability verification.

[0050] In one possible design, the processing unit is specifically used to determine a first integer based on an identifier of the first transaction in the latest block on the blockchain; randomly determine the number of data source exchanges for the initial data source sequence based on the first integer, and determine the exchange position of each data source exchange through a random algorithm.

[0051] In one possible design, the processing unit is specifically used to determine the first score and the second score of each data source in the sequence of data sources to be verified according to the verification data submitted by each data source in the sequence of data sources to be verified for this round of reliability verification; the first score of any data source in the sequence of data sources to be verified is used to characterize the authenticity of the verification data submitted by the data source, and the second score of the data source is used to characterize the degree of deviation between the verification data submitted by the data source and the verification data submitted by other data sources in the sequence of data sources to be verified; and determine the third score of each data source in the sequence of data sources to be verified according to the first score and the second score of each data source in the sequence of data sources to be verified; the third score of any data source in the sequence of data sources to be verified is used to characterize the reliability of the data source.

[0052] In one possible design, the transceiver unit is specifically used to obtain the duration of the previous round of reliability verification; the processing unit is specifically used to determine a first difference; the first difference is the difference between the time when the data source submitted verification data in the previous round of reliability verification and the time when the data source to be verified was notified to submit verification data in the previous round of reliability verification; the delay rate of the data source is determined based on the ratio of the first difference to the duration of the previous round of reliability verification.

[0053] In one possible design, the processing unit is specifically used to determine the first K data sources in the updated data source sequence as the data source sequence to be selected, where K is equal to the number of times the data source is exchanged for the initial data source sequence; and determine N data sources in the data source sequence to be selected that meet the delay rate requirements as the data source sequence to be verified.

[0054] In a possible design, any data source among the M data sources has a corresponding statistical value, an initial value of the statistical value corresponding to any data source is 0, and the statistical value of the data source is used to characterize the number of times the data source skips reliability verification; the processing unit is specifically used to calculate according to the delay rate of each data source in the sequence of data sources to be selected and the corresponding statistical value, to obtain a first calculation result of each data source in the sequence of data sources to be selected;

[0055] If the first calculation result of the first data source is greater than or equal to the first random number, the first data source is added to the sequence of data sources to be verified; the first data source is any data source in the sequence of data sources to be selected; the first random number is obtained by the random algorithm, and the first random number is less than a preset value; the processing unit is also used to add the set value to the statistical values ​​corresponding to the data sources among the M data sources that do not belong to the sequence of data sources to be verified.

[0056] In a possible design, if the verification data submitted by the second data source for the current round of reliability verification is obtained by calculating the data to be verified submitted by multiple sub-data sources through a data calculation template, then the verification data submitted by the second data source for the current round of reliability verification also includes an acquisition path for the data to be verified of each of the multiple sub-data sources and the data calculation template; the second data source is any data source in the sequence of data sources to be verified; and the processing unit is specifically used to determine the first score of the second data source according to the verification data submitted by the second data source for the current round of reliability verification, the acquisition path for the data to be verified of each of the multiple sub-data sources, and the data calculation template.

[0057] In a third aspect, the present application also provides a device for determining the reliability of an off-chain data source, the device comprising: a processor, and a memory communicatively connected to the processor;

[0058] The memory stores computer-executable instructions;

[0059] The processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect above.

[0060] In a fourth aspect, the present application further provides a computer-readable storage medium, wherein the computer-readable storage medium includes a program, and when the program is executed on a device, the device executes the method as described in any one of the above-mentioned first aspects.

[0061] In a fifth aspect, the present application further provides a computer program product, wherein the computer program product comprises a computer program, and when the computer program is executed by a processor, the method described in the first aspect is implemented. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0063] Figure 1 A flowchart of a method for determining the reliability of an off-chain data source provided in an embodiment of the present application;

[0064] Figure 2 A schematic diagram of a blockchain application scenario provided for an embodiment of the present application;

[0065] Figure 3 A schematic diagram of the structure of the device for determining the reliability of an off-chain data source provided in an embodiment of the present application Figure 1 ;

[0066] Figure 4 A schematic diagram of the structure of the device for determining the reliability of an off-chain data source provided in an embodiment of the present application Figure 2 . DETAILED DESCRIPTION

[0067] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.

[0068] The application scenarios described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application. It is known to those skilled in the art that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present application are also applicable to similar technical problems. In the description of the present application, unless otherwise specified, the meaning of "multiple" is two or more.

[0069] In order to solve the problem of low efficiency in determining the reliability of data sources described in the background technology section, this application proposes the following Figure 1 The method shown in the figure is executed by the oracle contract on the blockchain.

[0070] First, let’s briefly explain the blockchain, oracle contract, and oracle node involved in this application:

[0071] Blockchain: Blockchain is a chain data structure that combines data blocks in a sequential manner in chronological order, and is a distributed ledger that is cryptographically guaranteed to be tamper-proof and unforgeable. The data on the blockchain is maintained by all nodes, and each node involved in the maintenance can copy a complete record of the data, establishing a distributed trust mechanism to ensure that the data in the system is open, transparent, traceable, and prevents illegal tampering. At present, blockchain technology has a wide range of application scenarios, such as Figure 2 As shown, it is mainly used in financial services, intelligent manufacturing, supply chain management and other fields, and can improve the coordination efficiency among multiple departments;

[0072] Oracle contract: Oracle contract is a special smart contract deployed on the blockchain. Since off-chain data is unsafe and untrustworthy for the blockchain, generally speaking, the blockchain cannot access or obtain off-chain data. Oracle contracts can be deployed on the blockchain to solve this problem. The oracle contract is responsible for receiving data sent by off-chain oracle nodes.

[0073] Oracle node: The oracle node transmits the data obtained outside the chain to the oracle contract on the chain. The existence of the oracle node enables the blockchain to interact with the data outside the chain, realizing the effective connection between the blockchain and the data source outside the chain.

[0074] The method for determining the reliability of off-chain data sources proposed in this application specifically includes:

[0075] Step 100: An initial data source sequence is formed according to preconfigured M data sources, where M is a positive integer.

[0076] Exemplarily, the oracle contract may pre-configure the number of data sources in the initial data source sequence for reliability verification. For example, M is pre-configured to 20, and the 20 data sources constitute the initial data source sequence.

[0077] Exemplarily, in addition to pre-configuring the number of data sources in the initial data source sequence, the oracle contract can also pre-configure the interval between two rounds of reliability verification. In the blockchain, block height is usually used as the time unit. For example, assuming that a block height represents 0.5s, if the interval between two rounds of reliability verification is 5s, then the interval between the two rounds of reliability verification can be pre-configured to 10 block heights; in addition, the block height is also used for time recording of certain on-chain operations. For example, at the 10th block height, the oracle contract on the chain received data sent by a data source.

[0078] Step 101: Determine a random exchange mechanism by setting an identifier of a setting transaction of a setting block, and obtain an updated data source sequence through the random exchange mechanism; the random exchange mechanism is used to exchange the positions of two data sources in the initial data source sequence.

[0079] Exemplarily, in order to ensure that the updated data source sequence has good randomness, the data source in the initial data source sequence is first exchanged. First, a random exchange mechanism needs to be determined. The random exchange mechanism includes the number of data source exchanges that need to be performed. The number of data source exchanges is determined according to the identifier of the set transaction of the set block; wherein, each transaction on the blockchain has a corresponding transaction number, and the transaction number can be used as an identifier of each transaction. The set block can be the latest block on the blockchain. The so-called latest block refers to the combination of the latest transaction on the blockchain. The set transaction can be the latest transaction in the set block. Then the identifier of the set transaction of the set block is the identifier of the first transaction in the latest block on the blockchain. The identifier of the transaction is usually a binary number, and the integer obtained after converting the binary transaction number is recorded as the first integer. It should be noted that the above selection of the latest transaction in the latest block to determine the random exchange mechanism is only an example, and the random exchange mechanism can also be determined according to any transaction in any block on the blockchain. This application does not limit this.

[0080] Exemplarily, after obtaining the first integer, the number of data source exchanges for the initial data source sequence is determined according to the first integer. For example, the result of taking the modulus of the first integer and the number of data sources in the initial data source sequence can be used as the number of data source exchanges, that is, the number of data source exchanges can be determined according to the result of taking the modulus of the first integer and M; or, with the help of a random algorithm, the first integer can be input into the random algorithm, and the result of taking the modulus of the random number output by the random algorithm and M can be used as the number of data source exchanges. The present application does not impose any limitation on this, nor does it impose any limitation on the type of random algorithm used.

[0081] For example, assuming that M is 20, the first integer is 6, and 6%20=6, it can be determined that the number of data source exchanges for the initial data source sequence is 6.

[0082] Further exemplarily, after determining the number of data source exchanges, the data sources in the initial data source sequence are exchanged, and the exchange position of each data source exchange is determined by a random algorithm. After all data source exchanges are completed, an updated data source sequence can be obtained. Taking the i-th data source exchange as an example, the process of data source exchange is explained as follows: ① Generate a random number r1 using a random algorithm; ② Calculate the remainder of r1 with respect to M, and record the remainder as r2; ③ Exchange the i-th data source in the initial data source sequence with the r2-th data source in the initial data source sequence; After the above steps ① to ③, a data source exchange is completed, and the positions of the two data sources are changed.

[0083] Example 1: Assume that M is 20 and the first data source exchange is currently being performed, that is, i is equal to 1. Assume that the random number r1 generated by the random algorithm is equal to 12, then r2=12%20=12. Therefore, the positions of the first data source in the initial data source sequence and the twelfth data source in the initial data source sequence are exchanged.

[0084] Example 2: Assume that M is still 20, and the fifth data source exchange is currently being performed, that is, i is equal to 5. Assume that the random number r1 generated by the random algorithm is equal to 8, then r2=8%20=8. Due to the previous four data source exchanges, the positions of multiple data sources in the initial data source sequence have changed. Assume that the data source sequence obtained after the previous four data source exchanges is recorded as data source sequence 4, then the position of the 5th data source in data source sequence 4 should be exchanged with the 8th data source in data source sequence 4.

[0085] The data source positions are scrambled by exchanging the data sources of the initial data source sequence in this step, which can be understood as a "shuffling" operation in playing cards, so that the updated data source sequence obtained after the data source exchange has better randomness.

[0086] Step 102: Determine N data sources that meet the delay rate requirement in the update data source sequence as the data source sequence to be verified; the delay rate of the data source is determined according to the time when the data source submits verification data, and N is a positive integer and N is less than or equal to M.

[0087] Exemplarily, determining N data sources in the updated data source sequence that meet the delay rate requirements as the data source sequence to be verified can be understood as a data source screening process, and this screening process can be further divided into two screenings. Through step 101, an updated data source sequence can be obtained. The first screening is to determine the first K data sources in the updated data source sequence as the data source sequence to be selected, where K is equal to the number of data source exchanges performed on the initial data source sequence; for example, if the initial data source sequence is exchanged 15 times in step 101, then the first 15 data sources in the updated data source sequence obtained after 15 data source exchanges are determined as the data source sequence to be selected; the second screening is to determine the N data sources in the data source sequence to be selected that meet the delay rate requirements as the data source sequence to be verified.

[0088] Further exemplarily, the second screening is to determine N data sources that meet the delay rate requirements in the sequence of data sources to be selected as the sequence of data sources to be verified. In other words, the conditions for the second screening are related to the delay rate of the data source. In addition, in addition to being related to the delay rate of the data source, it is also related to the statistical value of the data source.

[0089] First, the delay rate of the data source is explained. If you need to calculate the delay rate of the data source, you need to obtain the reliability verification record of the data source and the duration of the previous round of reliability verification, where the reliability verification record of the data source includes the time when the data source submits verification data in the previous round of reliability verification, and then calculate the difference between the time when the data source submits verification data in the previous round of reliability verification and the time when the data source to be verified is notified to submit verification data in the previous round of reliability verification, which is recorded as the first difference. Finally, the delay rate of the data source is determined according to the ratio of the first difference to the duration of the previous round of reliability verification, as shown in the following formula:

[0090]

[0091] Among them, p is the delay rate of the data source, h1 is the time when the data source submits verification data in the previous round of reliability verification, t1 is the time when the data source to be verified is notified to submit verification data in the previous round of reliability verification, h1-t1 is the first difference, and t is the duration of the previous round of reliability verification.

[0092] For example, assuming that the duration of the previous round of reliability verification is 10 blocks, the oracle contract notifies the data sources to be verified to submit verification data at the 90th block, and one of the data sources to be verified submits verification data at the 94th block. Then the delay rate of the data source is

[0093] From the above, it can be seen that after the data source to be verified is notified to submit verification data, if the data source submits the verification data in a shorter time, the smaller the numerator of the above formula, the smaller the delay rate p of the data source. Therefore, the delay rate of the data source can also represent the response speed of the data source. The smaller the delay rate of the data source, the better the response speed of the data source.

[0094] Next, the statistical value of the data source is explained. Any of the M data sources has a corresponding statistical value, which is used to represent the number of times the data source skips reliability verification. The initial value of the statistical value corresponding to any data source is 0. If the statistical value corresponding to a data source is 5, it means that the data source has skipped 5 reliability verifications before this round of reliability verification.

[0095] After obtaining the delay rate and the corresponding statistical value of the data source, a calculation is performed based on the delay rate and the corresponding statistical value of each data source in the sequence of data sources to be selected to obtain a first calculation result of each data source in the sequence of selected data sources. The first calculation result can be obtained by the following formula:

[0096] p'=p×(count-1)

[0097] Wherein, p' is the first calculation result of the data source, p is the delay rate of the data source, and count is the statistical value corresponding to the data source.

[0098] For example, assuming that the delay rate of a data source is 40% and count is 4, the first calculation result of the data source is p'=40%×(4-1)=1.2.

[0099] Exemplarily, satisfying the delay rate requirement means that if the first calculation result of the first data source is greater than or equal to the first random number, the first data source is added to the sequence of data sources to be verified; because when the first calculation result of the first data source is greater than or equal to the first random number, it indicates that the delay rate of the first data source is large, and / or the first data source skips reliability verification a large number of times, and the reliability of the first data source should be verified in this round; wherein the first data source is any data source in the sequence of data sources to be selected; the first random number is obtained by a random algorithm, and the first random number is less than a preset value; the preset value is generally 100, or is set to other values ​​according to business needs, and this application does not limit this.

[0100] For example, assuming that the first random number determined by the random algorithm is 12, and there are data sources A, data source B and data source C in the sequence of data sources to be selected, assuming that the first calculation result of data source A calculated according to the delay rates of data sources A to C and the corresponding statistical values ​​is 3.6, the first calculation result of data source B is 12.8, and the first calculation result of data source C is 5.2, and only the first calculation result of data source B is greater than the first random number. Therefore, in the sequence of data sources to be selected, only data source B meets the delay rate requirements, and data source B is added to the sequence of data sources to be verified.

[0101] In addition, in addition to filtering the sequence of data sources to be selected based on the delay rate and corresponding statistical values ​​of the data source, it is also possible to filter based on the reliability score of the previous round of the data source. The historical reliability verification record of the data source also includes the reliability score of the previous round. If the data source submits verification data after the end of this round of reliability verification, or does not submit verification data, the reliability score of the data source will remain the reliability score of the previous round, and points will be deducted according to a preset ratio. In subsequent reliability verifications, data sources with reliability scores lower than the preset threshold can be added to the sequence of data sources to be verified.

[0102] For example, assuming that the end time of this round of reliability verification is the 100th block height, and the data source A to be verified submits verification data at the 102nd block height, then the verification data submitted by the data source is invalid data for this round of reliability verification, and the reliability score of data source A remains the reliability score of the previous round. Assuming that the reliability score of data source A in the previous round is 70 points, the preset ratio is 20%, and the preset threshold is 60 points, then the reliability score of data source A after deduction is 70-70×20%=56, which is less than 60. In the next round of reliability verification, data source A can still be added to the sequence of data sources to be verified.

[0103] One point that needs to be explained is that after determining the sequence of data sources to be verified, the statistical values ​​corresponding to the data sources among the M data sources that do not belong to the sequence of data sources to be verified are added to the set value to ensure timely updating of the statistical values ​​corresponding to the data sources, thereby ensuring the accuracy of the first calculation result of the data source, wherein the set value can be 1, and this application does not limit this.

[0104] Step 103: Notify each data source in the sequence of data sources to be verified to submit verification data for this round of reliability verification.

[0105] Exemplarily, after determining the sequence of data sources to be verified in step 102, the oracle contract notifies each data source in the sequence of data sources to be verified to submit verification data. Taking the second data source, any data source in the sequence of data sources to be verified, as an example, if the verification data submitted by the second data source for this round of reliability verification is obtained by calculating the data to be verified submitted by multiple sub-data sources through a data calculation template, then the verification data submitted by the second data source for this round of reliability verification also includes the acquisition path of the data to be verified of each sub-data source in the multiple sub-data sources and the data calculation template; otherwise, the second data source only needs to submit the verification data and the acquisition path of the verification data for this round of reliability verification.

[0106] For example, assuming that the verification data submitted by data source A is obtained by calculating the verification data submitted by sub-data sources B to D through a data calculation template, then the verification data submitted by data source A should also include the verification data acquisition path of sub-data source B, the verification data acquisition path of sub-data source C, the verification data acquisition path of sub-data source D, and the data calculation template.

[0107] Step 104: Determine the reliability of each data source in the sequence of data sources to be verified through the verification data submitted by each data source in the sequence of data sources to be verified.

[0108] Exemplarily, the reliability of each data source can be characterized by a reliability score of the data source. The present application determines the first score and the second score of each data source in the sequence of data sources to be verified based on the verification data submitted by each data source in the sequence of data sources to be verified for this round of reliability verification, and then determines the third score of each data source based on the first score and the second score of each data source. The third score is used to characterize the reliability of the data source.

[0109] Exemplarily, the first score of the data source is used to characterize the authenticity of the verification data submitted by the data source. Taking the second data source as an example, the first score of the second data source can be obtained by the following formula:

[0110] S1=(1-|data1-data0| / data1)×100

[0111] Among them, data0 is the data value corresponding to the verification data provided by the second data source, and data1 is the data value determined by the verification data obtained by the oracle contract according to the verification data acquisition path included in the verification data. If the verification data submitted by the second data source for this round of reliability verification is obtained by calculating the data to be verified submitted by multiple sub-data sources through the data calculation template, then the first score of the second data source is determined according to the verification data submitted by the second data source for this round of reliability verification, the acquisition path of the data to be verified of each sub-data source in the multiple sub-data sources, and the data calculation template. For example, if the verification data submitted by the second data source is obtained by calculating the verification data of sub-data sources B to D through the data calculation template, then to calculate data1 of the second data source, first, according to the acquisition path of the verification data of sub-data source B, the data value corresponding to the verification data of sub-data source B must be obtained, according to the acquisition path of the verification data of sub-data source C, the data value corresponding to the verification data of sub-data source C must be obtained, and according to the acquisition path of the verification data of sub-data source D, the data value corresponding to the verification data of sub-data source D must be obtained. Assuming that the data calculation template calculates the average value of the sum of the data values ​​corresponding to the verification data of each sub-data source, then data1 is equal to the average value of the sum of the data values ​​corresponding to the verification data of sub-data sources B to D.

[0112] For example, assuming that the data value data0 corresponding to the verification data submitted by the second data source is 70, and the data1 determined by the oracle contract is 60, then the first score S1 of the second data source = (1-|60-70| / 60)×100=83.

[0113] Exemplarily, still taking the second data source as an example, the second score of the second data source is used to characterize the degree of deviation between the verification data submitted by the second data source and the verification data submitted by other data sources in the sequence of data sources to be verified, which can be obtained by the following formula:

[0114]

[0115] Among them, data0 is the data value corresponding to the verification data provided by the second data source, and data3 is the average value of the sum of the data values ​​corresponding to the verification data submitted by each data source in the data source sequence to be verified, that is, the average value of the sum of data0 corresponding to the verification data submitted by each data source in the data source sequence to be verified.

[0116] For example, assuming that the sequence of data sources to be verified includes the second data source, the third data source, and the fourth data source, wherein the data value corresponding to the verification data submitted by the second data source is 70, the data value corresponding to the verification data submitted by the third data source is 75, and the data value corresponding to the verification data submitted by the fourth data source is 65, then when calculating the second score S2 of the second data source, data0 is 70, data3=(70+75+65) / 3=70, therefore, the second score of the second data source is

[0117] Exemplarily, after obtaining the first score and the second score of the data source, the average of the first score and the second score can be used as the third score of the data source, that is, S3 = (S1 + S2) / 2, or the first score and the second score can be weighted and summed according to a preset weight value, and the weighted sum result can be used as the third score of the data source. This application is not limited to this.

[0118] The method for determining the reliability of off-chain data sources proposed in this application can reduce the amount of data interacting between the chain and the outside of the chain, and improve the efficiency of determining the reliability of off-chain data sources; and this method no longer relies on the oracle node off-chain to determine the reliability of the data source and then synchronizes the oracle node to the chain, but directly determines the reliability of the data source on the chain, with a faster update speed.

[0119] Figure 3 and Figure 4 A schematic diagram of a possible device for determining the reliability of an off-chain data source provided in an embodiment of the present application. These devices for determining the reliability of an off-chain data source can be used to implement the functions of the oracle contract in the above method embodiment, and thus can also achieve the beneficial effects possessed by the above method embodiment.

[0120] like Figure 3 As shown, the device 300 for determining the reliability of an off-chain data source includes a transceiver unit 310 and a processing unit 320:

[0121] The processing unit 320 is used to form an initial data source sequence according to the pre-configured M data sources; M is a positive integer; by setting the identifier of the set transaction of the block, a random exchange mechanism is determined, and an updated data source sequence is obtained through the random exchange mechanism; the random exchange mechanism is used to exchange the positions of two data sources in the initial data source sequence; the N data sources that meet the delay rate requirements in the updated data source sequence are determined as the data source sequence to be verified; the delay rate of the data source is determined according to the time when the data source submits the verification data; N is a positive integer and N is less than or equal to M;

[0122] The transceiver unit 310 is used to notify each data source in the sequence of data sources to be verified to submit verification data for this round of reliability verification;

[0123] The processing unit 320 is further configured to determine the reliability of each data source in the sequence of data sources to be verified through verification data submitted by each data source in the sequence of data sources to be verified.

[0124] In one possible design, the transceiver unit 310 is specifically used to obtain the historical reliability verification record of the data source; the historical reliability verification record of the data source includes the time when the data source submitted the verification data in the previous round of reliability verification; the processing unit is specifically used to determine the delay rate of the data source based on the time when the data source submitted the verification data in the previous round of reliability verification and the time when the data source was notified to submit the verification data in the previous round of reliability verification.

[0125] In a possible design, the processing unit 320 is specifically used to determine a first integer based on an identifier of the first transaction in the latest block on the blockchain; randomly determine the number of data source exchanges for the initial data source sequence based on the first integer, and determine the exchange position of each data source exchange through a random algorithm.

[0126] In one possible design, the processing unit 320 is specifically used to determine the first score and the second score of each data source in the sequence of data sources to be verified according to the verification data submitted by each data source in the sequence of data sources to be verified for this round of reliability verification; the first score of any data source in the sequence of data sources to be verified is used to characterize the authenticity of the verification data submitted by the data source, and the second score of the data source is used to characterize the degree of deviation between the verification data submitted by the data source and the verification data submitted by other data sources in the sequence of data sources to be verified; and determine the third score of each data source in the sequence of data sources to be verified according to the first score and the second score of each data source in the sequence of data sources to be verified; the third score of any data source in the sequence of data sources to be verified is used to characterize the reliability of the data source.

[0127] In one possible design, the transceiver unit 310 is specifically used to obtain the duration of the previous round of reliability verification; the processing unit 320 determines a first difference; the first difference is the difference between the time when the data source submits verification data in the previous round of reliability verification and the time when the data source to be verified is notified to submit verification data in the previous round of reliability verification; the delay rate of the data source is determined based on the ratio of the first difference to the duration of the previous round of reliability verification.

[0128] In one possible design, the processing unit 320 is specifically used to determine the first K data sources in the updated data source sequence as the data source sequence to be selected, where K is equal to the number of times the data source is exchanged for the initial data source sequence; and determine N data sources in the data source sequence to be selected that meet the delay rate requirements as the data source sequence to be verified.

[0129] In a possible design, any data source among the M data sources has a corresponding statistical value, an initial value of the statistical value corresponding to any data source is 0, and the statistical value of the data source is used to characterize the number of times the data source skips reliability verification; the processing unit 320 is specifically used to calculate according to the delay rate of each data source in the sequence of data sources to be selected and the corresponding statistical value, to obtain a first calculation result of each data source in the sequence of data sources to be selected;

[0130] If the first calculation result of the first data source is greater than or equal to the first random number, the first data source is added to the sequence of data sources to be verified; the first data source is any data source in the sequence of data sources to be selected; the first random number is obtained by the random algorithm, and the first random number is less than a preset value; the processing unit 320 is also used to add the set value to the statistical values ​​corresponding to the data sources in the M data sources that do not belong to the sequence of data sources to be verified.

[0131] In a possible design, if the verification data submitted by the second data source for the current round of reliability verification is obtained by calculating the data to be verified submitted by multiple sub-data sources through a data calculation template, then the verification data submitted by the second data source for the current round of reliability verification also includes an acquisition path of the data to be verified of each of the multiple sub-data sources and the data calculation template; the second data source is any data source in the sequence of data sources to be verified; the processing unit 320 is specifically used to determine the first score of the second data source according to the verification data submitted by the second data source for the current round of reliability verification, the acquisition path of the data to be verified of each of the multiple sub-data sources, and the data calculation template.

[0132] For more detailed description of the transceiver unit 310 and the processing unit 320, please refer to Figure 1 The relevant description in the method embodiment shown is directly obtained and will not be repeated here.

[0133] like Figure 4As shown, the device 400 for determining the reliability of an off-chain data source includes a processor 410 and an interface circuit 420. The processor 410 and the interface circuit 420 are coupled to each other. It is understood that the interface circuit 420 can be a transceiver or an input-output interface. Optionally, the device 400 for determining the reliability of an off-chain data source may also include a memory 430 for storing instructions executed by the processor 410 or storing input data required by the processor 410 to execute instructions or storing data generated after the processor 410 executes instructions.

[0134] When the device 400 for determining the reliability of the off-chain data source is used to implement Figure 1 When the method is shown, the processor 410 is used to implement the functions of the processing unit 320, and the interface circuit 420 is used to implement the functions of the transceiver unit 310.

[0135] The division of units in the embodiments of the present application is schematic and is only a logical function division. There may be other division methods in actual implementation. In addition, each functional unit in each embodiment of the present application may be integrated into a processor, or may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0136] Although the preferred embodiments of the present application have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the present application.

[0137] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for determining the reliability of an off-chain data source, characterized in that: The method is applied to the oracle contract on the blockchain, and the method includes: An initial data source sequence is formed according to the preconfigured M data sources; M is a positive integer; By setting the identifier of the setting transaction of the block, a random exchange mechanism is determined, and an updated data source sequence is obtained through the random exchange mechanism; the random exchange mechanism is used to exchange the positions of two data sources in the initial data source sequence; Determine N data sources that meet the delay rate requirement in the update data source sequence as a data source sequence to be verified; the delay rate of the data source is determined according to the time when the data source submits verification data; N is a positive integer and N is less than or equal to M; Notify each data source in the sequence of data sources to be verified to submit verification data for this round of reliability verification; The reliability of each data source in the sequence of data sources to be verified is determined through the verification data submitted by each data source in the sequence of data sources to be verified.

2. The method according to claim 1, characterized in that The delay rate of the data source is determined according to the time when the data source submits the verification data, including: Acquire the historical reliability verification record of the data source; the historical reliability verification record of the data source includes the time when the data source submitted verification data in the last round of reliability verification; The delay rate of the data source is determined according to the time when the data source submits verification data in the last round of reliability verification and the time when the data source is notified to submit verification data in the last round of reliability verification.

3. The method according to claim 1, characterized in that The blockchain node determines the random exchange mechanism by setting the identifier of the set transaction of the set block, including: The blockchain node determines a first integer based on an identifier of a first transaction in a latest block on the blockchain; The number of times the data source is exchanged for the initial data source sequence is randomly determined according to the first integer, and the exchange position of each data source exchange is determined by a random algorithm.

4. The method according to claim 1, characterized in that Determining the reliability of each data source in the sequence of data sources to be verified by using the verification data submitted by each data source in the sequence of data sources to be verified includes: Determine a first score and a second score of each data source in the sequence of data sources to be verified according to the verification data submitted by each data source in the sequence of data sources to be verified for this round of reliability verification; the first score of any data source in the sequence of data sources to be verified is used to characterize the authenticity of the verification data submitted by the data source, and the second score of the data source is used to characterize the degree of deviation between the verification data submitted by the data source and the verification data submitted by other data sources in the sequence of data sources to be verified; The third score of each data source in the sequence of data sources to be verified is determined according to the first score and the second score of each data source in the sequence of data sources to be verified; the third score of any data source in the sequence of data sources to be verified is used to characterize the reliability of the data source.

5. The method according to claim 2, characterized in that Determining the delay rate of the data source according to the time when the data source submits verification data in the last round of reliability verification and the time when the data source is notified to submit verification data in the last round of reliability verification includes: Get the duration of the last round of reliability verification; Determine a first difference; the first difference is the difference between the time when the data source submitted the verification data in the previous round of reliability verification and the time when the data source to be verified was notified to submit the verification data in the previous round of reliability verification; The delay rate of the data source is determined according to a ratio of the first difference to a duration of the previous round of reliability verification.

6. The method according to claim 1 or 3, characterized in that: The step of determining N data sources in the update data source sequence that meet the delay rate requirement as a data source sequence to be verified includes: Determine the first K data sources in the updated data source sequence as the data source sequence to be selected, where K is equal to the number of data source exchanges performed on the initial data source sequence; N data sources that meet the delay rate requirement in the to-be-selected data source sequence are determined as the to-be-verified data source sequence.

7. The method according to any one of claims 6, characterized in that Any data source among the M data sources has a corresponding statistical value, the initial value of the statistical value corresponding to any data source is 0, and the statistical value of the data source is used to represent the number of times the data source skips reliability verification; The step of determining N data sources that meet the delay rate requirement in the sequence of data sources to be selected as the sequence of data sources to be verified includes: Calculating according to the delay rate of each data source in the sequence of data sources to be selected and the corresponding statistical value to obtain a first calculation result of each data source in the sequence of data sources to be selected; If the first calculation result of the first data source is greater than or equal to the first random number, the first data source is added to the sequence of data sources to be verified; the first data source is any data source in the sequence of data sources to be selected; the first random number is obtained by the random algorithm, and the first random number is less than a preset value; After determining the N data sources that meet the delay rate requirement in the to-be-selected data source sequence as the to-be-verified data source sequence, the method further includes: The statistical values ​​corresponding to the data sources that do not belong to the sequence of data sources to be verified among the M data sources are all added with a set value.

8. The method according to claim 4, characterized in that If the verification data submitted by the second data source for this round of reliability verification is obtained by calculating the data to be verified submitted by multiple sub-data sources through a data calculation template, then the verification data submitted by the second data source for this round of reliability verification also includes the acquisition path of the data to be verified of each sub-data source in the multiple sub-data sources and the data calculation template; the second data source is any data source in the sequence of data sources to be verified; The determining, according to the verification data submitted by each data source in the sequence of data sources to be verified for the current round of reliability verification, a first score of each data source in the sequence of data sources to be verified comprises: The first score of the second data source is determined according to the verification data submitted by the second data source for this round of reliability verification, the acquisition path of the data to be verified of each of the multiple sub-data sources, and the data calculation template.

9. A device for determining the reliability of an off-chain data source, characterized in that: The device comprises: a transceiver unit and a processing unit; The processing unit is used to form an initial data source sequence according to pre-configured M data sources; M is a positive integer; a random exchange mechanism is determined by setting an identifier of a set transaction of a set block, and an updated data source sequence is obtained through the random exchange mechanism; the random exchange mechanism is used to exchange the positions of two data sources in the initial data source sequence; N data sources that meet the delay rate requirements in the updated data source sequence are determined as a data source sequence to be verified; the delay rate of the data source is determined according to the time when the data source submits verification data; N is a positive integer and N is less than or equal to M; The transceiver unit is used to notify each data source in the sequence of data sources to be verified to submit verification data for this round of reliability verification; The processing unit is further configured to determine the reliability of each data source in the sequence of data sources to be verified through verification data submitted by each data source in the sequence of data sources to be verified.

10. A device for determining the reliability of an off-chain data source, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 8.

11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 8 when executed by a processor.

12. A computer program product, characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 8 when being executed by a processor.