Data processing method, related nodes and storage medium based on smart contract

By using oracles to obtain external data regularly and verify it in a smart contract, the problem that smart contracts cannot directly obtain external data is solved, and the interaction between smart contracts and real-world data is realized, and system overhead is reduced.

CN110992020BActive Publication Date: 2025-04-18TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN201911134378.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-19
Publication Date
2025-04-18
Estimated Expiration
2039-11-19

AI Technical Summary

Technical Problem

Smart contracts cannot directly obtain external data from the real world, resulting in insufficient security and large system overhead.

Method used

By sending data access instructions to the oracle regularly, obtaining external impact data, and verifying it on the blockchain node, the smart contract completes the target transaction event.

Benefits of technology

It realizes the interaction between smart contracts and real-world data, reduces system overhead, and improves the security of data interaction.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110992020B_ABST
    Figure CN110992020B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a data processing method based on smart contracts, related nodes and storage media, wherein the method includes: the blockchain node sends a data access instruction to the oracle; the blockchain node receives the external impact data returned by the oracle in response to the data access instruction, and the external impact data is data used to affect the target transaction event transaction; the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data. By implementing the present invention, when the blockchain node has a data access demand during the execution of the smart contract, the external impact data can be safely obtained, the data interaction between the smart contract and the real world is realized, and the system overhead is reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a data processing method based on smart contracts, related nodes and storage media. Background Art

[0002] Smart contracts are computer protocols designed to disseminate, verify or execute contracts in an information-based manner. They are essentially a computer-executed program. The contract trigger conditions, execution matters and other detailed contract contents are stored in the blockchain network in the form of code. When the trigger conditions are met, the transaction can be accurately and automatically executed without the involvement of a third party. This ensures that the execution of smart contracts is fair, just and reliable.

[0003] However, smart contracts still have many flaws, such as the inability to obtain external data from the real world. Currently, obtaining external data from the blockchain is done directly using applications outside the blockchain or through customized smart contracts, which has problems such as insufficient security and high system overhead. Summary of the invention

[0004] The embodiment of the present invention discloses a data processing method based on smart contracts, related nodes and storage media. By sending data access instructions to an oracle at regular intervals, external influence data can be safely obtained, data interaction between smart contracts and the real world can be achieved, and system overhead can be reduced.

[0005] In a first aspect, an embodiment of the present invention provides a data processing method based on a smart contract, which is applied to a blockchain node deployed with a smart contract, the method comprising: the blockchain node sends a data access instruction to a oracle, the data access instruction carries an access address of a data source device, and is used to indicate obtaining external influence data from the access address of the data source device, and the access address of the data source device is deployed in the smart contract of the blockchain node; the blockchain node receives the external influence data returned by the oracle in response to the data access instruction, and the external influence data is data used to influence the transaction of a target transaction event; the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event based on the external influence data.

[0006] In one implementation, the blockchain node sends a data access instruction to the oracle, including: the blockchain node sends a data access instruction to the oracle at a regular interval through the target function in the smart contract to call the oracle to obtain external impact data.

[0007] In one implementation, a blockchain node receives signature data returned by an oracle in response to a data access instruction, and the signature data is used to verify external influence data. The blockchain node triggers a smart contract to complete the transaction processing indicated by a target transaction event based on the external influence data, including: after the blockchain node successfully verifies the signature data, the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event based on the external influence data.

[0008] In one implementation, the target transaction event is a tax invoicing event, and the external influencing data includes the target user's to-be-invoiced data. The blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event based on the external influencing data, including: when the invoicing quantity corresponding to the target user's to-be-invoiced data is greater than or equal to a first threshold, triggering the smart contract to execute the tax invoicing event and issuing a tax invoice for the target user.

[0009] In one implementation, the target transaction event is a financial lending event, and the external impact data includes the asset data of the borrower. The blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event based on the external impact data, including: when the value of the borrower's assets indicated by the borrower's asset data is greater than or equal to the value of the loan amount, the smart contract is triggered to execute the financial lending event to complete the loan to the borrower.

[0010] In one implementation, the target transaction event is a copyright purchase event, and the external influencing data includes the qualification review data of the copyright purchaser. The blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event based on the external influencing data, including: when the qualification review data of the copyright purchaser indicates that the copyright purchaser is qualified to purchase, the smart contract is triggered to execute the copyright purchase event and complete the authorization to the copyright purchaser.

[0011] In the second aspect, an embodiment of the present invention provides a data processing method based on a smart contract, which is applied to an oracle. The method includes: the oracle receives a data access instruction sent by a blockchain node, and the data access instruction carries an access address of a data source device, which is used to instruct to obtain external influence data from the access address of the data source device, and the access address of the data source device is deployed in the smart contract of the blockchain node; the oracle responds to the data access instruction, obtains the external influence data, and returns the external influence data to the blockchain node, and the external influence data is data used to influence the target transaction event transaction.

[0012] In one implementation, the oracle responds to the data access instruction, obtains external data, and returns the external impact data to the blockchain node, including: the oracle responds to the data access instruction, obtains external data from the access address of the data source device, and the external data includes external impact data and signature data; the oracle verifies the external impact data using the signature data; after the verification is successful, the oracle returns the external impact data to the blockchain node.

[0013] In a third aspect, the present invention provides a blockchain node, which includes a functional device, such as a module or a unit, for executing the method described in the first aspect or any possible implementation of the first aspect.

[0014] In a fourth aspect, the present invention provides an oracle comprising a functional device, such as a module or a unit, for executing the method described in the second aspect or any possible implementation of the second aspect.

[0015] In a fifth aspect, an embodiment of the present invention provides a blockchain node, which includes a memory, a processor, an input device, and an output device. The memory stores a set of program codes, and the processor calls the program code stored in the memory to execute the method described in the first aspect or any possible implementation of the first aspect.

[0016] In the sixth aspect, an embodiment of the present invention provides an oracle, which includes a memory, a processor, an input device, and an output device. The memory stores a set of program codes, and the processor calls the program code stored in the memory to execute the method described in the second aspect or any possible implementation of the second aspect.

[0017] In the seventh aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and executing the method described in the first aspect or any possible implementation of the first aspect.

[0018] In an eighth aspect, an embodiment of the present invention provides a computer-readable storage medium, wherein the computer storage medium stores one or more instructions, and the one or more instructions are suitable for being loaded by a processor and executing the method described in the second aspect or any possible implementation of the second aspect.

[0019] In the embodiment of the present invention, the blockchain node deployed with the smart contract sends a data access instruction to the oracle, and the data access instruction is generated when the blockchain node has a data access demand in the process of executing the smart contract; the blockchain node receives the external impact data returned by the oracle in response to the data access instruction, and the external impact data is used to affect the data of the target transaction event transaction; the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data. Therefore, when the blockchain node has a data access demand in the process of executing the smart contract, it can safely obtain the external impact data, realize the data interaction between the smart contract and the real world, and reduce the system overhead. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0021] Figure 1 This is a schematic diagram of a blockchain system framework provided by an embodiment of the present invention;

[0022] Figure 2 It is a flowchart of a data processing method based on a smart contract provided by an embodiment of the present invention;

[0023] Figure 3 This is a schematic diagram of a possible partial framework of a blockchain system provided by an embodiment of the present invention;

[0024] Figure 4 It is a scenario diagram of a data processing method based on a smart contract provided by an embodiment of the present invention;

[0025] Figure 5 It is a structural diagram of a data processing device based on a smart contract provided by an embodiment of the present invention;

[0026] Figure 6 It is a structural diagram of a data processing device based on a smart contract provided by an embodiment of the present invention;

[0027] Figure 7 It is a structural schematic diagram of a blockchain node provided by an embodiment of the present invention;

[0028] Figure 8 It is a structural diagram of a oracle provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments in the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. In addition, the following embodiments and features in the embodiments can be combined with each other without conflict.

[0030] The terms used in the present invention are only for the purpose of describing specific embodiments, rather than limiting the present invention. The singular forms "a", "said" and "the" used in the present invention and claims are also intended to include plural forms, unless the context clearly indicates other meanings. It should be understood that the term "and / or" used herein refers to any or all possible combinations of one or more associated listed items.

[0031] Smart contracts are deployed in blockchain nodes. In the process of executing smart contracts, there will be a need to access data outside the blockchain system. The oracle connected to the blockchain node is the data access node of the blockchain system. When the smart contract has a data access demand, it triggers the transaction event specified by the smart contract by accessing data outside the blockchain and feeding it back to the smart contract on the blockchain. If a smart contract on the blockchain has a data access demand, directly sending data access instructions to the oracle will generate a large number of instructions requesting the oracle to access data, increasing the operating load of the oracle, wasting computing resources, and increasing the maintenance cost of the blockchain system. Therefore, an embodiment of the present invention proposes a data processing scheme, which sends data acquisition instructions to the oracle at regular intervals to call the oracle for external data access, thereby reducing the operating load of the oracle while improving the security of data interaction.

[0032] The following is an application of the data processing method based on smart contracts in Figure 1 Taking the blockchain system shown in the figure as an example, the data processing scheme proposed in the embodiment of the present invention is described. Figure 1As shown, the blockchain system includes a blockchain node 100, a oracle 200 and at least one data source device 300. Among them, a smart contract is deployed in the blockchain node 100. When the smart contract has a data access requirement, a data access instruction will be generated. The blockchain node 100 sends the generated data access instruction to the oracle 200 at a fixed time. The oracle 200 receives and responds to the data access instruction, accesses the data source device 300 to obtain external data and returns it to the oracle 200. The oracle 200 verifies the external data, obtains external impact data after successful verification, and returns the external impact data to the blockchain node 100. The blockchain node 100 triggers the smart contract to execute the transaction according to the external impact data. Among them, the blockchain node 100 and the oracle 200 can be deployed on one or more terminal devices during actual deployment, and the terminal devices include but are not limited to mobile phones, tablet computers (table personal computers), personal digital assistants (personal digital assistants, PDAs), mobile internet devices (mobile internet devices, MIDs), wearable devices (wearable devices), vehicle-mounted devices and other devices that support and network communication.

[0033] Based on the above description, the embodiment of the present invention proposes a data processing method based on smart contracts, see Figure 2 , Figure 2 1 is a flow chart of a data processing method based on a smart contract provided by an embodiment of the present invention. The data processing method may include the following steps S201-S204:

[0034] Step S201: The blockchain node 100 sends a data access instruction to the oracle 200. The data access instruction is generated when the blockchain node 100 has a data access requirement during the execution of the smart contract. Accordingly, the oracle 200 receives the data access instruction sent by the blockchain node 100.

[0035] In the process of executing the smart contract, the blockchain node 100 generates a need to access external data in order to trigger the smart contract to complete the transaction processing, and generates a data access instruction. Then the blockchain node 100 sends the data access instruction to the oracle 200 regularly through the target function in the smart contract to call the oracle 200 to obtain external impact data. The oracle 200 receives the data access instruction sent by the blockchain node 100.

[0036] In one implementation, a target function and a timer are added to the smart contract, and the target function is used to call the oracle 200. Therefore, the timer triggers the target function according to a preset period, and calls the oracle 200 by executing the target function to obtain external impact data through data access instructions. Among them, the preset period can be customized by the R&D personnel according to the actual application situation, such as 5 minutes, 10 minutes, etc.

[0037] In practical applications, timers can also be deployed in smart contracts in the form of program code. The blockchain node 100 calls the relevant functions in the smart contract to periodically and regularly trigger the target function, and then calls the oracle 200 to obtain external impact data through data access instructions. Calling the oracle periodically through the timer can avoid a large number of requests for data access to the oracle, reduce the operating load of the oracle, and reduce system overhead.

[0038] In another implementation, when the smart contract has a need to access external data, the blockchain node 100 directly sends a data access instruction to the oracle 200, actively requesting the oracle 200 to obtain external impact data. When the oracle 200 receives the data access instruction, it responds to the data access instruction to obtain external impact data.

[0039] Optionally, there is no limit to the number of oracles 200, and a decentralized oracles network can be formed by multiple oracles 200. The oracles network can enable smart contracts to have decentralized two-way functions, which can accept external data input and send data to other systems. The oracles network can be connected to many systems such as bank payment systems, retail payment systems, event data, market data, and other blockchains. The blockchain node 100 sends a data access instruction to the oracles network, and the oracles network can select a target oracles to respond to the data access instruction to obtain external impact data according to the data access instruction. Among them, the implementation method of selecting the target oracle is not limited, for example, it can be selected by a load balancing mechanism.

[0040] Step S202: The oracle 200 responds to the data access instruction and obtains external data.

[0041] The oracle 200 responds to the data access instruction, obtains the access address of the data source device 300, and accesses the data source device 300 according to the access address to obtain external data from the data source device. The specific implementation method of obtaining external data is not limited, and two possible implementation methods are shown below.

[0042] In one implementation, the data access instruction carries an access address, which is custom configured by each smart contract's blockchain node 100. The specific implementation method for configuring the access address is not limited. For example, the developer enters the address (access address) of the relevant data source device 300 into the smart contract of the blockchain node 100 according to the specific contract content of the smart contract. Therefore, the oracle 200 obtains the access address from the data access instruction, accesses the data source device 300 according to the access address, and obtains external data from the data source device 300.

[0043] In another implementation, the oracle 200 stores the access addresses of all data source devices 300 that the blockchain system allows to access. There is no restriction on the storage method, such as marking the access address with the data type that can be accessed by the access address. When the oracle 200 receives a data access instruction sent by a smart contract, it can determine the target data source device 300 according to the type of access data in the data access instruction and find the access address. Then, the target data source device 300 is accessed according to the access address to obtain external data from the target data source device.

[0044] Optionally, the same smart contract may be executed by multiple blockchain nodes 100 in the blockchain system, see Figure 3 , Figure 3 A partial framework diagram of a possible blockchain system is shown. As shown in the figure, multiple blockchain nodes 100 executing the same smart contract send the same data access instruction to the oracle 200. After receiving the first data access instruction, the oracle 200 stores the data access instruction. If the same data access instruction is subsequently received from other blockchain nodes, the data access instruction is ignored. This can prevent the data source device 300 from repeatedly responding to data access instructions due to repeated access by the oracle 200, and also prevent the data source device from being damaged and slowing down the response speed due to repeated processing of access. After receiving the external data returned by the data source device 300 in response to the first data access instruction, the oracle 200 can store the data, and when the same data access instruction is subsequently sent by other blockchain nodes, the external data can be sent directly to other block connection points.

[0045] Step S203: The oracle 200 sends the external impact data to the blockchain node 100. Accordingly, the blockchain node 100 receives the external impact data returned by the oracle 200.

[0046] The external data includes external impact data and signature data. The oracle 200 uses the signature data to verify the external impact data in the external data. After successful verification, the external impact data is returned to the blockchain node 100. Accordingly, the blockchain node 100 receives the external impact data returned by the oracle 200. The specific implementation method for verifying the external impact data in the external data is not limited, and a possible implementation method is shown below.

[0047] The oracle 200 generates a pair of keys and makes the public key public. After the data source device 300 finds the external impact data in response to the data access instruction, it performs a hash calculation on the external impact data to obtain a first hash value, and uses the public key to asymmetrically encrypt the first hash value to obtain the signature data. Then the data source device 300 sends the signature data and the external impact data to the oracle 200. After receiving the signature data and the external impact data, the oracle 200 uses the private key to decrypt the signature data to obtain the first hash value, and performs a hash calculation on the received external impact data to obtain the second hash value. If the first hash value is consistent with the second hash value, it means that the external impact data has not been changed, and it can be determined that the received external impact data is safe. The oracle 200 can return the received external impact data to the blockchain node 100. If the first hash value is inconsistent with the second hash value, it means that the received external impact data is unreliable, ignore the external data, and re-access the data source device 300 to obtain the external data. Among them, the method of performing the hash calculation is not limited, and any function in the SHA-0, SHA-1, SHA-2, and SHA-3 series hash functions can be used.

[0048] Optionally, the external data includes external impact data and signature data, and the oracle 200 may return the external data to the blockchain node 100. Accordingly, the blockchain node 100 receives the external data returned by the oracle 200. The signature data is used to verify the external impact data in the external data. After successful verification, the external impact data is used to trigger the smart contract to complete the transaction processing indicated by the target transaction event. Among them, the specific implementation method of verifying the external impact data in the external data is not limited, and can be referred to the above description, which will not be repeated here.

[0049] Step S204: The blockchain node 100 triggers the smart contract to complete the transaction processing indicated by the target transaction event based on the external impact data.

[0050] When the external impact data meets the transaction triggering conditions, the smart contract is triggered to complete the transaction processing indicated by the target transaction event. The transaction triggering conditions are not fixed and can be set according to different application scenarios. The following shows the implementation methods of three possible application scenarios.

[0051] In one implementation, if the target transaction event is a tax invoicing event, and the external influencing data is the target user's pending invoicing data, then the transaction trigger condition is that the number of pending invoices reaches the first threshold. Among them, the first threshold is a custom configuration of the system, and its specific form of expression is not limited. It can be a specific value such as 1000 or 2000, or a specific time period such as 24 hours, 12 hours, etc. Then, when the external influencing data meets the transaction triggering condition, the smart contract is triggered to complete the transaction processing indicated by the transaction event. If the number of pending invoices corresponding to the target user's pending invoicing data reaches the first threshold, the smart contract is triggered to complete the tax invoicing indicated by the pending invoicing data.

[0052] In another implementation, if the target transaction event is a financial lending event and the external impact data is the asset data of the borrower, the transaction trigger condition is that the value of the borrower's assets is greater than or equal to the value of the loan amount. The specific form of the borrower's assets is not limited, such as real estate such as houses, or the market estimated value of the borrower's company, store, etc. When the external impact data meets the transaction trigger condition, the smart contract is triggered to complete the transaction processing indicated by the transaction event. For example, when the value of the borrower's assets indicated by the borrower's asset data is greater than or equal to the value of the loan amount, the smart contract is triggered to complete the loan to the borrower.

[0053] In another implementation, if the target transaction event is a copyright purchase event, and the external influencing data is the qualification review data of the copyright purchaser, then the transaction trigger condition is that the copyright purchaser is qualified to purchase. Among them, the evaluation form of the purchase qualification is not limited, and it can be a review of the purchase intention of the purchaser, or a review of the purchaser's historical purchase reputation. Then, when the external influencing data meets the transaction trigger condition, the smart contract is triggered to complete the transaction processing indicated by the transaction event. For example, when the qualification review data of the copyright purchaser indicates that the copyright purchaser is qualified to purchase, the smart contract is triggered to complete the authorization to the copyright purchaser.

[0054] In another implementation, if the target transaction event is a real estate trust event and the external influencing data is real estate information, the transaction trigger condition is that the real estate information meets the preset conditions. Among them, real estate information may include but is not limited to real estate value assessment, environmental report, background investigation, loan approval, etc. Then, when the external influencing data meets the transaction trigger condition, the smart contract is triggered to complete the transaction processing indicated by the transaction event. If the real estate value assessment is equal to the market average value, the loan approval is legal, etc., the smart contract is triggered to trade the property rights. Then the smart contract can also automatically pay the rent on the agreed date and automatically pay the property tax according to the real estate value and tax rate.

[0055] In the embodiment of the present invention, the blockchain node 100 deployed with the smart contract sends a data access instruction to the oracle 200, and the data access instruction is generated when the blockchain node 100 has a data access demand in the process of executing the smart contract; the blockchain node 100 receives the external impact data returned by the oracle 200 in response to the data access instruction, and the external impact data is used to affect the data of the target transaction event transaction; the blockchain node 100 triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data. Therefore, when the blockchain node 100 has a data access demand in the process of executing the smart contract, it can safely obtain the external impact data, realize the data interaction between the smart contract and the real world, and reduce the system overhead.

[0056] To help better understand the embodiment of the present invention, the following takes the target transaction event as a tax invoicing event as an example to describe the embodiment of the present invention in detail. Figure 4 , Figure 4 It is a scenario diagram of a data processing method based on a smart contract provided by an embodiment of the present invention.

[0057] For example, if the smart contract is a contract that stipulates the tax invoicing event, then in the process of executing the smart contract, it is necessary to obtain the target user's invoicing data outside the blockchain to trigger the tax invoicing event. If the smart contract is for an enterprise to issue a tax invoice, the target user is the target enterprise, so the enterprise's invoicing data (external impact data) is needed to trigger the smart contract to complete the tax invoicing, and the transaction trigger condition is set to the target enterprise's invoicing data within a 24-hour period. Specifically, the smart contract generates a data access instruction, which is used to obtain the target enterprise's invoicing data and carries the target enterprise's server address, that is, the access address of the data source device 300. Optionally, the smart contract can issue invoices for multiple companies, so the number of target enterprises is not limited, and it can be multiple, and the server addresses of multiple target enterprises can be entered in the smart contract. Further, the smart contract triggers the target function to call the oracle 200 every 24 hours through a timer, and the blockchain node 100 sends the data access instruction to the oracle 200. The oracle 200 receives and responds to the data access instruction, obtains the server address of the target enterprise, accesses the server of the target enterprise according to the server address to obtain the invoicing data of the target enterprise; at the same time, the oracle 200 generates a pair of keys (private key and public key) and sends the public key to the server of the target enterprise. The target enterprise receives the data access instruction and the public key, responds to the data access instruction to select the invoicing data from 0:00 to 24:00 on October 31, 2019, and performs a hash value calculation to obtain a first hash value, and then uses the public key to sign the first hash value to obtain signature data. The target enterprise sends external data (invoicing data and signature data) to the oracle 200, and accordingly, the oracle 200 receives the external data and verifies it. The oracle 200 decrypts the signature data with the private key to obtain the first hash value, and performs a hash operation on the invoicing data to obtain the second hash value. If the first hash value is consistent with the second hash value, the external data is verified and the invoicing data is returned to the blockchain node 100. The blockchain node 100 determines whether the invoiced data meets the transaction trigger conditions. If the invoiced data meets the 24-hour time period, the transaction trigger conditions are met, triggering the smart contract to issue tax invoices for the target enterprise's invoiced data.

[0058] Optionally, if the smart contract issues a tax invoice for an individual, the target user is an individual, so the individual's pending invoice data (external influencing data) is required to trigger the smart contract to complete the tax invoicing, and the transaction trigger condition is set to 1,000 copies of the individual's pending invoice data. The specific implementation method can refer to the implementation method taking the enterprise as an example, which will not be repeated here.

[0059] In the embodiment of the present invention, the blockchain node 100 deployed with the smart contract sends a data access instruction to the oracle 200, and the data access instruction is generated when the blockchain node 100 has a data access demand in the process of executing the smart contract; the blockchain node 100 receives the external impact data returned by the oracle 200 in response to the data access instruction, and the external impact data is used to affect the data of the target transaction event transaction; the blockchain node 100 triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data. Therefore, when the blockchain node 100 has a data access demand in the process of executing the smart contract, it can safely obtain the external impact data, realize the data interaction between the smart contract and the real world, and reduce the system overhead.

[0060] See also Figure 5 , Figure 5 is a schematic diagram of a data processing device provided by an embodiment of the present invention, wherein the data processing device may be a blockchain node for executing Figure 2 In any of the method embodiments shown, the method steps described with the blockchain node as the execution subject, the node device 50 may include a sending unit 501, a receiving unit 502 and a processing unit 503. Among them:

[0061] Sending unit 501: used to send a data access instruction to the oracle, where the data access instruction carries the access address of the data source device, and is used to instruct to obtain external impact data from the access address of the data source device, where the access address of the data source device is deployed in the smart contract of the blockchain node;

[0062] Receiving unit 502: used to receive external impact data returned by the oracle in response to the data access instruction, where the external impact data is data used to affect the target transaction event transaction;

[0063] Processing unit 503: used to trigger the smart contract to complete the transaction processing indicated by the target transaction event according to the external influencing data.

[0064] In one implementation, when the sending unit 501 is used to send a data access instruction to the oracle, it is specifically used to:

[0065] Data access instructions are sent to the oracle at regular intervals through the target function in the smart contract to call the oracle to obtain external impact data.

[0066] In one implementation, the processing unit 503 is used to receive the signature data returned by the oracle in response to the data access instruction, and the signature data is used to verify the external impact data. When the processing unit 503 triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, it is specifically used to:

[0067] After the signature data is successfully verified, the smart contract is triggered to complete the transaction processing indicated by the target transaction event based on the external impact data.

[0068] In one implementation, the target transaction event is a tax invoicing event, and the external impact data includes the target user's to-be-invoiced data. When the processing unit 503 is used to trigger the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, it is specifically used to:

[0069] When the invoicing quantity corresponding to the target user's to-be-invoiced data is greater than or equal to the first threshold, the smart contract is triggered to execute the tax invoicing event and issue a tax invoice for the target user.

[0070] In one implementation, the target transaction event is a financial lending event, and the external impact data includes the asset data of the borrower. When the processing unit 503 is used to trigger the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, it is specifically used to:

[0071] When the value of the borrower's assets indicated by the borrower's asset data is greater than or equal to the value of the loan amount, the smart contract is triggered to execute the financial lending event and complete the loan to the borrower.

[0072] In one implementation, the target transaction event is a copyright purchase event, and the external influencing data includes qualification review data of the copyright purchaser. When the processing unit 503 is used to trigger the smart contract to complete the transaction processing indicated by the target transaction event according to the external influencing data, it is specifically used to:

[0073] When the qualification review data of the copyright buyer indicates that the copyright buyer is qualified to purchase, the smart contract is triggered to execute the copyright purchase event and complete the authorization to the copyright buyer.

[0074] See also Figure 6 , Figure 6 is a schematic diagram of a data processing device based on a smart contract provided by an embodiment of the present invention. The data processing device may be a oracle for executing Figure 2 In any of the method embodiments shown, the method steps described with the oracle as the execution subject, the oracle device 60 may include a receiving unit 601, an acquiring unit 602, and a sending unit 603. Among them:

[0075] Receiving unit 601: used to receive a data access instruction sent by a blockchain node, the data access instruction carries an access address of a data source device, and is used to instruct to obtain external impact data from the access address of the data source device, where the access address of the data source device is deployed in the smart contract of the blockchain node;

[0076] Responding unit 602: used to respond to data access instructions, obtain external impact data, and return the external impact data to the blockchain node, where the external impact data is data used to affect the target transaction event transaction.

[0077] In one implementation, the response unit 602 is used to respond to the data access instruction, obtain external data, and return the external impact data to the blockchain node, specifically to:

[0078] In response to the data access instruction, external data is obtained from the access address of the data source device, where the external data includes external impact data and signature data;

[0079] Use signature data to verify external impact data;

[0080] After successful verification, the external impact data is returned to the blockchain node.

[0081] According to another embodiment of the present invention, Figures 5 and 6 The various units in the data processing device shown can be separately or completely combined into one or several other units to constitute, or one (some) of the units can be further divided into multiple functionally smaller units to constitute, which can achieve the same operation without affecting the realization of the technical effects of the embodiments of the present invention. The above-mentioned units are divided based on logical functions. In practical applications, the functions of one unit can also be implemented by multiple units, or the functions of multiple units can be implemented by one unit. In other embodiments of the present invention, the device based on data processing based on smart contracts can also include other units. In practical applications, these functions can also be implemented with the assistance of other units, and can be implemented by the collaboration of multiple units.

[0082] In the embodiment of the present invention, the blockchain node deployed with the smart contract sends a data access instruction to the oracle, and the data access instruction is generated when the blockchain node has a data access demand in the process of executing the smart contract; the blockchain node receives the external impact data returned by the oracle in response to the data access instruction, and the external impact data is used to affect the data of the target transaction event transaction; the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data. Therefore, when the blockchain node has a data access demand in the process of executing the smart contract, it can safely obtain the external impact data, realize the data interaction between the smart contract and the real world, and reduce the system overhead.

[0083] Based on the description of the above method embodiment and device embodiment, the embodiment of the present invention also provides a schematic diagram of the structure of a blockchain node. Figure 7The blockchain node 70 (specifically, a terminal device 70) includes at least a processor 701, an input device 702, an output device 703, and a computer storage medium 704. The processor 701, the input device 702, the output device 703, and the computer storage medium 704 in the blockchain node may be connected via a bus or other means.

[0084] The computer storage medium 704 can be stored in the memory of the blockchain node, and the computer storage medium 704 is used to store a computer program, and the computer program includes program instructions, and the processor 701 is used to execute the program instructions stored in the computer storage medium 704. The processor 701 (or CPU (Central Processing Unit)) is the computing core and control core of the blockchain node, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function; in one embodiment, the processor 701 described in the embodiment of the present invention can be used to perform a series of data processing on the change data, including: sending a data access instruction to the oracle, the data access instruction carries the access address of the data source device, and is used to indicate that the external impact data is obtained from the access address of the data source device, and the access address of the data source device is deployed in the smart contract of the blockchain node; receiving the external impact data returned by the oracle in response to the data access instruction, and the external impact data is the data used to affect the target transaction event transaction; the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, and so on.

[0085] The embodiment of the present invention also provides a computer storage medium (Memory), which is a memory terminal device in a blockchain node for storing programs and data. It is understandable that the computer storage medium here can include both the built-in storage medium in the blockchain node and the extended storage medium supported by the blockchain node. The computer storage medium provides a storage space, which stores the operating system of the blockchain node. In addition, one or more instructions suitable for being loaded and executed by the processor 701 are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory, such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.

[0086] In one embodiment, the processor 701 may load and execute one or more instructions stored in a computer storage medium to implement the corresponding steps of the method in the above-mentioned embodiment of the data processing method based on the smart contract; in a specific implementation, one or more instructions in the computer storage medium are loaded by the processor 701 and the following steps are executed:

[0087] Send a data access instruction to the oracle. The data access instruction carries the access address of the data source device and is used to instruct the external impact data to be obtained from the access address of the data source device. The access address of the data source device is deployed in the smart contract of the blockchain node.

[0088] Receive external impact data returned by the oracle in response to the data access instruction, where the external impact data is data used to affect the target transaction event transaction;

[0089] According to external impact data, trigger the smart contract to complete the transaction processing indicated by the target transaction event

[0090] In one implementation, when sending a data access instruction to the oracle, the one or more instructions are loaded and specifically executed by the processor 701:

[0091] Data access instructions are sent to the oracle at regular intervals through the target function in the smart contract to call the oracle to obtain external impact data.

[0092] In one implementation, when receiving the signature data returned by the oracle in response to the data access instruction, the signature data is used to verify the external impact data, and when triggering the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, the one or more instructions are loaded and specifically executed by the processor 701:

[0093] After the signature data is successfully verified, the smart contract is triggered to complete the transaction processing indicated by the target transaction event based on the external impact data.

[0094] In one implementation, the target transaction event is a tax invoicing event, and the external impact data includes the target user's to-be-invoiced data. The blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, and the one or more instructions are loaded and specifically executed by the processor 701:

[0095] When the invoicing quantity corresponding to the target user's to-be-invoiced data is greater than or equal to the first threshold, the smart contract is triggered to execute the tax invoicing event and issue a tax invoice for the target user.

[0096] In one implementation, the target transaction event is a financial lending event, and the external impact data includes the asset data of the borrower. When the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, the one or more instructions are loaded and specifically executed by the processor 701:

[0097] When the value of the borrower's assets indicated by the borrower's asset data is greater than or equal to the value of the loan amount, the smart contract is triggered to execute the financial lending event and complete the loan to the borrower.

[0098] In one implementation, the target transaction event is a copyright purchase event, and the external impact data includes the qualification review data of the copyright purchaser. When the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, the one or more instructions are loaded and specifically executed by the processor 701:

[0099] When the qualification review data of the copyright buyer indicates that the copyright buyer is qualified to purchase, the smart contract is triggered to execute the copyright purchase event and complete the authorization to the copyright buyer.

[0100] Based on the description of the above method embodiment and device embodiment, the present invention also provides a schematic diagram of the structure of a oracle. Figure 8 , the oracle 80 (specifically, the terminal device 80) includes at least a processor 801, an input device 802, an output device 803, and a computer storage medium 804. The processor 801, the input device 802, the output device 803, and the computer storage medium 804 in the oracle can be connected via a bus or other means.

[0101] The computer storage medium 804 can be stored in the memory of the oracle, and the computer storage medium 804 is used to store a computer program, and the computer program includes program instructions, and the processor 801 is used to execute the program instructions stored in the computer storage medium 804. The processor 801 (or CPU (Central Processing Unit)) is the computing core and control core of the oracle, which is suitable for implementing one or more instructions, and is specifically suitable for loading and executing one or more instructions to implement the corresponding method flow or corresponding function; in one embodiment, the processor 801 described in the embodiment of the present invention can be used to perform a series of data processing on the change data, including: receiving a data access instruction sent by a blockchain node, the data access instruction carries the access address of the data source device, and is used to indicate that external impact data is obtained from the access address of the data source device, and the access address of the data source device is deployed in the smart contract of the blockchain node; responding to the data access instruction, obtaining external impact data, and returning the external impact data to the blockchain node, and the external impact data is data used to affect the target transaction event transaction. , and so on.

[0102] The embodiment of the present invention also provides a computer storage medium (Memory), which is a memory terminal device in the oracle, used to store programs and data. It can be understood that the computer storage medium here can include both the built-in storage medium in the oracle and the extended storage medium supported by the oracle. The computer storage medium provides a storage space, which stores the operating system of the oracle. In addition, one or more instructions suitable for being loaded and executed by the processor 801 are also stored in the storage space, and these instructions can be one or more computer programs (including program codes). It should be noted that the computer storage medium here can be a high-speed RAM memory, or a non-volatile memory (non-volatile memory), such as at least one disk storage; optionally, it can also be at least one computer storage medium located away from the aforementioned processor.

[0103] In one embodiment, the processor 801 may load and execute one or more instructions stored in a computer storage medium to implement the corresponding steps of the method in the above-mentioned embodiment of the data processing method based on the smart contract; in a specific implementation, one or more instructions in the computer storage medium are loaded by the processor 801 and the following steps are executed:

[0104] Receive a data access instruction sent by a blockchain node, the data access instruction carries an access address of a data source device, and is used to instruct to obtain external impact data from the access address of the data source device, where the access address of the data source device is deployed in a smart contract of the blockchain node;

[0105] In response to the data access instruction, external influence data is obtained and returned to the blockchain node, where the external influence data is data used to influence the target transaction event transaction.

[0106] In one implementation, when the oracle responds to the data access instruction, obtains external data, and returns the external impact data to the blockchain node, the one or more instructions are loaded and specifically executed by the processor 701:

[0107] In response to the data access instruction, external data is obtained from the access address of the data source device, where the external data includes external impact data and signature data;

[0108] Use signature data to verify external impact data;

[0109] After successful verification, the external impact data is returned to the blockchain node.

[0110] In the embodiment of the present invention, the blockchain node deployed with the smart contract sends a data access instruction to the oracle, and the data access instruction is generated when the blockchain node has a data access demand in the process of executing the smart contract; the blockchain node receives the external impact data returned by the oracle in response to the data access instruction, and the external impact data is used to affect the data of the target transaction event transaction; the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data. Therefore, when the blockchain node has a data access demand in the process of executing the smart contract, it can safely obtain the external impact data, realize the data interaction between the smart contract and the real world, and reduce the system overhead.

[0111] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A data processing method based on smart contracts, characterized in that: Applied to a blockchain node where a smart contract is deployed, the method includes: The blockchain node periodically sends data access instructions to a decentralized oracle network composed of multiple oracles through the target function in the smart contract, so that the oracle network selects a target oracle for processing the data access instructions through a load balancing mechanism; the data access instruction is generated when the blockchain node has a data access demand during the execution of the smart contract, and the data access instruction carries the access address of the data source device, which is used to instruct the target oracle to obtain external impact data from the access address of the data source device, and the access address of the data source device is deployed in the smart contract of the blockchain node; The blockchain node receives the external impact data returned by the target oracle in response to the data access instruction, where the external impact data is data used to affect the target transaction event transaction; The blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event based on the external impact data.

2. The method according to claim 1, characterized in that The method further comprises: The blockchain node receives the signature data returned by the target oracle in response to the data access instruction, where the signature data is used to verify the external impact data; The blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, including: After successfully verifying the signature data, the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event based on the external impact data.

3. The method according to claim 1, characterized in that The target transaction event is a tax invoicing event, the external impact data includes the target user's to-be-invoiced data, and the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, including: When the invoicing quantity corresponding to the to-be-invoiced data of the target user is greater than or equal to a first threshold, the smart contract is triggered to execute the tax invoicing event to issue a tax invoice for the target user.

4. The method according to claim 1, characterized in that The target transaction event is a financial lending event, the external impact data includes asset data of the borrower, and the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, including: When the value of the borrower's assets indicated by the borrower's asset data is greater than or equal to the value of the loan amount, the smart contract is triggered to execute the financial lending event to complete the loan to the borrower.

5. The method according to claim 1, characterized in that The target transaction event is a copyright purchase event, the external impact data includes qualification review data of the copyright purchaser, and the blockchain node triggers the smart contract to complete the transaction processing indicated by the target transaction event according to the external impact data, including: When the qualification review data of the copyright purchaser indicates that the copyright purchaser is qualified to purchase, the smart contract is triggered to execute the copyright purchase event and complete the authorization to the copyright purchaser.

6. A data processing method based on smart contracts, characterized in that: Applied to a decentralized oracle network composed of multiple oracles, the method includes: The target oracle in the oracle network receives the data access instruction sent periodically by the blockchain node through the target function in the deployed smart contract. The target oracle is any oracle selected by the oracle network through the load balancing mechanism to process the data access instruction. The data access instruction is generated when the blockchain node has a data access demand during the execution of the smart contract. The data access instruction carries the access address of the data source device, which is used to instruct the target oracle to obtain external impact data from the access address of the data source device. The access address of the data source device is deployed in the smart contract of the blockchain node. The target oracle responds to the data access instruction, obtains the external influence data, and returns the external influence data to the blockchain node, where the external influence data is data used to influence the target transaction event transaction.

7. The method according to claim 6, characterized in that The target oracle responds to the data access instruction, obtains the external impact data, and returns the external impact data to the blockchain node, including: The target oracle responds to the data access instruction and obtains external data from the access address of the data source device, wherein the external data includes the external impact data and signature data; The target oracle verifies the external influence data using the signature data; After successful verification, the target oracle returns the external impact data to the blockchain node.

8. A blockchain node, characterized in that: The blockchain node includes: a memory including computer-readable instructions; A processor connected to the memory, the processor being used to execute the computer-readable instructions, so that the device executes the data processing method based on the smart contract as described in any one of claims 1 to 5.

9. A oracle, characterized in that: The oracle includes: a memory including computer-readable instructions; A processor connected to the memory, the processor being used to execute the computer-readable instructions, so that the device executes the smart contract-based data processing method described in claim 6 or 7.

Citation Information

Patent Citations

  • Alliance-chain-based out-of-chain data access method and system

    CN107507005A

  • A method and device for interacting between a block chain and the out-of-chain data

    CN109670335A

  • Method and device for executing an intelligent contract in a block chain

    CN109872157A