A method, device and electronic device for updating off-chain data authorization oracle
Through the collaborative work of on-chain modules and off-chain nodes, combined with the multiple verification mechanism of storage contracts and governance contracts, the problem that blockchain cannot actively obtain off-chain data and data tampering is solved, and the secure writing and selection of data is realized. Improves the reliability and impartiality of data.
Patent Information
- Application Number
- CN202110366917.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-06
- Publication Date
- 2024-12-17
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The blockchain environment cannot actively obtain data from the real world off-chain, and off-chain data is easily tampered with when written to the blockchain, which lacks security.
The on-chain module selects the data source that can be linked and broadcasts. The off-chain nodes collect data based on information and publish transactions. The on-chain module verifies the data and writes it to the chain. The data source and verification data are selected based on storage contracts and governance contracts. Ensure the security of the data.
Improve the security of off-chain data writing to the blockchain, prevent data tampering, and ensure data reliability and fairness through multiple verification and selection cycles.
Smart Images

Figure CN113065167B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain technology, and in particular to a method, device and electronic device for updating an off-chain data authorization oracle. Background Art
[0002] The blockchain is a closed environment. Smart contracts on the chain passively receive data and cannot actively obtain data from the real world off the chain. In addition, smart contracts are programs that can only reach the trigger state when the corresponding conditions are met. If the triggering conditions of the smart contract depend on the information under the blockchain, it is necessary to use an oracle to provide this information under the blockchain and write it into the blockchain record.
[0003] An oracle is a one-way digital agent that can find and verify real-world data and submit information to smart contracts in an encrypted manner. Oracles are the middle layer that securely connects blockchains to off-chain systems. Blockchains can be connected to various off-chain environments such as data providers, web APIs, enterprise backends, cloud service providers, IoT devices, electronic signatures, payment systems, and other blockchains through oracles.
[0004] At present, off-chain data is usually collected and published by third-party data sources, such as bank loan data, real-time transaction data of exchanges, etc. Since the data stored on the blockchain must be reliable and secure, and these data may be tampered with, they cannot be directly stored on the blockchain. Summary of the invention
[0005] In order to solve the problems existing in the prior art, the present invention provides the following technical solutions.
[0006] On one hand, the present invention provides a method for updating an off-chain data authorization oracle, comprising:
[0007] The on-chain module selects and broadcasts data sources that can be uploaded to the chain;
[0008] The off-chain node collects data and publishes transactions based on the information of the on-chain data source, requesting that the data be written into the on-chain module;
[0009] The on-chain module verifies the data and writes it to the chain after successful verification.
[0010] Preferably, the on-chain module selects the on-chain data source including:
[0011] The on-chain module includes a storage contract and a governance contract. The storage contract is used to store data, and the governance contract is used to issue governance tokens to users to generate governance contract users.
[0012] The storage contract publishes multiple data sources;
[0013] The governance contract user selects a data source and determines the data source that can be put on the chain based on the selection result.
[0014] Preferably, the governance contract user selects a data source, and the data sources that can be put on the chain are determined based on the selection result, including:
[0015] The governance contract is set to have multiple users;
[0016] Each governance contract user selects a data source;
[0017] The data source that is selected the most is determined as the data source that can be uploaded to the chain.
[0018] Preferably, a selection cycle is set, and each governance contract user selects a data source within the selection cycle. The selection is stopped at the end of the selection cycle, and the most selected data source is statistically obtained.
[0019] Preferably, the selection period is set according to the application.
[0020] Preferably, the off-chain node collects data according to the information of the on-chain data source, including:
[0021] The off-chain node reads the information of the on-chain data source broadcasted by the on-chain module;
[0022] The off-chain node collects data from the on-chain data source.
[0023] Preferably, the on-chain module verifies the data and writes it to the chain after successful verification, including:
[0024] The governance contract user verifies the data and signs after successful verification;
[0025] The successfully verified data and the signature of the governance contract user are written into the storage contract.
[0026] A second aspect of the present invention provides a device for updating an off-chain data authorization oracle, comprising:
[0027] The on-chain module is used to select and broadcast data sources that can be uploaded to the chain, and is also used for the on-chain module to verify the data and write it to the chain after successful verification;
[0028] The off-chain node is used to collect data and issue transactions based on the information of the on-chain data source, and request that the data be written into the on-chain module.
[0029] A third aspect of the present invention provides a memory storing a plurality of instructions, wherein the instructions are used to implement the above method.
[0030] The present invention also provides an electronic device, comprising a processor and a memory connected to the processor, wherein the memory stores a plurality of instructions, and the instructions can be loaded and executed by the processor so that the processor can execute the above method.
[0031] The beneficial effects of the present invention are as follows: the present invention provides a method, device and electronic device for updating an off-chain data authorization oracle, and the method includes: the on-chain module selects and broadcasts a data source that can be on the chain; the off-chain node collects data and publishes transactions based on the information of the on-chain data source, and requests that the data be written into the on-chain module; the on-chain module verifies the data and writes it to the chain after successful verification. Using the method provided by the present invention, the data written to the chain is not only security verified by the off-chain node, but also selected and verified by the on-chain module for the data source, which solves the problem that the data collected and published by the third-party data source may be tampered with when written to the chain, and ensures the security of the data written to the chain. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] Figure 1 A flowchart of the method for updating the off-chain data authorization oracle according to the present invention;
[0033] Figure 2 Schematic diagram of the structure of the device for updating the off-chain data authorization oracle according to the present invention. DETAILED DESCRIPTION
[0034] In order to better understand the above technical solution, the above technical solution will be described in detail below in conjunction with the accompanying drawings and specific implementation methods.
[0035] The method provided by the present invention can be implemented in the following terminal environment, and the terminal may include one or more of the following components: a processor, a memory, and a display screen. The memory stores at least one instruction, and the instruction is loaded and executed by the processor to implement the method described in the following embodiment.
[0036] The processor may include one or more processing cores. The processor uses various interfaces and lines to connect various parts of the entire terminal, and executes various functions of the terminal and processes data by running or executing instructions, programs, code sets or instruction sets stored in the memory, and calling data stored in the memory.
[0037] The memory may include random access memory (RAM) or read-only memory (ROM). The memory may be used to store instructions, programs, codes, code sets or instructions.
[0038] The display screen is used to display the user interface of each application.
[0039] In addition, those skilled in the art can understand that the structure of the above terminal does not constitute a limitation on the terminal, and the terminal may include more or fewer components, or combine certain components, or arrange the components differently. For example, the terminal also includes components such as a radio frequency circuit, an input unit, a sensor, an audio circuit, and a power supply, which will not be described in detail here.
[0040] Embodiment 1
[0041] like Figure 1 As shown, an embodiment of the present invention provides a method for updating an off-chain data authorization oracle, including:
[0042] S101, the on-chain module selects and broadcasts the data source that can be on-chain;
[0043] S102, the off-chain node collects data according to the information of the on-chain data source and publishes a transaction, requesting that the data be written into the on-chain module;
[0044] S103, the on-chain module verifies the data and writes it to the chain after successful verification.
[0045] In actual application, the data source used to provide data may include multiple data sources. Before acquiring data, the on-chain module selects one from multiple data sources and informs the off-chain node of the need to collect data through messages in order to obtain more secure, reliable and high-value data. After receiving the message from the on-chain module, the off-chain node reads the last determined data source information from the on-chain module, and collects data from the corresponding data source according to the data source information. After the off-chain node collects the data, it will issue a transaction and request that the data be written to the on-chain module. After receiving the request from the off-chain node, the on-chain module first verifies the data. If the verification is successful, the data can be written to the chain.
[0046] Among them, it should be noted that in order to ensure that the data collected and applied to be written to the chain is safe and reliable, the off-chain node will verify the collected data, and then request to write it to the chain after the verification is successful to ensure the data is correct and safe. After the on-chain module receives the request to write data from the off-chain node, it will first verify the data, sign it after the verification is passed, and then write the data and signature to the chain.
[0047] By adopting the method provided by the present invention, the data written into the chain is not only security verified by the off-chain nodes, but also selected by the on-chain module for the data source and verified for the data, thus solving the problem that the data collected and published by the third-party data source may be tampered with when written into the chain, and ensuring the security of the data written into the chain.
[0048] Executing step S101, the on-chain module selects the data source that can be on-chain including:
[0049] The on-chain module includes a storage contract and a governance contract. The storage contract is used to store data, and the governance contract is used to issue governance tokens to users to generate governance contract users.
[0050] The storage contract publishes multiple data sources;
[0051] The governance contract user selects a data source and determines the data source that can be put on the chain based on the selection result.
[0052] Among them, the on-chain data source refers to the data source that can be written to the chain. In actual application, the information of the data source is usually written to the chain. When the on-chain module selects the data source, it can make a selection based on the information of the data source written to the chain.
[0053] In an embodiment of the present invention, the information of the data source can be stored in a storage contract. When the smart contract on the chain needs off-chain data, the information of the data source can be published through the storage contract. The storage contract can publish the information of multiple data sources so that users on the chain can select the data source that meets the requirements from multiple data sources.
[0054] The governance contract on the chain is used to issue governance tokens to users, thereby generating governance contract users. Governance contract users select data sources that can be on-chain based on multiple data sources published by the storage contract.
[0055] In the above method, by allowing governance contract users to choose from multiple data sources, the uncertainty of the data source that can be uploaded to the chain can be increased, and the possibility of data that can ultimately be written to the chain being tampered with can be reduced.
[0056] In a preferred embodiment of the present invention, the governance contract user selects a data source, and the data source that can be put on the chain is determined according to the selection result, including:
[0057] The governance contract is set to have multiple users;
[0058] Each governance contract user selects a data source;
[0059] The data source that is selected the most is determined as the data source that can be uploaded to the chain.
[0060] As an embodiment, for example, each governance contract user can vote among multiple data sources, and the data source with the highest number of votes is the data source jointly selected and determined by the governance contract users, which is the data source that can be put on the chain.
[0061] By adopting the above method, multiple governance contract users jointly select and determine the data source that can be put on the chain, so as to avoid the situation where the data source that can be put on the chain is easily tampered with by only one governance contract user. In addition, the data source that can be put on the chain can be jointly selected and determined by multiple governance contract users, which can improve the quality of the on-chain data while ensuring the fairness and impartiality of the data source selection.
[0062] In a preferred embodiment of the present invention, a selection cycle may be set, and each governance contract user selects a data source within the selection cycle. The selection is stopped at the end of the selection cycle, and the most selected data source is statistically obtained.
[0063] By setting a selection cycle and allowing each governance contract user to select the data source within the selection cycle, it can not only reflect the binding force of the governance contract, but also ensure that each governance contract user has sufficient time to select the data source and fully exercise its governance power.
[0064] The value of the selection cycle can be set according to specific application requirements. For example, for some relatively simple applications, the off-chain data required is relatively simple, fewer factors need to be examined, or it is relatively common data. The governance contract user does not need to spend a lot of time to select, and the data source selection can be completed within a few hours. In this case, the selection cycle can be set to a few hours. At the end of the selection cycle, the selection of data sources by each governance contract user stops, and then the number of times each data source is selected is counted.
[0065] In a preferred embodiment of the present invention, the off-chain node collects data according to the information of the on-chain data source, including:
[0066] The off-chain node reads the information of the on-chain data source broadcasted by the on-chain module;
[0067] The off-chain node collects data from the on-chain data source.
[0068] After the on-chain module determines the data source that can be uploaded to the chain, it broadcasts its information. The off-chain nodes can read the on-chain data at regular intervals to obtain the information of the on-chain data source broadcast by the on-chain module.
[0069] After the off-chain node reads the information of the on-chain data source, it can connect to the corresponding data source and collect the corresponding data from it.
[0070] Among them, the off-chain nodes can collect data from the data source using common methods in the field, which will not be repeated here.
[0071] After the off-chain node collects the required data, it verifies it. If the verification is successful, it requests that the data be written to the chain.
[0072] In one embodiment of the present invention, the on-chain module verifies the data and writes it to the chain after successful verification, including:
[0073] The governance contract user verifies the data and signs after successful verification;
[0074] The successfully verified data and the signature of the governance contract user are written into the storage contract.
[0075] As an example, in order to ensure the immutability of the data written on the chain, the off-chain node can perform a hash operation on the collected data to obtain a hash value, and send the hash value and the data to the chain at the same time. Each governance contract user on the chain performs a hash operation on the data and compares the received hash value with the hash value calculated by itself. If the two are consistent, the verification is successful and signed. If all governance contract users pass the data verification and sign, the data can be written to the chain, otherwise the data cannot be written to the chain.
[0076] For example, off-chain nodes encrypt data and send the encrypted data to the chain. Each governance contract user on the chain first decrypts the data and then verifies it, which can further ensure that the data cannot be tampered with.
[0077] Embodiment 2
[0078] like Figure 2 As shown, another aspect of the present invention also includes a functional module architecture that is completely consistent with the aforementioned method flow, that is, the embodiment of the present invention also provides an off-chain data authorization oracle update device, including:
[0079] The on-chain module 201 is used to select and broadcast a data source that can be on-chain, and is also used for the on-chain module to verify the data and write it to the chain after successful verification;
[0080] The off-chain node 202 is used to collect data and publish transactions based on the information of the on-chain data source, and request that the data be written into the on-chain module.
[0081] In the on-chain module, the selection of a data source that can be on-chain includes:
[0082] The on-chain module includes a storage contract and a governance contract. The storage contract is used to store data, and the governance contract is used to issue governance tokens to users to generate governance contract users.
[0083] The storage contract publishes multiple data sources;
[0084] The governance contract user selects a data source and determines the data source that can be put on the chain based on the selection result.
[0085] Furthermore, the governance contract user selects a data source, and the data sources that can be put on the chain are determined based on the selection results, including:
[0086] The governance contract is set to have multiple users;
[0087] Each governance contract user selects a data source;
[0088] The data source that is selected the most is determined as the data source that can be uploaded to the chain.
[0089] Furthermore, a selection cycle is set, and each governance contract user selects a data source within the selection cycle. The selection is stopped at the end of the selection cycle, and the most selected data source is statistically obtained.
[0090] Furthermore, the selection period is set according to the application.
[0091] The data collected by the off-chain node according to the information of the on-chain data source includes:
[0092] The off-chain node reads the information of the on-chain data source broadcasted by the on-chain module;
[0093] The off-chain node collects data from the on-chain data source.
[0094] Furthermore, the on-chain module verifies the data and writes it to the chain after successful verification, including:
[0095] The governance contract user verifies the data and signs after successful verification;
[0096] The successfully verified data and the signature of the governance contract user are written into the storage contract.
[0097] The device can be implemented through the method for updating the off-chain data authorization oracle provided in the above-mentioned embodiment 1. The specific implementation method can be found in the description in embodiment 1 and will not be repeated here.
[0098] The present invention also provides a memory storing a plurality of instructions, wherein the instructions are used to implement the method described in the first embodiment.
[0099] The present invention also provides an electronic device, comprising a processor and a memory connected to the processor, wherein the memory stores a plurality of instructions, and the instructions can be loaded and executed by the processor so that the processor can execute the method described in the first embodiment.
[0100] Although preferred embodiments of the present invention have been described, additional changes and modifications may be made to these embodiments by those skilled in the art once the basic inventive concepts are known. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention. Obviously, those skilled in the art may make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A method for updating an off-chain data authorization oracle, characterized in that: include: The on-chain module selects and broadcasts data sources that can be uploaded to the chain; The off-chain node collects data and publishes transactions based on the information of the on-chain data source, requesting that the data be written into the on-chain module; The on-chain module verifies the data and writes it to the chain after successful verification; The on-chain module selects a data source that can be put on the chain, including: the on-chain module includes a storage contract and a governance contract, the storage contract is used to store data, and the governance contract is used to issue governance tokens to users to generate governance contract users; the storage contract publishes multiple data sources; the governance contract user selects a data source, and determines the data source that can be put on the chain according to the selection result; The governance contract user selects a data source, and the data source that can be put on the chain is determined according to the selection result, including: the governance contract user is set to multiple; each governance contract user selects a data source; the data source that is selected the most is determined as the data source that can be put on the chain; Set a selection cycle, and each governance contract user selects a data source within the selection cycle. The selection stops at the end of the selection cycle, and the most selected data sources are counted; The selection period is set according to the application; The off-chain node collecting data according to the information of the on-chain data source includes: the off-chain node reading the information of the on-chain data source broadcasted by the on-chain module; the off-chain node collecting data from the on-chain data source; The on-chain module verifies the data and writes it to the chain after successful verification, including: the governance contract user verifies the data and signs it after successful verification; and writes the successfully verified data and the signature of the governance contract user into the storage contract.
2. A device for updating an off-chain data authorization oracle, characterized in that: include: The on-chain module is used to select and broadcast data sources that can be uploaded to the chain, and is also used for the on-chain module to verify the data and write it to the chain after successful verification; The off-chain node is used to collect data and issue transactions based on the information of the on-chain data source, and request to write the data into the on-chain module; The on-chain module selects a data source that can be put on the chain, including: the on-chain module includes a storage contract and a governance contract, the storage contract is used to store data, and the governance contract is used to issue governance tokens to users to generate governance contract users; the storage contract publishes multiple data sources; the governance contract user selects a data source, and determines the data source that can be put on the chain according to the selection result; The governance contract user selects a data source, and the data source that can be put on the chain is determined according to the selection result, including: the governance contract user is set to multiple; each governance contract user selects a data source; the data source that is selected the most is determined as the data source that can be put on the chain; Set a selection cycle, and each governance contract user selects a data source within the selection cycle. The selection stops at the end of the selection cycle, and the most selected data sources are counted; The selection period is set according to the application.
3. A memory, characterized in that: A plurality of instructions are stored, and the instructions are used to implement the method according to claim 1.
4. An electronic device, characterized in that: The method comprises a processor and a memory connected to the processor, wherein the memory stores a plurality of instructions, and the instructions can be loaded and executed by the processor, so that the processor can execute the method according to claim 1.
Citation Information
Patent Citations
Implementation method and device for blockchain smart contract
CN108694669A
Block chain-based time service oracle machine implementation method
CN110633286A
Data processing method and device based on block chain, terminal and medium
CN110930254A
Data processing method based on intelligent contract, related nodes and storage medium
CN110992020A
Cross-chain exchange method and system based on credible oracle machine and medium
CN111145023A
