CN116909659A - Execution method, device, equipment and storage medium of blockchain intelligent contract - Google Patents

Execution method, device, equipment and storage medium of blockchain intelligent contract Download PDF

Info

Publication number
CN116909659A
CN116909659A CN202310906571.0A CN202310906571A CN116909659A CN 116909659 A CN116909659 A CN 116909659A CN 202310906571 A CN202310906571 A CN 202310906571A CN 116909659 A CN116909659 A CN 116909659A
Authority
CN
China
Prior art keywords
intelligent contract
intelligent
node
block
contract
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
CN202310906571.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.)
China United Network Communications Group Co Ltd
Original Assignee
China United Network Communications 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 China United Network Communications Group Co Ltd filed Critical China United Network Communications Group Co Ltd
Priority to CN202310906571.0A priority Critical patent/CN116909659A/en
Publication of CN116909659A publication Critical patent/CN116909659A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/448Execution paradigms, e.g. implementations of programming paradigms
    • G06F9/4482Procedural

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application provides a method, a device, equipment and a storage medium for executing a blockchain intelligent contract, which are used for executing a transaction request sent by a received user when detecting that a first node does not start an intelligent contract function, obtaining a transaction result, generating a non-intelligent contract executing node identifier, then generating a non-intelligent node block and sending the non-intelligent node block to a next node, and after receiving the non-intelligent node block sent by a previous node, other nodes execute the node identifier according to an intelligent contract checking request, determining that the intelligent contract cannot be executed, generating a block checking completion identifier, inserting the block checking completion identifier into the non-intelligent node block, and updating the updated non-intelligent node block into a blockchain system.

Description

Execution method, device, equipment and storage medium of blockchain intelligent contract
Technical Field
The present application relates to the field of blockchain technologies, and in particular, to a method, an apparatus, a device, and a storage medium for executing a blockchain intelligent contract.
Background
Blockchain intelligence contracts are a special protocol that aims to provide, validate and execute contracts. In particular, intelligent contracts are an important reason that blockchains are called decentralizing, which allows us to perform traceable, irreversible and secure transactions without the need for third parties. The smart contract contains all the information about the transaction and is executed only after the requirements are met.
However, in the prior art, in order to implement execution of the blockchain intelligent contract, the intelligent contract is generally written by a specific language and then pushed to each node of the blockchain to be compiled and executed respectively, so as to ensure that the intelligent contract is executed, but the efficiency of compiling and executing the intelligent contract is different due to different hardware performances of different machines, so that the intelligent contract has great influence on the nodes with lower part of hardware performances, and the nodes are disconnected seriously.
In summary, how to simply and efficiently promote execution of blockchain intelligent contracts is a technical problem that needs to be solved in the art.
Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for executing a blockchain intelligent contract, which are used for solving the technical problem of how to simply and efficiently promote the execution of the blockchain intelligent contract.
In a first aspect, the present application provides a method for executing a blockchain smart contract, applied to a first node in a blockchain system, including:
receiving a pre-written intelligent contract and a transaction request sent by a user;
executing the transaction request when detecting that the first node does not start the intelligent contract function, obtaining a transaction result, and generating a non-intelligent contract executing node identifier, wherein the non-intelligent contract executing node identifier is used for indicating that the non-intelligent contract node does not start the intelligent contract function;
generating a non-intelligent node block according to the transaction result and the non-intelligent contract execution node identifier, wherein the non-intelligent node block comprises an intelligent contract verification request, the transaction request and the intelligent contract, and the non-intelligent contract execution node identifier;
and sending the non-intelligent node block to the next node.
With reference to the first aspect, in some embodiments, the method further includes:
Receiving an intelligent contract detection request sent by the user;
and determining whether to start an intelligent contract function according to the intelligent contract detection request and the intelligent contract.
In a second aspect, the present application provides a method for executing a blockchain smart contract, applied to other nodes in a blockchain system except for a first node, including:
receiving a non-intelligent node block sent by a previous node, wherein the non-intelligent node block comprises an intelligent contract checking request, a transaction request and an intelligent contract, and a non-intelligent contract executing node identifier, wherein the non-intelligent contract executing node identifier is used for indicating that the previous node does not start an intelligent contract function;
according to the intelligent contract checking request, the intelligent contract, the non-intelligent contract executing node identification, and whether the intelligent contract can be executed or not is determined;
if the intelligent contract cannot be executed, generating a block verification completion identifier, wherein the block verification completion identifier is used for indicating that the intelligent contract verification is completed at the current node;
and inserting the block verification completion identifier into the non-intelligent node block to obtain an updated non-intelligent node block, and updating the updated non-intelligent node block into the blockchain system.
With reference to the second aspect, in some embodiments, the method further includes:
if the intelligent contract can be executed, executing the intelligent contract, and generating an intelligent contract executing result;
and generating an intelligent contract block according to the intelligent contract execution result, and updating the intelligent contract block into the blockchain system, wherein the intelligent contract block comprises the intelligent contract execution result, the intelligent contract and the transaction request.
With reference to the second aspect, in some embodiments, the method further includes:
receiving an intelligent node block sent by the last node, wherein the intelligent node block comprises other intelligent contracts and other transaction requests;
executing the other intelligent contracts according to the other transaction requests, and generating other intelligent contract execution results;
and generating other intelligent contract blocks according to the execution results of the other intelligent contracts, and updating the other intelligent contract blocks into the blockchain system, wherein the other intelligent contract blocks comprise the execution results of the other intelligent contracts, the other intelligent contracts and the other transaction requests.
In a third aspect, the present application provides an execution apparatus of a blockchain smart contract, including:
The first receiving module is used for receiving a pre-written intelligent contract and a transaction request sent by a user;
the transaction execution module is used for executing the transaction request to obtain a transaction result when detecting that the first node does not open the intelligent contract function, and generating a non-intelligent contract execution node identifier, wherein the non-intelligent contract execution node identifier is used for indicating that the non-intelligent contract node does not open the intelligent contract function;
the block generation module is used for generating a non-intelligent node block according to the transaction result and the non-intelligent contract execution node identifier, wherein the non-intelligent node block comprises an intelligent contract verification request, the transaction request and the intelligent contract, and the non-intelligent contract execution node identifier;
and the block sending module is used for sending the non-intelligent node block to the next node.
With reference to the third aspect, in some embodiments, the apparatus further includes:
the second receiving module is used for receiving an intelligent contract detection request sent by the user;
and the determining module is used for determining whether to start the intelligent contract function according to the intelligent contract detection request and the intelligent contract.
In a fourth aspect, the present application provides an execution apparatus of a blockchain smart contract, including:
The first receiving module is used for receiving a non-intelligent node block sent by a previous node, wherein the non-intelligent node block comprises an intelligent contract checking request, a transaction request and an intelligent contract, a non-intelligent contract executing node identifier is used for indicating that the previous node does not start an intelligent contract function;
the determining module is used for determining whether the intelligent contract can be executed according to the intelligent contract checking request and the non-intelligent contract executing node identifier;
the first generation module is used for generating a block verification completion identifier if the intelligent contract cannot be executed, wherein the block verification completion identifier is used for indicating that the intelligent contract verification is completed at the current node;
and the updating module is used for inserting the block verification completion identifier into the non-intelligent node block to obtain an updated non-intelligent node block, and updating the updated non-intelligent node block into the blockchain system.
With reference to the fourth aspect, in some embodiments, the apparatus further includes:
the second generation module is used for executing the intelligent contract if the intelligent contract can be executed, and generating an intelligent contract execution result;
And the third generation module is used for generating an intelligent contract block according to the intelligent contract execution result, updating the intelligent contract block into the blockchain system, wherein the intelligent contract block comprises the intelligent contract execution result, the intelligent contract and the transaction request.
With reference to the fourth aspect, in some embodiments, the apparatus further includes:
the second receiving module is used for receiving an intelligent node block sent by the last node, wherein the intelligent node block comprises other intelligent contracts and other transaction requests;
a fourth generation module, configured to execute the other intelligent contracts according to the other transaction requests, and generate other intelligent contract execution results;
and a fifth generating module, configured to generate other intelligent contract blocks according to the execution results of the other intelligent contracts, and update the other intelligent contract blocks to the blockchain system, where the other intelligent contract blocks include the execution results of the other intelligent contracts, and the other transaction requests.
In a fifth aspect, the present application provides an electronic device, comprising: a memory, a processor, a communication interface;
The memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method of the first aspect described above.
In a sixth aspect, the present application provides an electronic device, comprising: a memory, a processor, a communication interface;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method of the second aspect described above.
In a seventh aspect, the present application provides a computer readable storage medium having stored therein computer executable instructions that when executed by a processor are configured to implement the method of executing a blockchain smart contract as described in any of the above aspects.
According to the execution method, the device, the equipment and the storage medium of the blockchain intelligent contract, when the fact that the first node does not start the intelligent contract function is detected, the transaction request sent by a received user is executed, a transaction result is obtained, a non-intelligent contract execution node identifier is generated, then a non-intelligent node block is generated according to the transaction result and the non-intelligent contract execution node identifier and is sent to the next node, after receiving the non-intelligent node blocks sent by the previous node, other nodes except the first node in the blockchain system execute the node identifier according to the intelligent contract checking request, whether the intelligent contract can be executed is determined, if the intelligent contract cannot be executed is determined, a block checking completion identifier is generated, the block checking completion identifier is inserted into the non-intelligent node block, the updated non-intelligent node block is updated into the blockchain system, and the compiling and executing time of the intelligent contract on the whole blockchain can be reduced while the execution of the intelligent contract is ensured by the method, so that the processing efficiency of blockchain data is improved.
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.
FIG. 1 is an application scenario diagram of a method for executing a blockchain smart contract provided by an embodiment of the present application;
FIG. 2 is a flowchart illustrating an embodiment of a method for executing a blockchain smart contract according to the present application;
FIG. 3 is a schematic flow chart of block generation according to an embodiment of the present application;
FIG. 4 is a flowchart illustrating a second embodiment of a method for executing a blockchain smart contract according to the present application;
FIG. 5 is a schematic diagram of a smart contract function determination process according to an embodiment of the present application;
FIG. 6 is a flowchart illustrating a third exemplary implementation of a blockchain smart contract according to the present application;
FIG. 7 is a flowchart illustrating a fourth exemplary implementation of a blockchain smart contract according to the present application;
FIG. 8 is a schematic diagram of a smart contract block generation process according to an embodiment of the present application;
FIG. 9 is a flowchart illustrating a fifth exemplary implementation of a blockchain smart contract according to the present application;
FIG. 10 is a schematic diagram of a first embodiment of a device for executing a blockchain smart contract according to the embodiment of the application;
FIG. 11 is a schematic diagram of a second embodiment of a device for executing a blockchain smart contract according to the embodiment of the present application;
FIG. 12 is a schematic diagram of a third embodiment of a device for executing a blockchain smart contract according to the embodiment of the application;
FIG. 13 is a schematic diagram of a fourth embodiment of a device for executing a blockchain smart contract according to the embodiment of the application;
fig. 14 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
fig. 15 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Specific embodiments of the present application have been shown by way of the above drawings and will be described in more detail below. The drawings and the written description are not intended to limit the scope of the inventive concepts in any way, but rather to illustrate the inventive concepts to those skilled in the art by reference to the specific embodiments.
Detailed Description
Reference will now be made in detail to exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, the same numbers in different drawings refer to the same or similar elements, unless otherwise indicated. The implementations described in the following exemplary examples do not represent all implementations consistent with the application. Rather, they are merely examples of apparatus and methods consistent with aspects of the application as detailed in the accompanying claims.
Intelligent contract compilation execution of blockchains generally does not have cross-platform extensibility. Since there are processors of different vendors, different brands and different generations, and the instruction sets supported by these different processors are often different and the same vendor is the same brand, but the instruction sets supported by the processors of different generations are not exactly the same, the same program code written in the same high-level language, and the machine code converted by the compiler on different servers may be different. Specifically, in the process of converting program code written in a high-level language into machine code, a compiler optimizes the program in combination with the characteristics of a specific instruction set of a processor to improve the execution speed of the program, and such optimization is often related to specific processor hardware. Thus, the same machine code, one on x86, may not be able to run on ARM, and even the same x86 platform, the instruction set is continuously enriched and expanded over time, which results in different generations of machine code running on the x86 platform. Moreover, because executing machine code requires scheduling by the operating system kernel for the processor, machine code that supports operation under different operating systems may differ even with the same hardware. Therefore, the intelligent contracts in the blockchain are executed, the intelligent contracts are written by a specific language and then pushed to each node of the blockchain to be compiled and executed respectively, so that the intelligent contracts are executed, but the compiling and executing efficiency of the intelligent contracts are different due to the different hardware performances of different machines, the intelligent contracts can greatly influence the nodes with lower part of hardware performances, and the nodes are disconnected when serious, so that the blockchain data processing efficiency is low.
Aiming at the problems, the execution method, the device, the equipment and the storage medium of the blockchain intelligent contract provided by the application realize simpler and more convenient execution and high efficiency of the blockchain intelligent contract. Specifically, for executing intelligent contracts in a blockchain, the intelligent contracts are usually compiled by using a specific language, so that each node in the blockchain compiles and executes the intelligent contracts, and the inventor finds that when the contracts compiled by the specific language are pushed to each node of the blockchain to respectively compiles and execute, the compiling and executing of the intelligent contracts can be greatly influenced due to the hardware difference of each node processor, and even the node is led to be offline in severe cases, so that the processing efficiency of the blockchain data is low, and considers the problems, the inventor researches whether the compiling and executing of the intelligent contracts can be performed by reducing the nodes with poor performance in the blockchain, so that the processing efficiency of the blockchain data is improved.
Fig. 1 is an application scenario diagram of a method for executing a blockchain intelligent contract according to an embodiment of the present application, where, as shown in fig. 1, the method for executing a blockchain intelligent contract according to an embodiment of the present application is mainly applied to a blockchain intelligent contract execution scenario, where the scenario includes at least a plurality of blockchain nodes, and each node of a blockchain may perform data communication, where each node of the blockchain may perform transaction, transaction confirmation and broadcasting, and may also store related data in the blockchain, and the blockchain node may be any electronic device, for example, a mobile phone, or may also be a server device, which may perform the functions described above.
The present application is not particularly limited to the type and form of the entity device.
The following describes the technical scheme of the present application and how the technical scheme of the present application solves the above technical problems in detail with specific embodiments. The following embodiments may be combined with each other, and the same or similar concepts or processes may not be described in detail in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a flowchart of an embodiment one of a method for executing a blockchain smart contract according to an embodiment of the present application, as shown in fig. 2, where the method for executing a blockchain smart contract according to the embodiment is applied to a first node in a blockchain system, and includes:
s101: and receiving a pre-written intelligent contract and a transaction request sent by the user.
In this step, in order to ensure the security of the user data, reduce the human error rate, and further execute the transaction by adopting the blockchain intelligent contract, the user first writes the intelligent contract in advance, then sends the intelligent contract in advance and the transaction request to the blockchain system, and the first node in the blockchain system receives the intelligent contract in advance and the transaction request sent by the user.
Specifically, the user may write the intelligent contract according to the transaction requirement, and the embodiment of the application does not limit the specific content of the intelligent contract.
S102: and executing the transaction request when detecting that the first node does not start the intelligent contract function, obtaining a transaction result, and generating a non-intelligent contract executing node identifier.
In this step, in order to reduce the time for compiling and executing the intelligent contract on the whole blockchain, after the blockchain system receives the intelligent contract and the transaction request sent by the user in the above step, it detects the first node, and when detecting that the first node does not open the intelligent contract function, it indicates that the first node does not have the condition for compiling and executing the intelligent contract, so that the first node cannot compile and execute the intelligent contract, only can execute the basic transaction, and then, according to the transaction request, the basic transaction is performed to obtain the transaction result, and a non-intelligent contract executing node identifier is generated, where the non-intelligent contract executing node identifier is used to indicate that the non-intelligent contract node does not open the intelligent contract function.
S103: and executing node identification according to the transaction result and the non-intelligent contract to generate a non-intelligent node block.
In this step, the transaction result and the non-intelligent contract executing node identifier are obtained through the data processing in the above step, and in order to be able to continue to perform data processing in the blockchain, a non-intelligent node block is generated according to the transaction result and the non-intelligent contract executing node identifier, where the non-intelligent node block includes an intelligent contract checking request, a transaction request and an intelligent contract, and the non-intelligent contract executing node identifier.
Specifically, in the block generation process, as shown in fig. 3, whether the current node generates a non-intelligent contract execution node identifier is detected, if the non-intelligent contract execution node identifier is generated, the non-intelligent node block is generated if the current node does not have the condition of compiling and executing the intelligent contract, and if the current node does not generate the non-intelligent contract execution node identifier, the intelligent node block is generated if the current node has the condition of compiling and executing the intelligent contract.
S104: and sending the non-intelligent node block to the next node.
In this step, after the first node generates the non-intelligent node block in the blockchain system, the non-intelligent node block is broadcast to the blockchain system and then sent to the next node.
Specifically, all newly added nodes of the non-intelligent contract executing node are provided with the non-intelligent contract executing node identification, and the nodes of the non-intelligent contract executing node do not perform data checksum calculation of the intelligent contract.
According to the execution method of the blockchain intelligent contract, the prefabricated intelligent contract and the transaction request sent by the user are received, when the fact that the first node does not start the intelligent contract function is detected, the transaction request is executed, a transaction result is obtained, a non-intelligent contract execution node identifier is generated, a non-intelligent node block is generated according to the transaction result and the non-intelligent contract execution node identifier, and the non-intelligent node block is sent to the next node.
Fig. 4 is a schematic flow chart of a second embodiment of a method for executing a blockchain smart contract according to the embodiment of the present application, as shown in fig. 4, where on the basis of the first embodiment, the method for executing a blockchain smart contract according to the present embodiment further includes:
s105: and receiving an intelligent contract detection request sent by the user.
In this step, before executing the blockchain smart contract, in order to reduce the time of compiling and executing the smart contract on the whole blockchain, and further improve the efficiency of blockchain data processing, the user sends a smart contract detection request to the blockchain system, and a first node of the blockchain receives the smart contract detection request sent by the user, where the smart contract detection request is used to instruct the first node to detect whether to start the smart contract function.
S106: according to the intelligent contract detection request, the intelligent contract determines whether to start the intelligent contract function.
In this step, after the first node receives the smart contract detection request sent by the user in the above step, it determines whether to start the smart contract function according to the smart contract detection request and the smart contract content.
Specifically, because the hardware performance of the nodes is different, the capability of compiling and executing the intelligent contracts is different, in order to reduce the influence of the node with lower hardware performance on the execution of the intelligent contracts, the node selects whether to start the intelligent contract function according to the hardware performance of the node.
Optionally, when there are fewer nodes in the blockchain, the data set cannot provide the conditions of the intelligent contracts, the intelligent contract function is not started, when the nodes which do not start the intelligent contracts occupy more than 30% of the total number of nodes in the blockchain, the function cannot be started, as shown in fig. 5, if the first node starts the intelligent contract function, the intelligent contracts sent by the user are received, and the intelligent contracts are executed according to the transaction request, if the first node does not start the intelligent contract function, the intelligent contracts sent by the user are received, but the intelligent contracts are not executed, and meanwhile, the non-intelligent contract executing node identifier is generated.
According to the execution method of the blockchain intelligent contract, which is provided by the embodiment, the intelligent contract detection request sent by the user is received, whether the intelligent contract function is started is determined according to the intelligent contract detection request, and whether the intelligent contract function is started is detected by the nodes in the blockchain, so that the compiling execution time of the intelligent contract is shortened, and the data processing efficiency is improved.
Fig. 6 is a flowchart of a third embodiment of a method for executing a blockchain smart contract according to the present application, as shown in fig. 6, where the method for executing a blockchain smart contract according to the present application is applied to other nodes in a blockchain system except for a first node, and includes:
s201: and receiving the non-intelligent node block sent by the last node.
In this step, other nodes except the first node in the blockchain system can receive the block sent by the previous node or can send the block to the next node, so that the first node sends the non-intelligent node block to other nodes and the other nodes receive the non-intelligent node block sent by the previous node in order to save the compiling execution time of the intelligent contract.
S202: according to the intelligent contract checking request, the intelligent contract and the non-intelligent contract executing node identification, whether the intelligent contract can be executed or not is determined.
In this step, after receiving the non-intelligent node block sent by the previous node, the other nodes read the non-intelligent node block, where the non-intelligent node block includes an intelligent contract checking request, a transaction request, a non-intelligent contract executing node identifier and an intelligent contract, where the non-intelligent contract executing node identifier is used to indicate that the previous node does not open an intelligent contract function, and further determine whether the intelligent contract can be executed.
Specifically, other nodes read whether the non-intelligent node block contains a non-intelligent contract executing node identifier, if the non-intelligent contract executing node identifier exists, the condition that the sub-block is generated by a node which does not open an intelligent contract function is not provided for compiling and executing the intelligent contract is indicated, then the sub-block is checked according to an intelligent contract checking request, whether the compiling and executing condition of the intelligent contract is met is determined, and accordingly whether the intelligent contract can be executed is determined.
S203: if it is determined that the intelligent contract cannot be executed, a block verification completion identification is generated.
In this step, whether the intelligent contract can be executed is checked through the steps, if it is determined that the intelligent contract cannot be executed, in order to reduce the execution time of the intelligent contract and reduce the compiling execution of the efficiency node, the compiling execution of the intelligent contract is not performed at the node, and a block check completion identifier is generated.
S204: and inserting the block verification completion identifier into the non-intelligent node block to obtain an updated non-intelligent node block, and updating the updated non-intelligent node block into the blockchain system.
In this step, after the block verification completion identifier is obtained in the above step, in order to ensure correct execution of the intelligent contract, the block verification completion identifier is inserted into the non-intelligent node block, and then the updated non-intelligent node block is updated into the blockchain system.
Specifically, in order to ensure correct execution of the intelligent contract, when other nodes perform verification according to the intelligent contract verification request, if the conditions for executing the intelligent contract are not met, the block verification completion identifier of the node needs to be read, and then the next node can be generated, so that the block verification completion identifier needs to be inserted into a non-intelligent node block, and then the updated non-intelligent node block is broadcasted into a blockchain.
According to the execution method of the blockchain intelligent contract, which is provided by the embodiment, the non-intelligent node block sent by the last node is received, the node identification is executed by the non-intelligent contract according to the intelligent contract checking request, whether the intelligent contract can be executed or not is determined, the block checking completion identification is inserted into the non-intelligent node block, the updated non-intelligent node block is obtained, the updated non-intelligent node block is updated into the blockchain system, the compiling execution time of the intelligent contract is shortened, and the data processing efficiency is improved.
Fig. 7 is a flow chart of a fourth embodiment of a method for executing a blockchain smart contract according to the embodiment of the present application, as shown in fig. 7, where on the basis of the third embodiment, the method for executing a blockchain smart contract according to the embodiment of the present application further includes:
s205: and if the intelligent contract can be executed, executing the intelligent contract, and generating an intelligent contract executing result.
In this step, after checking whether the smart contract can be executed in the above embodiment, if it is determined that the smart contract can be executed, in order to reduce the execution time of the smart contract and improve the data processing efficiency, the smart contract is executed, and an execution result of the smart contract is generated.
S206: and generating an intelligent contract block according to the intelligent contract execution result, and updating the intelligent contract block into the blockchain system.
In this step, after obtaining the execution result of the smart contract, as shown in fig. 8, after verifying that the node has the condition of executing the smart contract, an smart contract block is generated, where the smart contract block includes the execution result of the smart contract, the transaction request, and the smart contract block is updated into the blockchain system.
According to the execution method of the blockchain intelligent contract, if the fact that the intelligent contract can be executed is determined, the intelligent contract is executed, an intelligent contract execution result is generated, an intelligent contract block is generated according to the intelligent contract execution result, the intelligent contract block is updated to the blockchain system, compiling execution time of the intelligent contract is shortened, and data processing efficiency is improved.
Fig. 9 is a schematic flow chart of a fifth embodiment of a method for executing a blockchain smart contract according to the embodiment of the present application, as shown in fig. 9, on the basis of the fourth embodiment, the method for executing a blockchain smart contract according to the embodiment of the present application further includes:
s207: and receiving the intelligent node block sent by the last node.
In this step, the block received by the other node is a block of a previous node, wherein the block may be a non-intelligent node block or an intelligent node block, if the previous node has a condition of executing an intelligent contract, the intelligent contract is executed and an intelligent node block is generated and sent to the next node, and the next node receives the intelligent node block sent by the previous node.
S208: and executing other intelligent contracts according to other transaction requests, and generating other intelligent contract execution results.
S209: and generating other intelligent contract blocks according to the execution results of other intelligent contracts, and updating the other intelligent contract blocks into the blockchain system.
In step S208 and step S209, unlike the foregoing process of receiving the non-intelligent node block, after receiving the intelligent node block, the intelligent contract may be compiled and executed directly according to the transaction request without performing the intelligent contract check on itself. The specific execution process is the same as the specific execution process of step S205 and step S206 in the foregoing embodiment, and will not be described in detail here.
According to the execution method of the blockchain intelligent contract, which is provided by the embodiment, the intelligent node block sent by the last node is received, other intelligent contracts are executed according to other transaction requests, other intelligent contract execution results are generated, other intelligent contract blocks are generated according to other intelligent contract execution results, other intelligent contract blocks are updated into the blockchain system, after the node without the condition of executing the intelligent contracts receives the intelligent contract block generated by the node for executing the intelligent contracts, the intelligent contracts can be compiled and executed according to the intelligent contract block, and therefore the efficiency of processing the blockchain data is improved.
Fig. 10 is a schematic structural diagram of an embodiment one of a device for executing a blockchain smart contract according to an embodiment of the present application, and as shown in fig. 10, a device 300 for executing a blockchain smart contract includes:
the first receiving module 301 is configured to receive a pre-written smart contract and a transaction request sent by a user.
The transaction execution module 302 is configured to execute the transaction request when it is detected that the first node does not open the smart contract function, obtain a transaction result, and generate a non-smart contract execution node identifier, where the non-smart contract execution node identifier is configured to indicate that the non-smart contract node does not open the smart contract function.
The block generating module 303 is configured to generate a non-intelligent node block according to the transaction result and the non-intelligent contract executing node identifier, where the non-intelligent node block includes an intelligent contract checking request, a transaction request and an intelligent contract, and the non-intelligent contract executing node identifier.
The block transmitting module 304 is configured to transmit the non-intelligent node block to the next node.
Fig. 11 is a schematic structural diagram of a second embodiment of a device for executing a blockchain smart contract according to the embodiment of the present application, and as shown in fig. 11, the device 300 for executing a blockchain smart contract further includes:
and the second receiving module 305 is configured to receive an intelligent contract detection request sent by the user.
A determining module 306, configured to determine whether to open the smart contract function according to the smart contract detection request.
The implementation device of the blockchain intelligent contract provided in any of the foregoing embodiments is configured to implement the technical solution of the first node side in the blockchain system in the foregoing method embodiments, and its implementation principle and technical effects are similar and are not repeated herein.
Fig. 12 is a schematic structural diagram of a third embodiment of a device for executing a blockchain smart contract according to the embodiment of the present application, and as shown in fig. 12, a device 400 for executing a blockchain smart contract includes:
The first receiving module 401 is configured to receive a non-intelligent node block sent by a previous node, where the non-intelligent node block includes an intelligent contract checking request, a transaction request and an intelligent contract, and the non-intelligent contract performs a node identifier, where the non-intelligent contract performs the node identifier is used to indicate that the previous node does not start an intelligent contract function.
A determining module 402, configured to determine whether the smart contract can be executed according to the smart contract checking request and the non-smart contract executing node identifier.
The first generation module 403 is configured to generate a block check completion identifier, where the block check completion identifier is used to indicate that the intelligent contract check is completed at the current node, if it is determined that the intelligent contract cannot be executed.
And the updating module 404 is configured to insert the block verification completion identifier into the non-intelligent node block, obtain an updated non-intelligent node block, and update the updated non-intelligent node block into the blockchain system.
Fig. 13 is a schematic structural diagram of a fourth embodiment of a device for executing a blockchain smart contract according to the embodiment of the present application, where, as shown in fig. 13, the device 400 for executing a blockchain smart contract further includes:
and the second generating module 405 is configured to execute the smart contract if it is determined that the smart contract can be executed, and generate a smart contract execution result.
The third generating module 406 is configured to generate an intelligent contract block according to the intelligent contract execution result, and update the intelligent contract block to the blockchain system, where the intelligent contract block includes the intelligent contract execution result, the intelligent contract, and the transaction request.
Optionally, the execution apparatus 400 of the blockchain smart contract further includes:
the second receiving module 407 is configured to receive an intelligent node block sent by the previous node, where the intelligent node block includes other intelligent contracts and other transaction requests.
And a fourth generating module 408, configured to execute other intelligent contracts according to other transaction requests, and generate other intelligent contract execution results.
And a fifth generating module 409, configured to generate other intelligent contract blocks according to the execution results of other intelligent contracts, and update the other intelligent contract blocks into the blockchain system, where the other intelligent contract blocks include the execution results of other intelligent contracts, and other transaction requests.
The implementation device of the blockchain intelligent contract provided in any of the foregoing embodiments is configured to implement the technical solutions of the blockchain system in the foregoing method embodiments on the sides of the nodes except the first node, and its implementation principle and technical effects are similar and are not described herein again.
Fig. 14 is a schematic structural diagram of an electronic device according to an embodiment of the present application, as shown in fig. 14, an electronic device 500 includes: a memory 501, a processor 502, a communication interface 503;
memory 501 stores computer-executable instructions.
The processor 502 executes computer-executable instructions stored in the memory 501 to implement the solution executed by the first node in the block chain system in the above embodiment.
The electronic device provided in this embodiment is configured to execute the technical scheme on the first node side in the blockchain system in any of the foregoing method embodiments, and its implementation principle and technical effects are similar and are not described herein again.
Fig. 15 is a schematic structural diagram of an electronic device according to an embodiment of the present application, as shown in fig. 15, an electronic device 600 includes: a memory 601, a processor 602, a communication interface 603;
the memory 601 stores computer-executable instructions.
The processor 602 executes the computer-executable instructions stored in the memory 601 to implement the technical solution executed by the nodes other than the first node in the block chain system in the above embodiment.
It should be appreciated that the foregoing processor 502 and processor 602 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of a method disclosed in connection with the present application may be embodied directly in a hardware processor for execution, or in a combination of hardware and software modules in a processor for execution.
All or part of the steps for implementing the method embodiments described above may be performed by hardware associated with program instructions. The aforementioned program may be stored in a readable memory. The program, when executed, performs steps including the method embodiments described above; and the aforementioned memory (storage medium) includes: read-only memory (ROM), RAM, flash memory, hard disk, solid state disk, magnetic tape, floppy disk, optical disk (optical disc), and any combination thereof.
The electronic device provided in this embodiment is configured to execute the technical solutions of the other node sides except the first node in the blockchain system in any of the foregoing method embodiments, and its implementation principle and technical effects are similar, and are not described herein again.
Embodiments of the present application also provide a computer-readable storage medium having stored therein computer-executable instructions that, when executed by a processor, are configured to implement the method of any of the embodiments.
The readable storage medium may be implemented by any type or combination of volatile or nonvolatile memory devices such as static random access memory, electrically erasable programmable read-only memory, magnetic memory, flash memory, magnetic or optical disk. A readable storage medium can be any available medium that can be accessed by a general purpose or special purpose computer.
In the alternative, a readable storage medium is coupled to the processor such that the processor can read information from, and write information to, the readable storage medium. In the alternative, the readable storage medium may be integral to the processor. The processor and the readable storage medium may reside in an application specific integrated circuit (Application Specific Integrated Circuits, ASIC). The processor and the readable storage medium may reside as discrete components in a device.
The embodiment of the application also provides a computer program product, which comprises a computer program, the computer program is stored in a computer readable storage medium, at least one processor can read the computer program from the computer readable storage medium, and the technical scheme provided by any one of the method embodiments can be realized when the at least one processor executes the computer program.
Other embodiments of the application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. This application is intended to cover any variations, uses, or adaptations of the application following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the application pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It is to be understood that the application is not limited to the precise arrangements and instrumentalities shown in the drawings, which have been described above, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (13)

1. A method for executing a blockchain smart contract, applied to a first node in a blockchain system, comprising:
receiving a pre-written intelligent contract and a transaction request sent by a user;
executing the transaction request when detecting that the first node does not start the intelligent contract function, obtaining a transaction result, and generating a non-intelligent contract executing node identifier, wherein the non-intelligent contract executing node identifier is used for indicating that the non-intelligent contract node does not start the intelligent contract function;
generating a non-intelligent node block according to the transaction result and the non-intelligent contract execution node identifier, wherein the non-intelligent node block comprises an intelligent contract verification request, the transaction request and the intelligent contract, and the non-intelligent contract execution node identifier;
and sending the non-intelligent node block to the next node.
2. The method according to claim 1, wherein the method further comprises:
Receiving an intelligent contract detection request sent by the user;
and determining whether to start an intelligent contract function according to the intelligent contract detection request and the intelligent contract.
3. A method for executing a blockchain smart contract, applied to nodes other than a first node in a blockchain system, comprising:
receiving a non-intelligent node block sent by a previous node, wherein the non-intelligent node block comprises an intelligent contract checking request, a transaction request and an intelligent contract, and a non-intelligent contract executing node identifier, wherein the non-intelligent contract executing node identifier is used for indicating that the previous node does not start an intelligent contract function;
according to the intelligent contract checking request, the intelligent contract, the non-intelligent contract executing node identification, and whether the intelligent contract can be executed or not is determined;
if the intelligent contract cannot be executed, generating a block verification completion identifier, wherein the block verification completion identifier is used for indicating that the intelligent contract verification is completed at the current node;
and inserting the block verification completion identifier into the non-intelligent node block to obtain an updated non-intelligent node block, and updating the updated non-intelligent node block into the blockchain system.
4. A method according to claim 3, characterized in that the method further comprises:
if the intelligent contract can be executed, executing the intelligent contract, and generating an intelligent contract executing result;
and generating an intelligent contract block according to the intelligent contract execution result, and updating the intelligent contract block into the blockchain system, wherein the intelligent contract block comprises the intelligent contract execution result, the intelligent contract and the transaction request.
5. The method according to claim 4, wherein the method further comprises:
receiving an intelligent node block sent by the last node, wherein the intelligent node block comprises other intelligent contracts and other transaction requests;
executing the other intelligent contracts according to the other transaction requests, and generating other intelligent contract execution results;
and generating other intelligent contract blocks according to the execution results of the other intelligent contracts, and updating the other intelligent contract blocks into the blockchain system, wherein the other intelligent contract blocks comprise the execution results of the other intelligent contracts, the other intelligent contracts and the other transaction requests.
6. An apparatus for executing a blockchain smart contract, comprising:
the first receiving module is used for receiving a pre-written intelligent contract and a transaction request sent by a user;
the transaction execution module is used for executing the transaction request to obtain a transaction result when detecting that the first node does not open the intelligent contract function, and generating a non-intelligent contract execution node identifier, wherein the non-intelligent contract execution node identifier is used for indicating that the non-intelligent contract node does not open the intelligent contract function;
the block generation module is used for generating a non-intelligent node block according to the transaction result and the non-intelligent contract execution node identifier, wherein the non-intelligent node block comprises an intelligent contract verification request, the transaction request and the intelligent contract, and the non-intelligent contract execution node identifier;
and the block sending module is used for sending the non-intelligent node block to the next node.
7. The apparatus of claim 6, wherein the apparatus further comprises:
the second receiving module is used for receiving an intelligent contract detection request sent by the user;
and the determining module is used for determining whether to start the intelligent contract function according to the intelligent contract detection request and the intelligent contract.
8. An apparatus for executing a blockchain smart contract, comprising:
the first receiving module is used for receiving a non-intelligent node block sent by a previous node, wherein the non-intelligent node block comprises an intelligent contract checking request, a transaction request and an intelligent contract, a non-intelligent contract executing node identifier is used for indicating that the previous node does not start an intelligent contract function;
the determining module is used for determining whether the intelligent contract can be executed according to the intelligent contract checking request and the non-intelligent contract executing node identifier;
the first generation module is used for generating a block verification completion identifier if the intelligent contract cannot be executed, wherein the block verification completion identifier is used for indicating that the intelligent contract verification is completed at the current node;
and the updating module is used for inserting the block verification completion identifier into the non-intelligent node block to obtain an updated non-intelligent node block, and updating the updated non-intelligent node block into the blockchain system.
9. The apparatus of claim 8, wherein the apparatus further comprises:
The second generation module is used for executing the intelligent contract if the intelligent contract can be executed, and generating an intelligent contract execution result;
and the third generation module is used for generating an intelligent contract block according to the intelligent contract execution result, updating the intelligent contract block into the blockchain system, wherein the intelligent contract block comprises the intelligent contract execution result, the intelligent contract and the transaction request.
10. The apparatus of claim 9, wherein the apparatus further comprises:
the second receiving module is used for receiving an intelligent node block sent by the last node, wherein the intelligent node block comprises other intelligent contracts and other transaction requests;
a fourth generation module, configured to execute the other intelligent contracts according to the other transaction requests, and generate other intelligent contract execution results;
and a fifth generating module, configured to generate other intelligent contract blocks according to the execution results of the other intelligent contracts, and update the other intelligent contract blocks to the blockchain system, where the other intelligent contract blocks include the execution results of the other intelligent contracts, and the other transaction requests.
11. An electronic device, comprising: a memory, a processor, a communication interface; the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of any one of claims 1 to 2.
12. An electronic device, comprising: a memory, a processor, a communication interface;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored in the memory to implement the method of any one of claims 3 to 5.
13. A computer readable storage medium having stored therein computer executable instructions which when executed by a processor are for implementing a method of executing a blockchain smart contract as in any of claims 1 to 5.
CN202310906571.0A 2023-07-21 2023-07-21 Execution method, device, equipment and storage medium of blockchain intelligent contract Pending CN116909659A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310906571.0A CN116909659A (en) 2023-07-21 2023-07-21 Execution method, device, equipment and storage medium of blockchain intelligent contract

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310906571.0A CN116909659A (en) 2023-07-21 2023-07-21 Execution method, device, equipment and storage medium of blockchain intelligent contract

Publications (1)

Publication Number Publication Date
CN116909659A true CN116909659A (en) 2023-10-20

Family

ID=88367765

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310906571.0A Pending CN116909659A (en) 2023-07-21 2023-07-21 Execution method, device, equipment and storage medium of blockchain intelligent contract

Country Status (1)

Country Link
CN (1) CN116909659A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117235188A (en) * 2023-11-15 2023-12-15 成都三合力通科技有限公司 Data universe sharing system and method based on alliance computing

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117235188A (en) * 2023-11-15 2023-12-15 成都三合力通科技有限公司 Data universe sharing system and method based on alliance computing
CN117235188B (en) * 2023-11-15 2024-01-30 成都三合力通科技有限公司 Data universe sharing system and method based on alliance computing

Similar Documents

Publication Publication Date Title
CN110058873B (en) Application page updating method, device, equipment and storage medium
CN103647816A (en) Method and device for upgrading application software
CN103765402A (en) Tracking a program's calling context using a hybrid code signature
CN110837393A (en) Method and device for manufacturing firmware differential upgrade package and readable storage medium
CN116909659A (en) Execution method, device, equipment and storage medium of blockchain intelligent contract
CN110995825B (en) Intelligent contract issuing method, intelligent node equipment and storage medium
CN104461582A (en) Service processing method and device and equipment
CN111930448B (en) Method, electronic device, and storage medium for service distribution
CN106775781B (en) Method and device for reducing application installation packages and electronic equipment
US10747514B2 (en) Reduced save and restore instructions for call-clobbered registers
CN111459524A (en) Software upgrading method, device and system
WO2022156379A1 (en) Hotfix method and apparatus
CN111240772A (en) Data processing method and device based on block chain and storage medium
CN112416612B (en) Service calling method and device, computer equipment and readable storage medium
US20110119656A1 (en) Computing system, method and computer-readable medium processing debug information in computing system
CN106293814B (en) Upgrading method and device
US8689200B1 (en) Method and system for optimizing an executable program by generating special operations for identical program entities
CN110737455A (en) Firmware updating method and device and electronic equipment
CN111629200A (en) Method and device for rapidly detecting differential packet reliability and readable storage medium
CN113312073B (en) Installation package file processing method and related device
CN108958795B (en) BootLoader code reuse method and development board in embedded system
CN114924742A (en) Hot patch making and applying method and device for virtual machine simulation software
CN112631599A (en) Compiling method, device and storage medium
CN113821246A (en) Software non-inductive incremental updating method, device, system and storage medium
US10671397B2 (en) Reduced save and restore instructions for call-clobbered registers

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