CN113778564B - Method, equipment and storage medium for efficiently executing EVM intelligent contract - Google Patents
Method, equipment and storage medium for efficiently executing EVM intelligent contract Download PDFInfo
- Publication number
- CN113778564B CN113778564B CN202111034607.8A CN202111034607A CN113778564B CN 113778564 B CN113778564 B CN 113778564B CN 202111034607 A CN202111034607 A CN 202111034607A CN 113778564 B CN113778564 B CN 113778564B
- Authority
- CN
- China
- Prior art keywords
- dynamic library
- contract
- evm
- function
- basic component
- 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.)
- Active
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4482—Procedural
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/30—Creation or generation of source code
- G06F8/31—Programming languages or programming paradigms
- G06F8/315—Object-oriented languages
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F8/00—Arrangements for software engineering
- G06F8/40—Transformation of program code
- G06F8/41—Compilation
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44505—Configuring for program initiating, e.g. using registry, configuration files
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/445—Program loading or initiating
- G06F9/44521—Dynamic linking or loading; Link editing at or after load time, e.g. Java class loading
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/448—Execution paradigms, e.g. implementations of programming paradigms
- G06F9/4488—Object-oriented
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/44—Arrangements for executing specific programs
- G06F9/455—Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
- G06F9/45504—Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/34—Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE 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/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Abstract
The invention belongs to the technical field of computers, and particularly relates to a method, equipment and a storage medium for efficiently executing an EVM intelligent contract. The method provided by the invention is realized by releasing the basic component functions with the same functions written by the native codes for the parts needing a large amount of computation in the EVM intelligent contract, the parts needing a large amount of computation directly acquire the result by calling the basic component functions and the configuration parameters in the dynamic library in the process of executing the intelligent contract by the EVM, the dynamic library directly depends on the operation system to run after being written and compiled by the native codes, and then the result is fed back to the EVM, the EVM continues to execute the intelligent contract, the EVM does not execute the parts needing a large amount of computation, the EVM is prevented from having low computation speed, the parts needing a large amount of computation are written by adopting the intelligent contract programming language, the problem of repeated deployment exists, and the execution efficiency of the contract can be greatly improved for the EVM intelligent contract needing a large amount of computation.
Description
Technical Field
The invention belongs to the technical field of computers, and particularly relates to a method, equipment and a storage medium for efficiently executing an EVM intelligent contract.
Background
The blockchain technique is a distributed ledger technique that can store transaction data in non-tamperable blocks and concatenate the blocks in time order to form a blockchain. In a narrow sense, a blockchain is a distributed ledger that combines blocks of data in a sequential manner in time order into a chain data structure, and that is cryptographically secured against tampering and counterfeiting; in broad terms, blockchain technology is a completely new distributed infrastructure and computing method that uses a blockchain data structure to verify and store data, a distributed node consensus algorithm to generate and update data, a cryptographic way to secure data transmission and access, and an intelligent contract consisting of automated script code to program and manipulate data.
Smart contracts, smart Contracts, is a computer protocol that aims to propagate, verify, or execute contracts in an informative manner. The intelligent contracts in the blockchain field have the following characteristics: 1. rules within the contract are transparent to the rule disclosure and the data is externally visible; 2. all transactions are publicly visible, and there is no spurious or hidden transaction. We often say that blockchain technology has the characteristics of "openness transparent" and "non-tamperable", which are all what intelligent contracts impart to blockchains. The programmer's world is consistent with awareness: the person is more uncontrollable than the program and the machine. The person would be disliked but the code would not be subjectively active. Traditional contractual behaviors are rules formulated by a person and executed by the person. Of course, boundary problems or anomalies are encountered, also defined by humans. However, with the smart contracts, these become different. A developer makes a set of rules through the intelligent contract, then issues the rules on line, a person interacts with the intelligent contract, and the machine completes a part of a service, so that the cheating behavior possibly caused by the person when the person performs execution is avoided.
An ethernet (ethernet) platform supports Ethernet Virtual Machines (EVM), which may be written using a low-level stack byte code based class assembly language proximate to the machine, referred to as "ethernet virtual machine code" (ethernet virtual machine (EVM) code). For developing application contract writer, the intelligent contract can be written conveniently by using intelligent contract programming language with complete figure and flexibility, such as Solidity, serpent, LLL, and the intelligent contract can be interpreted and executed on the virtual machine after compiling the byte codes of the urban virtual machine. However, in order to obtain the characteristics of "being able to disregard a specific physical machine architecture", "being portable", "being easy to implement", and the like, the EVM is a stack-based virtual machine, which has the disadvantages that the execution speed is slow, the execution efficiency of the intelligent contract is low, and meanwhile, the EVM contract lacks basic components, such as a commonly used container, a complex algorithm (zero knowledge proof algorithm), and other encryption algorithms, which all require a large amount of computation for the component acquisition application, if the intelligent contract programming language is used for writing, the contract is too large in size, the contract execution efficiency is extremely low, and the problem of repeated deployment exists, and the EVM needs to be deposited to the bottom, so that the commonly used container, the complex algorithm (zero knowledge proof algorithm), other encryption algorithms and other basic components can be efficiently implemented through native code, but if the EVM is implemented through built-in static native code, the node software needs to be recompiled and installed to run, and the recompilation and installation of the basic components needed each time needs to be increased, so that the method is required to efficiently execute the EVM intelligent contract, especially the EVM intelligent contract, which includes the basic components requiring a large amount of computation.
Disclosure of Invention
In order to achieve the above objective, the present invention provides a method, an apparatus, and a storage medium for efficiently executing an EVM smart contract, which can efficiently implement a portion of the EVM smart contract that needs a large amount of computation, and improve the execution efficiency of the EVM smart contract.
The invention adopts the following technical scheme.
In a first aspect, a method for executing an EVM intelligent contract with high efficiency is provided, and the method is applied to a blockchain system, wherein the blockchain system modifies a compiler in advance and adds a dynamic library call function instruction, a dynamic library is issued in a network of the blockchain system and is stored in a database of the blockchain system, the dynamic library comprises a plurality of compiled basic component functions, the basic component functions adopt native codes to realize functions, and the native codes comprise C language, c++, JAVA, GO language or run; the method comprises the following steps:
intelligent contract development
Developing a first contract by adopting an intelligent contract programming language, extracting a first part in the first contract, wherein the first part is a part with calculated amount exceeding a preset calculated amount, identifying the function of the first part in the first contract, comparing the function of the first part in the first contract with the function of a basic component function in a dynamic library, generating a dynamic library call request to call by a dynamic library call function and configuring a call parameter if the basic component function which is the same as the function of the first part in the first contract exists, constructing a new basic component function and compiling the new basic component function and storing the new basic component function in the dynamic library if the new basic component function is not present, generating a dynamic library call request to call by the dynamic library call function and configuring the call parameter, and completing the development of the first contract; the calling parameters comprise a dynamic library address key value, a function name needing to be called and parameters needing to be calculated.
Smart contract deployment
The method comprises the steps of obtaining byte codes compiled by a dynamic library in advance, compiling the first contract to obtain first contract byte codes, and storing the byte codes of the first contract and the byte codes of the dynamic library when deployment transaction of the first contract is executed, so that first contract deployment is completed.
And after deployment, independently storing the byte codes of the first contract and the byte codes of the dynamic library in a database of the blockchain system, and storing the dynamic library address called by the first contract through a key-value, wherein the dynamic library address called by the first contract corresponds to a unique key value.
Smart contract execution
And when the EVM executes the execution dynamic library calling function, calling the corresponding basic component function in the dynamic library from the blockchain database through the dynamic library calling function and the calling parameter and executing, returning an execution result to the EVM, and continuing to execute the first contract until the execution is completed.
Preferably, the dynamic library is compressed and stored through a compression rule; the compression rule comprises setting the maximum storage byte of the dynamic library, compressing the dynamic library to generate a compressed dynamic library when the size of the dynamic library is larger than the maximum storage byte, and configuring a mark field for the compressed dynamic library, wherein the mark field is used for recording the decompression algorithm of the compressed dynamic library.
Preferably, the specific calling method of the dynamic library comprises the following steps:
responding to a dynamic library call request sent by the EVM, reading whether a required dynamic library exists in the LRU, directly loading the dynamic library if the required dynamic library exists, and executing the next step if the required dynamic library does not exist;
and inquiring a corresponding dynamic library from the blockchain database according to the dynamic library calling request, judging whether the dynamic library is a compressed dynamic library, if so, decompressing according to the marking field to obtain the dynamic library, if not, directly obtaining the dynamic library, and simultaneously storing the obtained dynamic library into the LRU.
Preferably, when a new base component function is constructed, the function of the base component is verified through a user signature, and after the verification is passed, the function is compiled and stored in a dynamic library.
Preferably, the base component functions in the dynamic library are divided according to functions.
Preferably, the base component function includes multiple versions written in different native code, the calling version being determined from the native operating system.
In a second aspect, a computer device is provided that includes one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method as described in the first aspect above.
In a third aspect, there is provided a storage medium storing a computer program which, when executed by a processor, implements a method as described in the first aspect above.
The invention has the advantages that for the parts needing a large amount of computation in the EVM intelligent contract, the parts needing a large amount of computation are realized by releasing the basic component functions with the same functions written by the original codes, in the process of executing the intelligent contract by the EVM, the parts needing a large amount of computation are directly used for acquiring the results by calling the basic component functions and the configuration parameters in the dynamic library, the dynamic library is directly attached to the operating system for operation after the original codes are written and compiled, then the results are fed back to the EVM, the EVM continues to execute the intelligent contract, the EVM does not execute the parts needing a large amount of computation, the EVM is prevented from having low computation speed, the parts which are written by adopting the intelligent contract programming language and have large contract size, and the problem of repeated deployment exists, and the execution efficiency of the contract can be greatly improved for the EVM needing a large amount of computation.
Drawings
FIG. 1 is a flow chart of the method of embodiment 1 of the present invention;
fig. 2 is a schematic structural diagram of a computer device according to embodiment 2 of the present invention.
Detailed Description
The invention is described in further detail below with reference to specific examples and figures of the specification. Those of ordinary skill in the art will be able to implement the invention based on these descriptions. In addition, the embodiments of the present invention referred to in the following description are typically only some, but not all, embodiments of the present invention. Therefore, all other embodiments, which can be made by one of ordinary skill in the art without undue burden, are intended to be within the scope of the present invention, based on the embodiments of the present invention. The methods outlined in the examples of the present invention are all those known to those skilled in the art unless specifically stated otherwise.
Example 1
The embodiment provides a method for executing EVM intelligent contracts with high efficiency, which is applied to a blockchain system, wherein the blockchain system modifies a compiler in advance and adds a dynamic library call function instruction, a dynamic library is issued in a network of the blockchain system and is stored in a database of the blockchain system, the dynamic library comprises a plurality of compiled basic component functions, the basic component functions adopt native codes to realize functions, and the native codes comprise C language, C++, JAVA, GO language or RUST; the method comprises the following steps:
intelligent contract development
Developing a first contract by adopting an intelligent contract programming language, extracting a first part in the first contract, wherein the first part is a part with calculated amount exceeding a preset calculated amount, identifying the function of the first part in the first contract, comparing the function of the first part in the first contract with the function of a basic component function in a dynamic library, generating a dynamic library call request to call by a dynamic library call function and configuring a call parameter if the basic component function which is the same as the function of the first part in the first contract exists, constructing a new basic component function and compiling the new basic component function and storing the new basic component function in the dynamic library if the new basic component function is not present, generating a dynamic library call request to call by the dynamic library call function and configuring the call parameter, and completing the development of the first contract; the calling parameters comprise a dynamic library address key value, a function name needing to be called and parameters needing to be calculated.
Smart contract deployment
The method comprises the steps of obtaining byte codes compiled by a dynamic library in advance, compiling the first contract to obtain first contract byte codes, and storing the byte codes of the first contract and the byte codes of the dynamic library when deployment transaction of the first contract is executed, so that first contract deployment is completed.
And after deployment, independently storing the byte codes of the first contract and the byte codes of the dynamic library in a database of the blockchain system, and storing the dynamic library address called by the first contract through a key-value, wherein the dynamic library address called by the first contract corresponds to a unique key value.
Smart contract execution
And when the EVM executes the execution dynamic library calling function, calling the corresponding basic component function in the dynamic library from the blockchain database through the dynamic library calling function and the calling parameter and executing, returning an execution result to the EVM, and continuing to execute the first contract until the execution is completed.
Further, the dynamic library is compressed and stored through a compression rule; the compression rule comprises setting the maximum storage byte of the dynamic library, compressing the dynamic library to generate a compressed dynamic library when the size of the dynamic library is larger than the maximum storage byte, and configuring a mark field for the compressed dynamic library, wherein the mark field is used for recording the decompression algorithm of the compressed dynamic library.
Further, the specific calling method of the dynamic library comprises the following steps:
responding to a dynamic library call request sent by the EVM, reading whether a required dynamic library exists in the LRU, directly loading the dynamic library if the required dynamic library exists, and executing the next step if the required dynamic library does not exist;
and inquiring a corresponding dynamic library from the blockchain database according to the dynamic library calling request, judging whether the dynamic library is a compressed dynamic library, if so, decompressing according to the marking field to obtain the dynamic library, if not, directly obtaining the dynamic library, and simultaneously storing the obtained dynamic library into the LRU. The decompressed dynamic libraries (including the dynamic libraries which do not need to be decompressed) are stored in the LRU, and are indexed and queried through the address, when the same dynamic library needs to be loaded for the second time, the loading is directly read from the LRU, and the calculation cost required by reading from the database and decompressing can be effectively avoided;
caching decompressed dynamic libraries by LRU can very effectively improve the execution efficiency of contracts that require high frequency calls to compress dynamic libraries.
Further, when a new basic component function is constructed, the function of the basic component is verified through a user signature, and after the verification is passed, the function is compiled and stored in a dynamic library.
Further, the basic component functions in the dynamic library are divided according to functions.
Further, the base component function includes multiple versions written in different native code, the calling version being determined from the native operating system. Specifically, for example, the language type setting of the native code includes C language, c++, JAVA, GO language and run, and then the basic component function for implementing a certain function includes five versions written in five languages of C language, c++, JAVA, GO language and run, all of which are stored under the names of the basic component function, when the call is required, according to the local operating system, which version is selected, the selected version can be directly run on the operating system after compiling, without depending on a virtual machine or an interpreter, etc., so as to promote the universality of the dynamic library.
The principle of the embodiment is that the method is realized by releasing the basic component functions with the same functions written by the native codes, in the process of executing the intelligent contract by the EVM, the part needing a large amount of computation directly obtains the result by calling the basic component functions and the configuration parameters in the dynamic library, the dynamic library is directly attached to the operating system to run after the native codes are written and compiled, then the result is fed back to the EVM, the EVM continues to execute the intelligent contract, the EVM does not execute the part needing a large amount of computation, the EVM is prevented from having low computation speed, the part writing a large amount of computation by adopting the intelligent contract programming language has too large contract size, and the problem of repeated deployment exists, so that the execution efficiency of the contract can be greatly improved for the EVM intelligent contract needing a large amount of computation.
For example, there are n base component functions, each Func1 (parameter); func2; ........... Funcn; compiling them into dynamic libraries, named according to preset naming rules, for example named contact_xxx.so; when developing a smart contract through the visibility requires the use of a dynamic library named contact_xxx.so, then the required parameters are entered through the dynamic library function, including the following:
1. call entry address (see later description);
2. function name functionName;
3. calling parameters (parameters that need to be calculated for applying for a called smart contract);
when the EVM virtual machine executes to the dynamic library, the corresponding dynamic library contact_xxx.so is loaded from the blockchain database and executed, and finally the execution result is returned.
When a contract including a contact_xxx.so dynamic library is deployed, in addition to the requirement of storing the visibility bytecode in the database, a further storage address of the contact_xxx.so dynamic library is required, and a hash value after the current deployment user nonce_xxx.so concatenation of the deployment transaction hash is used as a stored key value and also as a call entry address. The reason that the hash value after the current deployment user nonce hash (contact_xxx. So) concatenation of the transaction hash is used as the stored key value is that the key value needs to have uniqueness and consistency of calculation results of different nodes, so that a plurality of addresses cannot exist when the key value is used for acquiring the addresses, and the uniqueness and consistency can be well guaranteed.
Example 2
A computer apparatus, the apparatus comprising: one or more processors; a memory for storing one or more programs that, when executed by the one or more processors, cause the one or more processors to perform the method described in embodiment 1.
A storage medium storing a computer program which, when executed by a processor, implements the method described in embodiment 1 above.
Fig. 2 is a schematic structural diagram of an apparatus according to this embodiment.
As shown in fig. 2, as another aspect, the present application also provides a computer apparatus 500 including one or more Central Processing Units (CPUs) 501, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM) 502 or a program loaded from a storage part 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data required for the operation of the device 500 are also stored. The CPU501, ROM502, and RAM503 are connected to each other through a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input section 506 including a keyboard, a mouse, and the like; an output portion 507 including a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker, and the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 is also connected to the I/O interface 505 as needed via a network execution communication processing driver 510 such as the internet. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as needed so that a computer program read therefrom is mounted into the storage section 508 as needed.
In particular, according to embodiments of the present disclosure, the method described in embodiment 1 above may be implemented as a computer software program. For example, embodiments disclosed herein include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method described in any of the embodiments above. In such an embodiment, the computer program may be downloaded and installed from a network via the communication portion 509, and/or installed from the removable media 511.
As yet another aspect, the present application also provides a computer-readable storage medium, which may be a computer-readable storage medium contained in the apparatus of the above-described embodiment; or may be a computer-readable storage medium, alone, that is not assembled into a device. The computer readable storage medium stores one or more programs for use by one or more processors in performing the methods described herein.
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units or modules described in the embodiments of the present application may be implemented by software, or may be implemented by hardware. The described units or modules may also be provided in a processor, for example, each of the units may be a software program provided in a computer or a mobile smart device, or may be separately configured hardware devices. Wherein the names of the units or modules do not in some cases constitute a limitation of the units or modules themselves.
The foregoing description is only of the preferred embodiments of the present application and is presented as a description of the principles of the technology being utilized. It will be appreciated by persons skilled in the art that the scope of the invention referred to in this application is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or their equivalents without departing from the spirit of the application. Such as the above-described features and technical features having similar functions (but not limited to) disclosed in the present application are replaced with each other.
Claims (8)
1. The method for executing EVM intelligent contract in high efficiency is applied to a block chain system, and is characterized in that the block chain system modifies a compiler in advance and adds a dynamic library call function instruction, a dynamic library is issued in a network of the block chain system and is stored in a database of the block chain system, the dynamic library comprises a plurality of compiled basic component functions, the basic component functions adopt native codes to realize functions, and the native codes comprise C language, C++, JAVA, GO language or RUST; the method comprises the following steps:
developing intelligent contracts; developing a first contract by adopting an intelligent contract programming language, extracting a first part in the first contract, wherein the first part is a part with calculated amount exceeding a preset calculated amount, identifying the function of the first part in the first contract, comparing the function of the first part in the first contract with the function of a basic component function in a dynamic library, generating a dynamic library call request to call by a dynamic library call function and configuring a call parameter if the basic component function which is the same as the function of the first part in the first contract exists, constructing a new basic component function and compiling the new basic component function and storing the new basic component function in the dynamic library if the new basic component function is not present, generating a dynamic library call request to call by the dynamic library call function and configuring the call parameter, and completing the development of the first contract; the calling parameters comprise a dynamic library address key value, a function name to be called and parameters to be calculated;
deploying intelligent contracts; the method comprises the steps of obtaining byte codes compiled by a dynamic library in advance, compiling the first contract to obtain first contract byte codes, and storing the byte codes of the first contract and the byte codes of the dynamic library when deployment transaction of the first contract is executed, so that first contract deployment is completed; after deployment, independently storing byte codes of a first contract and byte codes of a dynamic library in a database of the blockchain system, and storing a dynamic library address called by the first contract through a key-value, wherein the dynamic library address called by the first contract corresponds to a unique key value;
executing intelligent contracts; and when the EVM executes the execution dynamic library calling function, calling the corresponding basic component function in the dynamic library from the blockchain database through the dynamic library calling function and the calling parameter and executing, returning an execution result to the EVM, and continuing to execute the first contract until the execution is completed.
2. The method for efficiently executing EVM smart contracts according to claim 1, wherein said dynamic library is stored in compression by compression rules; the compression rule comprises setting the maximum storage byte of the dynamic library, compressing the dynamic library to generate a compressed dynamic library when the size of the dynamic library is larger than the maximum storage byte, and configuring a mark field for the compressed dynamic library, wherein the mark field is used for recording the decompression algorithm of the compressed dynamic library.
3. The method for efficiently executing EVM smart contracts according to claim 2, wherein the specific calling method of the dynamic library comprises:
responding to a dynamic library call request sent by the EVM, reading whether a required dynamic library exists in the LRU, directly loading the dynamic library if the required dynamic library exists, and executing the next step if the required dynamic library does not exist;
and inquiring a corresponding dynamic library from the blockchain database according to the dynamic library calling request, judging whether the dynamic library is a compressed dynamic library, if so, decompressing according to the marking field to obtain the dynamic library, if not, directly obtaining the dynamic library, and simultaneously storing the obtained dynamic library into the LRU.
4. A method for efficiently executing an EVM intelligent contract according to claim 1, 2 or 3, characterized in that when a new base component function is constructed, the function of the base component is verified by a user signature, and after the verification is passed, the function is compiled and stored in a dynamic library.
5. A method of efficiently executing EVM smart contracts according to claim 1 or 2 or 3, wherein the underlying component functions in the dynamic library are partitioned according to functionality.
6. A method of efficiently executing an EVM smart contract according to claim 1 or 2 or 3, wherein the base component functions include multiple versions written in different native code, the calling version being determined from the native operating system.
7. A computer device, characterized by one or more processors;
a memory for storing one or more programs,
the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-6.
8. A storage medium storing a computer program, which when executed by a processor implements the method of any one of claims 1-6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111034607.8A CN113778564B (en) | 2021-09-03 | 2021-09-03 | Method, equipment and storage medium for efficiently executing EVM intelligent contract |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111034607.8A CN113778564B (en) | 2021-09-03 | 2021-09-03 | Method, equipment and storage medium for efficiently executing EVM intelligent contract |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113778564A CN113778564A (en) | 2021-12-10 |
CN113778564B true CN113778564B (en) | 2023-05-30 |
Family
ID=78841247
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111034607.8A Active CN113778564B (en) | 2021-09-03 | 2021-09-03 | Method, equipment and storage medium for efficiently executing EVM intelligent contract |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113778564B (en) |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109299587A (en) * | 2018-09-11 | 2019-02-01 | 平安科技(深圳)有限公司 | Algorithm protection method, device, equipment and storage medium based on go language |
CN113222596A (en) * | 2021-04-23 | 2021-08-06 | 上海和数软件有限公司 | Electric power data storage method and system based on block chain intelligent contract |
Family Cites Families (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107392619B (en) * | 2017-07-31 | 2020-12-29 | 众安信息技术服务有限公司 | Intelligent contract processing method and device |
CN111899102A (en) * | 2018-11-30 | 2020-11-06 | 创新先进技术有限公司 | Method for realizing privacy protection in block chain |
US20210089422A1 (en) * | 2019-09-06 | 2021-03-25 | Common Computer Inc. | System and method for serverless computing based on blockchain |
-
2021
- 2021-09-03 CN CN202111034607.8A patent/CN113778564B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109299587A (en) * | 2018-09-11 | 2019-02-01 | 平安科技(深圳)有限公司 | Algorithm protection method, device, equipment and storage medium based on go language |
CN113222596A (en) * | 2021-04-23 | 2021-08-06 | 上海和数软件有限公司 | Electric power data storage method and system based on block chain intelligent contract |
Also Published As
Publication number | Publication date |
---|---|
CN113778564A (en) | 2021-12-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109976761B (en) | Software development kit generation method and device and terminal equipment | |
US9146759B2 (en) | Assumption-based compilation | |
US10140119B2 (en) | Modular serialization | |
US8561045B2 (en) | Constructing runtime state for inlined code | |
CN111179086B (en) | Intelligent contract virtual machine based on WebAsssemly | |
US11321090B2 (en) | Serializing and/or deserializing programs with serializable state | |
WO2022148390A1 (en) | Methods for deploying, updating and calling smart contract in blockchain | |
EP3961390A1 (en) | Method for executing smart contract and blockchain node | |
WO2021057252A1 (en) | Service processing flow configuration method and apparatus, and service request processing method and apparatus | |
CN106850650B (en) | Method for accessing data by game client and client game system | |
WO2021175053A1 (en) | Method and apparatus for executing functional module in virtual machine | |
US20100058299A1 (en) | Method of array interception using data-flow analysis | |
CN111240772A (en) | Data processing method and device based on block chain and storage medium | |
US8935657B2 (en) | Model-to-model transformation by kind | |
CN114327481A (en) | Code processing method, device, equipment and storage medium | |
US10922107B2 (en) | Apparatus and method for realizing runtime system for programming language | |
CN114115884A (en) | Management method and related device for programming service | |
CN111880801A (en) | Application program dynamic method and device and electronic equipment | |
CN113778564B (en) | Method, equipment and storage medium for efficiently executing EVM intelligent contract | |
CN116226921A (en) | Desensitization processing method and device | |
EP3961437B1 (en) | Method for executing smart contract, blockchain node, and storage medium | |
EP3961438B1 (en) | Method for executing smart contract, blockchain node, and storage medium | |
CN112363804B (en) | Blockchain JVM application method, device and storage medium | |
US11573777B2 (en) | Method and apparatus for enabling autonomous acceleration of dataflow AI applications | |
Sharp et al. | Static analysis of object references in RMI-based Java software |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |