Smart contract execution method and device, equipment and medium

A technology of smart contracts and execution methods, applied in the field of information security, can solve the problems of long time consumption, poor execution performance, and large time proportion, and achieve the effect of improving execution efficiency and reducing compilation time.

Active Publication Date: 2019-08-06
BAIDU ONLINE NETWORK TECH (BEIJIBG) CO LTD
View PDF10 Cites 41 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0003] Interpretation execution performance is poor, mainly from two aspects: (1) Interpretation execution itself needs to use the stack virtual machine to cooperate, each operation needs to interact with the stack, fetch operands, perform operations, and the result will be written, resulting in performance R

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Smart contract execution method and device, equipment and medium
  • Smart contract execution method and device, equipment and medium
  • Smart contract execution method and device, equipment and medium

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0026] figure 1 It is a flowchart of a smart contract execution method provided in Embodiment 1 of the present invention. This embodiment can be applied to how to execute smart contracts to solve the existing way of realizing smart contracts through bytecode interpretation and execution. There are smart contracts The case of the execution efficiency problem. The solution of the embodiment of the present invention is executed by the blockchain node, and further, can be executed by the contract virtual machine in the blockchain node device. Optionally, the contract virtual machine can be a WebAssembly contract virtual machine. The method can be executed by a smart contract execution device, and the device can be configured in a computing device carrying a block chain node, and implemented in the form of hardware and / or software. see figure 1 , the method may specifically include:

[0027] S110, acquire a transaction request initiated based on the smart contract.

[0028] A ...

Embodiment 2

[0047] figure 2 It is a flow chart of a smart contract execution method provided in Embodiment 2 of the present invention. This embodiment further optimizes the above-mentioned embodiments and proposes a solution for optimizing contract source code files. see figure 2 , the method may specifically include:

[0048] S210. Decompile the smart contract bytecode file into a target high-level language to obtain a contract source code file.

[0049] S220, inserting at least one hook function among a debug hook function, a resource consumption audit control hook function, and a code injection hook function into the contract source code file.

[0050] Among them, the hook function is a part of the Windows message processing mechanism. By setting the "hook", the application program can filter all messages and events at the system level, and access messages that cannot be accessed under normal circumstances. The essence of a hook is a program for processing system messages, which i...

Embodiment 3

[0060] image 3 It is a flowchart of a smart contract execution method provided in Embodiment 3 of the present invention. This embodiment is further optimized on the basis of the foregoing embodiments. see image 3 , the method may specifically include:

[0061] S310. Decompile the smart contract bytecode file into a target high-level language to obtain the contract source code file.

[0062] S320. Compile the contract source code file to obtain a contract dynamic link library file.

[0063] S330. Insert a unified virtual machine calling proxy interface and a virtual machine writing proxy interface into the contract dynamic link library file.

[0064] Since the contract dynamic link library file itself does not have a read-write interface, in the subsequent process of executing the smart contract, the contract dynamic link library file needs to call external functions or external variables. Based on this, after compiling the contract source code file to obtain the contract...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The embodiment of the invention discloses a smart contract execution method and device, equipment and a medium. The method comprises the steps of obtaining a transaction request initiated based on a smart contract; in the process of executing the smart contract to process the transaction request, calling a contract dynamic link library file, wherein an intelligent contract bytecode file is decompiled into a target advanced language to obtain a contract source code file, and the contract source code file is compiled to obtain the contract dynamic link library file. Through the technical schemeprovided by the embodiment of the invention, the execution efficiency of the smart contract can be improved.

Description

technical field [0001] The embodiments of the present invention relate to the technical field of information security, and in particular, to a smart contract execution method, device, equipment and medium. Background technique [0002] The smart contract in the blockchain needs to run in a virtual machine, and the smart contract is mainly implemented through Wasm (WebAssembly, bytecode file) interpretation and execution. Wasm is a portable and safe object code format. It is an intermediate code format generated before high-level language is compiled into machine language. A Wasm file is a module (unit), and a module contains 9 sections (segments), including import segment, export segment, etc. Wasm interpretation and execution refers to the process of fetching Wasm through the stack virtual machine -> translation -> execution -> the result will be written. [0003] Interpretation execution performance is poor, mainly from two aspects: (1) Interpretation execution ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F9/455G06F8/41
CPCG06F9/45516G06F9/45529G06F8/41
Inventor 段兵樊冰新肖伟
Owner BAIDU ONLINE NETWORK TECH (BEIJIBG) CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products