Smart contract running method, device and equipment, storage medium and computer program product

By encapsulating transactions and identifying contract types within the target smart contract, the contract engine is determined, thus solving the problem of commercial distributed blockchains being incompatible with EVM contracts and achieving the technical effect of running EVM contracts compatiblely in commercial distributed blockchains.

CN120979968APending Publication Date: 2025-11-18中移信息技术有限公司 +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511110471.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-08
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

Commercial distributed blockchains such as EOS only support contract engines based on C++ and JavaScript, and cannot run EVM contracts based on Solidity. This makes it impossible to run EVM contracts in commercial distributed blockchains without making significant changes to the blockchain kernel.

Method used

A method for running smart contracts is provided, which encapsulates the target smart contract into a format adapted to commercial distributed blockchains, determines the corresponding target contract engine based on the contract type, and calls the contract engine to process transactions in order to run the target smart contract in a commercial distributed blockchain.

Benefits of technology

It enables the compatibility of Ethereum Virtual Machine contracts without making significant changes to the blockchain kernel, thus expanding the compatibility of commercial distributed blockchains.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120979968A_ABST
    Figure CN120979968A_ABST
Patent Text Reader

Abstract

The invention discloses a smart contract operation method, device and equipment, a storage medium and a computer program product, and relates to the technical field of blockchains, the method comprises the steps that a target smart contract is deployed to a commercial distributed blockchain according to a contract deployment request sent by a user, and the target smart contract comprises an Ethereum virtual machine contract and a conventional contract; performing transaction encapsulation on the target smart contract to obtain a commercial distributed transaction; determining a corresponding target contract engine based on the contract type to which the target smart contract belongs; and calling the target contract engine to process the commercial distributed transaction so as to run the target smart contract in the commercial distributed block chain. According to the application, the commercial distributed transaction is obtained after transaction encapsulation is performed on the target smart contract, and then the target contract engine corresponding to the target smart contract is called to process the commercial distributed transaction, so that compatible operation of the Ethereum virtual machine contract in the commercial distributed block chain can be realized without making a large change on a block chain kernel.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of blockchain technology, and in particular to a smart contract operation method, apparatus, device, storage medium, and computer program product. Background Technology

[0002] The Ethereum Virtual Machine (EVM) is the core virtual machine on the Ethereum blockchain, designed to execute smart contracts. It can run on all nodes, ensuring the reliability and security of smart contracts. Early versions of the EVM were developed with the help of Ethereum, providing strong support for the development of the Ethereum blockchain.

[0003] The EVM and Ethereum have close historical ties, and the EVM contract engine has become one of the most popular engines in the field of blockchain smart contract technology, enabling smart contracts to fully realize their functions and significance on the Ethereum platform. However, currently, commercial distributed blockchains (EOS, Enterprise Operation System) only support contract engines based on C++ and JavaScript, and cannot support the EVM contract engine based on Solidity. This directly means that related technologies cannot run EVM contracts compatiblely in commercial distributed blockchains without making significant modifications to the blockchain kernel, thus preventing the introduction of the rich EVM ecosystem into the EOS system. Summary of the Invention

[0004] The main purpose of this application is to provide a smart contract running method, device, equipment, storage medium and computer program product, which aims to solve the technical problem that related technologies cannot run EVM contracts in commercial distributed blockchains without making significant changes to the blockchain kernel.

[0005] To achieve the above objectives, this application provides a smart contract execution method, the method comprising the following steps: Deploy the target smart contract to a commercial distributed blockchain based on the deployment contract request issued by the user. The target smart contract includes Ethereum Virtual Machine contracts and regular contracts. The target smart contract is encapsulated into a transaction to obtain a commercial distributed transaction. The corresponding target contract engine is determined based on the contract type to which the target smart contract belongs; The target contract engine is invoked to process the commercial distributed transaction in order to run the target smart contract in the commercial distributed blockchain.

[0006] In one embodiment, the step of deploying a target smart contract to a commercial distributed blockchain based on a user-issued deployment contract request, wherein the target smart contract includes an Ethereum Virtual Machine contract and a regular contract, includes: When a deployment contract request is received from a user, the deployment contract transaction and deployment type corresponding to the deployment contract request are obtained; The target smart contract is initialized according to the deployment contract transaction and deployment type, and the target smart contract is deployed to a commercial distributed blockchain based on the initialization result.

[0007] In one embodiment, the step of encapsulating the target smart contract into a commercial distributed transaction includes: The first module is extended, and the transaction parameters contained in the target smart contract are serialized through the first module to obtain serialized data; Based on the serialized data, the target smart contract is encapsulated into a transaction to obtain a commercial distributed transaction.

[0008] In one embodiment, before the step of determining the corresponding target contract engine based on the contract type to which the target smart contract belongs, the method further includes: The second module is extended, and the magic number corresponding to the contract code in the target smart contract is identified through the second module; The type of contract to which the target smart contract belongs is determined based on the magic number.

[0009] In one embodiment, the step of determining the corresponding target contract engine based on the contract type to which the target smart contract belongs includes: The second module separates the calling logic of the optional contract engine; The third module is extended, and in the third module, the corresponding target contract engine is determined from the optional contract engines based on the contract type.

[0010] In one embodiment, the target contract engine includes a first engine and a second engine, and the step of invoking the target contract engine to process the commercial distributed transaction to run the target smart contract in the commercial distributed blockchain includes: If the target smart contract is the Ethereum Virtual Machine contract, then the first engine is invoked to process the commercial distributed transaction in order to run the target smart contract in the commercial distributed blockchain; If the target smart contract is a regular contract, then the second engine is invoked to process the commercial distributed transaction in order to run the target smart contract in the commercial distributed blockchain.

[0011] Furthermore, to achieve the above objectives, this application also proposes a smart contract running device, which includes: The contract deployment module is used to deploy target smart contracts to a commercial distributed blockchain according to the deployment contract request issued by the user. The target smart contracts include Ethereum Virtual Machine contracts and regular contracts. The transaction encapsulation module is used to encapsulate the target smart contract into a transaction to obtain a commercial distributed transaction. The engine determination module is used to determine the corresponding target contract engine based on the contract type to which the target smart contract belongs; The contract execution module is used to call the target contract engine to process the commercial distributed transaction in order to run the target smart contract in the commercial distributed blockchain.

[0012] In addition, to achieve the above objectives, this application also proposes a smart contract running device, the device comprising: a memory, a processor, and a smart contract running program stored on the memory and capable of running on the processor, the smart contract running program being configured to implement the steps of the smart contract running method as described above.

[0013] In addition, to achieve the above objectives, this application also proposes a storage medium, which is a computer-readable storage medium, on which a smart contract execution program is stored, and when the smart contract execution program is executed by a processor, it implements the steps of the smart contract execution method as described above.

[0014] In addition, to achieve the above objectives, the present invention also provides a computer program product, the computer program product including a smart contract execution program, which, when executed by a processor, implements the steps of the smart contract execution method as described above.

[0015] This application deploys a target smart contract to a commercial distributed blockchain based on a user's deployment contract request. The target smart contract includes an Ethereum Virtual Machine (EVM) contract and a regular contract. The application encapsulates the target smart contract into transactions to obtain commercial distributed transactions. It then determines a corresponding target contract engine based on the contract type of the target smart contract and invokes the target contract engine to process the commercial distributed transactions, thereby running the target smart contract within the commercial distributed blockchain. This application provides a smart contract execution method. This method allows for the encapsulation of a target smart contract into transactions to obtain commercial distributed transactions, and then invokes the corresponding target contract engine to process the commercial distributed transactions. This achieves the technical effect of compatiblely running EVM contracts within a commercial distributed blockchain without requiring significant modifications to the blockchain kernel. Attached Figure Description

[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application.

[0017] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the accompanying drawings used in the description of the embodiments or related technologies will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0018] Figure 1 This is a flowchart illustrating the first embodiment of the smart contract operation method of this application; Figure 2 This is a schematic diagram of the smart contract execution architecture of the smart contract execution method of this application; Figure 3 This is a flowchart illustrating the second embodiment of the smart contract operation method of this application; Figure 4 This is a diagram illustrating the contract deployment example of the smart contract execution method described in this application. Figure 5 This is a diagram illustrating a contract call example for the smart contract execution method of this application. Figure 6 This is a flowchart illustrating the third embodiment of the smart contract operation method of this application; Figure 7 This is a transaction processing example diagram of the smart contract operation method of this application; Figure 8 This is a structural block diagram of the first embodiment of the smart contract running device of this application; Figure 9 This is a schematic diagram of the structure of a smart contract running device in the hardware operating environment involved in the embodiments of this application.

[0019] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation

[0020] It should be understood that the specific embodiments described herein are only used to explain the technical solutions of this application and are not intended to limit this application.

[0021] It should be noted that the executing entity in the embodiments of this application can be a computing service device with data processing, network communication, and program execution functions, such as a tablet computer, personal computer, or mobile phone, or an electronic device capable of performing the above functions, such as the aforementioned smart contract execution device. The following embodiments will be described using a smart contract execution device as an example.

[0022] This application provides a method for running a smart contract, referring to... Figure 1 , Figure 1 This is a flowchart illustrating the first embodiment of the smart contract operation method of this application.

[0023] In this embodiment, the smart contract execution method includes the following steps: Step S10: Deploy the target smart contract to a commercial distributed blockchain according to the deployment contract request issued by the user. The target smart contract includes an Ethereum Virtual Machine contract and a regular contract.

[0024] It should be noted that the aforementioned commercial distributed blockchain is the EOS (Enterprise Operation System) blockchain, the aforementioned Ethereum Virtual Machine contract is the EVM (Ethereum Virtual Machine) contract written in the Solidity programming language, and the aforementioned regular contract is the contract that the EOS blockchain originally supported, such as WASM (WebAssembly Smart Contract) written in the C++ programming language, JS (Smart Contract) written in the JavaScript programming language, etc.

[0025] In this implementation, users can send a contract deployment request to the smart contract execution device via a client. Once the request is approved, the smart contract execution device can deploy the target smart contract corresponding to the deployment request to a commercial distributed blockchain. During this process, the transactions contained in the target smart contract will be received by nodes in the commercial distributed blockchain, and the transactions will be synchronized to the next block after being broadcast. The client can be a command-line tool, an SDK (Software Development Kit), etc., and this embodiment does not impose any restrictions on it.

[0026] Step S20: Encapsulate the target smart contract into a transaction to obtain a commercial distributed transaction.

[0027] It should be understood that transaction encapsulation of smart contracts typically refers to abstracting, standardizing, or enhancing the security of the smart contract's calling logic, making it easier to use or adaptable to different scenarios. Based on this, the technical problem involved in this embodiment is that related technologies cannot run Ethereum Virtual Machine contracts compatiblely in commercial distributed blockchains without making significant modifications to the blockchain kernel. Therefore, in this embodiment, transaction encapsulation can be used to convert the transaction format of the target smart contract into a transaction format adapted to commercial distributed blockchains. For example, assuming the target smart contract's transaction format is EMV, it can be converted to EOS transaction format by encapsulating the target smart contract, thereby obtaining the aforementioned commercial distributed transaction.

[0028] Step S30: Determine the corresponding target contract engine based on the contract type to which the target smart contract belongs.

[0029] It should be noted that the aforementioned target contract engine can be used to process transactions contained in the target smart contract.

[0030] In practical implementation, the type of target contract engine to be invoked can be determined based on the contract type of the target smart contract. For example, for an EVM-type target smart contract, the corresponding target contract engine can be the EVM contract engine.

[0031] Step S40: Invoke the target contract engine to process the commercial distributed transaction in order to run the target smart contract in the commercial distributed blockchain.

[0032] In practical implementation, the aforementioned target contract engine can be integrated into a commercial distributed blockchain, thereby enabling the target smart contract, including the Ethereum Virtual Machine contract, to run compatiblely in a commercial distributed blockchain without making significant changes to the blockchain kernel.

[0033] To further describe the smart contract operation method mentioned in this embodiment, please refer to... Figure 2 , Figure 2 This is a schematic diagram of the smart contract execution architecture of the smart contract execution method of this application. Figure 2In the CMEOSjs framework, the client represents the client that sends the aforementioned contract deployment request. This client includes: contract deployment (format encapsulation and contract submission); contract invocation (EVM data type and transaction message encapsulation); and invocation results (result decoding and event decoding). A CMEOS node represents a node in the EOS blockchain. This node contains HTTP (Hypertext Transfer Protocol) plugins, a Net plugin, a Chain plugin, a WASM contract engine, a JS contract engine, and an EVM contract engine, among others. The EVM contract engine includes: contract deployment, including contract saving, contract verification, and contract initialization; contract invocation, including contract loading, parameter processing, and ABI (Application Binary Interface) proxy; EVM runtime sandbox, including the EVM virtual machine, engine initialization, transaction context, account address switching, resource gas (a unit of work used to measure computation, storage, and bandwidth resource consumption) switching, timeout handling (runtime calculation, timeout error output, and timeout error handling), log processing (log generation, log appending, and log reading), and event handling (event generation, event saving, and event output); database, including read interfaces, write interfaces, storage sandbox, and database; and adaptation layer, including data interfaces (such as Block.* interfaces, Msg.* interfaces, Tx.* interfaces, and Address.* interfaces) and encryption algorithms (such as sha256, ripemd160, identity, and secp256k1).

[0034] This embodiment deploys a target smart contract to a commercial distributed blockchain based on a user's deployment contract request. The target smart contract includes an Ethereum Virtual Machine (EVM) contract and a regular contract. The target smart contract is then encapsulated into a commercial distributed transaction. A corresponding target contract engine is determined based on the contract type of the target smart contract. The target contract engine is then invoked to process the commercial distributed transaction, thereby running the target smart contract within the commercial distributed blockchain. This embodiment provides a smart contract execution method. This method allows for the encapsulation of a target smart contract into a commercial distributed transaction, followed by invoking the corresponding target contract engine to process the transaction. This achieves the technical effect of compatiblely running EVM contracts within a commercial distributed blockchain without requiring significant modifications to the blockchain kernel.

[0035] refer to Figure 3 , Figure 3 This is a flowchart illustrating the second embodiment of the smart contract operation method of this application.

[0036] In one feasible implementation, step S10 may include: Step S101: When a deployment contract request is received from a user, obtain the deployment contract transaction and deployment type corresponding to the deployment contract request.

[0037] Step S102: Initialize the target smart contract according to the deployment contract transaction and deployment type, and deploy the target smart contract to the commercial distributed blockchain based on the initialization result.

[0038] In the specific implementation, when a user sends a deployment contract request, the deployment contract transaction corresponding to the deployment contract request can be placed in the transaction queue (a temporary buffer for storing pending transactions) of the commercial distributed blockchain. Then, the transactions in the transaction queue are processed to deserialize the deployment contract transaction. Next, the setcode can be executed through the apply_action built into the system contract to identify the deployment type corresponding to the deployment contract request, thereby selecting an engine that matches the deployment type to initialize the target smart contract. Finally, the initialization result is saved to the database of the commercial distributed blockchain to deploy the target smart contract to the commercial distributed blockchain.

[0039] For easier understanding, please refer to Figure 4 , Figure 4 This diagram illustrates the contract deployment example for the smart contract execution method described in this application. Figure 4 In the EVM contract deployment example shown, the user Actor submits a transaction through the client / SDK. Simultaneously, nodes in the EOS blockchain broadcast this transaction P2P (peer-to-peer) and place it in the transaction queue of the CMEOS node. Then, after deserializing the transactions in the transaction queue, the system contract determines that the deployment type corresponding to the transaction is EVM type, and calls the EVM engine based on the deployment type. Finally, the EVM engine initializes the EVM contract corresponding to the transaction, and saves the initialization result to the database of the EOS blockchain, thereby realizing the deployment of the EVM contract to the EOS blockchain.

[0040] In one feasible implementation, step S20 may include: Step S201: Expand the first module and serialize the transaction parameters contained in the target smart contract through the first module to obtain serialized data.

[0041] It should be noted that the first module mentioned above can be the transaction module. The transaction module is a key tool for developers to interact with the blockchain network and can be used to build, sign, send, and manage blockchain transactions.

[0042] In practical implementation, the first module can be extended using a software development kit (SDK) adapted to commercial distributed blockchains. More specifically, the transaction parameters contained in the target smart contract can be serialized using the ABI (Application Binary Interface) definition in the first module to obtain serialized data.

[0043] Step S202: Based on the serialized data, the target smart contract is encapsulated into a transaction to obtain a commercial distributed transaction.

[0044] It should be understood that the EOS transaction format can be used as the target format for transaction encapsulation. Based on the serialized data mentioned above, the target smart contract can be encapsulated to obtain the aforementioned commercial distributed transaction.

[0045] For easier understanding, please refer to Figure 5 , Figure 5 This is a contract call example diagram of the smart contract execution method of this application. Based on the contract call example diagram, the flow of transaction parameters within the contract can be observed macroscopically. Specifically, in Figure 5 In this context, assuming the target smart contract is an EVM contract, its corresponding transaction parameters can be EVM transaction messages. Therefore, transaction processing (the purpose of this transaction processing is to achieve transaction encapsulation) can be performed on the EVM contract in the client / SDK to achieve serialization, that is, converting the EVM transaction message into an EVM transaction message and then assembling it into an EOS transaction message; correspondingly, after receiving the EOS transaction message, the EOS node can serialize the EOS transaction message to obtain the EOS transaction message signature for security verification, and execute the call to the EVM contract after successful verification.

[0046] In this embodiment, when a user sends a deployment contract request, the system obtains the deployment contract transaction and deployment type corresponding to the request; initializes the target smart contract based on the deployment contract transaction and deployment type; and deploys the target smart contract to a commercial distributed blockchain based on the initialization result. The system extends the first module and serializes the transaction parameters contained in the target smart contract to obtain serialized data. Based on the serialized data, the system encapsulates the target smart contract to obtain a commercial distributed transaction. This embodiment initializes different types of target smart contracts based on the deployment contract transaction and deployment type corresponding to the deployment contract request, thereby deploying the target smart contract to a commercial distributed blockchain to ensure that subsequent steps can call the target smart contract normally. Simultaneously, by extending the first module, the system encapsulates the transactions in the target smart contract into EOS format transactions, allowing the commercial distributed blockchain to process the transaction parameters of the target smart contract without changing the interface layer.

[0047] refer to Figure 6 , Figure 6 This is a flowchart illustrating the third embodiment of the smart contract operation method of this application.

[0048] In one feasible implementation, prior to step S30, the following may also be included: Step S21: Expand the second module and identify the magic number corresponding to the contract code in the target smart contract through the second module.

[0049] It should be noted that the second module mentioned above can be the wasm_interface (wasm interface) module; the magic number mentioned above is a number or string with a specific meaning.

[0050] In the specific implementation, the magic number corresponding to the contract code in the target smart contract can be identified through the validate method of the second module mentioned above. If the identification fails, an error will be directly reported that the contract cannot be identified.

[0051] Step S22: Determine the contract type of the target smart contract based on the magic number.

[0052] It should be understood that different magic numbers correspond to different contract types. For example, the magic number of a WASM contract can be 0x0061736d, and its corresponding ASCII (American Standard Code for Information Interchange) code is asm; the magic number of a JS contract can be 0x04034b50, and its corresponding ASCII code is PK\003\004, which is the magic number for zip format; the magic number of an EVM contract can be 0x0065766d, and its corresponding ASCII code is evm.

[0053] In one feasible implementation, step S30 may include: Step S301: Separate the calling logic of the optional contract engine through the second module.

[0054] In a practical implementation, the calling logic of the optional contract engine can be separated through the apply method of the second module.

[0055] Step S302: Expand the third module, and in the third module, determine the corresponding target contract engine from the optional contract engines based on the contract type.

[0056] It should be noted that the third module mentioned above can be the contract_interface module.

[0057] In practical implementation, the target contract engine corresponding to the contract type can be determined through the third module mentioned above. For example, the target contract engine for an EVM contract is the EVM contract engine, the target contract engine for a WASM contract is the WASM contract engine, and the target contract engine for a JS contract is the JS contract engine, etc.

[0058] In one feasible implementation, the target contract engine includes a first engine and a second engine, and step S40 may include: Step S401: If the target smart contract is the Ethereum Virtual Machine contract, then the first engine is invoked to process the commercial distributed transaction to run the target smart contract in the commercial distributed blockchain.

[0059] It should be noted that the aforementioned first engine can be the EVM contract engine corresponding to the Ethereum Virtual Machine contract.

[0060] Step S402: If the target smart contract is the regular contract, then the second engine is invoked to process the commercial distributed transaction to run the target smart contract in the commercial distributed blockchain.

[0061] It should be noted that the aforementioned regular contract can be a WASM contract or a JS contract. Correspondingly, when the regular contract is a WASM contract, the aforementioned second engine can be a WASM contract engine; when the regular contract is a JS contract, the aforementioned second engine can be a JS contract engine.

[0062] In the specific implementation, you can refer to Figure 7 , Figure 7 This is an example diagram illustrating transaction processing in the smart contract execution method of this application. Figure 7 In this process, the aforementioned commercial distributed transactions are placed in a transaction queue. Once the processing begins, the distributed transactions are retrieved from the queue and deserialized. Then, the contracts need to be identified and verified. If it is a system contract, it is executed by the native code of the nodes in the commercial distributed blockchain; this embodiment does not modify this. If it is a call to a target smart contract, it needs to be executed through the target smart contract engine. Before executing the contract, this embodiment needs to abstract a contract engine interface module. This module simultaneously connects to the WASM contract engine, JS contract engine, and EVM contract engine, thereby supporting the invocation of multiple contract engines.

[0063] This embodiment extends the second module to identify the magic number corresponding to the contract code in the target smart contract; determines the contract type of the target smart contract based on the magic number; separates the calling logic of the optional contract engines through the second module; extends the third module to determine the corresponding target contract engine from the optional contract engines based on the contract type; if the target smart contract is the Ethereum Virtual Machine contract, the first engine is called to process the commercial distributed transaction to run the target smart contract in the commercial distributed blockchain; if the target smart contract is the regular contract, the second engine is called to process the commercial distributed transaction to run the target smart contract in the commercial distributed blockchain. This embodiment extends the second module to identify the magic number corresponding to the contract code in the target smart contract, thereby ensuring accurate identification of the contract type of the target smart contract; it also separates the calling logic of the optional contract engines through the second module and reshapes the calling logic of these contract engines through the extended third module; furthermore, this embodiment calls the corresponding engine to process the commercial distributed transaction according to the type of the target smart contract, thereby enabling the running of different types of contracts in the commercial distributed blockchain and broadening the applicable scenarios of this embodiment.

[0064] Reference Figure 8 , Figure 8 This is a structural block diagram of the first embodiment of the smart contract running device of this application.

[0065] like Figure 8As shown, the smart contract running device proposed in this application includes: The contract deployment module 801 is used to deploy a target smart contract to a commercial distributed blockchain according to a deployment contract request issued by a user. The target smart contract includes an Ethereum Virtual Machine contract and a regular contract. The transaction encapsulation module 802 is used to encapsulate the target smart contract into a commercial distributed transaction; Engine determination module 803 is used to determine the corresponding target contract engine based on the contract type to which the target smart contract belongs; The contract execution module 804 is used to call the target contract engine to process the commercial distributed transaction in order to run the target smart contract in the commercial distributed blockchain.

[0066] This embodiment deploys a target smart contract to a commercial distributed blockchain based on a user's deployment contract request. The target smart contract includes an Ethereum Virtual Machine (EVM) contract and a regular contract. The target smart contract is then encapsulated into a commercial distributed transaction. A corresponding target contract engine is determined based on the contract type of the target smart contract. The target contract engine is then invoked to process the commercial distributed transaction, thereby running the target smart contract within the commercial distributed blockchain. This embodiment provides a smart contract execution method. This method allows for the encapsulation of a target smart contract into a commercial distributed transaction, followed by invoking the corresponding target contract engine to process the transaction. This achieves the technical effect of compatiblely running EVM contracts within a commercial distributed blockchain without requiring significant modifications to the blockchain kernel.

[0067] Based on the first embodiment of the smart contract running device described in this application, a second embodiment of the smart contract running device of this application is proposed.

[0068] In this embodiment, the contract deployment module 801 is further configured to, when receiving a deployment contract request from a user, obtain the deployment contract transaction and deployment type corresponding to the deployment contract request; initialize the target smart contract according to the deployment contract transaction and deployment type; and deploy the target smart contract to a commercial distributed blockchain based on the initialization result.

[0069] Furthermore, the transaction encapsulation module 802 is also used to extend the first module and serialize the transaction parameters contained in the target smart contract through the first module to obtain serialized data; and encapsulate the target smart contract based on the serialized data to obtain a commercial distributed transaction.

[0070] Furthermore, the engine judgment module 803 is also used to extend the second module and identify the magic number corresponding to the contract code in the target smart contract through the second module; and determine the contract type to which the target smart contract belongs based on the magic number.

[0071] Furthermore, the engine judgment module 803 is also used to separate the calling logic of the optional contract engine through the second module; extend the third module, and determine the corresponding target contract engine from the optional contract engines based on the contract type in the third module.

[0072] Furthermore, the contract execution module 804 is also configured to, if the target smart contract is the Ethereum Virtual Machine contract, call the first engine to process the commercial distributed transaction to run the target smart contract in the commercial distributed blockchain; if the target smart contract is the regular contract, call the second engine to process the commercial distributed transaction to run the target smart contract in the commercial distributed blockchain.

[0073] Other embodiments or specific implementations of the smart contract running device of this application can be found in the above-described method embodiments, and will not be repeated here.

[0074] This application provides a smart contract running device, which includes: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to execute the smart contract running method in the first embodiment described above.

[0075] The following is for reference. Figure 9 The diagram illustrates a structural schematic of a smart contract running device suitable for implementing embodiments of this application. The smart contract running device in the embodiments of this application may include, but is not limited to, mobile terminals such as mobile phones, laptops, digital broadcast receivers, PDAs (Personal Digital Assistants), PADs (Portable Application Description), PMPs (Portable Media Players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and fixed terminals such as digital TVs and desktop computers. Figure 9 The smart contract running device shown is merely an example and should not impose any limitations on the functionality and scope of use of the embodiments of this application.

[0076] like Figure 9As shown, the smart contract running device may include a processing unit 1001 (e.g., a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory 1002 or a program loaded from a storage device 1003 into a random access memory 1004. The random access memory 1004 also stores various programs and data required for the operation of the smart contract running device. The processing unit 1001, the read-only memory 1002, and the random access memory 1004 are interconnected via a bus 1005. An input / output interface 1006 is also connected to the bus. Typically, the following systems can be connected to the input / output interface 1006: input devices 1007 including, for example, a touchscreen, touchpad, keyboard, mouse, image sensor, microphone, accelerometer, gyroscope, etc.; output devices 1008 including, for example, a liquid crystal display (LCD), speaker, vibrator, etc.; storage devices 1003 including, for example, magnetic tape, hard disk, etc.; and communication devices 1009. The communication device 1009 allows the smart contract running device to communicate wirelessly or wiredly with other devices to exchange data. While the figure shows smart contract running devices with various systems, it should be understood that implementation or possession of all the systems shown is not required. More or fewer systems may be implemented alternatively.

[0077] Specifically, according to the embodiments disclosed in this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments disclosed in this application include a computer program product comprising a computer program carried on a computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device, or installed from storage device 1003, or installed from read-only memory 1002. When the computer program is executed by processing device 1001, it performs the functions defined in the methods of the embodiments disclosed in this application.

[0078] The smart contract running device provided in this application, employing the smart contract running method described in the above embodiments, can solve the technical problem that related technologies cannot run EVM contracts compatiblely in commercial distributed blockchains without making significant modifications to the blockchain kernel. Compared with related technologies, the beneficial effects of the smart contract running device provided in this application are the same as those of the smart contract running method provided in the above embodiments, and other technical features of this smart contract running device are the same as those disclosed in the previous embodiment method, and will not be repeated here.

[0079] It should be understood that the various parts disclosed in this application can be implemented using hardware, software, firmware, or a combination thereof. In the description of the above embodiments, specific features, structures, materials, or characteristics can be combined in any suitable manner in one or more embodiments or examples.

[0080] The above description is merely a specific embodiment of this application, but the scope of protection of this application is not limited thereto. Any variations or substitutions that can be easily conceived by those skilled in the art within the scope of the technology disclosed in this application should be included within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.

[0081] This application provides a computer-readable storage medium having computer-readable program instructions (i.e., a computer program) stored thereon, which are used to execute the smart contract operation method in the above embodiments.

[0082] The computer-readable storage medium provided in this application may be, for example, a USB flash drive, but is not limited to, electrical, magnetic, optical, electromagnetic, infrared, or semiconductor systems or devices, or any combination thereof. More specific examples of computer-readable storage media may include, but are not limited to: electrical connections having one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof. In this embodiment, the computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system or device. The program code contained on the computer-readable storage medium may be transmitted using any suitable medium, including but not limited to: wires, optical cables, RF (Radio Frequency), etc., or any suitable combination thereof.

[0083] The aforementioned computer-readable storage medium may be included in the smart contract running device; or it may exist independently and not assembled into the smart contract running device.

[0084] The aforementioned computer-readable storage medium carries one or more programs that, when executed by a smart contract execution device, enable the smart contract execution device to write computer program code for performing the operations of this application in one or more programming languages ​​or a combination thereof. These programming languages ​​include object-oriented programming languages ​​such as Java, Smalltalk, and C++; and also conventional procedural programming languages ​​such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, such as a local area network (LAN) or a wide area network (WAN), or connected to an external computer (e.g., via the Internet using an Internet service provider).

[0085] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of this application. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, can be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0086] The modules described in the embodiments of this application can be implemented in software or hardware. The names of the modules do not necessarily limit the functionality of the unit itself.

[0087] The readable storage medium provided in this application is a computer-readable storage medium that stores computer-readable program instructions (i.e., computer programs) for executing the above-described smart contract execution method. This solves the technical problem that related technologies cannot run EVM contracts compatiblely in commercial distributed blockchains without significant modifications to the blockchain kernel. Compared with related technologies, the beneficial effects of the computer-readable storage medium provided in this application are the same as those of the smart contract execution method provided in the above embodiments, and will not be elaborated upon here.

[0088] This application also provides a computer program product, including a computer program that, when executed by a processor, implements the steps of the smart contract operation method described above.

[0089] The computer program product provided in this application can solve the technical problems of smart contract operation. Compared with related technologies, the beneficial effects of the computer program product provided in this application are the same as the beneficial effects of the smart contract operation method provided in the above embodiments, and will not be repeated here.

[0090] The above description is only a part of the embodiments of this application and does not limit the patent scope of this application. All equivalent structural transformations made under the technical concept of this application and using the contents of the specification and drawings of this application, or direct / indirect applications in other related technical fields, are included in the patent protection scope of this application.

Claims

1. A method for running a smart contract, characterized in that, The smart contract operation method includes the following steps: Deploy the target smart contract to a commercial distributed blockchain based on the deployment contract request issued by the user. The target smart contract includes Ethereum Virtual Machine contracts and regular contracts. The target smart contract is encapsulated into a transaction to obtain a commercial distributed transaction. The corresponding target contract engine is determined based on the contract type to which the target smart contract belongs; The target contract engine is invoked to process the commercial distributed transaction in order to run the target smart contract in the commercial distributed blockchain.

2. The smart contract operation method as described in claim 1, characterized in that, The step of deploying a target smart contract to a commercial distributed blockchain based on a user-issued deployment contract request, wherein the target smart contract includes an Ethereum Virtual Machine contract and a regular contract, includes: When a deployment contract request is received from a user, the deployment contract transaction and deployment type corresponding to the deployment contract request are obtained; The target smart contract is initialized according to the deployment contract transaction and deployment type, and the target smart contract is deployed to a commercial distributed blockchain based on the initialization result.

3. The smart contract operation method as described in claim 1, characterized in that, The step of encapsulating the target smart contract into a commercial distributed transaction includes: The first module is extended, and the transaction parameters contained in the target smart contract are serialized through the first module to obtain serialized data; Based on the serialized data, the target smart contract is encapsulated into a transaction to obtain a commercial distributed transaction.

4. The smart contract operation method as described in claim 1, characterized in that, Before the step of determining the corresponding target contract engine based on the contract type to which the target smart contract belongs, the method further includes: The second module is extended, and the magic number corresponding to the contract code in the target smart contract is identified through the second module; The type of contract to which the target smart contract belongs is determined based on the magic number.

5. The smart contract operation method as described in claim 4, characterized in that, The step of determining the corresponding target contract engine based on the contract type to which the target smart contract belongs includes: The second module separates the calling logic of the optional contract engine; The third module is extended, and in the third module, the corresponding target contract engine is determined from the optional contract engines based on the contract type.

6. The smart contract operation method as described in claim 1, characterized in that, The target contract engine includes a first engine and a second engine. The step of calling the target contract engine to process the commercial distributed transaction to run the target smart contract in the commercial distributed blockchain includes: If the target smart contract is the Ethereum Virtual Machine contract, then the first engine is invoked to process the commercial distributed transaction in order to run the target smart contract in the commercial distributed blockchain; If the target smart contract is a regular contract, then the second engine is invoked to process the commercial distributed transaction in order to run the target smart contract in the commercial distributed blockchain.

7. A smart contract operating device, characterized in that, The smart contract running device includes: The contract deployment module is used to deploy target smart contracts to a commercial distributed blockchain according to the deployment contract request issued by the user. The target smart contracts include Ethereum Virtual Machine contracts and regular contracts. The transaction encapsulation module is used to encapsulate the target smart contract into a transaction to obtain a commercial distributed transaction. The engine determination module is used to determine the corresponding target contract engine based on the contract type to which the target smart contract belongs; The contract execution module is used to call the target contract engine to process the commercial distributed transaction in order to run the target smart contract in the commercial distributed blockchain.

8. A smart contract running device, characterized in that, The device includes: a memory, a processor, and a smart contract execution program stored in the memory and executable on the processor, the smart contract execution program being configured to implement the steps of the smart contract execution method as described in any one of claims 1 to 6.

9. A storage medium, characterized in that, The storage medium is a computer-readable storage medium, and the storage medium stores a smart contract execution program. When the smart contract execution program is executed by a processor, it implements the steps of the smart contract execution method as described in any one of claims 1 to 6.

10. A computer program product, characterized in that, The computer program product includes a smart contract execution program, which, when executed by a processor, implements the steps of the smart contract execution method as described in any one of claims 1 to 6.