Blockchain-based data processing method, device, node device and storage medium

By receiving transaction requests in the blockchain network, obtaining and running matching smart contract execution functions to process data when data is released, the problem of low efficiency of blockchain data processing is solved, anonymous smart contracts are realized, and blockchain is improved safety and efficiency.

CN110955724BActive Publication Date: 2024-11-08TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN201911148907.1
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-11-21
Publication Date
2024-11-08
Estimated Expiration
2039-12-17

AI Technical Summary

Technical Problem

Blockchain technology has problems such as low scalability in data processing efficiency and security, inadequate open source projects, and low data processing efficiency.

Method used

By receiving the client's transaction request, obtaining the smart contract execution function matching the request, adding it to the transaction data, and running these functions to process the transaction data when the data is published to the blockchain, thereby improving the data processing efficiency, and through Do not publish smart contracts to the blockchain network to realize anonymous smart contracts, improving security.

Benefits of technology

Save time to obtain execution functions, improve data processing efficiency, and reduce network resource consumption by avoiding smart contract release, enhancing the security of blockchain.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN110955724B_ABST
    Figure CN110955724B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention provides a data processing method, device, node device and storage medium based on blockchain, wherein the method comprises: receiving a transaction request sent by a client, wherein the transaction request comprises transaction data; obtaining an execution function of a smart contract matching the transaction request; adding the execution function to the transaction data to obtain target data; publishing the target data to blockchain, and running the execution function in the target data during the publishing process to process the transaction data. The embodiment of the present invention can effectively improve data processing efficiency and blockchain security.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data processing technology, and in particular to a data processing method, an apparatus, a node device and a storage medium based on blockchain. Background Art

[0002] Blockchain technology has the characteristics of decentralization, block data is basically tamper-proof, and trustlessness. It is considered to be a subversion of the computer model after the Internet. However, blockchain technology still has problems such as low scalability, immature open source projects, and low data processing efficiency. Therefore, how to improve the efficiency of data processing in the blockchain network is an urgent problem to be solved. Summary of the invention

[0003] The embodiments of the present invention provide a data processing method, an apparatus, a node device and a storage medium based on blockchain, which can effectively improve data processing efficiency and blockchain security.

[0004] On the one hand, an embodiment of the present invention provides a data processing method based on blockchain, the method comprising:

[0005] receiving a transaction request sent by a client, wherein the transaction request includes transaction data;

[0006] Obtaining an execution function of a smart contract that matches the transaction request;

[0007] Adding the execution function to the transaction data to obtain target data;

[0008] The target data is published to the blockchain, and during the publishing process, an execution function in the target data is run to process the transaction data.

[0009] In one embodiment, obtaining the execution function of the smart contract that matches the transaction request includes: detecting the transaction category to which the transaction data belongs; and obtaining the execution function of the smart contract that matches the transaction category.

[0010] In one embodiment, obtaining the execution function of the smart contract that matches the transaction category includes: determining a target identifier of the execution function that matches the transaction category to which the transaction data belongs based on a mapping relationship between the stored transaction category and the execution function identifier of the smart contract; and obtaining an execution function that matches the target identifier from a plurality of execution functions of the stored smart contract.

[0011] In one embodiment, before obtaining the execution function of the smart contract that matches the transaction request, the method also includes: obtaining the data size of the execution function of the smart contract that matches the transaction request; detecting whether the data size is less than or equal to a preset value; if the data size is less than or equal to the preset value, triggering the step of obtaining the execution function of the smart contract that matches the transaction request.

[0012] In one embodiment, the method further includes: if the data size is greater than the preset value, obtaining a target identifier of the execution function and adding the target identifier to the transaction data; publishing the transaction data with the added target identifier to the blockchain, and in the publishing process, calling and executing a matching execution function according to the target identifier to process the transaction data.

[0013] In one embodiment, the transaction request includes a fund transaction request, the execution function includes a fund transaction function, and the transaction data includes a payment blockchain account, a transaction amount, and a receiving blockchain account; the target data is published to the blockchain, and the execution function in the target data is run during the publishing process to process the transaction data, including: publishing the target data to the blockchain, and obtaining the fund balance of the payment blockchain account during the publishing process, and detecting whether the fund balance is greater than or equal to the transaction amount; when the fund balance is greater than or equal to the transaction amount, running the fund transaction function in the target transaction data to transfer the value corresponding to the transaction amount from the payment blockchain account to the receiving blockchain account.

[0014] In one embodiment, before obtaining the execution function of the smart contract that matches the transaction request, the method also includes: detecting whether the client has the authority to execute the transaction requested by the transaction request; if the client has the authority to execute the transaction requested by the transaction request, triggering the step of executing the execution function of the smart contract that matches the transaction request.

[0015] On the other hand, an embodiment of the present invention provides a data processing device based on blockchain, the device comprising:

[0016] A transceiver unit, configured to receive a transaction request sent by a client, wherein the transaction request includes transaction data;

[0017] An acquisition unit, used to acquire an execution function of a smart contract matching the transaction request;

[0018] A processing unit, used for adding the execution function to the transaction data to obtain target data;

[0019] The processing unit is further used to publish the target data to the blockchain, and to run the execution function in the target data to process the transaction data during the publishing process.

[0020] On the other hand, an embodiment of the present invention provides a node device, including: a processor, a communication interface and a memory, wherein the processor, the communication interface and the memory are interconnected, wherein the memory stores an executable program code, and the processor is used to call the executable program code to execute the above-mentioned blockchain-based data processing method.

[0021] Correspondingly, an embodiment of the present invention also provides a storage medium, which stores instructions, and when the storage medium is run on a computer, it enables the computer to execute the above-mentioned blockchain-based data processing method.

[0022] The embodiment of the present invention obtains the execution function of the smart contract that matches the transaction request, adds the execution function to the transaction data included in the transaction request to obtain the target data, and runs the execution function to process the transaction data in the process of publishing the target data to the blockchain. On the one hand, it can save the time of obtaining the matching execution function in the chain process and effectively improve the data processing efficiency; on the other hand, there is no need to publish the smart contract to the blockchain network, thereby realizing anonymous smart contracts and improving the security of the blockchain. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0024] Figure 1 This is a schematic diagram of the architecture of a blockchain network provided by an embodiment of the present invention;

[0025] Figure 2 is a schematic diagram of the architecture of a data processing system provided by an embodiment of the present invention;

[0026] Figure 3 It is a schematic diagram of the structure of a blockchain block provided by an embodiment of the present invention;

[0027] Figure 4 It is a flowchart of a data processing method based on blockchain provided by an embodiment of the present invention;

[0028] Figure 5 It is a structural schematic diagram of a blockchain-based data processing device provided by an embodiment of the present invention;

[0029] Figure 6 It is a structural diagram of a node device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0030] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.

[0031] With the advent of the technological era and the development of mobile Internet, the pace of network change is getting faster and faster. The process of realizing information integration in the same field or multiple fields and providing customers with all-round information solutions is also facing new challenges such as system architecture improvement and support focus shift. Therefore, blockchain technology, as a specific implementation of distributed ledgers, has gradually become the preferred way to store and trade data in various fields with its natural advantages in storing and managing data.

[0032] by Figure 1 The following is an example of the schematic diagram of the blockchain network architecture shown in FIG. Figure 1 As shown, the node devices in the blockchain network may include banks, insurance companies, government buildings, shops, schools, and hospitals. Banks, insurance companies, government buildings, shops, schools, and hospitals all participate in the management and processing of the same blockchain network, and can also participate in supervising the legality of transactions to achieve fairness in the blockchain network's processing or storage of transaction data. At the same time, the above-mentioned banks, insurance companies, government buildings, shops, schools, and hospitals all belong to different fields, and the information fusion and interaction of different fields can better improve the quality and efficiency of social work. Any node device in the blockchain network can verify the acquired transaction data. When the verification result is successful, a block can be generated based on the transaction data (such as Figure 1 The block shown in the figure is published to the blockchain so that other node devices in the blockchain network can perform distributed storage on the block. Figure 1 As shown, the node devices in the blockchain network may include banks, insurance companies, government buildings, shops, schools and hospitals, and banks, insurance companies, government buildings, shops, schools and hospitals may perform distributed storage of the identity information of the same user A, so the user A may query his or her own identity information at any institution.

[0033] like Figure 2 As shown in FIG. 1 , a data processing system provided by an embodiment of the present invention can be a distributed system formed by connecting a client and multiple node devices (any form of computing devices in the access network, such as a server and a user terminal) through network communication. The client can also be a node device in a blockchain network. The distributed system can be a blockchain system, see Figure 2 , Figure 2 It is an optional architecture diagram of the data processing system provided by the embodiment of the present invention applied to the blockchain system (or blockchain network), which is formed by a client and multiple node devices. The node devices form a peer-to-peer (P2P) network, and the P2P protocol is an application layer protocol running on the Transmission Control Protocol (TCP) protocol. In a distributed system, any machine such as a server or a terminal can join and become a node, and the node includes a hardware layer, an intermediate layer, an operating system layer, and an application layer.

[0034] See also Figure 2 The functions of each node in the blockchain system shown include:

[0035] 1) Routing: a basic function of a node, used to support communication between nodes.

[0036] In addition to the routing function, the node can also have the following functions:

[0037] 2) Blockchain, including a series of blocks that are connected to each other in the order of their generation. Once a new block is added to the blockchain, it will not be removed. The block records the record data submitted by the nodes in the blockchain system.

[0038] See also Figure 3 , Figure 3 This is an optional schematic diagram of the block structure provided by an embodiment of the present invention. Each block includes the hash value of the data record stored in this block (the hash value of this block) and the hash value of the previous block. Each block is connected by the hash value to form a blockchain. In addition, the block can also include information such as the timestamp when the block was generated. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains relevant information for verifying the validity of its information (anti-counterfeiting) and generating the next block.

[0039] 3) Applications are deployed in the blockchain to implement specific businesses based on actual business needs, record data related to the implementation of functions to form record data, carry digital signatures in the record data to indicate the source of the task data, and send the record data to other nodes in the blockchain system for other nodes to add the record data to a temporary block when they successfully verify the source and integrity of the record data.

[0040] For example, the services implemented by the application include:

[0041] 3.1) Wallet, used to provide the function of conducting electronic currency transactions, including initiating transactions (i.e., sending the transaction record of the current transaction to other nodes in the blockchain system. After the other nodes successfully verify the transaction, as a response to acknowledge the validity of the transaction, the transaction record data is stored in the temporary block of the blockchain; of course, the wallet also supports querying the remaining electronic currency in the electronic currency address;

[0042] 3.2) Shared ledger, which is used to provide functions such as storage, query and modification of account data. The record data of the operation on the account data is sent to other nodes in the blockchain system. After other nodes verify the validity, as a response to acknowledging the validity of the account data, the record data is stored in a temporary block, and a confirmation can also be sent to the node that initiated the operation.

[0043] 3.3) Smart contracts are computerized protocols that can execute the terms of a contract. They are implemented by deploying code on a shared ledger that is executed when certain conditions are met. The code is used to complete automated transactions based on actual business needs, such as querying the logistics status of the goods purchased by the buyer and transferring the buyer's electronic currency to the merchant's address after the buyer signs for the goods. Of course, smart contracts are not limited to executing contracts for transactions, but can also execute contracts for processing received information.

[0044] In the current blockchain architecture, developers first define the contract logic through a certain programming language to generate a smart contract, where the smart contract includes a variety of execution functions, each of which is used to implement a specific function; the smart contract encapsulates a number of predefined states, conversion rules, trigger conditions, and corresponding operations; then the smart contract is published on the blockchain (contract registration), and after being signed by all parties, it is attached to the blockchain data in the form of program code, and after being propagated and verified by the blockchain network, it is recorded in the distributed ledger of each node. The blockchain can monitor the status of the entire smart contract in real time, and activate and execute the contract after confirming that the specific trigger conditions are met. It can be seen that in the current method, the smart contract needs to be published on the blockchain first, and then after the trigger conditions are met, the matching execution function in the smart contract is called and run to process the transaction data. On the one hand, the smart contract is named, which will affect the security of the blockchain to a certain extent, and the publishing process of the smart contract is cumbersome and will consume a lot of network resources; on the other hand, the process of calling the execution function of the smart contract will take a long time and reduce the processing efficiency of transaction data.

[0045] Based on this, an embodiment of the present invention provides a data processing method based on blockchain, including the following steps: receiving a transaction request sent by a client, the transaction request including transaction data; obtaining the execution function of the smart contract matching the transaction request; and adding the obtained execution function to the transaction data to obtain the target data; publishing the target data to the blockchain, and running the execution function in the target data during the publishing process to process the transaction data. Through the above method, on the one hand, the time for obtaining the matching execution function during the chaining process can be saved, and the data processing efficiency can be effectively improved; on the other hand, there is no need to publish the smart contract to the blockchain network, so that anonymous smart contracts can be realized and the security of the blockchain can be improved, which is described in detail below.

[0046] See also Figure 4 , Figure 4 A flowchart of a data processing method based on blockchain provided in an embodiment of the present invention. The data processing method based on blockchain described in an embodiment of the present invention can be applied to a node device, and the node device can be Figure 2 Any node device of the blockchain network in the data processing system shown. In other embodiments, the node device is an optimal node device determined based on the load status, response time and distance between each node device in the blockchain network and the client. The blockchain-based data processing method described in the embodiment of the present invention includes:

[0047] S401: Receive a transaction request sent by a client, where the transaction request includes transaction data.

[0048] In the embodiment of the present invention, transaction data is data required to be used in the execution process of the transaction requested by the transaction request; the transaction request may be a data modification request, a data read request, a data write request, etc. In one embodiment, the transaction request may be a fund transaction request, and the transaction data includes a payment blockchain account, a transaction amount, a payment blockchain account, etc. After receiving the transaction request sent by the client, the node device obtains the transaction data carried by the transaction request.

[0049] S402: Obtain an execution function of a smart contract that matches the transaction request.

[0050] In the embodiment of the present invention, the node device stores multiple execution functions of the smart contract, and stores the mapping relationship between various transaction requests and the execution function identifiers of the smart contract; the node device determines the target identifier of the execution function that matches the transaction request it receives according to the mapping relationship, and obtains the execution function that matches the target identifier from the multiple execution functions of the smart contract stored in it. For example, the transaction request is a capital transaction request, and the execution function required to execute the capital transaction is a capital transaction function, and the capital transaction function includes a capital data modification function, a capital data reading function, etc.; the node device obtains the above-mentioned capital data modification function, capital data reading function, etc. from the multiple execution functions stored in it.

[0051] In other embodiments, the node device obtains the execution function of the smart contract that matches the transaction request in the following manner: detecting the transaction category to which the transaction data belongs, and obtaining the execution function of the smart contract that matches the transaction category; using the obtained execution function as the execution function that matches the transaction request. In one embodiment, the node device stores multiple execution functions of smart contracts, and stores the mapping relationship between various transaction categories and the execution function identifiers of smart contracts; the node device determines the target identifier of the execution function that matches the transaction category to which the transaction data belongs based on the mapping relationship, and obtains the execution function that matches the target identifier from the multiple execution functions of the smart contract stored therein.

[0052] In one embodiment, before the node device obtains the smart contract execution function that matches the transaction request, it first obtains the data size of the smart contract execution function that matches the transaction request, and detects whether the data size is less than or equal to a preset value; if it is detected that the data size is less than or equal to the preset value, then steps S402 to S404 are executed. If it is detected that the data size is greater than the preset value, the target identifier of the smart contract execution function that matches the transaction request is obtained, and the target identifier is added to the transaction data; then the transaction data with the added target identifier is published to the blockchain, and the execution function that matches the target identifier is called and executed during the publishing process to process the transaction data. By adopting the above method, when the data size of the obtained execution function exceeds a certain value, only the identifier of the execution function is added to the transaction data, which can reduce the amount of data on the blockchain to a certain extent and save storage resources.

[0053] In another embodiment, before the node device obtains the smart contract execution function that matches the transaction request, it detects whether the client has the authority to execute the transaction requested by the transaction request; if it is detected that the client has the authority to execute the transaction requested by the transaction request, steps S402 to S404 are executed. If it is detected that the client does not have the authority to execute the transaction requested by the transaction request, the node device publishes the transaction request to the blockchain, and broadcasts a message that the transaction request does not have the authority to the nodes in the blockchain network, and / or adds an unauthorized identifier to the transaction request in the blockchain network. The above method is conducive to the subsequent rapid verification of whether the transaction requested by the transaction request has been executed.

[0054] S403: Add the execution function to the transaction data to obtain target data.

[0055] In an embodiment of the present invention, there are one or more execution functions of the smart contract that matches the transaction request. In one embodiment, when there are multiple execution functions of the smart contract that matches the transaction request, the node device obtains the running order of the multiple execution functions in the subsequent processing of the transaction data, and adds the multiple execution functions to the target data in sequence according to the running order, so that the multiple execution functions are also arranged in the target data according to the running order. The above method is conducive to quickly finding the corresponding execution function when the multiple execution functions are subsequently run, and to a certain extent, further improves the data processing efficiency of the blockchain.

[0056] S404: Publish the target data to the blockchain, and run the execution function in the target data during the publishing process to process the transaction data.

[0057] In an embodiment of the present invention, the node device generates a block according to the target data, publishes the generated block to the blockchain, and runs the execution function in the target data to process the transaction data in the process of publishing the block to the blockchain. In the above manner, the node device can directly run the execution function in the target data to process the transaction data during the data on-chain process. Compared with the current method of obtaining the matching execution function from the underlying smart contract module during the data on-chain process, this solution can save the time of obtaining the matching execution function during the data on-chain process, thereby improving the processing efficiency of transaction data. In addition, the execution function of the smart contract in this solution does not need to be published to the blockchain network, which can not only save the network resources consumed by publishing the smart contract, but also realize anonymous smart contracts, thereby improving the security of the blockchain to a certain extent.

[0058] In one embodiment, the transaction request includes a fund transaction request, the execution function includes a fund transaction function, and the transaction data includes a payment blockchain account, a transaction amount, and a payment blockchain account; the node device publishes the target data to the blockchain, and obtains the fund balance of the payment blockchain account during the publishing process, and detects whether the fund balance is greater than or equal to the transaction amount; when the fund balance is greater than or equal to the transaction amount, the fund transaction function in the target transaction data is run to transfer the value corresponding to the transaction amount from the payment blockchain account to the payment blockchain account. When the fund balance is less than the transaction amount, the node device cancels the operation of publishing the target data to the blockchain and sends a prompt message of transaction failure to the client. In other embodiments, after the node device cancels the operation of publishing the target data to the blockchain, the transaction request is published to the blockchain, and the message that the transaction request is not responded to is broadcast to the nodes in the blockchain network, and / or, an unresponsive mark is added to the transaction request in the blockchain network. Through the above method, it is conducive to the subsequent rapid verification of whether the transaction requested by the transaction request has been executed.

[0059] In one embodiment, before obtaining the fund balance of the payment blockchain account, the node device may also first detect whether the transaction amount exceeds the limit of the payment blockchain account, which limit may be the limit of a single transaction amount, or the limit of a single-day transaction amount, etc. If it is detected that the transaction amount does not exceed the limit of the payment blockchain account, the step of obtaining the fund balance of the payment blockchain account is performed. If it is detected that the transaction amount exceeds the limit of the payment blockchain account, the node device cancels the operation of publishing the target data to the blockchain and sends a prompt message of transaction failure to the client. In other embodiments, after the node device cancels the operation of publishing the target data to the blockchain, the transaction request is published to the blockchain, and the message that the transaction request has not been responded to is broadcast to the nodes in the blockchain network, and / or, an unresponsive mark is added to the transaction request in the blockchain network. Through the above method, it is conducive to the subsequent rapid verification of whether the transaction requested by the transaction request has been executed.

[0060] In another embodiment, the transaction request includes a data query request, the execution function includes a data query function, and the transaction data includes a query keyword; the node device publishes the target data to the blockchain, and runs the data query function in the target transaction data during the publishing process to query the information matching the keyword. For example, the data query request is a logistics information query request, the data query function is a logistics information query function, and the query keyword is a logistics order number. In the process of publishing the target data to the blockchain, the logistics information query function is run to query the logistics information matching the logistics order number.

[0061] In another embodiment, the transaction request includes a temperature control request, the execution function includes a temperature control function, and the transaction data includes a control object and a set value; the node device adjusts the temperature setting value of the control object to the set value by running the temperature control function. It should be noted that the above process is a way to combine blockchain with the Internet of Things and use the execution function of smart contracts to achieve intelligent automation in the field of smart homes. Other methods such as humidity, brightness, opening, closing, unlocking, etc. are similar and will not be repeated here.

[0062] The embodiment of the present invention obtains the execution function of the smart contract that matches the transaction request, adds the execution function to the transaction data included in the transaction request to obtain the target data, and runs the execution function to process the transaction data in the process of publishing the target data to the blockchain. On the one hand, it can save the time of obtaining the matching execution function in the chain process and effectively improve the data processing efficiency; on the other hand, there is no need to publish the smart contract to the blockchain network, thereby realizing anonymous smart contracts and improving the security of the blockchain.

[0063] See also Figure 5 , Figure 5 A schematic diagram of the structure of a blockchain-based data processing device provided in an embodiment of the present invention. The blockchain-based data processing device described in an embodiment of the present invention is applied to the node device in the above method embodiment, and the device includes:

[0064] The transceiver unit 501 is used to receive a transaction request sent by a client, wherein the transaction request includes transaction data;

[0065] An acquisition unit 502 is used to acquire an execution function of a smart contract that matches the transaction request;

[0066] The processing unit 503 is used to add the execution function to the transaction data to obtain target data;

[0067] The processing unit 503 is further used to publish the target data to the blockchain, and to run the execution function in the target data to process the transaction data during the publishing process.

[0068] In one embodiment, when the acquisition unit 502 acquires the execution function of the smart contract that matches the transaction request, it is specifically used to: detect the transaction category to which the transaction data belongs; and acquire the execution function of the smart contract that matches the transaction category.

[0069] In one embodiment, when the acquisition unit 502 acquires the execution function of the smart contract that matches the transaction category, it is specifically used to: determine the target identifier of the execution function that matches the transaction category to which the transaction data belongs based on the mapping relationship between the stored transaction category and the execution function identifier of the smart contract; and acquire the execution function that matches the target identifier from the multiple execution functions of the stored smart contract.

[0070] In one embodiment, the acquisition unit 502 is further used to acquire the data size of the execution function of the smart contract matching the transaction request;

[0071] The processing unit 503 is further used to detect whether the data size is less than or equal to a preset value. If the data size is less than or equal to the preset value, the acquisition unit 502 is triggered to acquire the execution function of the smart contract matching the transaction request.

[0072] In one embodiment, the processing unit 503 is further used to: if the data size is greater than the preset value, trigger the acquisition unit 502 to acquire the target identifier of the execution function; add the target identifier to the transaction data; publish the transaction data with the target identifier added to the blockchain, and call and execute the matching execution function according to the target identifier during the publishing process to process the transaction data.

[0073] In one embodiment, the transaction request includes a fund transaction request, the execution function includes a fund transaction function, and the transaction data includes a payment blockchain account, a transaction amount, and a payment blockchain account;

[0074] When the processing unit 503 publishes the target data to the blockchain and runs the execution function in the target data to process the transaction data during the publishing process, it is specifically used to:

[0075] Publishing the target data to the blockchain, obtaining the fund balance of the payment blockchain account during the publishing process, and detecting whether the fund balance is greater than or equal to the transaction amount;

[0076] When the fund balance is greater than or equal to the transaction amount, the fund transaction function in the target transaction data is executed to transfer the value corresponding to the transaction amount from the payment blockchain account to the payment collection blockchain account.

[0077] In one embodiment, the processing unit 503 is further used to: detect whether the client has the authority to execute the transaction requested by the transaction request; if the client has the authority to execute the transaction requested by the transaction request, trigger the acquisition unit 502 to obtain the execution function of the smart contract that matches the transaction request.

[0078] It can be understood that the functions of each functional unit of the blockchain-based data processing device described in the embodiment of the present invention can be specifically implemented according to the method in the above method embodiment, and its specific implementation process can refer to the relevant description of the above method embodiment, which will not be repeated here.

[0079] The embodiment of the present invention obtains the execution function of the smart contract that matches the transaction request, adds the execution function to the transaction data included in the transaction request to obtain the target data, and runs the execution function to process the transaction data in the process of publishing the target data to the blockchain. On the one hand, it can save the time of obtaining the matching execution function in the chain process and effectively improve the data processing efficiency; on the other hand, there is no need to publish the smart contract to the blockchain network, thereby realizing anonymous smart contracts and improving the security of the blockchain.

[0080] See also Figure 6 , Figure 6 A schematic diagram of the structure of a node device provided in an embodiment of the present invention. The node device described in the embodiment of the present invention includes: a processor 601, a communication interface 602 and a memory 603. The processor 601, the communication interface 602 and the memory 603 can be connected via a bus or other means, and the embodiment of the present invention takes the connection via a bus as an example.

[0081] Among them, the processor 601 (or CPU (Central Processing Unit)) is the computing core and control core of the node device, which can parse various instructions in the node device and process various data of the node device. For example, the CPU can transmit various interactive data between the internal structures of the node device, and so on. The communication interface 602 may optionally include a standard wired interface, a wireless interface (such as Wi-Fi, a mobile communication interface, etc.), which is controlled by the processor 601 for sending and receiving data. The memory 603 (Memory) is a memory device in the node device for storing programs and data. It can be understood that the memory 603 here can include both the built-in memory of the node device and the extended memory supported by the node device. The memory 603 provides a storage space, which stores the operating system of the node device, and may include but is not limited to: Android system, iOS system, Windows Phone system, etc., and the present invention is not limited to this.

[0082] In the embodiment of the present invention, the processor 601 performs the following operations by running the executable program code in the memory 603:

[0083] A transaction request sent by a client is received through the communication interface 602, wherein the transaction request includes transaction data; an execution function of a smart contract matching the transaction request is obtained; the execution function is added to the transaction data to obtain target data; the target data is published to the blockchain, and during the publishing process, the execution function in the target data is run to process the transaction data.

[0084] In one embodiment, when the processor 601 obtains the execution function of the smart contract that matches the transaction request, it is specifically used to: detect the transaction category to which the transaction data belongs; and obtain the execution function of the smart contract that matches the transaction category.

[0085] In one embodiment, when the processor 601 obtains the execution function of the smart contract that matches the transaction category, it is specifically used to: determine the target identifier of the execution function that matches the transaction category to which the transaction data belongs based on the mapping relationship between the stored transaction category and the execution function identifier of the smart contract; and obtain the execution function that matches the target identifier from the multiple execution functions of the stored smart contract.

[0086] In one embodiment, before the processor 601 obtains the execution function of the smart contract that matches the transaction request, it is also used to: obtain the data size of the execution function of the smart contract that matches the transaction request; detect whether the data size is less than or equal to a preset value; if the data size is less than or equal to the preset value, execute the step of obtaining the execution function of the smart contract that matches the transaction request and its subsequent steps.

[0087] In one embodiment, the processor 601 is further used to: if the data size is greater than the preset value, obtain the target identifier of the execution function and add the target identifier to the transaction data; publish the transaction data with the added target identifier to the blockchain, and during the publishing process, call and execute the matching execution function according to the target identifier to process the transaction data.

[0088] In one embodiment, the transaction request includes a fund transaction request, the execution function includes a fund transaction function, and the transaction data includes a payment blockchain account, a transaction amount, and a payment blockchain account;

[0089] When the processor 601 publishes the target data to the blockchain and runs the execution function in the target data to process the transaction data during the publishing process, it is specifically used to: publish the target data to the blockchain, obtain the fund balance of the payment blockchain account during the publishing process, and detect whether the fund balance is greater than or equal to the transaction amount; when the fund balance is greater than or equal to the transaction amount, run the fund transaction function in the target transaction data to transfer the value corresponding to the transaction amount from the payment blockchain account to the receiving blockchain account.

[0090] In one embodiment, before the processor 601 obtains the execution function of the smart contract that matches the transaction request, it is also used to: detect whether the client has the authority to execute the transaction requested by the transaction request; if the client has the authority to execute the transaction requested by the transaction request, execute the step of obtaining the execution function of the smart contract that matches the transaction request and subsequent steps.

[0091] In a specific implementation, the processor 601, the communication interface 602, and the memory 603 described in the embodiment of the present invention can execute the implementation method of the node device described in a blockchain-based data processing method provided in an embodiment of the present invention, and can also execute the implementation method described in a blockchain-based data processing device provided in an embodiment of the present invention, which will not be repeated here.

[0092] The embodiment of the present invention obtains the execution function of the smart contract that matches the transaction request, adds the execution function to the transaction data included in the transaction request to obtain the target data, and runs the execution function to process the transaction data in the process of publishing the target data to the blockchain. On the one hand, it can save the time of obtaining the matching execution function in the chain process and effectively improve the data processing efficiency; on the other hand, there is no need to publish the smart contract to the blockchain network, thereby realizing anonymous smart contracts and improving the security of the blockchain.

[0093] An embodiment of the present invention also provides a computer-readable storage medium, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the blockchain-based data processing method as described in the embodiment of the present invention.

[0094] An embodiment of the present invention also provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to execute the blockchain-based data processing method as described in the embodiment of the present invention.

[0095] It should be noted that, for the above-mentioned various method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0096] A person skilled in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

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

Claims

1. A data processing method based on blockchain, characterized in that: The method comprises: receiving a transaction request sent by a client, wherein the transaction request includes transaction data; Obtaining the data size of the execution function of the smart contract matching the transaction request; Detecting whether the data size is less than or equal to a preset value; If the data size is less than or equal to the preset value, obtaining the execution function of the smart contract matching the transaction request; adding the execution function to the transaction data to obtain the target data; publishing the target data to the blockchain, and running the execution function in the target data during the publishing process to process the transaction data; If the data size is greater than the preset value, the target identifier of the execution function is obtained and the target identifier is added to the transaction data; the transaction data with the added target identifier is published to the blockchain, and during the publishing process, the matching execution function is called and executed according to the target identifier to process the transaction data.

2. The method according to claim 1, characterized in that The obtaining of an execution function of a smart contract matching the transaction request includes: Detecting the transaction category to which the transaction data belongs; Get the execution function of the smart contract that matches the transaction type.

3. The method according to claim 2, characterized in that The obtaining of an execution function of a smart contract matching the transaction category includes: Determine, according to the mapping relationship between the stored transaction category and the execution function identifier of the smart contract, a target identifier of the execution function that matches the transaction category to which the transaction data belongs; An execution function matching the target identifier is obtained from a plurality of execution functions of the stored smart contract.

4. The method according to claim 1, characterized in that The transaction request includes a fund transaction request, the execution function includes a fund transaction function, and the transaction data includes a payment blockchain account, a transaction amount, and a payment blockchain account; The target data is published to the blockchain, and during the publishing process, an execution function in the target data is run to process the transaction data, including: Publishing the target data to the blockchain, obtaining the fund balance of the payment blockchain account during the publishing process, and detecting whether the fund balance is greater than or equal to the transaction amount; When the fund balance is greater than or equal to the transaction amount, the fund transaction function in the target data is executed to transfer the value corresponding to the transaction amount from the payment blockchain account to the payment collection blockchain account.

5. The method according to claim 1, characterized in that Before obtaining the execution function of the smart contract matching the transaction request, the method further includes: Detecting whether the client has the authority to execute the transaction requested by the transaction request; If the client has the authority to execute the transaction requested by the transaction request, the step of obtaining the execution function of the smart contract matching the transaction request is triggered.

6. A data processing device based on blockchain, characterized in that: The device comprises: A transceiver unit, configured to receive a transaction request sent by a client, wherein the transaction request includes transaction data; An acquisition unit, configured to acquire a data size of an execution function of a smart contract matching the transaction request; A processing unit, used to detect whether the data size is less than or equal to a preset value; The processing unit is further configured to trigger the acquisition unit to acquire the execution function of the smart contract matching the transaction request if the data size is less than or equal to the preset value, add the execution function to the transaction data to obtain the target data, publish the target data to the blockchain, and run the execution function in the target data to process the transaction data during the publishing process; The processing unit is further configured to trigger the acquisition unit to acquire the target identifier of the execution function if the data size is greater than the preset value, and to add the target identifier to the transaction data, publish the transaction data with the added target identifier to the blockchain, and call and execute the matching execution function according to the target identifier during the publishing process to process the transaction data.

7. A node device, characterized in that: include: A processor, a communication interface and a memory, wherein the processor, the communication interface and the memory are connected to each other, wherein the memory stores an executable program code, and the processor is used to call the executable program code to execute the blockchain-based data processing method according to any one of claims 1 to 5.

8. A storage medium, characterized in that: The storage medium stores instructions, which, when executed on a computer, enable the computer to execute the blockchain-based data processing method as described in any one of claims 1 to 5.

9. A computer program product comprising instructions, characterized in that When it runs on a computer, it enables the computer to execute the blockchain-based data processing method as described in any one of claims 1 to 5.