CN110928880B - Data processing method, device, terminal and medium based on block chain - Google Patents

Data processing method, device, terminal and medium based on block chain Download PDF

Info

Publication number
CN110928880B
CN110928880B CN201911139153.3A CN201911139153A CN110928880B CN 110928880 B CN110928880 B CN 110928880B CN 201911139153 A CN201911139153 A CN 201911139153A CN 110928880 B CN110928880 B CN 110928880B
Authority
CN
China
Prior art keywords
data
reference data
node
target
acquisition request
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201911139153.3A
Other languages
Chinese (zh)
Other versions
CN110928880A (en
Inventor
周开班
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201911139153.3A priority Critical patent/CN110928880B/en
Publication of CN110928880A publication Critical patent/CN110928880A/en
Application granted granted Critical
Publication of CN110928880B publication Critical patent/CN110928880B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The embodiment of the invention discloses a data processing method, a device, a terminal and a medium based on a block chain, wherein the method comprises the following steps: acquiring a data acquisition request generated based on an intelligent contract, and acquiring reference data from each data source object according to the data acquisition request to obtain a reference data set; if the similarity between the reference data in the reference data set is greater than the preset similarity, selecting one reference data from the reference data as the target data; target data is applied in the smart contract. By implementing the method, the intelligent contract can directly acquire the data from the node, so that the consensus checking process is simplified, and the data acquisition efficiency of the intelligent contract is improved.

Description

Data processing method, device, terminal and medium based on block chain
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a data processing method, apparatus, terminal, and medium based on a blockchain.
Background
The new application of the blockchain is that of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like is essentially a decentralised database, namely a series of data blocks which are generated by correlation using a cryptography method, and each data block contains a batch of transaction information and is used for verifying the validity of the transaction information and generating the next block. However, the blockchain is a closed environment, and the blockchain cannot actively acquire real world data outside the chain. Mainly because blockchains cannot actively initiate network calls, while on-chain intelligent contracts receive data passively. Second, the smart contract is not "smart" in nature, and it only reaches a program that triggers a state if the corresponding condition is satisfied. And the intelligent contract needs to acquire external data to judge whether the corresponding condition is met currently.
When the existing intelligent contract needs to acquire data, an acquisition request needs to be sent to a foresight machine contract deployed in a blockchain network, after the foresight machine contract takes an access request sent by the intelligent contract, the foresight machine contract goes to the external network to acquire the data, and then the data is uploaded to the blockchain network, so that the intelligent contract takes the data from the blockchain, and the uplink operation can be completed only by the participation of a plurality of consensus nodes, so that the efficiency of acquiring the data by the intelligent contract is lower.
Disclosure of Invention
The embodiment of the invention provides a data processing method, a device, a terminal and a medium based on a block chain, which can enable an intelligent contract to directly acquire data from nodes, thereby simplifying a consensus checking process and improving the efficiency of acquiring the data by the intelligent contract.
In a first aspect, an embodiment of the present invention provides a data processing method based on a blockchain, where the method is performed by any one first node in the blockchain network, and an intelligent contract is deployed in the blockchain network, and the method includes:
acquiring a data acquisition request generated based on the intelligent contract, wherein the data acquisition request is used for acquiring target data meeting preset requirements, the data acquisition request comprises data source objects, and each data source object is used for providing reference data;
Acquiring reference data from each data source object according to the data acquisition request to obtain a reference data set;
if the similarity between the reference data in the reference data set is greater than the preset similarity, selecting one reference data from the reference data as the target data;
the target data is applied to the smart contract.
In a second aspect, an embodiment of the present invention provides a blockchain-based data processing apparatus, the apparatus including:
the intelligent contract generation module is used for generating an intelligent contract according to the target data, wherein the intelligent contract is used for generating a data acquisition request which is used for acquiring target data meeting preset requirements, the data acquisition request comprises data source objects, and each data source object is used for providing reference data;
the acquisition module is further used for acquiring reference data from the data source objects according to the data acquisition request to obtain a reference data set;
the selecting module is used for selecting one piece of reference data from the reference data as the target data if the similarity between the reference data in the reference data set is greater than the preset similarity;
And the application module is used for applying the target data to the intelligent contract.
In a third aspect, an embodiment of the present invention provides a terminal, including a processor, an input interface, an output interface, and a memory, where the processor, the input interface, the output interface, and the memory are connected to each other, where the memory is configured to store a computer program, the computer program includes program instructions, and the processor is configured to invoke the program instructions to execute the method according to the first aspect.
In a fourth aspect, an embodiment of the present invention provides a computer readable storage medium, wherein the computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method according to the first aspect.
In the embodiment of the invention, a first node acquires a data acquisition request generated based on an intelligent contract, acquires reference data from each data source object according to the data acquisition request, and acquires a reference data set; if the similarity between the reference data in the reference data set is greater than the preset similarity, the first node selects one reference data from the reference data as target data, and applies the target data to the intelligent contract. By implementing the method, the nodes in the blockchain network can directly return the data required by the intelligent contract without the need of uplink the data, so that the common-knowledge checking process is simplified, and the efficiency of acquiring the data by the intelligent contract is improved.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for the description of the embodiments will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and other drawings may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a flow chart of a block chain based data processing method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another block chain based data processing method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a consensus verification process according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a blockchain network according to an embodiment of the present invention;
FIG. 5 is a block chain architecture diagram according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a block chain based data processing apparatus according to an embodiment of the present invention;
fig. 7 is a schematic structural diagram of a terminal according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention.
The new application of the blockchain is that of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, encryption algorithm and the like is essentially a decentralised database, namely a series of data blocks which are generated by correlation using a cryptography method, and each data block contains a batch of transaction information and is used for verifying the validity of the transaction information and generating the next block. However, the blockchain is a closed environment, and the blockchain cannot actively acquire real world data outside the chain. Mainly because blockchains cannot actively initiate network calls, while on-chain intelligent contracts receive data passively. Second, the smart contract is not "smart" in nature, and it only reaches a program that triggers a state if the corresponding condition is satisfied. And the intelligent contract needs to acquire external data to judge whether the corresponding condition is met currently.
When the existing intelligent contract needs to acquire data, an acquisition request needs to be sent to a foresight machine contract deployed in a blockchain network, after the foresight machine contract takes an access request sent by the intelligent contract, the foresight machine contract goes to the external network to acquire the data, and then the data is uploaded to the blockchain network, so that the intelligent contract takes the data from the blockchain, and the uplink operation can be completed only by the participation of a plurality of consensus nodes, so that the efficiency of acquiring the data by the intelligent contract is lower. For example, when the temperature is 20 degrees, the a transfers 100 elements to the B, and the intelligent contract only executes the contract when the temperature is 20 degrees, so the intelligent contract needs to send a data acquisition request to the foresight machine contract, send the data to each node in the blockchain network for consensus verification after the foresight machine contract acquires the temperature data, and upload the temperature data to the blockchain network after the verification is passed, so that the intelligent contract acquires the temperature data. The above process needs participation of each consensus node, and intelligent saving needs data to be uplink before data can be acquired, and the data acquisition efficiency is low.
Based on the above description, the embodiment of the present invention provides a data processing method based on a blockchain technology, where the blockchain is a novel application of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism, an encryption algorithm, etc. essentially is a de-centralized database, that is, a string of data blocks that are generated by associating with each other using a cryptography method, and each data block includes a batch of transaction information for verifying the validity of the transaction information and generating the next block. The blockchain underlying platform may include processing modules for user management, basic services, smart contracts, operation monitoring, and the like. The user management module is responsible for identity information management of all blockchain participants, including maintenance of public and private key generation (account management), key management, maintenance of corresponding relation between the true identity of the user and the blockchain address (authority management), and the like. The specific implementation steps of the method comprise the steps that a first node acquires a data acquisition request generated based on an intelligent contract, acquires reference data from each data source object according to the data acquisition request, and acquires a reference data set; if the similarity between the reference data in the reference data set is greater than the preset similarity, the first node selects one reference data from the reference data as target data, and applies the target data to the intelligent contract. The first node can be any node in the blockchain network, and can be a terminal specifically, by implementing the method, the first node can directly return data required by the intelligent contract without the need of uplink data, so that the common-knowledge checking process is simplified, and the efficiency of acquiring the data by the intelligent contract is improved.
In summary, it is known that, by adopting the data processing method based on the blockchain, when the intelligent contract needs to acquire data, the first node directly acquires corresponding data from the outside, determines whether the acquired data is reliable data based on the similarity of the data acquired by different data sources, and directly returns the data to the intelligent contract after determining that the reliable data is acquired, so that the intelligent contract determines whether the triggering condition is met based on the received data. By implementing the method, the node can directly check the acquired data and send the data to the intelligent contract after the data passes the check, so that the process of common-knowledge check of other nodes on the data is simplified, and the efficiency of acquiring the data by the intelligent contract is improved.
Referring to fig. 1, the data processing process based on the blockchain may include the following steps S101 to S104:
s101, a first node acquires a data acquisition request generated based on an intelligent contract.
In the embodiment of the invention, the first node may be any node in a blockchain network, specifically may be a terminal, including a mobile phone, a computer, a tablet computer, etc., where the blockchain network is deployed with an intelligent contract, the data acquisition request is used to acquire target data meeting a preset requirement, where the preset requirement may be a temperature value requirement, a time node requirement for a ball game, etc., specifically may be preset by a user, the target data is data meeting the preset requirement, such as a temperature value, a time node for a ball game, etc., the data acquisition request includes data source objects, each data source object is used to provide reference data, the data source objects may be various application programs, such as a weather application program, a ball game rebroadcasting application program, and a background server of each data source object may store corresponding reference data, in particular implementation, the data source object in the data acquisition request may include multiple application programs, each data source object may each provide corresponding reference data meeting the preset requirement, the reference data meeting the preset requirement may be the same or different reference data meeting the preset requirement, and the reference data stored in different data source objects may provide a temperature value, such as the first temperature value and the second temperature value is provided for the second temperature value 20, and the temperature value is provided for the second temperature value 20.
Specifically, when the user sets the intelligent contract, the user can set a contract triggering condition in the intelligent contract, the contract triggering condition can be that the temperature is 20 degrees, the ball game goes to section 4 and the like, the intelligent contract executes a task corresponding to the intelligent contract when the intelligent contract detects that the triggering condition is met, the task can be that A transfers 100 yuan to B, and B sends goods to A and the like. However, the smart contract needs to acquire external target data (such as the current temperature or the running condition of the ball game) to determine whether the contract trigger condition is currently satisfied, and thus, a data acquisition request needs to be generated based on the smart contract and acquired by the first node in the blockchain.
In a specific implementation, each node in the blockchain network provided by the embodiment of the invention may be deployed with a prophetic contract, so that a specific manner of acquiring a data acquisition request generated based on an intelligent contract by a first node may be that the blockchain network periodically generates a data acquisition request based on the intelligent contract and sends the data acquisition request to the prophetic contract of the first node, so that the first node periodically acquires the data acquisition request generated based on the intelligent contract, or the blockchain network may also generate the data acquisition request based on the intelligent contract and send the data acquisition request to the prophetic contract of the first node when a trigger event is detected, where the trigger event may be that a transaction occurs between nodes of the blockchain network, a node in the network newly increases or exits, and the like, and specifically may be that a user sets in the intelligent contract in the blockchain network in advance. Alternatively, a plurality of data acquisition nodes for data acquisition may be set in the blockchain network in advance, the data acquisition nodes periodically acquire the data acquisition request generated based on the intelligent contract from the blockchain network, and the first node is any one of the data acquisition nodes.
S102, the first node acquires reference data from each data source object according to the data acquisition request to obtain a reference data set.
In the embodiment of the invention, after the first node acquires the data acquisition request generated based on the intelligent contract, reference data is acquired from each data source object according to the data acquisition request, and a reference data set is obtained. For example, the data acquisition request is used to acquire a current outdoor temperature value, the data source object includes a first weather application, a second weather application, and a third weather application, the first node may acquire the current outdoor temperature value as a first temperature value from the first weather application, acquire the current outdoor temperature value as a second temperature value from the second weather application, and acquire the current outdoor temperature value as a third temperature value from the third weather application, and the first node determines the first temperature value, the second temperature value, and the third temperature value as reference data, and determines the above 3 reference data as a reference data set.
In one implementation manner, a pre-disposition machine contract is arranged in the first node, the pre-disposition machine contract comprises a data acquisition code, the first node acquires reference data from each data source object according to a data acquisition request, and the specific manner of acquiring the reference data set can be that the first node adds information of each data source object into the data acquisition code in a parameter form to acquire a target data acquisition code; the first node executes target data acquisition codes in the foresight machine contract to send data acquisition requests to the data source objects; and receiving the reference data returned by each data source object to obtain a reference data set. The information of the data source object may be a name or an access address of the data source object, that is, the first node specifically obtains the corresponding reference data according to the deployed foresight contract.
S103, if the similarity between the reference data in the reference data set is greater than the preset similarity, the first node selects one reference data from the reference data as target data.
In the embodiment of the invention, the first node acquires the reference data from each data source object, and calculates the similarity between each reference data in the reference data set after the reference data set is acquired.
In a specific implementation, a specific calculation manner of the similarity between the reference data in the reference data set may be that the first node determines a first number corresponding to the same reference data in the reference data set and a second number corresponding to all the reference data in the reference data set; and determining a ratio between the first number and the second number to determine a similarity between each of the reference data in the set of reference data. It should be noted that, the same reference data may be mode data in the reference data set, that is, the reference data with the highest occurrence frequency, for example, the reference data set includes temperature values returned by 5 data source objects, including "20, 20", and it is determined that the first number corresponding to the same reference data is 5, the second number corresponding to all the reference data is 5, and the ratio between the first number and the second number is 100%. The first node determines that the similarity between the reference data in the reference data set is 100%, and for another example, the reference data set includes temperature values returned by 5 data source objects, including "20, 19, 20", and determines that the first number corresponding to the same reference data is 4, the second number corresponding to all the reference data is 5, and the ratio between the first number and the second number is 80%. The first node determines that the similarity between the individual reference data in the reference data set is 80%.
Further, if the similarity between the reference data in the reference data set is greater than the preset similarity, the first node selects one reference data from the reference data as the target data.
Specifically, the specific manner in which the first node selects one reference data from the reference data as the target data may be that the first node determines the same M reference data from the reference data set, determines any one reference data of the M reference data as the target data, where M is a positive integer, and the same M reference data may specifically be M reference data with the highest occurrence frequency. For example, the reference data set includes temperature values returned by 5 data source objects, including "20, 19, 20, and 20", where the first node determines that the similarity between the respective reference data in the reference data set is 80% and the preset similarity is 70%, where the first node determines that the similarity between the respective reference data is greater than the preset similarity, and where the same reference data is "20", and where the first node may determine "20" as the target data.
In one implementation manner, the steps may be specifically performed by a foresight machine contract deployed in the first node, for example, a similarity judgment condition is preset in the foresight machine contract, and the target data selecting manner is set, so that the foresight machine contract selects one reference data from the reference data as the target data.
S104, the first node applies the target data to the intelligent contract.
In the embodiment of the invention, after the first node determines the target data, the target data can be directly returned to the intelligent contract, so that the intelligent contract applies the target data, namely whether the task trigger condition is met or not is judged according to the target data. Specifically, the first node may return to the smart contract by way of a foresight machine contract deployed in the first node. By the method, the node can judge the reliability of the data based on the similarity of the data acquired from different data sources, and if the similarity of the data returned by a plurality of data sources is high enough, the data can be directly applied to the intelligent contracts in the blockchain without being transmitted to other nodes for consensus verification, so that the data verification process is simplified, and the data acquisition efficiency of the intelligent contracts is improved.
In the embodiment of the invention, a first node acquires a data acquisition request generated based on an intelligent contract, acquires reference data from each data source object according to the data acquisition request, and acquires a reference data set; if the similarity between the reference data in the reference data set is greater than the preset similarity, the first node selects one reference data from the reference data as target data, and applies the target data to the intelligent contract. By implementing the method, the node can directly return the data required by the intelligent contract without the need of linking the data, thereby simplifying the consensus checking process and improving the efficiency of acquiring the data by the intelligent contract.
Referring to fig. 2, the data processing process based on the blockchain may include the following steps S201 to S208:
s201, a first node acquires a data acquisition request generated based on an intelligent contract.
In the embodiment of the invention, the first node may be any node in a blockchain network, specifically may be a terminal, including a mobile phone, a computer, a tablet computer, and the like, where the blockchain network is deployed with an intelligent contract, the data acquisition request is used to acquire target data meeting a preset requirement, the data acquisition request includes data source objects, each data source object is used to provide reference data, each data source object may specifically be each application program, specifically, the first node may acquire, from the blockchain network, a data acquisition request generated based on the intelligent contract through a foresight contract timing configured in the first node, and a user may configure an interval duration of the timing acquisition in the foresight contract in advance.
S202, the first node acquires reference data from each data source object according to the data acquisition request to obtain a reference data set.
In the embodiment of the invention, each data source object may be specifically an application program, after the first node obtains a data obtaining request generated based on an intelligent contract, it may detect whether the first node has access rights for each application program in the data obtaining request, if a target application program having no access rights exists, the first node feeds back to the blockchain network that the first node does not have rights for accessing the target application program, that is, the first node cannot obtain reference data provided by the target application program, in which case the blockchain network may automatically modify the data obtaining request generated based on the intelligent contract, that is, the target application program is removed from the data obtaining request including the data source object, and a new data obtaining request is sent to the first node again, where the new data obtaining request does not include the target application program, so that the first node obtains the reference data from each data source object according to the new data obtaining request, or the first node sends the data obtaining request to other nodes having access rights for the target application program in the blockchain network, so that the other nodes obtain the reference data from the target application program, and the first node obtains the reference data from the target application program.
If the first node has access rights to each application program in the data acquisition request, the first node acquires reference data from each application program according to the data acquisition request, and a reference data set is obtained. Specifically, the first node sends an access request to each application program and receives reference data returned by each application program. In one implementation manner, a pre-deployment machine contract is deployed in a first node, the pre-deployment machine contract comprises a data acquisition code, the first node acquires reference data from each data source object according to a data acquisition request, and the specific manner of acquiring the reference data set can be that the first node adds access addresses of each application program into the data acquisition code in a parameter form to acquire a target data acquisition code; the first node executes target data acquisition codes in the foresight machine contract to send data acquisition requests to the data source objects; and receiving the reference data returned by each data source object to obtain a reference data set.
S203, the first node checks whether signature information carried by each reference data in the reference data set exists in a preset database.
In the embodiment of the invention, each piece of reference data in the reference data set also carries signature information, the first node acquires the reference data from each data source object according to the data acquisition request, and after the reference data set is acquired, the first node detects whether the signature information carried in each piece of reference data in the reference data set exists in a preset database, wherein a legal signature information set is stored in the preset database in advance, and the legal signature information set comprises a plurality of legal signature information. That is, after the first node obtains each reference data, the validity of the source of each reference data is detected, specifically, the signature information carried in the reference data may be verified, if the signature information carried in the reference data is stored in the preset database, it is determined that the reference data has validity and may be used, and step S204 is performed, if the tag information carried in the reference data is not stored in the preset database, the first node may discard the reference data. The signature information may specifically be a digital key, a fingerprint password, or the like, and is not particularly limited. By the method, the validity of the reference data source can be detected, and information from an illegal data source object is prevented from being acquired. Specifically, the first node may perform the above steps using a foreshadowing machine contract deployed in the first node.
S204, the first node calculates the similarity between the reference data in the reference data set.
In the embodiment of the invention, after the first node determines that each acquired reference data is legal data, the similarity between each reference data in the reference data set is calculated.
In a specific implementation, a specific calculation manner of the similarity between the reference data in the reference data set may be that the first node determines a first number corresponding to the same reference data in the reference data set and a second number corresponding to all the reference data in the reference data set; and determining a ratio between the first number and the second number to determine a similarity between each of the reference data in the set of reference data. It should be noted that the same reference data may be mode data in the reference data set, that is, the reference data with the highest occurrence frequency. For example, the reference data set includes temperature values returned by 5 data source objects, including "20, 18, and 20", and then the reference data with the highest occurrence frequency (i.e. the same reference data) is determined to be "20", and the first number corresponding to the same reference data is determined to be 3, the second number corresponding to all the reference data is 5, and the ratio between the first number and the second number is 60%.
S205, if the similarity between the reference data in the reference data set is greater than the preset similarity, the first node selects one reference data from the reference data as the target data.
In the embodiment of the invention, if the similarity between the reference data in the reference data set is greater than the preset similarity, the first node selects one reference data from the reference data as the target data. Specifically, the specific manner in which the first node selects one reference data from the reference data as the target data may be that the first node determines the same M reference data from the reference data set, determines any one reference data of the M reference data as the target data, where M is a positive integer, and the same M reference data may specifically be M reference data with the highest occurrence frequency.
S206, the first node applies the target data to the intelligent contract.
In the embodiment of the invention, after the first node determines the target data, the target data can be directly returned to the intelligent contract, so that the intelligent contract applies the target data, namely whether the task trigger condition is met or not is judged according to the target data. Specifically, the first node may return to the smart contract by way of a foresight machine contract deployed in the first node.
S207, the first node broadcasts the target data to at least one second node in the blockchain network, so that the at least one second node performs consensus verification on the target data.
In the embodiment of the invention, after the first node applies the target data to the intelligent contract, the intelligent contract judges whether the target data meets the contract trigger condition, wherein the contract trigger condition is preset in the intelligent contract, the contract trigger condition can be that the temperature is 20 ℃, the ball race goes to the 4 th section and the like, the intelligent contract can execute the task corresponding to the intelligent contract only when the intelligent contract detects that the trigger condition is met, the task can be that A transfers 100 yuan to B, and B sends goods to A and the like. Further, when the intelligent contract determines that the target data meets the task trigger condition, the first node is triggered to broadcast the target data and the task executed by the intelligent contract to at least one second node in the blockchain network, so that the at least one second node in the blockchain network performs consensus verification on the target data. Specifically, the process of performing the consensus check on the target data by at least one second node may be that each second node also obtains second reference data from the data source object, and detects whether the second target data obtained based on the second reference data is identical to the target data broadcasted by the first node, if so, it is determined that the check result on the target data is that the check result passes, and step S208 is performed, as shown in fig. 3, the second node includes node 1, node 2, node 3 and node 4, the data source object carried by the data obtaining request includes data source object 1, data source object 2, data source object 3 and data source object 4, and the node 1, node 2, node 3 and node 4 may obtain corresponding reference data from each data source object to complete the consensus check on the target data.
S208, if at least one second node in the blockchain network passes the verification of the target data, the first node packages the target data into blocks, and adds the blocks into the blockchain network.
In the embodiment of the invention, if at least one second node in the blockchain network checks the target data, the first node packages the target data into blocks and adds the blocks into the blockchain network. By the method, after the target data acquired from the outside are used, the external data are uplink, so that the data acquisition efficiency of the intelligent contract is improved, at least one second node performs consensus verification on the target data based on the data acquired from the data source object, the process of the consensus verification is simplified, and the data uplink efficiency is improved.
In the embodiment of the invention, a first node acquires a data acquisition request generated based on an intelligent contract, acquires reference data from each data source object according to the data acquisition request, and acquires a reference data set; if the similarity between the reference data in the reference data set is greater than the preset similarity, the first node selects one reference data from the reference data as target data, and applies the target data to the intelligent contract, the intelligent contract is used for linking the external data after the target data is acquired from the outside, so that the efficiency of acquiring the data by the intelligent contract is improved, and at least one second node performs consensus checking on the target data based on the data acquired from the data source object, so that the process of consensus checking is simplified, and the efficiency of data linking is improved.
Referring to the blockchain network shown in fig. 4, the blockchain network refers to a system for sharing data between nodes, where the blockchain network may include a plurality of nodes 401, and the plurality of nodes 401 may refer to terminals in the blockchain network, as shown in fig. 4. Each node may receive input information while operating normally and maintain shared data within the blockchain network based on the received input information. In order to ensure information intercommunication in the blockchain network, information connection can exist between every two nodes in the blockchain network, and information transmission can be carried out between the nodes through the information connection. For example, when any node in the blockchain network receives input information, other nodes in the blockchain network acquire the input information according to a consensus algorithm, and store the input information as data in shared data, so that the data stored on all nodes in the blockchain network are consistent.
For each node in the blockchain network, the node identification corresponding to the node identification is provided, and each node in the blockchain network can store the node identifications of other nodes in the blockchain network so as to broadcast the generated blocks to other nodes in the blockchain network according to the node identifications of the other nodes. Each node can maintain a node identification list shown in the following table, and the node names and the node identifications are correspondingly stored in the node identification list. The node identifier may be an IP (Internet Protocol, protocol of interconnection between networks) address, and any other information that can be used to identify the node, and the IP address is only illustrated in table 1.
Node name Node identification
Node 1 117.114.151.174
Node 2 117.116.189.145
Node N 119.123.789.258
Each node in the blockchain network stores one and the same blockchain. The blockchain is composed of a plurality of blocks, referring to fig. 5, the block chain is composed of a plurality of blocks, the starting block comprises a block head and a block body, the block head stores a version number of input information, a last block hash value and Merkle root node, and the block body stores the input information; the next block of the starting block takes the starting block as a father block, the next block also comprises a block head and a block main body, the block head stores the input information characteristic value of the current block, the version number of the father block, the hash value of the last block and the Merkle root node, and the like, so that the block data stored in each block in the block chain is associated with the block data stored in the father block, and the safety of the input information in the block is ensured. In a specific implementation, revenue information uploaded by each node can be stored in each block.
When each block in the blockchain is generated, when the node where the blockchain is positioned receives input information, checking the input information, after the checking is finished, storing the input information into a memory pool, and updating a hash tree used for recording the input information; then, updating the update time stamp to the time of receiving the input information, trying different random numbers, and calculating the characteristic value for a plurality of times, so that the calculated characteristic value can meet the following formula:
SHA256(SHA256(version+prev_hash+merkle_root+ntime+nbits+x))<TARGET
Wherein SHA256 is a eigenvalue algorithm used to calculate eigenvalues; version (version number) is version information of the related block protocol in the block chain; the prev_hash is the block header characteristic value of the parent block of the current block; the merkle_root is a characteristic value of input information; ntime is the update time of the update timestamp; the nbits is the current difficulty, is a fixed value in a period of time, and is determined again after exceeding a fixed period of time; x is a random number; TARGET is a eigenvalue threshold that can be determined from nbits.
Thus, when the random number meeting the formula is calculated, the information can be correspondingly stored to generate the block head and the block main body, and the current block is obtained. And then, the node where the blockchain is located sends the newly generated blocks to other nodes in the blockchain network where the newly generated blocks are located according to the node identifications of other nodes in the blockchain network, the other nodes verify the newly generated blocks, and the newly generated blocks are added into the blockchain stored in the newly generated blocks after the verification is completed.
Based on the above description of the embodiment of the data processing method based on the blockchain, the embodiment of the invention also discloses a data processing device based on the blockchain, and the data processing device based on the blockchain can be a computer program (including program code) running in a terminal or can be a physical device contained in the terminal. The blockchain-based data processing device may perform the method shown in fig. 1 or fig. 2. Referring to fig. 6, the blockchain-based data processing device 60 includes: the system comprises an acquisition module 601, a selection module 602, an application module 603, a determination module 604, a detection module 605 and an uploading module 606.
An obtaining module 601, configured to obtain a data obtaining request generated based on the smart contract, where the data obtaining request is used to obtain target data that meets a preset requirement, and the data obtaining request includes data source objects, where each data source object is used to provide reference data;
the acquiring module 601 is further configured to acquire reference data from the data source objects according to the data acquisition request, so as to obtain a reference data set;
a selection module 602, configured to select one reference data from the reference data sets as the target data if the similarity between the reference data sets is greater than a preset similarity;
an application module 603 is configured to apply the target data to the smart contract.
In one implementation, the determining module 604 is specifically configured to:
determining a first quantity corresponding to the same reference data in the reference data set and a second quantity corresponding to all the reference data in the reference data set;
and determining the similarity between each reference data in the reference data set by the ratio between the first quantity and the second quantity.
In one implementation, the selecting module 602 is specifically configured to:
determining the same M pieces of reference data from the reference data set, wherein M is a positive integer;
and determining any one of the M pieces of reference data as the target data.
In one implementation, the data source object includes an application program, and the detection module 605 is specifically configured to:
detecting whether the first node has access rights for each application in the data acquisition request;
if yes, executing the step of acquiring the reference data from each data source object according to the data acquisition request.
In one implementation manner, a prophetic contract is pre-deployed in the first node, where the prophetic contract includes a data acquisition code, and an acquisition module 601 is specifically configured to:
adding the information of each data source object into the data acquisition code in the form of parameters to obtain a target data acquisition code;
executing target data acquisition codes in the predictor contract, and sending the data acquisition requests to the data source objects;
and receiving the reference data returned by each data source object to obtain a reference data set.
In one implementation, each of the reference data carries signature information, and the detection module 605 is specifically configured to:
checking whether signature information carried by each reference data in the reference data set exists in a preset database or not, wherein a legal signature information set is stored in the preset database in advance;
if yes, executing the step of selecting one piece of reference data from the reference data as the target data if the similarity between the reference data in the reference data set is greater than the preset similarity.
In one implementation, each of the reference data carries signature information, and the uploading module 606 is specifically configured to:
broadcasting the target data to at least one second node in the blockchain network, so that the at least one second node performs consensus verification on the target data;
and if at least one second node in the blockchain network passes the verification of the target data, packing the target data into blocks, and adding the blocks into the blockchain network.
In the embodiment of the invention, the acquisition module 601 acquires a data acquisition request generated based on an intelligent contract, and acquires reference data from each data source object according to the data acquisition request to obtain a reference data set; if the similarity between the reference data in the reference data set is greater than the preset similarity, the selecting module 602 selects one reference data from the reference data as the target data, and the applying module 603 applies the target data to the smart contract. By implementing the method, the nodes in the blockchain network can directly return the data required by the intelligent contract without the need of uplink the data, so that the common-knowledge checking process is simplified, and the efficiency of acquiring the data by the intelligent contract is improved.
Fig. 7 is a schematic structural diagram of a terminal according to an embodiment of the present invention. As shown in fig. 7, the terminal includes: at least one processor 701, an input device 703, an output device 704, a memory 705, and at least one communication bus 702. Wherein the communication bus 702 is used to enable connected communications between these components. The memory 705 may be a high-speed RAM memory or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 705 may also optionally be at least one storage device located remotely from the processor 701. Wherein the processor 701 may be described in connection with fig. 6, a set of program code is stored in the memory 705, and the processor 701, the input device 703, the output device 704 call the program code stored in the memory 705 for performing the following operations:
a processor 701, configured to obtain a data acquisition request generated based on the smart contract, where the data acquisition request is used to obtain target data that meets a preset requirement, and the data acquisition request includes data source objects, where each data source object is used to provide reference data;
a processor 701, configured to obtain reference data from the data source objects according to the data obtaining request, so as to obtain a reference data set;
A processor 701, configured to select one reference data from the reference data sets as the target data if the similarity between the reference data sets is greater than a preset similarity;
a processor 701 for applying the target data to the smart contract.
In one implementation, the processor 701 is specifically configured to:
determining a first quantity corresponding to the same reference data in the reference data set and a second quantity corresponding to all the reference data in the reference data set;
and determining the similarity between each reference data in the reference data set by the ratio between the first quantity and the second quantity.
In one implementation, the processor 701 is specifically configured to:
determining the same M pieces of reference data from the reference data set, wherein M is a positive integer;
and determining any one of the M pieces of reference data as the target data.
In one implementation, the data source object includes an application program, and the processor 701 is specifically configured to:
detecting whether the first node has access rights for each application in the data acquisition request;
If yes, executing the step of acquiring the reference data from each data source object according to the data acquisition request.
In one implementation, the first node has a foresight machine contract deployed in advance, where the foresight machine contract includes a data acquisition code, and the processor 701 is specifically configured to:
adding the information of each data source object into the data acquisition code in the form of parameters to obtain a target data acquisition code;
executing target data acquisition codes in the predictor contract, and sending the data acquisition requests to the data source objects;
and receiving the reference data returned by each data source object to obtain a reference data set.
In one implementation, each of the reference data carries signature information, and the processor 701 is specifically configured to:
checking whether signature information carried by each reference data in the reference data set exists in a preset database or not, wherein a legal signature information set is stored in the preset database in advance;
if yes, executing the step of selecting one piece of reference data from the reference data as the target data if the similarity between the reference data in the reference data set is greater than the preset similarity.
In one implementation, each of the reference data carries signature information, and the processor 701 is specifically configured to:
broadcasting the target data to at least one second node in the blockchain network, so that the at least one second node performs consensus verification on the target data;
and if at least one second node in the blockchain network passes the verification of the target data, packing the target data into blocks, and adding the blocks into the blockchain network.
In the embodiment of the present invention, the processor 701 obtains a data acquisition request generated based on an intelligent contract, and obtains reference data from each data source object according to the data acquisition request, thereby obtaining a reference data set; if the similarity between the reference data in the reference data set is greater than the preset similarity, the processor 701 selects one reference data from the reference data as the target data, and the processor 701 applies the target data to the smart contract. By implementing the method, the nodes in the blockchain network can directly return the data required by the intelligent contract without the need of uplink the data, so that the common-knowledge checking process is simplified, and the efficiency of acquiring the data by the intelligent contract is improved.
The modules described in the embodiments of the present invention may be implemented by general-purpose integrated circuits such as a CPU (Central Processing Unit ) or by ASIC (Application Specific Integrated Circuit, application specific integrated circuit).
It should be appreciated that in embodiments of the present invention, the processor 701 may be a central processing module (Central Processing Unit, CPU), which may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The bus 702 may be an industry standard architecture (Industry Standard Architecture, ISA) bus, an external device interconnect (Peripheral Component, PCI) bus, or an extended industry standard architecture (Extended Industry Standard Architecture, EISA) bus, etc., and the bus 702 may be divided into an address bus, a data bus, a control bus, etc., with fig. 7 being shown with only one bold line for ease of illustration, but not with only one bus or one type of bus.
Those skilled in the art will appreciate that implementing all or part of the above-described methods in the embodiments may be accomplished by computer programs to instruct related hardware, where the programs may be stored in a computer readable storage medium, and where the programs may include the processes of the embodiments of the methods described above when executed. The computer readable storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like.
The foregoing disclosure is illustrative of the present invention and is not to be construed as limiting the scope of the invention, which is defined by the appended claims.

Claims (9)

1. A blockchain-based data processing method applied to a blockchain network, the method being performed by a first node in the blockchain network, the blockchain network having an intelligent contract deployed therein, the method comprising:
acquiring a data acquisition request generated based on the intelligent contract, wherein the data acquisition request is used for acquiring target data meeting preset requirements, the data acquisition request comprises data source objects, and each data source object is used for providing reference data;
Acquiring reference data from each data source object according to the data acquisition request to obtain a reference data set;
checking whether signature information carried by each reference data in the reference data set exists in a preset database or not, wherein a legal signature information set is stored in the preset database in advance;
if yes, and the similarity between the reference data in the reference data set is greater than the preset similarity, selecting one reference data from the reference data as the target data;
the target data is applied to the smart contract.
2. The method of claim 1, wherein after obtaining the reference data from the respective data source objects according to the data obtaining request, the method further comprises:
determining a first quantity corresponding to the same reference data in the reference data set and a second quantity corresponding to all the reference data in the reference data set;
and determining the similarity between each reference data in the reference data set by the ratio between the first quantity and the second quantity.
3. The method of claim 1, wherein said selecting one reference data from said respective reference data as said target data comprises:
determining the same M pieces of reference data from the reference data set, wherein M is a positive integer;
and determining any one of the M pieces of reference data as the target data.
4. The method of claim 1, wherein the data source objects comprise applications, wherein the obtaining the reference data from the respective data source objects according to the data obtaining request to obtain the reference data set comprises:
detecting whether the first node has access rights for each application in the data acquisition request;
if yes, executing the step of acquiring the reference data from each data source object according to the data acquisition request.
5. The method according to claim 1, wherein a foreseeing machine contract is pre-deployed in the first node, the foreseeing machine contract includes a data acquisition code, the acquiring reference data from the respective data source objects according to the data acquisition request, and obtaining a reference data set includes:
Adding the information of each data source object into the data acquisition code in the form of parameters to obtain a target data acquisition code;
executing target data acquisition codes in the predictor contract, and sending the data acquisition requests to the data source objects;
and receiving the reference data returned by each data source object to obtain a reference data set.
6. The method of claim 1, wherein after the applying the target data to the smart contract, the method further comprises:
broadcasting the target data to at least one second node in the blockchain network, so that the at least one second node performs consensus verification on the target data;
and if at least one second node in the blockchain network passes the verification of the target data, packing the target data into blocks, and adding the blocks into the blockchain network.
7. A blockchain-based data processing device, the device being disposed in any one of first nodes in a blockchain network having a smart contract deployed therein, the device comprising:
The intelligent contract generation module is used for generating an intelligent contract according to the target data, wherein the intelligent contract is used for generating a data acquisition request which is used for acquiring target data meeting preset requirements, the data acquisition request comprises data source objects, and each data source object is used for providing reference data;
the acquisition module is further used for acquiring reference data from the data source objects according to the data acquisition request to obtain a reference data set;
the detection module is used for checking whether signature information carried by each reference data in the reference data set exists in a preset database, and a legal signature information set is stored in the preset database in advance;
the selecting module is used for selecting one piece of reference data from the reference data to serve as the target data if the similarity among the reference data in the reference data set is larger than the preset similarity under the condition that the detecting module confirms that signature information carried by the reference data in the reference data set exists in a preset database;
and the application module is used for applying the target data to the intelligent contract.
8. A terminal comprising a processor, an input interface, an output interface and a memory, the processor, the input interface, the output interface and the memory being interconnected, wherein the memory is adapted to store a computer program comprising program instructions, the processor being configured to invoke the program instructions to perform the method of any of claims 1-6.
9. A computer readable storage medium, characterized in that the computer readable storage medium stores a computer program comprising program instructions which, when executed by a processor, cause the processor to perform the method of any of claims 1-6.
CN201911139153.3A 2019-11-19 2019-11-19 Data processing method, device, terminal and medium based on block chain Active CN110928880B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911139153.3A CN110928880B (en) 2019-11-19 2019-11-19 Data processing method, device, terminal and medium based on block chain

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911139153.3A CN110928880B (en) 2019-11-19 2019-11-19 Data processing method, device, terminal and medium based on block chain

Publications (2)

Publication Number Publication Date
CN110928880A CN110928880A (en) 2020-03-27
CN110928880B true CN110928880B (en) 2024-01-12

Family

ID=69850383

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911139153.3A Active CN110928880B (en) 2019-11-19 2019-11-19 Data processing method, device, terminal and medium based on block chain

Country Status (1)

Country Link
CN (1) CN110928880B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111488616A (en) * 2020-04-08 2020-08-04 北京瑞策科技有限公司 Method and device for realizing preplan machine of service data block chain
CN112667616B (en) * 2020-12-31 2022-07-22 杭州趣链科技有限公司 Traffic data evaluation method and system based on block chain and electronic equipment
CN112765687B (en) * 2021-01-12 2022-05-13 湖北宸威玺链信息技术有限公司 Data source identification method based on block chain
CN113469815A (en) * 2021-09-02 2021-10-01 支付宝(杭州)信息技术有限公司 Data management method and device
CN117376371A (en) * 2022-06-30 2024-01-09 腾讯科技(深圳)有限公司 Data processing method, system, device, equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005099937A (en) * 2003-09-22 2005-04-14 Patolis Corp Search data structure of document information about industrial property, recording medium with search data structure recorded, and apparatus, system, method, and program for search of document information about industrial property, and recording medium with program recorded
CN108323200A (en) * 2018-01-25 2018-07-24 深圳前海达闼云端智能科技有限公司 Data training method and device based on block chain, storage medium and block chain link points
EP3401865A1 (en) * 2017-05-10 2018-11-14 Coinplug, Inc Method for paying cost of iot device based on blockchain and merkle tree structure related thereto, and server, service providing terminal, and digital wallet using the same
CN110210961A (en) * 2019-05-21 2019-09-06 平安普惠企业管理有限公司 Data capture method, server and computer storage medium based on alliance's chain

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107453896B (en) * 2017-06-27 2020-08-04 创新先进技术有限公司 Method and device for processing multiple block chain network data and server

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2005099937A (en) * 2003-09-22 2005-04-14 Patolis Corp Search data structure of document information about industrial property, recording medium with search data structure recorded, and apparatus, system, method, and program for search of document information about industrial property, and recording medium with program recorded
EP3401865A1 (en) * 2017-05-10 2018-11-14 Coinplug, Inc Method for paying cost of iot device based on blockchain and merkle tree structure related thereto, and server, service providing terminal, and digital wallet using the same
CN108323200A (en) * 2018-01-25 2018-07-24 深圳前海达闼云端智能科技有限公司 Data training method and device based on block chain, storage medium and block chain link points
CN110210961A (en) * 2019-05-21 2019-09-06 平安普惠企业管理有限公司 Data capture method, server and computer storage medium based on alliance's chain

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
区块链的税收智能合约设计;陈宇翔;张兆雷;刘地军;彭笛;李枫;;通信技术(06);全文 *

Also Published As

Publication number Publication date
CN110928880A (en) 2020-03-27

Similar Documents

Publication Publication Date Title
CN110928880B (en) Data processing method, device, terminal and medium based on block chain
CN107566124B (en) Hash operation-based consensus establishing method, block chain system and storage medium
CN111600720B (en) Data processing method, device and equipment based on block chain and readable storage medium
US10073916B2 (en) Method and system for facilitating terminal identifiers
CN107819631B (en) Equipment anomaly detection method, device and equipment
CN111444211B (en) Block chain consensus node checking method, device, equipment and storage medium
US20220272105A1 (en) Blockchain-based data detection method, apparatus, and computer-readable storage medium
CN110995513B (en) Data sending and receiving method in Internet of things system, internet of things equipment and platform
CN110690974B (en) Block chain based data verification method, device, equipment and readable storage medium
CN111506656A (en) Consensus processing method and device for block chain system, intelligent device and storage medium
CN107861811B (en) Task information transmission method and device in workflow system and computer equipment
CN105100032A (en) Method and apparatus for preventing resource steal
CN110930254A (en) Data processing method, device, terminal and medium based on block chain
CN111711544B (en) Link dial testing method and device, electronic equipment and storage medium
CN110597918A (en) Account management method and device and computer readable storage medium
CN111885050A (en) Data storage method and device based on block chain network, related equipment and medium
CN110912689A (en) Method and system for generating and verifying unique value
CN110460471B (en) Super node election method, device and storage medium
CN111224782B (en) Data verification method based on digital signature, intelligent device and storage medium
CN110990790B (en) Data processing method and equipment
CN110505084B (en) Block chain packing node consensus electing method
CN112200680B (en) Block link point management method, device, computer and readable storage medium
CN111367923A (en) Data processing method, data processing device, node equipment and storage medium
CN109544165B (en) Resource transfer processing method, device, computer equipment and storage medium
CN110598452B (en) Evidence information processing method, device, storage medium and equipment based on blockchain

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant