CN114327477A - Intelligent contract execution method and device, electronic device and storage medium - Google Patents
Intelligent contract execution method and device, electronic device and storage medium Download PDFInfo
- Publication number
- CN114327477A CN114327477A CN202111606437.6A CN202111606437A CN114327477A CN 114327477 A CN114327477 A CN 114327477A CN 202111606437 A CN202111606437 A CN 202111606437A CN 114327477 A CN114327477 A CN 114327477A
- Authority
- CN
- China
- Prior art keywords
- intelligent contract
- smart contract
- code
- machine code
- intelligent
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 64
- 238000003860 storage Methods 0.000 title claims abstract description 16
- 230000015654 memory Effects 0.000 claims description 21
- 238000006243 chemical reaction Methods 0.000 claims description 16
- 238000004590 computer program Methods 0.000 claims description 13
- 238000012545 processing Methods 0.000 claims description 7
- 230000008569 process Effects 0.000 description 19
- 238000005516 engineering process Methods 0.000 description 9
- 230000006870 function Effects 0.000 description 8
- 230000005540 biological transmission Effects 0.000 description 6
- 238000010586 diagram Methods 0.000 description 4
- 238000004458 analytical method Methods 0.000 description 2
- 230000006399 behavior Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 2
- 238000011161 development Methods 0.000 description 2
- 238000004519 manufacturing process Methods 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- BBRBUTFBTUFFBU-LHACABTQSA-N Ornoprostil Chemical compound CCCC[C@H](C)C[C@H](O)\C=C\[C@H]1[C@H](O)CC(=O)[C@@H]1CC(=O)CCCCC(=O)OC BBRBUTFBTUFFBU-LHACABTQSA-N 0.000 description 1
- 230000001133 acceleration Effects 0.000 description 1
- JEIPFZHSYJVQDO-UHFFFAOYSA-N iron(III) oxide Inorganic materials O=[Fe]O[Fe]=O JEIPFZHSYJVQDO-UHFFFAOYSA-N 0.000 description 1
- 230000002427 irreversible effect Effects 0.000 description 1
- 238000010295 mobile communication Methods 0.000 description 1
- 238000005457 optimization Methods 0.000 description 1
- 238000013519 translation Methods 0.000 description 1
Images
Landscapes
- Stored Programmes (AREA)
Abstract
本申请涉及一种智能合约执行方法、装置、电子装置和存储介质,其中,该智能合约执行方法包括:获取智能合约的字节码;根据LLVM项目的中间语言结构,将智能合约的字节码转换为智能合约的中间代码;调用LLVM项目提供的编译器,根据智能合约的中间代码确定智能合约的机器码;执行智能合约的机器码。通过本申请,解决了相关技术中执行智能合约时需要先进行解析再执行,导致智能合约的执行效率较低的问题,提高了智能合约的执行效率。
The present application relates to a smart contract execution method, device, electronic device and storage medium, wherein the smart contract execution method includes: obtaining the bytecode of the smart contract; according to the intermediate language structure of the LLVM project, converting the bytecode of the smart contract Convert to the intermediate code of the smart contract; call the compiler provided by the LLVM project to determine the machine code of the smart contract according to the intermediate code of the smart contract; execute the machine code of the smart contract. This application solves the problem in the related art that when executing a smart contract, it needs to be parsed and then executed, resulting in a low execution efficiency of the smart contract, and the execution efficiency of the smart contract is improved.
Description
技术领域technical field
本申请涉及区块链技术领域,特别是涉及智能合约执行方法、装置、电子装置和存储介质。This application relates to the field of blockchain technology, and in particular, to a smart contract execution method, device, electronic device and storage medium.
背景技术Background technique
区块链技术是一种互联网数据库技术,其特点是去中心化、公开透明,允许每个人参与数据库记录。随着区块链技术的发展,智能合约得到了越来越多的应用,具体地,智能合约是一种程序化合约,在满足预设条件时自动执行,可部署在区块链中。Blockchain technology is an Internet database technology that is characterized by decentralization, openness and transparency, allowing everyone to participate in database records. With the development of blockchain technology, smart contracts have been used more and more. Specifically, smart contracts are programmed contracts that are automatically executed when preset conditions are met, and can be deployed in the blockchain.
在相关技术中执行智能合约的过程为,获取编写完成的智能合约,将智能合约部署在区块链节点中进行调用,在调用时需要将智能合约先进行解析然后再进行执行,效率较低。The process of executing a smart contract in related technologies is to obtain the written smart contract, deploy the smart contract in the blockchain node for invocation, and need to parse the smart contract before executing the invocation, which is inefficient.
针对相关技术中执行智能合约时需要先进行解析再执行,导致智能合约的执行效率较低的问题,目前还没有提出有效的解决方案。There is no effective solution to the problem that the execution of smart contracts in related technologies needs to be parsed and then executed, resulting in low execution efficiency of smart contracts.
发明内容SUMMARY OF THE INVENTION
在本实施例中提供了一种智能合约执行方法、装置、系统、电子装置和存储介质,以解决相关技术中执行智能合约时需要先进行解析再执行,导致智能合约的执行效率较低的问题。In this embodiment, a smart contract execution method, device, system, electronic device and storage medium are provided to solve the problem in the related art that when executing a smart contract, it needs to be parsed and then executed, resulting in low execution efficiency of the smart contract .
第一个方面,在本实施例中提供了一种智能合约执行方法,包括:In a first aspect, this embodiment provides a smart contract execution method, including:
获取智能合约的字节码;Get the bytecode of the smart contract;
根据LLVM项目的中间语言结构,将所述智能合约的字节码转换为智能合约的中间代码;Convert the bytecode of the smart contract into the intermediate code of the smart contract according to the intermediate language structure of the LLVM project;
调用所述LLVM项目提供的编译器,根据所述智能合约的中间代码确定智能合约的机器码;Invoke the compiler provided by the LLVM project, and determine the machine code of the smart contract according to the intermediate code of the smart contract;
执行所述智能合约的机器码。Machine code that executes the smart contract.
在其中一些实施例中,所述根据LLVM项目的中间语言结构,将所述智能合约的字节码转换为智能合约的中间代码包括:In some of these embodiments, converting the bytecode of the smart contract into the intermediate code of the smart contract according to the intermediate language structure of the LLVM project includes:
获取由所述中间语言结构确定的语法规范;obtaining a grammatical specification determined by the intermediate language structure;
根据所述语法规范,将所述智能合约的字节码中所有的语句序列转换为所述智能合约的中间代码。According to the grammar specification, all the statement sequences in the bytecode of the smart contract are converted into the intermediate code of the smart contract.
在其中一些实施例中,所述根据所述语法规范,将所述智能合约的字节码中所有的语句序列转换为所述智能合约的中间代码包括:In some of the embodiments, converting all the statement sequences in the bytecode of the smart contract into the intermediate code of the smart contract according to the grammar specification includes:
获取所述智能合约的字节码中的第一指令类型,根据所述语法规范在所述中间语言结构中确定第二指令类型;obtaining the first instruction type in the bytecode of the smart contract, and determining the second instruction type in the intermediate language structure according to the grammar specification;
将所述第一指令类型和所述第二指令类型进行存储,以得到所述智能合约的中间代码。The first instruction type and the second instruction type are stored to obtain the intermediate code of the smart contract.
在其中一些实施例中,所述调用所述LLVM项目提供的编译器,根据所述智能合约的中间代码确定智能合约的机器码包括:In some of the embodiments, the invoking the compiler provided by the LLVM project to determine the machine code of the smart contract according to the intermediate code of the smart contract includes:
通过所述LLVM项目提供的编译器,将所述智能合约的中间代码编译为智能合约的第一机器码;Compile the intermediate code of the smart contract into the first machine code of the smart contract through the compiler provided by the LLVM project;
在所述第一机器码中加上符号表,并将所述第一机器码和所述符号表转换为二进制序列,得到所述智能合约的第二机器码。A symbol table is added to the first machine code, and the first machine code and the symbol table are converted into binary sequences to obtain the second machine code of the smart contract.
在其中一些实施例中,在执行所述智能合约的机器码之前,所述方法包括:In some of these embodiments, before executing the machine code of the smart contract, the method includes:
将所述智能合约的机器码存储至缓存和/或数据库。The machine code of the smart contract is stored in a cache and/or database.
在其中一些实施例中,所述执行所述智能合约的机器码包括:In some of these embodiments, the machine code for executing the smart contract includes:
在所述缓存中存在所述智能合约的机器码的情况下,执行所述缓存中的智能合约的机器码;If the machine code of the smart contract exists in the cache, execute the machine code of the smart contract in the cache;
在所述缓存中不存在所述智能合约的机器码的情况下,从所述数据库中获取智能合约的机器码进行执行;If the machine code of the smart contract does not exist in the cache, obtain the machine code of the smart contract from the database and execute it;
在所述数据库中不存在所述智能合约的机器码的情况下,执行所述智能合约的字节码。In the case where the machine code of the smart contract does not exist in the database, the bytecode of the smart contract is executed.
在其中一些实施例中,所述根据LLVM项目的中间语言结构,将所述智能合约的字节码转换为智能合约的中间代码包括:In some of these embodiments, converting the bytecode of the smart contract into the intermediate code of the smart contract according to the intermediate language structure of the LLVM project includes:
根据所述智能合约的字节码中的字节码顺序,依次将所述智能合约的字节码转换为智能合约的中间代码;或者,According to the bytecode sequence in the bytecode of the smart contract, sequentially convert the bytecode of the smart contract into the intermediate code of the smart contract; or,
将所述智能合约的字节码划分为多个字节码序列,通过并行处理将多个所述字节码序列转换为智能合约的多个中间代码序列,根据多个中间代码序列确定所述智能合约的中间代码。Divide the bytecode of the smart contract into multiple bytecode sequences, convert the multiple bytecode sequences into multiple intermediate code sequences of the smart contract through parallel processing, and determine the multiple intermediate code sequences according to the multiple intermediate code sequences. Intermediate code for smart contracts.
第二个方面,在本实施例中提供了一种智能合约执行装置,包括获取模块、转换模块、调用模块和执行模块:In a second aspect, a smart contract execution device is provided in this embodiment, including an acquisition module, a conversion module, a calling module, and an execution module:
所述获取模块,用于获取智能合约的字节码;The obtaining module is used to obtain the bytecode of the smart contract;
所述转换模块,用于根据LLVM项目的中间语言结构,将所述智能合约的字节码转换为智能合约的中间代码;The conversion module is used to convert the bytecode of the smart contract into the intermediate code of the smart contract according to the intermediate language structure of the LLVM project;
所述调用模块,用于调用所述LLVM项目提供的编译器,根据所述智能合约的中间代码确定智能合约的机器码;The calling module is used to call the compiler provided by the LLVM project, and determine the machine code of the smart contract according to the intermediate code of the smart contract;
所述执行模块,用于执行所述智能合约的机器码。The execution module is used to execute the machine code of the smart contract.
第三个方面,在本实施例中提供了一种电子装置,包括存储器、处理器以及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述处理器执行所述计算机程序时实现上述第一个方面所述的智能合约执行方法。In a third aspect, this embodiment provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor, where the processor executes the computer During the program, the smart contract execution method described in the first aspect above is realized.
第四个方面,在本实施例中提供了一种存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述第一个方面所述的智能合约执行方法的步骤。In a fourth aspect, this embodiment provides a storage medium on which a computer program is stored, and when the program is executed by a processor, implements the steps of the smart contract execution method described in the first aspect above.
与相关技术相比,在本实施例中提供的智能合约执行方法,通过获取智能合约的字节码;根据LLVM项目的中间语言结构,将智能合约的字节码转换为智能合约的中间代码;调用LLVM项目提供的编译器,根据智能合约的中间代码确定智能合约的机器码;执行智能合约的机器码,解决了相关技术中执行智能合约时需要先进行解析再执行,导致智能合约的执行效率较低的问题,提高了智能合约的执行效率。Compared with related technologies, the smart contract execution method provided in this embodiment obtains the bytecode of the smart contract; according to the intermediate language structure of the LLVM project, the bytecode of the smart contract is converted into the intermediate code of the smart contract; Call the compiler provided by the LLVM project to determine the machine code of the smart contract according to the intermediate code of the smart contract; execute the machine code of the smart contract, which solves the need to parse and then execute the smart contract in related technologies, resulting in the execution efficiency of the smart contract. Lower problems and improve the execution efficiency of smart contracts.
本申请的一个或多个实施例的细节在以下附图和描述中提出,以使本申请的其他特征、目的和优点更加简明易懂。The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below in order to make other features, objects and advantages of the application more apparent.
附图说明Description of drawings
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide further understanding of the present application and constitute a part of the present application. The schematic embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation of the present application. In the attached image:
图1是本实施例的智能合约执行方法的终端的硬件结构框图;Fig. 1 is the hardware structure block diagram of the terminal of the smart contract execution method of the present embodiment;
图2是本实施例的智能合约执行方法的流程图;Fig. 2 is the flow chart of the smart contract execution method of the present embodiment;
图3是本实施例的智能合约的中间代码的获取方法的流程图;Fig. 3 is the flow chart of the acquisition method of the intermediate code of the smart contract of the present embodiment;
图4是根据本申请实施例的智能合约的机器码的获取方法的流程图;4 is a flowchart of a method for acquiring a machine code of a smart contract according to an embodiment of the present application;
图5是根据本申请优选实施例的智能合约部署与调用的方法的流程图;5 is a flowchart of a method for deploying and invoking a smart contract according to a preferred embodiment of the present application;
图6是本实施例的智能合约执行装置的结构框图。FIG. 6 is a structural block diagram of the smart contract execution apparatus of this embodiment.
具体实施方式Detailed ways
为更清楚地理解本申请的目的、技术方案和优点,下面结合附图和实施例,对本申请进行了描述和说明。For a clearer understanding of the purpose, technical solutions and advantages of the present application, the present application is described and illustrated below with reference to the accompanying drawings and embodiments.
除另作定义外,本申请所涉及的技术术语或者科学术语应具有本申请所属技术领域具备一般技能的人所理解的一般含义。在本申请中的“一”、“一个”、“一种”、“该”、“这些”等类似的词并不表示数量上的限制,它们可以是单数或者复数。在本申请中所涉及的术语“包括”、“包含”、“具有”及其任何变体,其目的是涵盖不排他的包含;例如,包含一系列步骤或模块(单元)的过程、方法和系统、产品或设备并未限定于列出的步骤或模块(单元),而可包括未列出的步骤或模块(单元),或者可包括这些过程、方法、产品或设备固有的其他步骤或模块(单元)。在本申请中所涉及的“连接”、“相连”、“耦接”等类似的词语并不限定于物理的或机械连接,而可以包括电气连接,无论是直接连接还是间接连接。在本申请中所涉及的“多个”是指两个或两个以上。“和/或”描述关联对象的关联关系,表示可以存在三种关系,例如,“A和/或B”可以表示:单独存在A,同时存在A和B,单独存在B这三种情况。通常情况下,字符“/”表示前后关联的对象是一种“或”的关系。在本申请中所涉及的术语“第一”、“第二”、“第三”等,只是对相似对象进行区分,并不代表针对对象的特定排序。Unless otherwise defined, the technical or scientific terms involved in this application shall have the general meaning understood by a person with ordinary skills in the technical field to which this application belongs. Words like "a", "an", "an", "the", "these" and the like in this application do not denote quantitative limitations, and they may be singular or plural. The terms "comprising", "comprising", "having" and any variations thereof referred to in this application are intended to cover non-exclusive inclusion; for example, processes, methods and The system, product or device is not limited to the listed steps or modules (units), but may include unlisted steps or modules (units), or may include other steps or modules inherent to these processes, methods, products or devices (unit). References in this application to "connected," "connected," "coupled," and similar words are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. As used in this application, "plurality" refers to two or more. "And/or" describes the association relationship between associated objects, indicating that there can be three kinds of relationships. For example, "A and/or B" can mean that A exists alone, A and B exist at the same time, and B exists alone. Normally, the character "/" indicates that the objects associated with each other are an "or" relationship. The terms "first", "second", "third", etc. involved in this application are only for distinguishing similar objects, and do not represent a specific order for the objects.
在本实施例中提供的方法实施例可以在终端、计算机或者类似的运算装置中执行。比如在终端上运行,图1是本实施例的智能合约执行方法的终端的硬件结构框图。如图1所示,终端可以包括一个或多个(图1中仅示出一个)处理器102和用于存储数据的存储器104,其中,处理器102可以包括但不限于微处理器MCU或可编程逻辑器件FPGA等的处理装置。上述终端还可以包括用于通信功能的传输设备106以及输入输出设备108。本领域普通技术人员可以理解,图1所示的结构仅为示意,其并不对上述终端的结构造成限制。例如,终端还可包括比图1中所示更多或者更少的组件,或者具有与图1所示出的不同配置。The method embodiments provided in this embodiment may be executed in a terminal, a computer or a similar computing device. For example, running on a terminal, FIG. 1 is a block diagram of the hardware structure of the terminal of the smart contract execution method of this embodiment. As shown in FIG. 1 , the terminal may include one or more (only one is shown in FIG. 1 )
存储器104可用于存储计算机程序,例如,应用软件的软件程序以及模块,如在本实施例中的智能合约执行方法对应的计算机程序,处理器102通过运行存储在存储器104内的计算机程序,从而执行各种功能应用以及数据处理,即实现上述的方法。存储器104可包括高速随机存储器,还可包括非易失性存储器,如一个或者多个磁性存储装置、闪存、或者其他非易失性固态存储器。在一些实例中,存储器104可进一步包括相对于处理器102远程设置的存储器,这些远程存储器可以通过网络连接至终端。上述网络的实例包括但不限于互联网、企业内部网、局域网、移动通信网及其组合。The
传输设备106用于经由一个网络接收或者发送数据。上述的网络包括终端的通信供应商提供的无线网络。在一个实例中,传输设备106包括一个网络适配器(NetworkInterface Controller,简称为NIC),其可通过基站与其他网络设备相连从而可与互联网进行通讯。在一个实例中,传输设备106可以为射频(Radio Frequency,简称为RF)模块,其用于通过无线方式与互联网进行通讯。
在本实施例中提供了一种智能合约执行方法,图2是本实施例的智能合约执行方法的流程图,如图2所示,该流程包括如下步骤:A smart contract execution method is provided in this embodiment, and FIG. 2 is a flowchart of the smart contract execution method in this embodiment. As shown in FIG. 2 , the process includes the following steps:
步骤S201,获取智能合约的字节码。Step S201, obtaining the bytecode of the smart contract.
智能合约是一种旨在以信息化方式传播、验证或执行合同的计算机协议。智能合约允许在没有第三方的情况下进行可信交易,且上述交易可追踪、不可逆转。具体地,交易的双方通过区块链节点执行智能合约,实现数据的更新或者查询。A smart contract is a computer protocol designed to inform, verify, or execute a contract. Smart contracts allow for trusted transactions that are traceable and irreversible without a third party. Specifically, both parties to the transaction execute smart contracts through blockchain nodes to update or query data.
字节码是一种序列二进制文件,通过将智能合约的源代码进行编译,可以得到智能合约的二进制序列,即得到智能合约的字节码。优选地,本实施例中智能合约的字节码可以为WASM(WebAssembly)格式,WASM是一种新的字节码格式,具有全新的底层二进制语法,并具有以下优势:1)性能高效。WASM采用二进制编码,在程序执行过程中的性能优越;2)存储成本低。相对于文本格式,二进制编码的文本占用的存储空间更小;3)多语言支持。用户可以使用C、C++、RUST、Go等多种计算机语言编写智能合约并编译成WASM格式的字节码。Bytecode is a sequence binary file. By compiling the source code of the smart contract, the binary sequence of the smart contract can be obtained, that is, the bytecode of the smart contract can be obtained. Preferably, the bytecode of the smart contract in this embodiment may be in the WASM (WebAssembly) format, and WASM is a new bytecode format with a brand new underlying binary syntax, and has the following advantages: 1) High performance. WASM adopts binary encoding, which has superior performance in the process of program execution; 2) the storage cost is low. Compared with the text format, the binary-coded text occupies less storage space; 3) Multi-language support. Users can use C, C++, RUST, Go and other computer languages to write smart contracts and compile them into WASM format bytecodes.
步骤S202,根据LLVM项目的中间语言结构,将智能合约的字节码转换为智能合约的中间代码,所以,智能合约的中间代码的语言结构与LLVM项目的中间语言结构相同。In step S202, according to the intermediate language structure of the LLVM project, the bytecode of the smart contract is converted into the intermediate code of the smart contract. Therefore, the language structure of the intermediate code of the smart contract is the same as the intermediate language structure of the LLVM project.
本申请中的LLVM项目,区别于底层虚拟机(Low Level Virtual Machine),是一个模块化和可重复使用的编译器和工具技术的集合,是一种可以用于构架编译器的框架系统,LLVM项目由许多模块组成,每个模块是输入程序的一个翻译单元。每个模块由函数、全局变量和符号表条目构成。进一步地,WASM格式的程序由也模块构成,该模块是用于部署、加载和编译的单元,模块中包含类型、函数、内存、全局变量的定义等,其定义特征和LLVM的模块类似。因此可以将WASM的模块转换为LLVM的模块,或者仅对WASM模块中的函数方法进行转换。The LLVM project in this application, which is different from the Low Level Virtual Machine (Low Level Virtual Machine), is a collection of modular and reusable compilers and tool technologies. It is a framework system that can be used to build compilers. LLVM A project consists of many modules, each module is a translation unit of the input program. Each module consists of functions, global variables, and symbol table entries. Further, a program in WASM format consists of a module, which is a unit for deployment, loading, and compilation. The module contains definitions of types, functions, memory, and global variables, and its definition characteristics are similar to those of LLVM modules. So it is possible to convert WASM modules to LLVM modules, or just function methods in WASM modules.
中间语言(Intermediate Representation,简称为IR)是一种面向语法、易于翻译成目标程序的源程序的等效内部表示代码,是程序编译过程中转换的中间格式,中间语言的可理解性及易于生成目标代码的程度介于源语言和目标语言之间。LLVM项目的中间语言记为LLVM-IR(LLVM Intermediate Representation)。Intermediate Representation (IR) is a syntax-oriented equivalent internal representation code of a source program that is easy to translate into a target program. It is an intermediate format converted during program compilation. The degree of object code is between the source language and the target language. The intermediate language of the LLVM project is recorded as LLVM-IR (LLVM Intermediate Representation).
本实施例中的LLVM项目的中间语言结构,规定了LLVM项目的中间语言的语法规范,即程序结构。The intermediate language structure of the LLVM project in this embodiment specifies the syntax specification of the intermediate language of the LLVM project, that is, the program structure.
在确定LLVM项目的中间语言结构之后,可以将智能合约的字节码进行语法分析和语义分析,然后根据语法分析和语义分析的结果,按照LLVM-IR的语法规范进行转换,得到智能合约的中间代码,该智能合约的中间代码即为LLVM-IR格式的。After the intermediate language structure of the LLVM project is determined, the bytecode of the smart contract can be parsed and semantically analyzed, and then converted according to the LLVM-IR grammatical specification according to the results of the syntax analysis and semantic analysis to obtain the intermediate of the smart contract. code, the intermediate code of the smart contract is in LLVM-IR format.
具体地,LLVM-IR有三种表现形式,分别是在内存中的编译器中间语言,在磁盘上的位码,以及表示为人类可读的汇编语言,这三种表示形式可以相互转换,其中,在磁盘上的位码适合于即时编译器的快速加载。Specifically, LLVM-IR has three representations, which are compiler intermediate language in memory, bitcode on disk, and human-readable assembly language. These three representations can be converted to each other, among which, Bitcode on disk is suitable for fast loading by just-in-time compilers.
步骤S203,调用LLVM项目提供的编译器,根据智能合约的中间代码确定智能合约的机器码。In step S203, the compiler provided by the LLVM project is invoked, and the machine code of the smart contract is determined according to the intermediate code of the smart contract.
在得到智能合约的中间代码之后,由于LLVM项目提供了很多的应用程序接口(Application Programming Interface,简称为API)用于编译IR,例如,可以调用LLVM的LLVM Target Machine Emit To Memory Buffer接口,将LLVM-IR转换为机器码存储在缓存(Memory Buffer)中。After obtaining the intermediate code of the smart contract, since the LLVM project provides many Application Programming Interfaces (APIs) for compiling IR, for example, you can call the LLVM Target Machine Emit To Memory Buffer interface of LLVM to convert the LLVM -IR is converted to machine code and stored in the cache (Memory Buffer).
步骤S204,执行所述智能合约的机器码。Step S204, executing the machine code of the smart contract.
本实施例中,在对智能合约进行部署时,先通过编译过程得到智能合约的机器码,因此,在执行智能合约时,可以直接执行智能合约的机器码,以提高智能合约的执行效率。In this embodiment, when the smart contract is deployed, the machine code of the smart contract is obtained through the compilation process. Therefore, when the smart contract is executed, the machine code of the smart contract can be directly executed to improve the execution efficiency of the smart contract.
通过上述步骤S201至步骤S204,获取到智能合约的字节码之后,利用LLVM项目,将智能合约转换为LLVM-IR格式,得到智能合约的中间代码,最后,依靠LLVM项目提供的编译器,得到智能合约的机器码,通过执行智能合约的机器码,可以提高智能合约的执行效率。因此本实施例基于智能合约的机器码实现智能合约的执行,可以更高效地加速智能合约的执行过程,解决了相关技术中执行智能合约时需要先进行解析再执行,导致智能合约的执行效率较低的问题,提高了智能合约的执行效率。Through the above steps S201 to S204, after the bytecode of the smart contract is obtained, the LLVM project is used to convert the smart contract into the LLVM-IR format to obtain the intermediate code of the smart contract. Finally, relying on the compiler provided by the LLVM project to obtain The machine code of the smart contract can improve the execution efficiency of the smart contract by executing the machine code of the smart contract. Therefore, this embodiment realizes the execution of the smart contract based on the machine code of the smart contract, which can speed up the execution process of the smart contract more efficiently, and solves the problem that the execution of the smart contract in the related art needs to be parsed and then executed, resulting in a higher execution efficiency of the smart contract. Low problem, improve the execution efficiency of smart contracts.
在其中的一些实施例中,图3是本实施例的智能合约的中间代码的获取方法的流程图,如图3所示,该流程包括如下步骤:In some of the embodiments, FIG. 3 is a flow chart of the method for obtaining the intermediate code of the smart contract in this embodiment. As shown in FIG. 3 , the flow includes the following steps:
步骤S301,获取由中间语言结构确定的语法规范。Step S301, acquiring the grammar specification determined by the intermediate language structure.
由于不同计算机语言的语法规范不同,所以在转换时需要先确定LLVM-IR的语法规范,便于后续编译。例如,LLVM-IR具有模块(Module)、函数(Function)、基本块(BasicBlock)和指令(Instruction),LLVM-IR头部需要用固定的标识来表示模块ID、源文件名等等。进一步地,由LLVM项目的中间语言结构确定的语法规范还包括标识符和变量,例如以@开头的全局标识符和%开头的局部标识符。其中,全局标识符包括全局变量、全局常量和函数,局部标识符通常为局部变量,包括以%tmp表示的命名局部变量和以带前缀的无符号数字值表示的未命名局部变量。Since the syntax specifications of different computer languages are different, it is necessary to determine the syntax specifications of LLVM-IR before conversion to facilitate subsequent compilation. For example, LLVM-IR has modules (Module), function (Function), basic block (BasicBlock) and instruction (Instruction), LLVM-IR header needs to use fixed identifiers to represent module ID, source file name and so on. Further, the syntax specification determined by the LLVM project's intermediate language structure also includes identifiers and variables, such as global identifiers starting with @ and local identifiers starting with %. Among them, global identifiers include global variables, global constants and functions, and local identifiers are usually local variables, including named local variables represented by %tmp and unnamed local variables represented by prefixed unsigned numeric values.
步骤S302,根据语法规范,将智能合约的字节码中所有的语句序列转换为智能合约的中间代码。Step S302, according to the grammar specification, convert all the statement sequences in the bytecode of the smart contract into the intermediate code of the smart contract.
智能合约的字节码为由一序列op代码/数据对组成的二进制文件,在确定好语法规范之后,即可遍历智能合约的字节码,将智能合约的字节码中的语句序列转换为LLVM-IR格式,以得到智能合约的中间代码。The bytecode of the smart contract is a binary file composed of a sequence of op code/data pairs. After the syntax specification is determined, the bytecode of the smart contract can be traversed, and the statement sequence in the bytecode of the smart contract can be converted into LLVM-IR format to get the intermediate code of the smart contract.
通过上述步骤S301和步骤S302,在获取由中间语言结构确定的语法规范之后,根据LLVM-IR的语法规范将智能合约的字节码进行转换,可以避免转换过程出错,提高智能合约中间代码的准确率。Through the above steps S301 and S302, after obtaining the syntax specification determined by the intermediate language structure, the bytecode of the smart contract is converted according to the syntax specification of LLVM-IR, which can avoid errors in the conversion process and improve the accuracy of the intermediate code of the smart contract. Rate.
进一步地,在获取智能合约的中间代码的过程中,可以先获取智能合约的字节码中的第一指令类型,根据语法规范在中间语言结构中确定第二指令类型,然后将第一指令类型和第二指令类型进行存储,以最终得到智能合约的中间代码。本实施例中,需要将智能合约的字节码中的指令类型和中间语言结构中的指令类型进行对应,例如,如果是智能合约的源代码为local.get指令,说明要获取一个局部变量,这个行为对应到LLVM-IR格式为load指令,为了转换方便,可以重新申请存储空间保存这个局部变量,最终在存储空间存储的内容为alloca,store,load三条指令。Further, in the process of obtaining the intermediate code of the smart contract, you can first obtain the first instruction type in the bytecode of the smart contract, determine the second instruction type in the intermediate language structure according to the grammar specification, and then use the first instruction type. And the second instruction type is stored to finally get the intermediate code of the smart contract. In this embodiment, it is necessary to correspond the instruction type in the bytecode of the smart contract with the instruction type in the intermediate language structure. For example, if the source code of the smart contract is the local.get instruction, it means that a local variable needs to be obtained. This behavior corresponds to the LLVM-IR format as the load instruction. For the convenience of conversion, you can re-apply for the storage space to save this local variable, and finally the contents stored in the storage space are alloca, store, and load three instructions.
在其中一些实施例中,图4是根据本申请实施例的智能合约的机器码的获取方法的流程图,如图4所示,该方法包括如下步骤:In some of the embodiments, FIG. 4 is a flowchart of a method for acquiring a machine code of a smart contract according to an embodiment of the present application. As shown in FIG. 4 , the method includes the following steps:
步骤S401,通过LLVM项目提供的编译器,将智能合约的中间代码编译为智能合约的第一机器码。In step S401, the intermediate code of the smart contract is compiled into the first machine code of the smart contract through the compiler provided by the LLVM project.
具体地,智能合约的第一机器码可以通过LLVM项目编译器的接口实现。Specifically, the first machine code of the smart contract can be implemented through the interface of the LLVM project compiler.
步骤S402,在第一机器码中加上符号表,并将第一机器码和符号表转换为二进制序列,得到智能合约的第二机器码。Step S402, adding a symbol table to the first machine code, and converting the first machine code and the symbol table into a binary sequence to obtain the second machine code of the smart contract.
在调用智能合约时,为了便于智能合约的执行,需要先在智能合约的第一机器码中添加符号表,其中,符号表是一种用于语言翻译器中的数据结构,在符号表中,程序代码中的每个标识符都和它的声明或使用信息绑定在一起,比如其数据类型、作用域以及内存地址等等,起到注释作用。在添加符号表之后,需要将第一机器码和符号表一起进行二进制转化,得到二进制序列格式的第二机器码。When calling a smart contract, in order to facilitate the execution of the smart contract, a symbol table needs to be added to the first machine code of the smart contract. The symbol table is a data structure used in the language translator. In the symbol table, Each identifier in the program code is bound with its declaration or usage information, such as its data type, scope, and memory address, etc., acting as a comment. After adding the symbol table, it is necessary to perform binary conversion on the first machine code and the symbol table to obtain the second machine code in the binary sequence format.
通过上述步骤S401和步骤S402,得到二进制格式的第二机器码,可以进一步加速智能合约的执行效率。Through the above steps S401 and S402, the second machine code in binary format is obtained, which can further accelerate the execution efficiency of the smart contract.
在其中一些实施例中,在执行智能合约的机器码之前,需要将智能合约的机器码进行存储,同时将智能合约的字节码存储至账本。具体地,可以将智能合约的机器码存储至缓存和/或数据库,然后从缓存和/或数据库中调用智能合约的机器码进行执行,以提高智能合约的执行效率。In some of these embodiments, before executing the machine code of the smart contract, the machine code of the smart contract needs to be stored, and the bytecode of the smart contract needs to be stored in the ledger. Specifically, the machine code of the smart contract can be stored in the cache and/or database, and then the machine code of the smart contract can be called from the cache and/or database for execution, so as to improve the execution efficiency of the smart contract.
进一步地,获取智能合约的优先级为:先缓存中的机器码,后数据库中的机器码。若机器码同时存储在缓存和数据库中,在缓存中存在智能合约的机器码的情况下,执行缓存中的智能合约的机器码;在缓存中不存在智能合约的机器码的情况下,从数据库中获取智能合约的机器码进行执行;在数据库中不存在智能合约的机器码的情况下,直接获取智能合约的字节码重新进行编译并缓存执行。需要说明的是,若机器码只在缓存中进行存储,当在缓存中获取不到机器码时,可直接获取智能合约的字节码,若机器码只在数据库中进行存储,可直接从数据库中获取机器码,不必经过缓存。本实施例提供了多种机器码的存储方式,提高了智能合约存储过程的场景适应性。Further, the priority of obtaining the smart contract is: first the machine code in the cache, and then the machine code in the database. If the machine code is stored in the cache and the database at the same time, if the machine code of the smart contract exists in the cache, execute the machine code of the smart contract in the cache; if the machine code of the smart contract does not exist in the cache, from the database Obtain the machine code of the smart contract for execution; if the machine code of the smart contract does not exist in the database, directly obtain the bytecode of the smart contract to recompile and cache for execution. It should be noted that if the machine code is only stored in the cache, when the machine code cannot be obtained in the cache, the bytecode of the smart contract can be obtained directly. If the machine code is only stored in the database, it can be directly obtained from the database. The machine code is obtained from the cache without having to go through the cache. This embodiment provides a variety of machine code storage methods, which improves the scene adaptability of the smart contract storage process.
在获取智能合约的机器码并进行执行时,可以先判断获取到的机器码是否为与当前编译器对应的机器码,例如,可以通过当前编译器的机器码格式去加载智能合约的机器码,如果能加载并解析出智能合约的内容则说明获取到的智能合约的机器码为当前编译器可执行的机器码,否则,对智能合约的字节码进行编译后再执行。When obtaining the machine code of the smart contract and executing it, you can first determine whether the obtained machine code is the machine code corresponding to the current compiler. For example, you can load the machine code of the smart contract through the machine code format of the current compiler. If the content of the smart contract can be loaded and parsed, it means that the obtained machine code of the smart contract is the machine code executable by the current compiler, otherwise, the bytecode of the smart contract is compiled and then executed.
在其中一些实施例中,将智能合约的字节码转换为中间代码时,可以根据智能合约的字节码中的字节码顺序,依次将智能合约的字节码转换为智能合约的中间代码,即字节码中在前的语句先进行转换,字节码中在后的语句后进行转换,以保证转换时语句的顺序不变,提高智能合约的中间代码的准确度;或者,将智能合约的字节码划分为多个字节码序列,通过并行处理,同时将多个字节码序列转换为智能合约的多个中间代码序列,提高智能合约转换过程的效率,最后根据多个中间代码序列确定智能合约的中间代码。In some of these embodiments, when converting the bytecode of the smart contract into the intermediate code, the bytecode of the smart contract can be sequentially converted into the intermediate code of the smart contract according to the bytecode sequence in the bytecode of the smart contract , that is, the former statement in the bytecode is converted first, and the latter statement in the bytecode is converted to ensure that the order of the statements remains unchanged during conversion and improve the accuracy of the intermediate code of the smart contract; The bytecode of the contract is divided into multiple bytecode sequences. Through parallel processing, the multiple bytecode sequences are converted into multiple intermediate code sequences of the smart contract to improve the efficiency of the smart contract conversion process. Finally, according to the multiple intermediate code sequences The code sequence determines the intermediate code of the smart contract.
下面通过优选实施例对本实施例进行描述和说明。The present embodiment will be described and illustrated below through preferred embodiments.
图5是根据本申请优选实施例的智能合约部署与调用的方法的流程图,如图5所示,该方法包括如下步骤:FIG. 5 is a flowchart of a method for deploying and invoking a smart contract according to a preferred embodiment of the present application. As shown in FIG. 5 , the method includes the following steps:
步骤S501,将智能合约的WASM字节码转换为LLVM-IR格式,得到智能合约的中间代码,用于作为LLVM编译器的输入;Step S501, converting the WASM bytecode of the smart contract into LLVM-IR format to obtain the intermediate code of the smart contract, which is used as the input of the LLVM compiler;
步骤S502,调用LLVM编译器,将LLVM-IR格式的智能合约进行转换,得到智能合约的机器码;LLVM编译器既可以作为一个动态调用库在区块链平台上,也可以直接内嵌到区块链平台的二进制之中;Step S502, call the LLVM compiler, convert the smart contract in LLVM-IR format, and obtain the machine code of the smart contract; the LLVM compiler can be used as a dynamic call library on the blockchain platform, or can be directly embedded in the block chain. In the binary of the blockchain platform;
步骤S503,将智能合约的WASM字节码写入账本,并将智能合约的机器码存储至缓存或者数据库;Step S503, write the WASM bytecode of the smart contract into the ledger, and store the machine code of the smart contract in a cache or database;
步骤S504,从缓存或者数据库中获取智能合约的机器码;如果区块链节点本地没有存储所述智能合约的机器码,则对智能合约的字节码进行解释执行;Step S504, obtaining the machine code of the smart contract from the cache or database; if the blockchain node does not store the machine code of the smart contract locally, interpret and execute the bytecode of the smart contract;
步骤S505,执行智能合约的机器码并返回执行结果,进一步地,若智能合约本身存在问题,则返回错误。Step S505, execute the machine code of the smart contract and return the execution result. Further, if there is a problem with the smart contract itself, an error is returned.
上述步骤S501至步骤S503为智能合约的部署过程,具体地,上述部署过程实现了一种AOT(Ahead of Time Compilation)过程,AOT过程是指在解释执行的程序运行之前,将程序代码先编译为机器码,然后执行机器码的行为。The above steps S501 to S503 are the deployment process of the smart contract. Specifically, the above deployment process implements an AOT (Ahead of Time Compilation) process. The AOT process refers to compiling the program code into machine code, and then execute the behavior of the machine code.
上述步骤S504和步骤S505为智能合约的调用过程,具体地,在区块链节点完成智能合约部署并执行智能合约,由于实质上是对智能合约的机器码进行执行,不需要再次解析的过程,所以可以提高智能合约的执行效率。The above steps S504 and S505 are the calling process of the smart contract. Specifically, the deployment of the smart contract is completed on the blockchain node and the smart contract is executed. Since the machine code of the smart contract is essentially executed, there is no need to parse the process again. Therefore, the execution efficiency of smart contracts can be improved.
本实施例在部署合约时,将智能合约的WASM字节码转换为LLVM-IR格式,再通过LLVM编译为机器码,在智能合约执行时直接使用编译之后的机器码进行智能合约的执行,实现AOT的智能合约加速方法。因此,通过LLVM编译器将字节码编译为机器码,借助于LLVM编译器良好的编译优化,能够更好的提升智能合约的执行性能,从而提升区块链平台的处理性能。In this embodiment, when deploying the contract, the WASM bytecode of the smart contract is converted into LLVM-IR format, and then compiled into machine code by LLVM, and the compiled machine code is directly used to execute the smart contract when the smart contract is executed. AOT's smart contract acceleration method. Therefore, the bytecode is compiled into machine code through the LLVM compiler, and with the help of the LLVM compiler's good compilation optimization, the execution performance of the smart contract can be better improved, thereby improving the processing performance of the blockchain platform.
需要说明的是,在上述流程中或者附图的流程图中示出的步骤可以在诸如一组计算机可执行指令的计算机系统中执行,并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。It should be noted that the steps shown in the above flow or the flow chart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical sequence is shown in the flow chart, in the In some cases, steps shown or described may be performed in an order different from that herein.
在本实施例中还提供了一种智能合约执行装置,该装置用于实现上述实施例及优选实施方式,已经进行过说明的不再赘述。以下所使用的术语“模块”、“单元”、“子单元”等可以实现预定功能的软件和/或硬件的组合。尽管在以下实施例中所描述的装置较佳地以软件来实现,但是硬件,或者软件和硬件的组合的实现也是可能并被构想的。In this embodiment, a smart contract execution device is also provided, and the device is used to implement the above-mentioned embodiments and preferred implementations, which have been described and will not be repeated. The terms "module", "unit", "subunit", etc. used below may be a combination of software and/or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, implementations in hardware, or a combination of software and hardware, are also possible and contemplated.
图6是本实施例的智能合约执行装置的结构框图,如图6所示,该装置包括获取模块61、转换模块62、调用模块63和执行模块64:FIG. 6 is a structural block diagram of the smart contract execution device of the present embodiment. As shown in FIG. 6 , the device includes an
获取模块61,用于获取智能合约的字节码;an
转换模块62,用于根据LLVM项目的中间语言结构,将所述智能合约的字节码转换为智能合约的中间代码;The
调用模块63,用于调用所述LLVM项目提供的编译器,根据所述智能合约的中间代码确定智能合约的机器码;The calling
执行模块64,用于执行智能合约的机器码。The
本实施例中,获取模块61获取到智能合约的字节码之后,转换模块62利用LLVM项目,将智能合约转换为LLVM-IR格式,得到智能合约的中间代码,最后,调用模块63依靠LLVM项目提供的编译器,得到智能合约的机器码,执行模块64通过执行智能合约的机器码,可以提高智能合约的执行效率。因此本实施例基于智能合约的机器码实现智能合约的执行,可以更高效地加速智能合约的执行过程,解决了相关技术中执行智能合约时需要先进行解析再执行,导致智能合约的执行效率较低的问题,提高了智能合约的执行效率。In this embodiment, after the
在其中一些实施例中,转换模块62还用于获取由所述中间语言结构确定的语法规范;根据所述语法规范,将所述智能合约的字节码中所有的语句序列转换为所述智能合约的中间代码。In some of the embodiments, the
在其中一些实施例中,转换模块62还用于获取所述智能合约的字节码中的第一指令类型,根据所述语法规范在所述中间语言结构中确定第二指令类型;将所述第一指令类型和所述第二指令类型进行存储,以得到所述智能合约的中间代码。In some of these embodiments, the
在其中一些实施例中,调用模块63还用于通过所述LLVM项目提供的编译器,将所述智能合约的中间代码编译为智能合约的第一机器码;在所述第一机器码中加上符号表,并将所述第一机器码和所述符号表转换为二进制序列,得到所述智能合约的第二机器码。In some of the embodiments, the calling
在其中一些实施例中,智能合约执行装置还包括存储模块,用于将所述智能合约的机器码存储至缓存和/或数据库。In some of these embodiments, the smart contract execution apparatus further includes a storage module for storing the machine code of the smart contract in a cache and/or a database.
在其中一些实施例中,执行模块64还用于在所述缓存中存在所述智能合约的机器码的情况下,执行所述缓存中的智能合约的机器码;在所述缓存中不存在所述智能合约的机器码的情况下,从所述数据库中获取智能合约的机器码进行执行;在所述数据库中不存在所述智能合约的机器码的情况下,执行所述智能合约的字节码。In some of these embodiments, the
在其中一些实施例中,转换模块62还用于根据所述智能合约的字节码中的字节码顺序,依次将所述智能合约的字节码转换为智能合约的中间代码;或者,将所述智能合约的字节码划分为多个字节码序列,通过并行处理将多个所述字节码序列转换为智能合约的多个中间代码序列,根据多个中间代码序列确定所述智能合约的中间代码。In some of the embodiments, the
需要说明的是,上述各个模块可以是功能模块也可以是程序模块,既可以通过软件来实现,也可以通过硬件来实现。对于通过硬件来实现的模块而言,上述各个模块可以位于同一处理器中;或者上述各个模块还可以按照任意组合的形式分别位于不同的处理器中。It should be noted that each of the above modules may be functional modules or program modules, and may be implemented by software or hardware. For the modules implemented by hardware, the above-mentioned modules may be located in the same processor; or the above-mentioned modules may also be located in different processors in any combination.
在本实施例中还提供了一种电子装置,包括存储器和处理器,该存储器中存储有计算机程序,该处理器被设置为运行计算机程序以执行上述任一项方法实施例中的步骤。An electronic device is also provided in this embodiment, including a memory and a processor, where a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.
可选地,上述电子装置还可以包括传输设备以及输入输出设备,其中,该传输设备和上述处理器连接,该输入输出设备和上述处理器连接。Optionally, the above-mentioned electronic device may further include a transmission device and an input-output device, wherein the transmission device is connected to the above-mentioned processor, and the input-output device is connected to the above-mentioned processor.
可选地,在本实施例中,上述处理器可以被设置为通过计算机程序执行以下步骤:Optionally, in this embodiment, the above-mentioned processor may be configured to execute the following steps through a computer program:
S1,获取智能合约的字节码;S1, get the bytecode of the smart contract;
S2,根据LLVM项目的中间语言结构,将所述智能合约的字节码转换为智能合约的中间代码;S2, according to the intermediate language structure of the LLVM project, convert the bytecode of the smart contract into the intermediate code of the smart contract;
S3,调用所述LLVM项目提供的编译器,根据所述智能合约的中间代码确定智能合约的机器码;S3, call the compiler provided by the LLVM project, and determine the machine code of the smart contract according to the intermediate code of the smart contract;
S4,执行所述智能合约的机器码。S4, the machine code for executing the smart contract.
需要说明的是,在本实施例中的具体示例可以参考上述实施例及可选实施方式中所描述的示例,在本实施例中不再赘述。It should be noted that, for specific examples in this embodiment, reference may be made to the examples described in the foregoing embodiments and optional implementation manners, and details are not repeated in this embodiment.
此外,结合上述实施例中提供的智能合约执行方法,在本实施例中还可以提供一种存储介质来实现。该存储介质上存储有计算机程序;该计算机程序被处理器执行时实现上述实施例中的任意一种智能合约执行方法。In addition, in combination with the smart contract execution method provided in the above embodiment, a storage medium may also be provided in this embodiment for implementation. A computer program is stored on the storage medium; when the computer program is executed by the processor, any one of the smart contract execution methods in the foregoing embodiments is implemented.
应该明白的是,这里描述的具体实施例只是用来解释这个应用,而不是用来对它进行限定。根据本申请提供的实施例,本领域普通技术人员在不进行创造性劳动的情况下得到的所有其它实施例,均属本申请保护范围。It should be understood that the specific embodiments described herein are used to illustrate this application, not to limit it. According to the embodiments provided in the present application, all other embodiments obtained by those of ordinary skill in the art without creative work fall within the protection scope of the present application.
显然,附图只是本申请的一些例子或实施例,对本领域的普通技术人员来说,也可以根据这些附图将本申请适用于其他类似情况,但无需付出创造性劳动。另外,可以理解的是,尽管在此开发过程中所做的工作可能是复杂和漫长的,但是,对于本领域的普通技术人员来说,根据本申请披露的技术内容进行的某些设计、制造或生产等更改仅是常规的技术手段,不应被视为本申请公开的内容不足。Obviously, the accompanying drawings are only some examples or embodiments of the present application, and for those skilled in the art, the present application can also be applied to other similar situations according to these drawings, but no creative work is required. In addition, it can be understood that although the work done in this development process may be complex and lengthy, for those of ordinary skill in the art, certain designs, manufactures and designs based on the technical content disclosed in this application Modifications such as production or production are only conventional technical means, and should not be regarded as insufficient content disclosed in this application.
“实施例”一词在本申请中指的是结合实施例描述的具体特征、结构或特性可以包括在本申请的至少一个实施例中。该短语出现在说明书中的各个位置并不一定意味着相同的实施例,也不意味着与其它实施例相互排斥而具有独立性或可供选择。本领域的普通技术人员能够清楚或隐含地理解的是,本申请中描述的实施例在没有冲突的情况下,可以与其它实施例结合。The term "embodiment" is used in this application to mean that a particular feature, structure, or characteristic described in connection with the embodiment may be included in at least one embodiment of the application. The appearance of the phrase in various places in the specification does not necessarily mean the same embodiment, nor does it mean that it is mutually exclusive or alternative to other embodiments. It can be clearly or implicitly understood by those of ordinary skill in the art that the embodiments described in this application may be combined with other embodiments without conflict.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对专利保护范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of patent protection. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the present application should be determined by the appended claims.
Claims (10)
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111606437.6A CN114327477A (en) | 2021-12-26 | 2021-12-26 | Intelligent contract execution method and device, electronic device and storage medium |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN202111606437.6A CN114327477A (en) | 2021-12-26 | 2021-12-26 | Intelligent contract execution method and device, electronic device and storage medium |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN114327477A true CN114327477A (en) | 2022-04-12 |
Family
ID=81012180
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN202111606437.6A Pending CN114327477A (en) | 2021-12-26 | 2021-12-26 | Intelligent contract execution method and device, electronic device and storage medium |
Country Status (1)
| Country | Link |
|---|---|
| CN (1) | CN114327477A (en) |
Cited By (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115809063A (en) * | 2022-12-05 | 2023-03-17 | 星环信息科技(上海)股份有限公司 | Storage process compiling method, system, electronic equipment and storage medium |
| CN117032940A (en) * | 2023-10-08 | 2023-11-10 | 北京小米移动软件有限公司 | System, method and device for scheduling resources, electronic equipment and storage medium |
| CN117093227A (en) * | 2023-10-10 | 2023-11-21 | 杭州趣链科技有限公司 | Method and device for executing intelligent contract |
| KR20250048918A (en) * | 2023-10-04 | 2025-04-11 | 한국과학기술원 | Method and device of static binary translation tailored for decompilation |
Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102693146A (en) * | 2012-05-09 | 2012-09-26 | 龙芯中科技术有限公司 | Code block conversion method and apparatus |
| CN110704063A (en) * | 2019-09-30 | 2020-01-17 | 支付宝(杭州)信息技术有限公司 | Method and device for compiling and executing intelligent contract |
| CN111770204A (en) * | 2020-08-31 | 2020-10-13 | 支付宝(杭州)信息技术有限公司 | Method for executing intelligent contract, block chain node and storage medium |
| CN112527316A (en) * | 2020-12-29 | 2021-03-19 | Oppo广东移动通信有限公司 | Code compiling method and device, electronic equipment and storage medium |
| CN112558984A (en) * | 2020-12-29 | 2021-03-26 | Oppo广东移动通信有限公司 | Code compiling method and device, electronic equipment and server |
| CN112612482A (en) * | 2020-12-28 | 2021-04-06 | 杭州趣链科技有限公司 | Method, device, equipment and storage medium for executing intelligent contract |
-
2021
- 2021-12-26 CN CN202111606437.6A patent/CN114327477A/en active Pending
Patent Citations (6)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN102693146A (en) * | 2012-05-09 | 2012-09-26 | 龙芯中科技术有限公司 | Code block conversion method and apparatus |
| CN110704063A (en) * | 2019-09-30 | 2020-01-17 | 支付宝(杭州)信息技术有限公司 | Method and device for compiling and executing intelligent contract |
| CN111770204A (en) * | 2020-08-31 | 2020-10-13 | 支付宝(杭州)信息技术有限公司 | Method for executing intelligent contract, block chain node and storage medium |
| CN112612482A (en) * | 2020-12-28 | 2021-04-06 | 杭州趣链科技有限公司 | Method, device, equipment and storage medium for executing intelligent contract |
| CN112527316A (en) * | 2020-12-29 | 2021-03-19 | Oppo广东移动通信有限公司 | Code compiling method and device, electronic equipment and storage medium |
| CN112558984A (en) * | 2020-12-29 | 2021-03-26 | Oppo广东移动通信有限公司 | Code compiling method and device, electronic equipment and server |
Non-Patent Citations (2)
| Title |
|---|
| 翁新钎: "安全哈希算法的并行化实现研究", 《中国优秀硕士学位论文全文数据库 信息科技辑》, 31 December 2015 (2015-12-31), pages 3 * |
| 袁钧涛: "《区块链应用开发实战》", 31 August 2020, 北京:机械工业出版社, pages: 61 - 62 * |
Cited By (8)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN115809063A (en) * | 2022-12-05 | 2023-03-17 | 星环信息科技(上海)股份有限公司 | Storage process compiling method, system, electronic equipment and storage medium |
| CN115809063B (en) * | 2022-12-05 | 2023-08-22 | 星环信息科技(上海)股份有限公司 | Storage process compiling method, system, electronic equipment and storage medium |
| KR20250048918A (en) * | 2023-10-04 | 2025-04-11 | 한국과학기술원 | Method and device of static binary translation tailored for decompilation |
| KR102834292B1 (en) * | 2023-10-04 | 2025-07-17 | 한국과학기술원 | Method and device of static binary translation tailored for decompilation |
| CN117032940A (en) * | 2023-10-08 | 2023-11-10 | 北京小米移动软件有限公司 | System, method and device for scheduling resources, electronic equipment and storage medium |
| CN117032940B (en) * | 2023-10-08 | 2024-02-13 | 北京小米移动软件有限公司 | Resource scheduling systems, methods, devices, electronic equipment and storage media |
| CN117093227A (en) * | 2023-10-10 | 2023-11-21 | 杭州趣链科技有限公司 | Method and device for executing intelligent contract |
| CN117093227B (en) * | 2023-10-10 | 2024-04-02 | 杭州趣链科技有限公司 | Method and device for executing intelligent contract |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN114327477A (en) | Intelligent contract execution method and device, electronic device and storage medium | |
| CN106415495B (en) | Programming system and language for application development | |
| CN103164249B (en) | Extension mechanism for script compiler | |
| WO2019237701A1 (en) | Cross-language programming | |
| US10303449B2 (en) | Compiling non-native constants | |
| CN106844643A (en) | A kind of Database Dynamic generation method based on template engine | |
| EP3607432B1 (en) | Flow-based scoping | |
| US7739696B2 (en) | Message translation systems and methods | |
| CN108345458B (en) | A method and system for calling static compiled language and scripting language | |
| CN112558984A (en) | Code compiling method and device, electronic equipment and server | |
| CN104794095B (en) | Distributed Calculation processing method and processing device | |
| CN110457013B (en) | Program component configuration device and method | |
| CN111240772A (en) | Data processing method and device based on block chain and storage medium | |
| CN109542464A (en) | Development deployment system, method and the storage medium of IoT equipment shell script | |
| CN112650502A (en) | Batch processing task processing method and device, computer equipment and storage medium | |
| CN116107669A (en) | Operator registration method, device and equipment of deep learning framework and storage medium | |
| CN115328679A (en) | Automatic integration method of heterogeneous function library, computing equipment and system thereof | |
| CN106484375B (en) | Instruction block loading method, soft switch equipment and system | |
| WO2025194931A1 (en) | Data processing method and apparatus, device, and storage medium | |
| CN114911541A (en) | Configuration information processing method and device, electronic equipment and storage medium | |
| CN115022312A (en) | Implementation method, device, electronic device and storage medium of multi-smart contract engine | |
| US7818719B2 (en) | Extending expression-based syntax for creating object instances | |
| US10802855B2 (en) | Producing an internal representation of a type based on the type's source representation | |
| CN108205539A (en) | A kind of data search method and equipment | |
| CN116975087A (en) | Heterogeneous data source retrieval method, device, equipment and medium |
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 |