CN116342283A - Trusted intelligent contract implementation method, device, equipment and readable storage medium - Google Patents

Trusted intelligent contract implementation method, device, equipment and readable storage medium Download PDF

Info

Publication number
CN116342283A
CN116342283A CN202310338306.7A CN202310338306A CN116342283A CN 116342283 A CN116342283 A CN 116342283A CN 202310338306 A CN202310338306 A CN 202310338306A CN 116342283 A CN116342283 A CN 116342283A
Authority
CN
China
Prior art keywords
contract
interface
intelligent contract
trusted
wasm
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
CN202310338306.7A
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.)
Wuhan Tianyu Information Industry Co Ltd
Original Assignee
Wuhan Tianyu Information Industry 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 Wuhan Tianyu Information Industry Co Ltd filed Critical Wuhan Tianyu Information Industry Co Ltd
Priority to CN202310338306.7A priority Critical patent/CN116342283A/en
Publication of CN116342283A publication Critical patent/CN116342283A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/52Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow
    • G06F21/53Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems during program execution, e.g. stack integrity ; Preventing unwanted data erasure; Buffer overflow by executing in a restricted environment, e.g. sandbox or secure virtual machine
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/50Monitoring users, programs or devices to maintain the integrity of platforms, e.g. of processors, firmware or operating systems
    • G06F21/57Certifying or maintaining trusted computer platforms, e.g. secure boots or power-downs, version controls, system software checks, secure updates or assessing vulnerabilities
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45562Creating, deleting, cloning virtual machine instances
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45579I/O management, e.g. providing access to device drivers or storage
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45587Isolation or security of virtual machine instances
    • 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/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45595Network integration; Enabling network access in virtual machine instances
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Abstract

The invention provides a method, a device, equipment and a readable storage medium for realizing a trusted intelligent contract, wherein the method for realizing the trusted intelligent contract is applied to an intelligent contract execution environment, the intelligent contract execution environment is deployed in the trusted execution environment, and the method for realizing the trusted intelligent contract comprises the following steps: when receiving a call request of an intelligent contract, a WASM module loads a WASM byte code of an environment interface and the intelligent contract, and creates a WASM virtual machine instance; acquiring and analyzing contract parameters of the intelligent contract through an environment interface; calling a contract method by using the method parameters to obtain an execution result of the intelligent contract; and returning the execution result of the intelligent contract through the environment interface. By the method and the system, the security of the intelligent contract can be effectively improved based on the sandbox isolation characteristic and the trusted execution environment when the WASM is executed, and meanwhile, more program languages can be supported based on the format standard of the WASM, so that the usability of the intelligent contract is improved.

Description

Trusted intelligent contract implementation method, device, equipment and readable storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method, an apparatus, a device, and a readable storage medium for implementing a trusted smart contract.
Background
The intelligent contract is a decentralised digital contract, final execution results are determined through a consensus protocol after each participant executes the contract, so that a transaction system which is transparent in disclosure and can not be tampered is realized, the early intelligent contract can be traced to a locking script and an unlocking script of the bit coin, the transaction authority of the bit coin is controlled by the intelligent contract, the intelligent contract developed in a solid program language can be deployed and operated on a decentralised global computer of the Ethernet as the Ethernet appears, and the intelligent contract is finally executed in an EVM (Ethernet virtual machine) of each node of the Ethernet, so that the intelligent contract is widely applied.
However, the intelligent contracts of the ethernet mill run on each node, the running environment of the node is complex and uncontrollable, so that the execution reliability of the intelligent contracts cannot be guaranteed, and the intelligent contracts of the ethernet mill are written in very limited program languages such as solubility and Vyper, so that the development threshold is increased, and the usability of the intelligent contracts is not high.
Disclosure of Invention
The invention mainly aims to provide a method, a device, equipment and a readable storage medium for realizing a trusted intelligent contract, which aim to solve the technical problems that the intelligent contract of an Ethernet is operated on each node, the operation environment of the node is complex and uncontrollable, the execution reliability of the intelligent contract cannot be ensured, the intelligent contract of the Ethernet is written only to support limited programming languages such as solidy, vyper and the like, the development threshold is increased, and the usability of the intelligent contract is low.
In a first aspect, the present invention provides a trusted smart contract implementation method, where the trusted smart contract implementation method is applied to a smart contract execution environment, where the smart contract execution environment includes a contract interface, an environment interface, and a WASM module, the contract interface includes a contract calling interface, and the smart contract execution environment is deployed in the trusted execution environment, and the trusted smart contract implementation method includes:
when the contract calling interface receives a calling request of the intelligent contract, the WASM module loads a WASM byte code of the environment interface and the intelligent contract, and creates a WASM virtual machine instance;
the WASM virtual machine instance obtains contract parameters of the intelligent contract through an environment interface;
analyzing the contract parameters to obtain contract methods and method parameters, calling the contract methods by using the method parameters to obtain the execution results of the intelligent contracts;
and returning the execution result of the intelligent contract through the environment interface.
Optionally, the contract interface further includes a contract deployment interface, and when the contract interface receives a call request of the intelligent contract, the WASM module loads the environment interface and WASM byte codes of the intelligent contract, and before creating the WASM virtual machine instance, the method includes:
and deploying the WASM byte code of the intelligent contract to the intelligent contract execution environment through a contract deployment interface.
Optionally, before the deploying the WASM bytecode of the smart contract to the smart contract execution environment through the contract deployment interface, the method includes:
the intelligent contract is compiled through a compiling tool, and WASM byte codes of the intelligent contract are generated.
Optionally, after the calling the contract method, the method includes:
and carrying out contract data interaction through an environment interface.
Optionally, after the execution result of the smart contract is obtained, the method includes:
and remotely authenticating the intelligent contract execution environment, the WASM byte code of the intelligent contract and the execution result of the intelligent contract so as to improve the security of the intelligent contract.
Optionally, the environment interface is provided in the form of an application program interface, and the contract interface is provided in the form of an application program interface or a network interface.
In a second aspect, the present invention further provides a trusted smart contract implementation apparatus, where the trusted smart contract implementation apparatus is applied to a smart contract execution environment, the smart contract execution environment includes a contract interface, an environment interface, and a WASM module, the contract interface includes a contract call interface, the smart contract execution environment is deployed in the trusted execution environment, and the trusted smart contract implementation apparatus includes:
the system comprises a creating module, a WASM module, a service module and a service module, wherein the creating module is used for loading a WASM byte code of an environment interface and an intelligent contract when a contract calling interface receives a calling request of the intelligent contract, and creating a WASM virtual machine instance;
the acquisition module is used for acquiring contract parameters of the intelligent contract by the WASM virtual machine instance through the environment interface;
the calling module is used for analyzing the contract parameters to obtain contract methods and method parameters, calling the contract methods by using the method parameters to obtain the execution results of the intelligent contracts;
and the return module is used for returning the execution result of the intelligent contract through the environment interface.
Optionally, the contract interface further includes a contract deployment interface, and the trusted smart contract implementation apparatus further includes a deployment module configured to:
and deploying the WASM byte code of the intelligent contract to the intelligent contract execution environment through a contract deployment interface.
In a third aspect, the present invention also provides a trusted smart contract implementation apparatus, the trusted smart contract implementation apparatus comprising a processor, a memory, and a trusted smart contract implementation program stored on the memory and executable by the processor, wherein the trusted smart contract implementation program, when executed by the processor, implements the steps of the trusted smart contract implementation method as described above.
In a fourth aspect, the present invention further provides a readable storage medium, where a trusted smart contract implementation program is stored, where the trusted smart contract implementation program, when executed by a processor, implements the steps of the trusted smart contract implementation method as described above.
In the invention, the trusted intelligent contract implementation method is applied to an intelligent contract execution environment, the intelligent contract execution environment comprises a contract interface, an environment interface and a WASM module, the contract interface comprises a contract calling interface, the intelligent contract execution environment is deployed in the trusted execution environment, and the trusted intelligent contract implementation method comprises the following steps: when the contract calling interface receives a calling request of the intelligent contract, the WASM module loads a WASM byte code of the environment interface and the intelligent contract, and creates a WASM virtual machine instance; the WASM virtual machine instance obtains service parameters of the intelligent contract through the environment interface, and executes WASM byte codes of the intelligent contract according to the service parameters to obtain an execution result of the intelligent contract; and returning the execution result of the intelligent contract through the environment interface. According to the invention, based on the sandbox isolation characteristic and the trusted execution environment during WASM execution, the security of the intelligent contract can be effectively improved, and meanwhile, the format standard based on WASM can support more program languages, so that the usability of the intelligent contract is improved, and in addition, the intelligent contract realized based on WASM has the advantages of small volume, high portability, high execution efficiency and high security.
Drawings
FIG. 1 is a flow chart of an embodiment of a method for implementing a trusted smart contract according to the present invention;
FIG. 2 is a schematic diagram of an intelligent contract execution environment for an embodiment of a trusted intelligent contract implementation method of the present invention;
FIG. 3 is a schematic diagram of a deployment and execution flow of an embodiment of a trusted smart contract implementation method of the present invention;
FIG. 4 is a schematic diagram of a compiling, deploying and executing process of an embodiment of a trusted smart contract implementation method of the present invention;
FIG. 5 is a schematic diagram of functional modules of an embodiment of a trusted smart contract implementation apparatus of the present invention;
FIG. 6 is a schematic diagram of a hardware architecture of an embodiment of a trusted smart contract implementation apparatus of the present invention.
The achievement of the objects, functional features and advantages of the present invention will be further described with reference to the accompanying drawings, in conjunction with the embodiments.
Detailed Description
It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
In a first aspect, an embodiment of the present invention provides a method for implementing a trusted smart contract.
In order to more clearly show the trusted intelligent contract implementation method provided by the embodiment of the present application, an application scenario of the trusted intelligent contract implementation method provided by the embodiment of the present application is introduced first.
The method for implementing the trusted intelligent contract provided by the embodiment of the invention is applied to an intelligent contract developed in a solution program language, which can be deployed and run on a decentralized global computer of an ethernet, the intelligent contract is finally executed in an EVM (ethernet virtual machine) of each node of the ethernet, however, the intelligent contract of the ethernet is run on each node, the running environment of the node is complex and uncontrollable, so that the credibility of the intelligent contract cannot be ensured, and the intelligent contract writing of the ethernet only supports very limited program languages such as solution and Vyper, so that the development threshold is increased, and the usability of the intelligent contract is not high.
WASM (WebAssembly) is a new type of byte code capable of running in a browser, which is similar to assembly language, and its binary format has very high compactness, and can greatly reduce the size of the object code file and improve the distribution efficiency of the application program. Furthermore, WASM bytecode has the advantage of efficient operation, while WASM is able to provide compilation targets in multiple types of languages like C/c++, rust, and Golang, enabling applications written in these languages to run in a browser.
In an embodiment, the trusted smart contract implementation method is applied to a smart contract execution environment, where the smart contract execution environment includes a contract interface, an environment interface and a WASM module, the contract interface includes a contract call interface, the smart contract execution environment is deployed in the trusted execution environment, referring to fig. 1, fig. 1 is a flow chart of an embodiment of the trusted smart contract implementation method of the present invention, and as shown in fig. 1, the trusted smart contract implementation method includes:
and step S10, when the contract calling interface receives a calling request of the intelligent contract, the WASM module loads the environment interface and WASM byte codes of the intelligent contract, and creates a WASM virtual machine instance.
In this embodiment, the smart contract execution environment is a software system, and functions such as deployment, execution and management of the smart contract are implemented through the smart contract execution environment, referring to fig. 2, fig. 2 is a schematic diagram of an smart contract execution environment architecture of an embodiment of the trusted smart contract implementation method of the present invention, as shown in fig. 2, the smart contract execution environment includes a contract interface, an environment interface and a WASM module, where the contract interface includes a contract calling interface and a contract deployment interface, the contract interface is an interface provided by the smart contract execution environment for calling and deploying the smart contract, the environment interface is an interface provided by the smart contract execution environment for accessing an external environment, and is mainly used for obtaining relevant service parameters of an external input smart contract, and returning execution results of the smart contract to the outside, and the WASM module is a core module of the smart contract execution environment, and is mainly responsible for parsing and executing a byte code file in WASM format, and the compiled WASM byte code file has characteristics of high efficiency, light quantization, cross-platform and multi-language support, and various systems and methods provided in cooperation with running (runtime) can implement that the smart contract execution environment calls and an interface, and a unified host of a unified engine can be created and a unified interface is convenient for parsing and a unified memory. The intelligent contract execution environment is wholly deployed and operated in a trusted execution environment, the trusted execution environment is an independent processing environment with operation and storage functions and can provide security and integrity protection, an isolated memory is independently allocated for sensitive data in hardware, all the computation of the sensitive data is carried out in the isolated memory, other parts in the hardware except an authorized interface cannot access information in the isolated memory, therefore, the security of the intelligent contract can be effectively improved, and in the embodiment, the trusted execution environment can be realized based on Intel SGX (SoftwareGuard Extensions, intel's software protection extension technology), intel TDX (TrustDomain Extensions, intel's virtual machine isolation technology) and the like.
In this embodiment, in the smart contract execution environment, when the contract calling interface receives a call request of an external smart contract, the WASM module creates a smart contract WASM virtual machine instance by loading the environment interface and the WASM bytecode of the smart contract.
In step S20, the WASM virtual machine instance obtains the contract parameters of the intelligent contract through the environment interface.
In this embodiment, the WASM has a sandbox isolation characteristic when executing, which improves security of the intelligent contract, and the WASM cannot directly interact with the outside when executing, and the contract parameters of the intelligent contract must be obtained from the outside by means of an environment interface, where the contract parameters include contract methods and method parameters of the intelligent contract to be invoked, and the hash value and method parameters of the contract methods are encoded and then transferred to the WASM virtual machine instance through the environment interface in the form of binary stream.
And step S30, analyzing the contract parameters to obtain contract methods and method parameters, calling the contract methods by using the method parameters to obtain the execution results of the intelligent contracts.
In this embodiment, after resolving the contract parameters, a contract method and a method parameter can be obtained, where the contract method is a program function of the intelligent contract to be called, and the method parameter is an input parameter of the program function, and the contract method is called by using the method parameter to complete execution of the intelligent contract, so as to obtain an execution result of the intelligent contract.
And step S40, returning an execution result of the intelligent contract through the environment interface.
In this embodiment, in the smart contract execution environment, the WASM bytecode of executing the smart contract, which is also referred to as calling the smart contract, it may be understood that the calling the smart contract may be based on the call request received by the calling smart contract, read/write the private store of the user, store money into the account balance of the user, send/receive a message or digital asset from the user/other smart contract, etc., and the execution result of the smart contract is returned to the caller of the smart contract through the environment interface.
In this embodiment, the whole intelligent contract execution environment is deployed and operated in a trusted execution environment implemented by intel sgx, intel tdx, etc., and functions of deployment, execution, management, etc. of a complete intelligent contract are implemented through a contract interface, an environment interface, and a WASM module, so that security of the intelligent contract can be effectively improved based on sandbox isolation characteristics and the trusted execution environment when the WASM is executed, and meanwhile, more program languages can be supported based on format standards of the WASM, so that usability of the intelligent contract is improved, and in addition, the intelligent contract implemented based on the WASM also has advantages of small volume, high portability, high execution efficiency, and high security.
Further, in an embodiment, the contract interface further includes a contract deployment interface, referring to fig. 3, fig. 3 is a schematic diagram of deployment and execution flow of an embodiment of the trusted smart contract implementation method of the present invention, as shown in fig. 3, before step S10, including:
and step S01, deploying WASM byte codes of the intelligent contracts to an intelligent contract execution environment through a contract deployment interface.
In this embodiment, the method may further include ABI (ApplicationBinaryInterface) files of an intelligent contract, and ABI files are application binary interface files, which are descriptive files about interface function classes provided for the intelligent contract, deploying the WASM bytecode files and ABI files of the intelligent contract to the intelligent contract execution environment through a contract deployment interface of the intelligent contract execution environment, and after verifying the file format and other aspects, storing the WASM bytecode files and ABI files to the intelligent contract execution environment.
Further, in an embodiment, referring to fig. 4, fig. 4 is a schematic diagram of a compiling, deploying and executing flow of an embodiment of a trusted smart contract implementation method of the present invention, as shown in fig. 4, before the smart contract WASM bytecode is deployed to a smart contract execution environment through a contract deployment interface, the method includes:
step S00, compiling the intelligent contract through a compiling tool to generate WASM byte codes of the intelligent contract.
In this embodiment, an intelligent contract development suite may be provided for a developer of an intelligent contract to improve usability of the intelligent contract, where the intelligent contract development suite includes a development kit and a compiling tool for the intelligent contract, where the development kit is a code base for the intelligent contract provided for the developer to use, and includes a data type and a related service interface related to the basis of the intelligent contract, and is implemented by packaging a low-level environment interface based on a mainstream programming language, so that the developer does not need to care about the content of the low-level environment interface, and only needs to write the intelligent contract according to the data type and the interface provided by the development kit, thereby greatly reducing a development threshold and improving development efficiency. The compiling tool is combined with the mainstream development language and the related compiling chain tool to compile and optimize the intelligent contract codes written by using the intelligent contract development package, the Tree-shaking (Tree shaking optimization) technology is used for reducing the volume of the intelligent contracts, and finally the ABI files and WASM byte code files of the intelligent contracts are generated. Because the WASM is also a byte code standard, only related tools are needed to support, the main stream programming language can be compiled into a target binary file in the WASM format, for example, the rust language is used for compiling, the official provided WASM32-unknown-unknown tool can be used for compiling, the intelligent contract compiling tool can provide installation packages under different operating system platforms to operate in the form of command lines, an intelligent contract project can be newly built through new instructions, at the moment, the dependence of the intelligent contract development package can be automatically configured, an intelligent contract template referring to the intelligent contract development package is generated, a developer of the intelligent contract can modify the intelligent contract template according to the requirement of own business, then the contracts are compiled through the build instructions, the ABI file of the intelligent contract with the suffix of ABI and the byte code file of the intelligent contract with the suffix of the WASM are respectively generated, and the generated WASM byte code file and the ABI file of the intelligent contract can be deployed into an intelligent contract execution environment for execution.
Further, in an embodiment, after the calling the contract method, the method includes:
and carrying out contract data interaction through an environment interface.
In this embodiment, during the execution of the smart contract, the interaction of the contract data, such as reading and writing the contract status data, returning the event, and acquiring the timestamp, may be performed through the environment interface according to the need.
Further, in an embodiment, after the execution result of the smart contract is obtained, the method includes:
and remotely authenticating the intelligent contract execution environment, the WASM byte code of the intelligent contract and the execution result of the intelligent contract so as to improve the security of the intelligent contract.
In this embodiment, as shown in fig. 2, the smart contract execution environment further includes a remote authentication module, configured to provide a remote report generating function of the trusted execution environment, where the generated remote report may be authenticated by an authentication center, and the remote authentication of the smart contract execution environment is used to prove the trust of the smart contract execution environment, so as to ensure the execution security of the smart contract code, and the remote authentication of the smart contract WASM bytecode data is used to prove the integrity of the smart contract code, and the remote authentication of the smart contract execution result data is used to prove the trust of the smart contract execution result, and the remote authentication of the three related scenarios is used to ensure the security and reliability of the smart contract, and the disclosure transparency and non-tamper of the smart contract transaction are also ensured without depending on the blockchain, so as to increase the application scenarios of the smart contract.
Further, in an embodiment, the environment interface is provided in the form of an application program interface and the contract interface is provided in the form of an application program interface or a network interface.
In this embodiment, the environment interface is provided in the form of an application program interface, and the contract interface is provided in the form of an application program interface or a network interface, such as an RPC (Remote ProcedureCall ) interface, that requests services from a remote computer program over a network without requiring knowledge of the protocols of the underlying network technology.
In a second aspect, the embodiment of the invention also provides a trusted smart contract implementation device.
Referring to fig. 5, fig. 5 is a schematic diagram illustrating functional modules of an embodiment of a trusted smart contract implementation apparatus of the present invention.
In this embodiment, the trusted smart contract implementation apparatus is applied to a smart contract execution environment, where the smart contract execution environment includes a contract interface, an environment interface, and a WASM module, the contract interface includes a contract call interface, the smart contract execution environment is deployed in the trusted execution environment, and the trusted smart contract implementation apparatus includes:
the creating module 10 is configured to, when the contract calling interface receives a calling request of the intelligent contract, load a WASM byte code of the environment interface and the intelligent contract, and create a WASM virtual machine instance;
an obtaining module 20, configured to obtain, by using the WASM virtual machine instance, contract parameters of the intelligent contract through the environment interface;
a calling module 30, configured to parse the contract parameters to obtain a contract method and method parameters, and call the contract method by using the method parameters to obtain an execution result of the intelligent contract;
and a return module 40, configured to return, through the environment interface, an execution result of the smart contract.
Further, in an embodiment, the contract interface further includes a contract deployment interface, and the trusted smart contract implementation apparatus further includes a deployment module configured to:
and deploying the WASM byte code of the intelligent contract to the intelligent contract execution environment through a contract deployment interface.
Further, in an embodiment, the trusted smart contract implementation apparatus further includes a compiling module, configured to:
the intelligent contract is compiled through a compiling tool, and WASM byte codes of the intelligent contract are generated.
Further, in an embodiment, the trusted smart contract implementation apparatus further includes an interaction module, configured to:
and carrying out contract data interaction through an environment interface.
Further, in an embodiment, the trusted smart contract implementation apparatus further includes a remote authentication module configured to:
and remotely authenticating the intelligent contract execution environment, the WASM byte code of the intelligent contract and the execution result of the intelligent contract so as to improve the security of the intelligent contract.
Further, in an embodiment, the environment interface is provided in the form of an application program interface and the contract interface is provided in the form of an application program interface or a network interface.
The function implementation of each module in the trusted intelligent contract implementation device corresponds to each step in the trusted intelligent contract implementation method embodiment, and the functions and implementation processes of the trusted intelligent contract implementation device are not described in detail herein.
In a third aspect, an embodiment of the present invention provides a trusted smart contract implementation apparatus.
Referring to fig. 6, fig. 6 is a schematic diagram illustrating a hardware structure of an embodiment of the trusted smart contract implementation apparatus of the present invention. In an embodiment of the present invention, the trusted smart contract implementation apparatus may include a processor 1001 (e.g., a central processor CentralProcessingUnit, CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. Wherein the communication bus 1002 is used to enable connected communications between these components; the user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard); the network interface 1004 may optionally include a standard wired interface, a WIreless interface (e.g., WIreless-FIdelity, WI-FI interface); the memory 1005 may be a high-speed Random Access Memory (RAM) or a stable memory (non-volatile memory), such as a disk memory, and the memory 1005 may alternatively be a storage device independent of the processor 1001. Those skilled in the art will appreciate that the hardware configuration shown in fig. 6 is not limiting of the invention and may include more or fewer components than shown, or may combine certain components, or a different arrangement of components.
With continued reference to FIG. 6, an operating system, a network communication module, a user interface module, and a trusted smart contract implementation program may be included in memory 1005, FIG. 6, which is a type of computer storage medium. The processor 1001 may call the trusted smart contract implementation program stored in the memory 1005, and execute the trusted smart contract implementation method provided by the embodiment of the present invention.
In a fourth aspect, embodiments of the present invention also provide a readable storage medium.
The readable storage medium of the present invention stores a trusted smart contract implementation program, wherein the trusted smart contract implementation program, when executed by a processor, implements the steps of the trusted smart contract implementation method described above.
The method implemented when the trusted smart contract implementation program is executed may refer to various embodiments of the trusted smart contract implementation method of the present invention, which are not described herein.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or system. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article, or system that comprises the element.
The foregoing embodiment numbers of the present invention are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
From the above description of the embodiments, it will be clear to those skilled in the art that the above-described embodiment method may be implemented by means of software plus a necessary general hardware platform, but of course may also be implemented by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present invention may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) as described above, comprising several instructions for causing a terminal device to perform the method according to the embodiments of the present invention.
The foregoing description is only of the preferred embodiments of the present invention, and is not intended to limit the scope of the invention, but rather is intended to cover any equivalents of the structures or equivalent processes disclosed herein or in the alternative, which may be employed directly or indirectly in other related arts.

Claims (10)

1. The trusted intelligent contract implementation method is applied to an intelligent contract execution environment, the intelligent contract execution environment comprises a contract interface, an environment interface and a WASM module, the contract interface comprises a contract calling interface, the intelligent contract execution environment is deployed in the trusted execution environment, and the trusted intelligent contract implementation method comprises the following steps:
when the contract calling interface receives a calling request of the intelligent contract, the WASM module loads a WASM byte code of the environment interface and the intelligent contract, and creates a WASM virtual machine instance;
the WASM virtual machine instance obtains contract parameters of the intelligent contract through an environment interface;
analyzing the contract parameters to obtain contract methods and method parameters, calling the contract methods by using the method parameters to obtain the execution results of the intelligent contracts;
and returning the execution result of the intelligent contract through the environment interface.
2. The trusted smart contract implementation method of claim 1, wherein the contract interface further comprises a contract deployment interface, wherein when the contract interface receives a call request for a smart contract, the WASM module loads a WASM bytecode of the smart contract and an environment interface, and before creating a WASM virtual machine instance, comprises:
and deploying the WASM byte code of the intelligent contract to the intelligent contract execution environment through a contract deployment interface.
3. The method of trusted smart contract implementation of claim 2, comprising, prior to said deploying the smart contract's WASM bytecode to the smart contract execution environment via the contract deployment interface:
the intelligent contract is compiled through a compiling tool, and WASM byte codes of the intelligent contract are generated.
4. The trusted smart contract implementation method of claim 1, after said invoking a contract method, comprising:
and carrying out contract data interaction through an environment interface.
5. The method for implementing a trusted smart contract according to claim 1, comprising, after said obtaining a result of execution of the smart contract:
and remotely authenticating the intelligent contract execution environment, the WASM byte code of the intelligent contract and the execution result of the intelligent contract so as to improve the security of the intelligent contract.
6. The trusted smart contract implementation method of claim 1, wherein the environment interface is provided in the form of an application program interface, and the contract interface is provided in the form of an application program interface or a network interface.
7. The trusted intelligent contract implementation device is applied to an intelligent contract execution environment, the intelligent contract execution environment comprises a contract interface, an environment interface and a WASM module, the contract interface comprises a contract calling interface, the intelligent contract execution environment is deployed in the trusted execution environment, and the trusted intelligent contract implementation device comprises:
the system comprises a creating module, a WASM module, a service module and a service module, wherein the creating module is used for loading a WASM byte code of an environment interface and an intelligent contract when a contract calling interface receives a calling request of the intelligent contract, and creating a WASM virtual machine instance;
the acquisition module is used for acquiring contract parameters of the intelligent contract by the WASM virtual machine instance through the environment interface;
the calling module is used for analyzing the contract parameters to obtain contract methods and method parameters, calling the contract methods by using the method parameters to obtain the execution results of the intelligent contracts;
and the return module is used for returning the execution result of the intelligent contract through the environment interface.
8. The trusted smart contract implementing apparatus of claim 7, wherein said contract interface further includes a contract deployment interface, said trusted smart contract implementing apparatus further comprising a deployment module to:
and deploying the WASM byte code of the intelligent contract to the intelligent contract execution environment through a contract deployment interface.
9. A trusted smart contract implementation apparatus, characterized in that it comprises a processor, a memory, and a trusted smart contract implementation program stored on the memory and executable by the processor, wherein the trusted smart contract implementation program, when executed by the processor, implements the steps of the trusted smart contract implementation method according to any one of claims 1 to 6.
10. A readable storage medium, characterized in that a trusted smart contract implementation program is stored on the readable storage medium, wherein the trusted smart contract implementation program, when executed by a processor, implements the steps of the trusted smart contract implementation method according to any one of claims 1 to 6.
CN202310338306.7A 2023-03-31 2023-03-31 Trusted intelligent contract implementation method, device, equipment and readable storage medium Pending CN116342283A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310338306.7A CN116342283A (en) 2023-03-31 2023-03-31 Trusted intelligent contract implementation method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310338306.7A CN116342283A (en) 2023-03-31 2023-03-31 Trusted intelligent contract implementation method, device, equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN116342283A true CN116342283A (en) 2023-06-27

Family

ID=86889275

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310338306.7A Pending CN116342283A (en) 2023-03-31 2023-03-31 Trusted intelligent contract implementation method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN116342283A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116805947A (en) * 2023-08-21 2023-09-26 腾讯科技(深圳)有限公司 Block chain data processing method, device, equipment and computer readable storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116805947A (en) * 2023-08-21 2023-09-26 腾讯科技(深圳)有限公司 Block chain data processing method, device, equipment and computer readable storage medium
CN116805947B (en) * 2023-08-21 2023-11-10 腾讯科技(深圳)有限公司 Block chain data processing method, device, equipment and computer readable storage medium

Similar Documents

Publication Publication Date Title
CN109710384B (en) Safe Java intelligent contract interpretation execution engine and method
CN110046023B (en) Data processing method and system based on intelligent contract of block chain
CN109933404B (en) Encoding and decoding method and system based on block chain intelligent contract
US8756616B2 (en) System and method for reducing the static footprint of mixed-language JAVA classes
CN110048846B (en) Signature verification method and system based on block chain intelligent contract
CN111770206A (en) Method for deploying intelligent contract, block chain node and storage medium
CN113688186B (en) Intelligent contract execution method, engine and block link point
CN113407362A (en) SOMEIP communication intermediate layer implementation method and system based on SOA architecture of vehicle-mounted Android system
US8141042B2 (en) Extending portability of java code through the use of AOP
CN116342283A (en) Trusted intelligent contract implementation method, device, equipment and readable storage medium
CN110046991B (en) Data processing method and system based on intelligent contract of block chain
US20230297348A1 (en) Method for operating second system application on first system, terminal device and storage medium
CN111159301A (en) Data creating method, device, equipment and storage medium based on intelligent contract
CN111651169B (en) Block chain intelligent contract operation method and system based on web container
US11803786B2 (en) Enterprise integration platform
CN115442372A (en) Interface calling method and micro-service application system applying same
CN115291933A (en) Method, device and equipment for constructing small program data packet and storage medium
JP7073813B2 (en) Control programs, control methods and information processing equipment
CN110888674B (en) Method and device for executing security calculation in Python virtual machine
US20110321009A1 (en) Implementing encryption via aspect oriented programming
CN114020278A (en) Data processing method, device, equipment and storage medium
CN117056317B (en) Data processing method, device, equipment and computer readable storage medium
CN114416219B (en) System function calling method, device, electronic equipment and readable medium
CN117093286B (en) Plug-in generation method, device, equipment and computer readable storage medium
CN111694730B (en) Method and device for eliminating error reference control resource

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