CN117539955A - Block chain-based data processing method, apparatus, device, medium and product - Google Patents

Block chain-based data processing method, apparatus, device, medium and product Download PDF

Info

Publication number
CN117539955A
CN117539955A CN202311458468.0A CN202311458468A CN117539955A CN 117539955 A CN117539955 A CN 117539955A CN 202311458468 A CN202311458468 A CN 202311458468A CN 117539955 A CN117539955 A CN 117539955A
Authority
CN
China
Prior art keywords
data
requested
target
consensus node
blockchain
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.)
Pending
Application number
CN202311458468.0A
Other languages
Chinese (zh)
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.)
Zhongchao Credit Card Industry Development Co ltd
China Banknote Printing and Minting Group Co Ltd
Original Assignee
Zhongchao Credit Card Industry Development Co ltd
China Banknote Printing and Minting Group 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 Zhongchao Credit Card Industry Development Co ltd, China Banknote Printing and Minting Group Co Ltd filed Critical Zhongchao Credit Card Industry Development Co ltd
Priority to CN202311458468.0A priority Critical patent/CN117539955A/en
Publication of CN117539955A publication Critical patent/CN117539955A/en
Pending legal-status Critical Current

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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
    • 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/25Integrating or interfacing systems involving database management systems
    • G06F16/252Integrating or interfacing systems involving database management systems between a Database Management System and a front-end application
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Business, Economics & Management (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Finance (AREA)
  • Data Mining & Analysis (AREA)
  • Accounting & Taxation (AREA)
  • General Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Development Economics (AREA)
  • Economics (AREA)
  • Marketing (AREA)
  • Strategic Management (AREA)
  • Technology Law (AREA)
  • General Business, Economics & Management (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application discloses a data processing method, a device, equipment, a medium and a product based on a block chain, wherein the method is applied to a first consensus node of the block chain, the first consensus node comprises a target application intelligent contract, the target application intelligent contract comprises a first business function, the first business function is used for calling a foresight contract, and the method comprises the following steps: receiving a target transaction request for a first target block under the condition that the first consensus node constructs the first target block, wherein the target transaction request comprises a data acquisition request; in the running process of the intelligent contract of the target application, under the condition that the to-be-requested data to be acquired in the data acquisition request is determined to call the predictive engine contract, acquiring the to-be-requested data from the outside based on the data acquisition request; and feeding the data to be requested back to the target application intelligent contract. To achieve consistency in the blockchain and predictors of the individual external information.

Description

Block chain-based data processing method, apparatus, device, medium and product
Technical Field
The application relates to the technical field of blockchains, in particular to a blockchain-based data processing method, a blockchain-based data processing device, a blockchain-based data processing equipment, a blockchain-based data processing medium and a blockchain-based data processing product.
Background
The function of the predictor is to write external information into the blockchain to complete the data intercommunication between the blockchain and the real world. For example, there is a blockchain application of weather forecast pre-warning, and a user can query for weather forecast through an on-chain intelligent contract. The weather forecast data is not generated on the chain, but rather, an intelligent contract is required to initiate a request to the interface of the weather service website to acquire the data. At this time, the propulsor is functional, the intelligent contract can initiate a request to the propulsor, the propulsor executes the call of the weather service website interface, and consistent response data is returned to the intelligent contract for the intelligent contract to process.
The core of the predictor is to ensure the authenticity of data, and because the blockchain and the predictor respectively belong to two systems, the fact that the predictor writes external information into the blockchain is a 'cross-chain operation' at present, and the atomicity of single external information executed in the two systems and the consistency of the data cannot be ensured.
Disclosure of Invention
An object of the embodiments of the present application is to provide a data processing method, apparatus, device, medium and product based on a blockchain, so as to ensure consistency of single external information in the blockchain and the predictor when the external information is written into the blockchain by using the predictor.
The technical scheme of the application is as follows:
in a first aspect, a data processing method based on a blockchain is provided, where the method is applied to a first consensus node of the blockchain, the first consensus node includes a target application intelligent contract, the target application intelligent contract includes a first business function, and the first business function is used for calling a foresight contract, and the method includes:
receiving a target transaction request for a first target block under the condition that the first consensus node builds the first target block, wherein the target transaction request comprises a data acquisition request, the blockchain comprises at least one consensus node, the at least one consensus node comprises the first consensus node, and the first target block is one block which is to be built by the first consensus node and forms the blockchain;
acquiring the data to be requested from the outside based on the data acquisition request under the condition that the data to be requested, which is acquired in the data acquisition request, is determined to need to call a foreseeing machine contract in the running process of the target application intelligent contract;
and feeding the data to be requested back to the target application intelligent contract so as to process the data to be requested based on the target application intelligent contract.
In a second aspect, there is provided a blockchain-based data processing apparatus applied to a first consensus node of the blockchain, the first consensus node including a target application intelligence contract including a first business function for invoking a predictor contract, the apparatus comprising:
a receiving module, configured to receive a target transaction request for a first target block under a condition that the first target block is constructed by a first consensus node, where the target transaction request includes a data acquisition request, the blockchain includes at least one consensus node, the at least one consensus node includes a first consensus node, and the first target block is a block to be constructed by the first consensus node that constitutes the blockchain;
the data acquisition module is used for acquiring the data to be requested from the outside based on the data acquisition request under the condition that the data to be requested, which is to be acquired in the data acquisition request, is determined to need to call a foreseeing machine contract in the running process of the target application intelligent contract;
and the data sending module is used for feeding the data to be requested back to the target application intelligent contract so as to process the data to be requested based on the target application intelligent contract.
In a third aspect, an embodiment of the present application provides an electronic device, where the electronic device includes a processor, a memory, and a program or instruction stored on the memory and executable on the processor, where the program or instruction, when executed by the processor, implements the steps of any one of the blockchain-based data processing methods of the embodiments of the present application.
In a fourth aspect, embodiments of the present application provide a readable storage medium having stored thereon a program or instructions that when executed by a processor perform the steps of any of the blockchain-based data processing methods of the embodiments of the present application.
In a fifth aspect, embodiments of the present application provide a computer program product, instructions in which, when executed by a processor of an electronic device, enable the electronic device to perform the steps of any of the blockchain-based data processing methods of the embodiments of the present application.
The technical scheme provided by the embodiment of the application at least brings the following beneficial effects:
in the embodiment of the application, under the condition that a first target block is built by a first consensus node in a blockchain, a target transaction request aiming at the first target block is received, in the operation process of a target application intelligent contract of the first consensus node, and under the condition that the target application intelligent contract is determined to call a predictive engine contract, data to be requested can be acquired from outside based on a data acquisition request in the target transaction request, then the data to be requested is fed back to the target application intelligent contract so as to carry out subsequent processing on the data to be requested based on the target application intelligent contract, and as a first business function capable of calling the predictive engine contract is directly added in the target application intelligent contract of the existing blockchain, the predictive engine contract can be directly called in the blockchain so as to acquire the data to be requested from outside based on the predictive engine contract, so that interaction of the data to be requested in the blockchain and the predictive engine system is not needed, and consistency and authenticity of the data to be requested are ensured. In addition, the first business function capable of calling the predictive engine contract is directly added on the existing blockchain, so that a blockchain system does not need to be reconstructed, and the implementation difficulty of the blockchain system is reduced.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the application and together with the description, serve to explain the principles of the application and do not constitute an undue limitation on the application.
FIG. 1 is a flow chart of a block chain based data processing method according to an embodiment of a first aspect of the present application;
FIG. 2 is a flow chart of a block chain based data processing method according to an embodiment of the first aspect of the present application;
FIG. 3 is a schematic block chain based data processing apparatus according to a second aspect of the present invention;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of a third aspect of the present application.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are intended to be illustrative of the application and are not intended to be limiting. It will be apparent to one skilled in the art that the present application may be practiced without some of these specific details. The following description of the embodiments is merely intended to provide a better understanding of the present application by showing examples of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present application. Rather, they are merely examples consistent with some aspects of the present application as detailed in the accompanying claims.
Before introducing the technical solution of the embodiments of the present application, the technical background of the embodiments of the present application is first described:
the function of the propulsor is to write external information into the blockchain to finish the data intercommunication between the blockchain and the real world, and the specific mode of obtaining the external information is that the intelligent contract in the blockchain initiates a request to the propulsor, the propulsor executes the call of the weather service website interface, returns consistent response data to the intelligent contract and is used for the intelligent contract to process.
The core of the predictor is to ensure the authenticity of data, and currently, the implementation mode mainly comprises two modes of centralization and decentralization. The centralization is achieved by proving that the data obtained from the original data source is authentic and not tampered with. The decentralization mode is that a plurality of predictor nodes jointly provide data, and the data is written into the blockchain through common knowledge results formed by means of aggregation calculation and the like.
The Chainlin is the most representative decentralizing predictor scheme, the Chainlin adopts the same mode as the block chain, a decentralizing independent predictor network is established, predictors in the network jointly acquire data from a data source, aggregate the data, transmit the verified aggregate data to an intelligent contract, trigger contract execution, and avoid the decentralizing risk in the whole process. Because of the implementation mode of the Chainlink, a set of blockchain system is required to be realized again from the bottom layer, and the blockchain system comprises key modules such as a verifiable data mechanism, a P2P network, a consensus algorithm, an account system and the like, so that the system is difficult to realize, and when data is acquired from the outside, the data is subjected to cross-chain operation between a predictor and a blockchain, and the consistency of the data cannot be ensured.
In order to solve the above-mentioned problems, the embodiments of the present application provide a data processing method, apparatus, device, medium and product based on a blockchain, where a first common node in the blockchain constructs a first target block, receive a target transaction request for the first target block, in a target application intelligent contract running process of the first common node, and in a case that it is determined that the target application intelligent contract needs to call a foresight contract, so as to obtain data to be requested from outside based on a data obtaining request in the target transaction request, and then feed back the data to be requested to the target application intelligent contract, so as to perform subsequent processing on the data to be requested based on the target application intelligent contract. In addition, the first business function capable of calling the predictive engine contract is directly added on the existing blockchain, so that a blockchain system does not need to be reconstructed, and the implementation difficulty of the blockchain system is reduced.
The block chain-based data processing method provided by the embodiment of the application is described in detail below by means of specific embodiments and application scenarios thereof with reference to the accompanying drawings.
Fig. 1 is a flowchart of a block chain based data processing method according to an embodiment of the present application, where an execution body of the block chain based data processing method may be a first consensus node in a block chain.
The blockchain may have at least one common node therein, including the first common node, where each common node is understood to be a computer on the blockchain for performing data processing.
In some embodiments of the present application, a target application intelligence contract may be included in the first consensus node, which may be about an intelligent contract for the target application, for example, an intelligent contract for a weather application. The target application intelligence contract may be understood as a piece of program code running in a blockchain, and may include a first business function in the target application intelligence contract, where the first business function may be understood as a functional method in the target application intelligence contract, and the first business function may be used to call a prophetic contract, where the prophetic contract may be understood as a piece of program code implementing prophetic functions. The predictor function may be used to obtain data from outside.
As shown in FIG. 1, the blockchain-based data processing method provided by embodiments of the present application may include steps 110-130.
Step 110, receiving a target transaction request for a first target block in case the first consensus node constructs the first target block.
The target transaction request may include a request for performing a transaction in the first target block, and the data acquisition request may include data to be requested, where the data to be requested may be data that the first consensus node is to request to perform processing in the first target block.
The first target block may be one of the blocks of the component blockchain that the first consensus node is currently constructing.
It will be appreciated that the blockchain includes a plurality of blocks, each of which is constructed by a consensus node.
In some embodiments of the present application, when the first consensus node is to construct the first target block, a target transaction request for the first target block may be received, where it is noted that there may be multiple transaction requests in the first target block, each transaction request has a corresponding identification number (Identity document, ID), for example, each transaction request uses a serial number as its ID, for example, the ID of the first transaction request is 1, the ID of the second transaction request is 2, and so on. The target transaction request may be any one of the multiple transaction requests, each target transaction request may have at least one data acquisition request, each data acquisition request may request to acquire at least one data to be requested, where in a case where there are multiple data acquisition requests in the target transaction request, the first consensus node may further package the multiple data acquisition requests in sequence, for example, may package the multiple data acquisition requests according to a request time of each data acquisition request, or may package the multiple data acquisition requests according to an importance level of each data acquisition request, which is not limited in the embodiment of the present application.
It should be noted that, when the data acquisition requests are multiple, a request identifier, i.e. an ID, may also be given to each data acquisition request when each data acquisition request is packaged, where the request identifier is generated for the target application smart contract and is used to characterize the unique identifier of the data acquisition request, and according to the ID, it may be found exactly which data acquisition request is to acquire data.
In some embodiments of the present application, in order to precisely construct the first target block, before step 110, the above-mentioned method may further include:
verifying the legitimacy of the first target block;
verifying whether the transaction task exists in the first target block under the condition that the legitimacy of the first target block passes;
the receiving a target transaction request for a first target block includes:
in the event that a transaction task is determined to be in the first target block, a target transaction request is received for the first target block.
In some embodiments of the present application, when a first consensus node is to construct a first target block, the validity of the first target block is first verified, specifically, whether the first target block is compatible in the blockchain. And judging whether a transaction task exists before the first target block when the validity check of the first target block passes, if no transaction task exists, proving that the first target block is an empty block, directly broadcasting the first target block, and if a transaction task exists, acquiring a target transaction request aiming at the first target block from a plurality of transaction tasks.
Referring to fig. 2, fig. 2 is a flowchart of data processing based on a blockchain, firstly, performing validity check on a first target block, after the validity check is passed, caching the valid first target block, then judging whether the first target block is a null block, if so, broadcasting the first target block, if not, starting to execute the first target block, namely, starting to accept a target transaction request for the first target block, and then acquiring data to be requested according to the target transaction request.
It should be noted that, in the technical solution of the embodiment of the present application, one of the plurality of transaction tasks is illustrated as an example, that is, the target transaction request is illustrated as an example, but the method is not limited to the case that only one transaction task is the target transaction request in the first target block, and the execution process of other transaction tasks is consistent with the process of the target transaction request, which is not repeated herein.
Step 120, in the process of running the target application intelligent contract, and under the condition that it is determined that the to-be-requested data to be acquired in the data acquisition request needs to call the foreseeing machine contract, acquiring the to-be-requested data from the outside based on the data acquisition request.
In some embodiments of the present application, after starting to execute the first target block, the target transaction request may be acquired, and then the target application intelligent contract is executed, in the execution process of the target application intelligent contract, if it is determined that the data to be requested to be acquired in the data acquisition request is external data of the blockchain, the target application intelligent contract is required to call the predictive engine contract, and since the target application intelligent contract has the first business function capable of calling the predictive engine contract, the predictive engine contract may be directly called, and then the data to be requested is acquired from the outside according to the data acquisition request based on the predictive engine contract.
With continued reference to fig. 2, fig. 2 illustrates an example in which a plurality of transaction tasks in a first target block are taken as a plurality of transaction tasks, after the transaction tasks are acquired, the first transaction task, that is, the transaction task with id=0, that is, the target transaction request is read, then it is determined whether the ID is smaller than the number of the transaction tasks in the first target block, if the id=0 is smaller than the number of the transaction tasks in the first target block, then the target transaction request with id=0 is acquired, execution of the target application smart contract is started, and when the target application smart contract is executed, if data to be requested in the target transaction request with id=0 is outside the blockchain, then a predictive engine contract needs to be called, and then the data to be requested is acquired from outside based on the predictive engine contract.
In some embodiments of the present application, when the target applies the smart contract, there is also data to be requested that is to be obtained inside the blockchain, so that the foreseeable machine contract may not be invoked. As such, following step 120, the above-described methods may further comprise:
and in the running process of the intelligent contract of the target application, acquiring data to be requested from the blockchain under the condition that the predicted machine contract is determined not to be required to be called.
With continued reference to the example of fig. 2, if it is determined that the data to be requested in the target transaction request with id=0 is internal to the blockchain, then the predicted machine contract is not required to be invoked, the data to be requested may be directly obtained from other blocks of the blockchain, and id+1 may be allowed to obtain the next target transaction request.
In the embodiment of the application, in the running process of the intelligent contract of the target application, under the condition that the contract of the predictive engine is not required to be called, the data to be requested can be directly obtained from the blockchain without obtaining the data to be requested from the outside, and the obtaining efficiency of the data to be requested is improved.
And 130, feeding the data to be requested back to the target application intelligent contract so as to process the data to be requested based on the target application intelligent contract.
In some embodiments of the present application, after the data to be requested is obtained, the data to be requested may be fed back to the target application intelligent contract, and the target application intelligent contract may process the data to be requested, for example, may perform subsequent other processing on the data to be requested, or may directly store the data to be requested into the first target block, which is not limited herein.
In some embodiments of the present application, the data acquisition request may further include an acquisition address of the data to be requested, that is, a uniform resource locator (Universal Resource Locator, URL) of the data to be requested, so step 120 may specifically include:
acquiring data to be requested from the outside based on the acquisition address of the data to be requested;
step 130 may specifically include:
and feeding back the data to be requested to the target application intelligent contract according to the request identification.
In some embodiments of the present application, the data to be requested may be directly obtained from the outside of the blockchain according to the obtaining address of the data to be requested, and then the obtained data to be requested is fed back to the target application intelligent contract according to the request identifier of the data obtaining request, so as to clearly know the data obtaining request corresponding to the obtained data to be requested.
In the embodiment of the application, the data to be requested is acquired from the outside based on the acquisition address of the data to be requested, so that the data to be requested can be accurately acquired, and after the data to be requested is acquired, the data to be requested is accurately fed back to the target application intelligent contract according to the request identifier.
In some embodiments of the present application, when implementing decentralization by using the chain mode, when the bottom layer re-implements a set of blockchain system, it is also necessary to repeatedly construct a decentralized consensus network to implement the predictor function, so that the difficulty in implementing the system is increased. In order to solve the problem, the method can be realized by directly utilizing the existing consensus network of the block chain without reconstruction, and can also directly multiplex the treatment mode of the existing consensus network of the block chain, thereby having high matching degree. The implementation of the consensus network of the blockchain is described below:
in some embodiments of the present application, the at least one consensus node may further comprise at least one second consensus node, the second consensus node being a further consensus node than the first consensus node.
To further promote consistency of the data to be requested, the above-described method may further comprise, after step 120:
Receiving data to be requested, which corresponds to a data acquisition request and is acquired by at least one second consensus node;
under the condition that the data to be requested acquired by the first consensus node is consistent with the data to be requested acquired by at least one second consensus node, the data acquisition request is determined to pass verification;
under the condition that the number of the verification passing data acquisition requests is larger than or equal to a preset number threshold, determining that the construction of the first target block is completed;
step 130 may specifically include:
and feeding back the data to be requested to the target application intelligent contract under the condition that the first target block is determined to be constructed.
The preset number threshold may be determined based on a preset number of consensus nodes of the at least one consensus node, where the preset number of consensus nodes allows to obtain errors of the data to be requested. The preset number may be set by the user according to his experience, and is not limited herein.
In some embodiments of the present application, for example, there are 5 consensus nodes, the preset number is 2 if the data to be requested, which is allowed to be acquired by 2 consensus nodes in the 5 consensus nodes, is wrong, can be set. The determining of the preset number threshold may be determining that the preset number threshold is 2×f+1 according to a practical bayer fault tolerance algorithm, that is, a PBFT consensus algorithm, where F is the preset number.
In some embodiments of the present application, after a first target block is constructed at a first consensus node, after data to be requested is obtained, other consensus nodes, that is, a second consensus node, may execute a target transaction request in the first target block according to the same execution process of the first consensus node, obtain data to be requested corresponding to a data obtaining request in the target transaction request, if the data to be requested obtained by the first consensus node is consistent with the data to be requested obtained by the second consensus node, the hash of the data obtaining request is consistent, if the data to be requested obtained by the first consensus node is inconsistent with the data to be requested obtained by the second consensus node, the hash of the data obtaining request is inconsistent, and the number of the hash of the statistical data obtaining request is consistent, and if the number is greater than or equal to a preset number threshold, that is, when the data is greater than 2×f+1, the construction of the first target block is determined to be completed, and the data to be requested can be fed back to a target application intelligent contract.
In the embodiment of the application, the data to be requested, which is acquired by at least one second consensus node and corresponds to the data acquisition request in the target transaction request, is received, the data acquisition request is determined to pass verification under the condition that the data to be requested acquired by the first consensus node is determined to be consistent with the data to be requested acquired by at least one second consensus node, the first target block is determined to be constructed and completed under the condition that the number of the data acquisition requests passing verification is determined to be greater than or equal to a preset number threshold, and the data to be requested is fed back to the target application intelligent contract under the condition that the first target block is determined to be constructed and completed, so that the consensus verification of the data acquisition request is performed by utilizing the consensus network of the existing block chain, new construction is not needed, the treatment mode of the consensus network of the existing block chain can be directly multiplexed, and the matching degree is high.
In some embodiments of the present application, after determining that the data acquisition request is authenticated, the method involved above may further include:
and discarding the first target block and constructing a second target block under the condition that the verification number of the data acquisition requests is smaller than a preset number threshold.
Wherein the second target block is another block to be newly constructed other than the first target block.
In some embodiments of the present application, in a case where it is determined that the number of data acquisition requests passing verification is less than a preset number threshold, it is indicated that the first target block cannot perform the acquisition of the transaction task, so that the first target block is discarded and another new block is reconstructed.
In the embodiment of the application, under the condition that the verification number of the data acquisition requests is smaller than the preset number threshold, the first target block is abandoned, and the second target block is constructed, so that the verification of the data acquisition requests can be ensured to be passed, and the data to be requested can be obtained.
In some embodiments of the present application, in order to more clearly understand the technical solutions of the embodiments of the present application, taking the PBFT consensus algorithm as an example, the process of generating a new block includes four stages of packing, executing, verifying and submitting, and the following description is given for each stage:
1. Packaging stage
Each consensus node builds blocks in turn, only one consensus node builds block in each round, and packages the transaction tasks of the newly built block, and the main work of the packaging stage is to determine which transactions in the transaction pool are put into the newly built block.
It should be noted that, the transaction pool has a plurality of transaction tasks, each transaction task can be regarded as a transaction request, and the packaging stage is to see which transaction tasks are to be received in the newly constructed block.
2. Execution phase
This stage is responsible for executing the block, i.e., the target application intelligence contract within the block, generating the signature packet, and broadcasting the signature packet to other consensus nodes. The execution of this stage is shown in fig. 2 and will not be described in detail here.
It should be noted that, after the first consensus node that is executing acquires the data to be requested, a signature packet may be generated, where the signature packet may include the acquired data to be requested and notification information of the acquired data to be requested, and then the signature packet may be broadcast to other consensus nodes.
3. Verification stage
The other consensus nodes (namely the second consensus nodes) execute the process of acquiring the data to be requested by the first consensus node, acquire the data to be requested corresponding to the data acquisition request, judge whether the data to be requested acquired by the first consensus node is consistent with the data to be requested acquired by at least one second consensus node, and broadcast a submitting packet to the other consensus nodes when the number of the data acquisition requests passing verification is more than or equal to 2 x F+1.
4. Commit phase
After collecting the full 2 x f+1 commit packets, the newly constructed block of this round may be committed to the database, completing the drop. By executing the scheme of the embodiment of the application, the method has the following advantages: the block chain system and the common network part of the decentralization predictor system are shared, so that the difficulty of repeated implementation is reduced. The intelligent contract execution and the predictor function are executed according to the program logic sequence, and the intelligent contract virtual machine ensures the transaction atomicity and data consistency of two different types of operations. The predictor system multiplexes the consensus network of the block chain system, the treatment modes are consistent, and the matching degree is high.
It should be noted that, in the data processing method based on the blockchain provided in the embodiments of the present application, the execution subject may be a data processing device based on the blockchain, or a control module for executing the data processing method based on the blockchain in the data processing device based on the blockchain.
Based on the same inventive concept as the data processing method based on the block chain, the application also provides a data processing device based on the block chain. The blockchain-based data processing device provided in the embodiments of the present application is described in detail below with reference to fig. 3.
FIG. 3 is a schematic diagram illustrating a block chain based data processing apparatus in accordance with an exemplary embodiment. The data processing device based on the block chain is applied to a first consensus node of the block chain, wherein the first consensus node comprises a target application intelligent contract, the target application intelligent contract comprises a first business function, and the first business function is used for calling a foreshadowing machine contract.
As shown in fig. 3, the blockchain-based data processing device 300 may include:
a receiving module 310, configured to receive a target transaction request for a first target block if the first target block is constructed by a first consensus node, where the target transaction request includes a data acquisition request, the blockchain includes at least one consensus node, the at least one consensus node includes a first consensus node, and the first target block is a block to be constructed by the first consensus node that constitutes the blockchain;
the data obtaining module 320 is configured to obtain, based on the data obtaining request, data to be requested from outside, in a process of running the target application intelligent contract, and in a case where it is determined that the data to be requested to be obtained in the data obtaining request needs to invoke a foreseeing machine contract;
And the data sending module 330 is configured to feed back the data to be requested to the target application intelligent contract, so as to process the data to be requested based on the target application intelligent contract.
In the embodiment of the application, under the condition that a first target block is built by a first consensus node in a blockchain, a target transaction request aiming at the first target block is received, in the operation process of a target application intelligent contract of the first consensus node, and under the condition that the target application intelligent contract is determined to call a predictive engine contract, data to be requested can be acquired from outside based on a data acquisition request in the target transaction request, then the data to be requested is fed back to the target application intelligent contract so as to carry out subsequent processing on the data to be requested based on the target application intelligent contract, and as a first business function capable of calling the predictive engine contract is directly added in the target application intelligent contract of the existing blockchain, the predictive engine contract can be directly called in the blockchain so as to acquire the data to be requested from outside based on the predictive engine contract, so that interaction of the data to be requested in the blockchain and the predictive engine system is not needed, and consistency and authenticity of the data to be requested are ensured. In addition, the first business function capable of calling the predictive engine contract is directly added on the existing blockchain, so that a blockchain system does not need to be reconstructed, and the implementation difficulty of the blockchain system is reduced.
In some embodiments of the present application, the data acquisition request further includes: a request identifier and an acquisition address of the data to be requested, wherein the request identifier is generated for the target application intelligent contract and is used for representing a unique identifier of the data acquisition request;
the data acquisition module 320 may be specifically configured to:
acquiring the data to be requested from the outside based on the acquisition address of the data to be requested;
the data sending module 330 may specifically be configured to:
and feeding the data to be requested back to the target application intelligent contract according to the request identification.
In some embodiments of the present application, the at least one consensus node further comprises at least one second consensus node; the receiving module 310 may also be configured to:
receiving data to be requested, which corresponds to the data acquisition request and is acquired by the at least one second consensus node;
the above-mentioned apparatus may further comprise:
the determining module is used for determining that the data acquisition request passes verification under the condition that the data to be requested acquired by the first consensus node is consistent with the data to be requested acquired by the at least one second consensus node;
the determining module is further configured to determine that the first target block is completely constructed when it is determined that the number of the data acquisition requests passing the verification is greater than or equal to a preset number threshold; the preset number threshold is determined based on a preset number, wherein the preset number is the number of consensus nodes allowing the at least one consensus node to acquire the data error to be requested;
The data sending module 330 may specifically be configured to:
and feeding back the data to be requested to the target application intelligent contract under the condition that the first target block is determined to be constructed.
In some embodiments of the present application, the apparatus referred to above may further comprise:
and the processing module is used for discarding the first target block and constructing a second target block under the condition that the verification quantity of the data acquisition request is smaller than the preset quantity threshold value.
In some embodiments of the present application, the apparatus referred to above may further comprise:
the verification module is used for verifying the validity of the first target block;
the verification module is further configured to verify whether a transaction task exists in the first target block if the validity of the first target block passes;
the receiving module 310 may also be configured to:
a target transaction request is received for the first target block if it is determined that there is a transaction task in the first target block.
In some embodiments of the present application, the data acquisition module 320 may also be configured to:
and in the running process of the target application intelligent contract, acquiring the data to be requested from the blockchain under the condition that the forecasting machine contract is determined not to be required to be called.
The blockchain-based data processing device provided in the embodiments of the present application may be used to execute the blockchain-based data processing method provided in the embodiments of the methods, and its implementation principle and technical effects are similar, and for the sake of brevity, the description is omitted here.
Based on the same inventive concept, the embodiment of the application also provides electronic equipment.
Fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 4, the electronic device may include a processor 401 and a memory 402 in which computer programs or instructions are stored.
In particular, the processor 401 described above may include a Central Processing Unit (CPU), or an application specific integrated circuit (Application Specific Integrated Circuit, ASIC), or may be configured as one or more integrated circuits implementing embodiments of the present invention.
Memory 402 may include mass storage for data or instructions. By way of example, and not limitation, memory 402 may comprise a Hard Disk Drive (HDD), floppy Disk Drive, flash memory, optical Disk, magneto-optical Disk, magnetic tape, or universal serial bus (Universal Serial Bus, USB) Drive, or a combination of two or more of the foregoing. Memory 402 may include removable or non-removable (or fixed) media, where appropriate. Memory 402 may be internal or external to the integrated gateway disaster recovery device, where appropriate. In a particular embodiment, the memory 402 is a non-volatile solid state memory. The Memory may include read-only Memory (Read Only Memory image, ROM), random-Access Memory (RAM), magnetic disk storage media devices, optical storage media devices, flash Memory devices, electrical, optical, or other physical/tangible Memory storage devices. Thus, in general, the memory includes one or more tangible (non-transitory) computer-readable storage media (e.g., memory devices) encoded with software comprising computer-executable instructions and when the software is executed (e.g., by one or more processors) it is operable to perform the operations described in the blockchain-based data processing methods provided by the embodiments described above.
The processor 401 may be configured to implement any of the blockchain-based data processing methods of the above embodiments by reading and executing computer program instructions stored in the memory 402.
In one example, the electronic device may also include a communication interface 403 and a bus 410. As shown in fig. 4, the processor 401, the memory 402, and the communication interface 403 are connected by a bus 410 and perform communication with each other.
The communication interface 403 is mainly used to implement communication between each module, device, unit and/or device in the embodiment of the present invention.
Bus 410 includes hardware, software, or both, coupling components of the electronic device to one another. By way of example, and not limitation, the buses may include an Accelerated Graphics Port (AGP) or other graphics bus, an Enhanced Industry Standard Architecture (EISA) bus, a Front Side Bus (FSB), a HyperTransport (HT) interconnect, an Industry Standard Architecture (ISA) bus, an infiniband interconnect, a Low Pin Count (LPC) bus, a memory bus, a micro channel architecture (MCa) bus, a Peripheral Component Interconnect (PCI) bus, a PCI-Express (PCI-X) bus, a Serial Advanced Technology Attachment (SATA) bus, a video electronics standards association local (VLB) bus, or other suitable bus, or a combination of two or more of the above. Bus 410 may include one or more buses, where appropriate. Although embodiments of the invention have been described and illustrated with respect to a particular bus, the invention contemplates any suitable bus or interconnect.
The electronic device can execute the data processing method based on the block chain in the embodiment of the invention, thereby realizing the data processing method based on the block chain described in fig. 1.
In addition, in combination with the blockchain-based data processing method in the above embodiment, an embodiment of the present invention may be implemented by providing a readable storage medium. The readable storage medium has program instructions stored thereon; the program instructions, when executed by a processor, implement any of the blockchain-based data processing methods of the embodiments described above.
In addition, in connection with the blockchain-based data processing method of the above embodiments, embodiments of the present invention may provide a computer program product, which when executed by a processor of an electronic device, causes the electronic device to perform any of the blockchain-based data processing methods of the above embodiments.
It should be understood that the invention is not limited to the particular arrangements and instrumentality described above and shown in the drawings. For the sake of brevity, a detailed description of known methods is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method processes of the present invention are not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between steps, after appreciating the spirit of the present invention.
The functional blocks shown in the above-described structural block diagrams may be implemented in hardware, software, firmware, or a combination thereof. When implemented in hardware, it may be, for example, an electronic circuit, an Application Specific Integrated Circuit (ASIC), suitable firmware, a plug-in, a function card, or the like. When implemented in software, the elements of the invention are the programs or code segments used to perform the required tasks. The program or code segments may be stored in a machine readable medium or transmitted over transmission media or communication links by a data signal carried in a carrier wave. A "machine-readable medium" may include any medium that can store or transfer information. Examples of machine-readable media include electronic circuitry, semiconductor memory devices, ROM, flash memory, erasable ROM (EROM), floppy disks, CD-ROMs, optical disks, hard disks, fiber optic media, radio Frequency (RF) links, and the like. The code segments may be downloaded via computer networks such as the internet, intranets, etc.
It should also be noted that the exemplary embodiments mentioned in this disclosure describe some methods or systems based on a series of steps or devices. However, the present invention is not limited to the order of the above-described steps, that is, the steps may be performed in the order mentioned in the embodiments, or may be performed in a different order from the order in the embodiments, or several steps may be performed simultaneously.
Aspects of the present application are described above with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, enable the implementation of the functions/acts specified in the flowchart and/or block diagram block or blocks. Such a processor may be, but is not limited to being, a general purpose processor, a special purpose processor, an application specific processor, or a field programmable logic circuit. It will also be understood that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware which performs the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In the foregoing, only the specific embodiments of the present invention are described, and it will be clearly understood by those skilled in the art that, for convenience and brevity of description, the specific working processes of the systems, modules and units described above may refer to the corresponding processes in the foregoing method embodiments, which are not repeated herein. It should be understood that the scope of the present invention is not limited thereto, and any equivalent modifications or substitutions can be easily made by those skilled in the art within the technical scope of the present invention, and they should be included in the scope of the present invention.

Claims (10)

1. A method for processing data based on a blockchain, the method being applied to a first consensus node of the blockchain, the first consensus node including a target application intelligent contract including a first business function for invoking a predictor contract, the method comprising:
receiving a target transaction request for a first target block under the condition that the first consensus node builds the first target block, wherein the target transaction request comprises a data acquisition request, the blockchain comprises at least one consensus node, the at least one consensus node comprises the first consensus node, and the first target block is one block which is to be built by the first consensus node and forms the blockchain;
acquiring the data to be requested from the outside based on the data acquisition request under the condition that the data to be requested, which is acquired in the data acquisition request, is determined to need to call a foreseeing machine contract in the running process of the target application intelligent contract;
and feeding the data to be requested back to the target application intelligent contract so as to process the data to be requested based on the target application intelligent contract.
2. The method of claim 1, wherein the data acquisition request further comprises: a request identifier and an acquisition address of the data to be requested, wherein the request identifier is generated for the target application intelligent contract and is used for representing a unique identifier of the data acquisition request;
the obtaining the data to be requested from the outside based on the data obtaining request includes:
acquiring the data to be requested from the outside based on the acquisition address of the data to be requested;
the feeding back the data to be requested to the target application intelligent contract comprises the following steps:
and feeding the data to be requested back to the target application intelligent contract according to the request identification.
3. The method of claim 1, wherein the at least one consensus node further comprises at least one second consensus node;
after the externally acquiring the data to be requested, the method further includes:
receiving data to be requested, which corresponds to the data acquisition request and is acquired by the at least one second consensus node;
under the condition that the data to be requested acquired by the first consensus node is consistent with the data to be requested acquired by the at least one second consensus node, the data acquisition request is determined to pass verification;
Under the condition that the number of the data acquisition requests passing verification is larger than or equal to a preset number threshold, determining that the first target block is constructed; the preset number threshold is determined based on a preset number, wherein the preset number is the number of consensus nodes allowing the at least one consensus node to acquire the data error to be requested;
the feeding back the data to be requested to the target application intelligent contract comprises the following steps:
and feeding back the data to be requested to the target application intelligent contract under the condition that the first target block is determined to be constructed.
4. A method according to claim 3, wherein after said determining that said data acquisition request is authenticated, said method further comprises:
and discarding the first target block and constructing a second target block under the condition that the number of the data acquisition requests passing verification is smaller than the preset number threshold.
5. The method of claim 1, wherein prior to the receiving the target transaction request for the first target block, the method further comprises:
verifying the validity of the first target block;
Verifying whether a transaction task exists in the first target block under the condition that the legitimacy of the first target block passes;
the receiving a target transaction request for the first target block includes:
a data acquisition request is received for the first target block if it is determined that there is a transaction task in the first target block.
6. The method according to any one of claims 1-5, further comprising:
and acquiring the data to be requested from the blockchain in the running process of the intelligent contract of the target application and under the condition that the prediction machine contract is determined not to be required to be called.
7. A blockchain-based data processing device, wherein the device is applied to a first consensus node of the blockchain, the first consensus node including a target application smart contract therein, the target application smart contract including a first business function therein, the first business function being used to invoke a predictor contract, the device comprising:
a receiving module, configured to receive a target transaction request for a first target block under a condition that the first target block is constructed by a first consensus node, where the target transaction request includes a data acquisition request, the blockchain includes at least one consensus node, the at least one consensus node includes a first consensus node, and the first target block is a block to be constructed by the first consensus node that constitutes the blockchain;
The data acquisition module is used for acquiring the data to be requested from the outside based on the data acquisition request under the condition that the data to be requested, which is to be acquired in the data acquisition request, is determined to need to call a foreseeing machine contract in the running process of the target application intelligent contract;
and the data sending module is used for feeding the data to be requested back to the target application intelligent contract so as to process the data to be requested based on the target application intelligent contract.
8. An electronic device, the electronic device comprising: a processor and a memory storing computer program instructions; the processor, when executing the computer program instructions, implements a blockchain-based data processing method as defined in any of claims 1-6.
9. A computer readable storage medium having stored thereon computer program instructions which when executed by a processor implement the blockchain-based data processing method of any of claims 1-6.
10. A computer program product, characterized in that instructions in the computer program product, when executed by a processor of an electronic device, cause the electronic device to perform the blockchain-based data processing method according to any of claims 1-6.
CN202311458468.0A 2023-11-03 2023-11-03 Block chain-based data processing method, apparatus, device, medium and product Pending CN117539955A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311458468.0A CN117539955A (en) 2023-11-03 2023-11-03 Block chain-based data processing method, apparatus, device, medium and product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311458468.0A CN117539955A (en) 2023-11-03 2023-11-03 Block chain-based data processing method, apparatus, device, medium and product

Publications (1)

Publication Number Publication Date
CN117539955A true CN117539955A (en) 2024-02-09

Family

ID=89785257

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311458468.0A Pending CN117539955A (en) 2023-11-03 2023-11-03 Block chain-based data processing method, apparatus, device, medium and product

Country Status (1)

Country Link
CN (1) CN117539955A (en)

Similar Documents

Publication Publication Date Title
CN109741056B (en) Method and device for uploading electronic certificate
CN111163129B (en) Resource processing method and device based on cross-link network
CN110570196B (en) Transaction data processing method, device, terminal equipment and storage medium
JP2021500816A (en) Vehicle-mounted equipment upgrade method and related equipment
CN112084234B (en) Data acquisition method, device, equipment and medium
CN111177225B (en) Account state existence proving method and device and state inquiring method and device
CN111008206A (en) Method and device for storing state data of cross-chain transaction and storage medium
CN113055497A (en) Method, device and system for uplink of data outside block chain network
CN111897826A (en) Parameter information updating method and device, electronic equipment and readable storage medium
CN112037062B (en) Transaction consensus method, device, electronic equipment and readable storage medium
CN116933702B (en) Verification method, verification device, electronic equipment and readable storage medium
CN117539955A (en) Block chain-based data processing method, apparatus, device, medium and product
CN109348451A (en) The storage method and device of vehicle auxiliary transmission record
CN114092093B (en) Block chain transaction processing method and device, electronic equipment and readable medium
CN116009940A (en) Method, device, computer equipment and medium for changing consensus cluster
CN113411198B (en) Communication method and device based on dual channels and RSSP-I, electronic equipment and storage medium
CN112950349B (en) Method and system for processing base distributed system flushing quadrature easy time sequence exception
CN108710557B (en) Method and system for judging data consistency of distributed software program
CN115118727B (en) Data transmission method, device, equipment and storage medium of distributed computing architecture
CN115379009B (en) Data processing method, device, equipment and medium
CN116471119B (en) Signature verification method and device based on rs and sign
CN118012913A (en) Method, device, equipment, medium and product for determining stream engine calculation result
CN115794796A (en) Data verification method, device, equipment, medium and product
CN117354007A (en) Isomorphic cross-chain method, isomorphic cross-chain device, isomorphic cross-chain equipment and isomorphic cross-chain medium
CN116028985A (en) Calculation force verification method, device and system

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