CN113220327B - Intelligent contract upgrading method and block chain system - Google Patents

Intelligent contract upgrading method and block chain system Download PDF

Info

Publication number
CN113220327B
CN113220327B CN202110510888.3A CN202110510888A CN113220327B CN 113220327 B CN113220327 B CN 113220327B CN 202110510888 A CN202110510888 A CN 202110510888A CN 113220327 B CN113220327 B CN 113220327B
Authority
CN
China
Prior art keywords
contract
block chain
blockchain
node
code
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
Application number
CN202110510888.3A
Other languages
Chinese (zh)
Other versions
CN113220327A (en
Inventor
林志平
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alipay Hangzhou Information Technology Co Ltd
Ant Blockchain Technology Shanghai Co Ltd
Original Assignee
Alipay Hangzhou Information Technology Co Ltd
Ant Blockchain Technology Shanghai Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alipay Hangzhou Information Technology Co Ltd, Ant Blockchain Technology Shanghai Co Ltd filed Critical Alipay Hangzhou Information Technology Co Ltd
Priority to CN202110510888.3A priority Critical patent/CN113220327B/en
Publication of CN113220327A publication Critical patent/CN113220327A/en
Application granted granted Critical
Publication of CN113220327B publication Critical patent/CN113220327B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45504Abstract machines for programme code execution, e.g. Java virtual machine [JVM], interpreters, emulators
    • G06F9/45516Runtime code conversion or optimisation
    • G06F9/4552Involving translation to a different instruction set architecture, e.g. just-in-time translation in a JVM

Abstract

The specification provides an intelligent contract upgrading method and a block chain system; the method can comprise the following steps: all blockchain nodes in the blockchain network respectively acquire contract deployment transactions containing byte codes and deploy corresponding intelligent contracts based on the contract deployment transactions, wherein the contract deployment transactions are generated in response to contract deployment requests of users; carrying out JIT compiling on the byte code by a first block chain link point in the block chain network to obtain a machine code of the intelligent contract; and all block chain link points in the block chain network respectively acquire contract upgrading transactions containing the machine codes, and upgrade the contract codes corresponding to the intelligent contracts from the byte codes to the machine codes based on the contract upgrading transactions, wherein the contract upgrading transactions are generated in response to contract upgrading requests of the users.

Description

Intelligent contract upgrading method and block chain system
Technical Field
The present disclosure relates to the field of blockchain, and in particular, to an intelligent contract upgrading method and a blockchain system.
Background
The block chain technology (also called as distributed ledger technology) is a decentralized distributed database technology, has the characteristics of decentralization, openness and transparency, no tampering, trustiness and the like, and is suitable for application scenes with high requirements on data reliability. JIT (Just-In-TimeCompiler) is a compilation method that can improve the execution efficiency of program code. How to apply JIT compilation to a block chain to improve the execution efficiency of an intelligent contract has become a technical problem to be solved urgently.
When applying JIT compilation to a blockchain, it is generally required that after the bytecode of an intelligent contract is deployed to each blockchain node, each blockchain node performs JIT compilation on the bytecode itself, and upgrades the deployed bytecode into compiled machine code. Since this approach requires that each block link point separately JIT-compile the bytecode, a large amount of block chain processing resources are occupied.
In addition, the block link point in the related art needs to perform contract upgrade operation upon receiving an upgrade instruction sent by a user. Since JIT coding is performed by each block chain, the user needs to send an upgrade indication to each block chain link point, which occupies a large amount of transmission resources.
Disclosure of Invention
In view of the above, one or more embodiments of the present disclosure provide an intelligent contract upgrading method and a blockchain system.
One or more embodiments of the present disclosure provide the following:
according to a first aspect of one or more embodiments of the present specification, there is provided an intelligent contract upgrading method, including:
all blockchain nodes in the blockchain network respectively acquire contract deployment transactions containing byte codes and deploy corresponding intelligent contracts based on the contract deployment transactions, wherein the contract deployment transactions are generated in response to contract deployment requests of users;
carrying out JIT compiling on the byte code by a first block chain link point in the block chain network to obtain a machine code of the intelligent contract;
and all block chain link points in the block chain network respectively acquire contract upgrading transactions containing the machine codes, and upgrade the contract codes corresponding to the intelligent contracts from the byte codes to the machine codes based on the contract upgrading transactions, wherein the contract upgrading transactions are generated in response to contract upgrading requests of the users.
According to a second aspect of one or more embodiments herein, there is provided a blockchain system, comprising: a plurality of blockchain nodes; wherein the content of the first and second substances,
each blockchain node in the blockchain system respectively acquires a contract deployment transaction containing byte codes and deploys a corresponding intelligent contract based on the contract deployment transaction, wherein the contract deployment transaction is generated in response to a contract deployment request of a user;
carrying out JIT compiling on the byte code by any block chain link point in the block chain system to obtain a machine code of the intelligent contract;
and all the block chain nodes in the block chain system respectively acquire contract upgrading transactions containing the machine codes, and upgrade the contract codes corresponding to the intelligent contracts from the byte codes to the machine codes based on the contract upgrading transactions, wherein the contract upgrading transactions are generated in response to contract upgrading requests of the users.
Drawings
FIG. 1 is a schematic diagram of compilation execution and interpretive execution in one embodiment.
Fig. 2 is a schematic diagram illustrating implementation and JIT in one embodiment.
FIG. 3 is a flowchart illustrating a method for intelligent contract upgrade, according to an exemplary embodiment of the present description.
Fig. 4 is a block chain system shown in an exemplary embodiment of the present specification.
FIG. 5 is an interaction diagram illustrating a method for intelligent contract upgrades in an exemplary embodiment of the present description.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. The following description refers to the accompanying drawings in which the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present specification. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the specification, as detailed in the claims that follow.
The terminology used in the description herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the description. As used in this specification and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms first, second, third, etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, the first information may also be referred to as second information, and similarly, the second information may also be referred to as first information, without departing from the scope of the present specification. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
The 1.0 era of blockchain generally refers to the development stage of blockchain applications represented by bitcoin between 2009 and 2014, which mainly aim to solve the decentralization problem of currency and payment means. Since 2014, developers have been focusing more and more on solving the deficiencies of bitcoin in technology and extensibility. In the end of 2013, vitarik burein issued the etherhouse white paper, "etherhouse: the next generation of intelligent contracts and decentralized application platforms introduce the intelligent contracts into the blockchain, open the application of the blockchain outside the currency field, and further open the 2.0 era of the blockchain.
An intelligent contract is an automatically executable computer contract based on specified trigger rules and may also be considered a digital version of a traditional contract. The concept of smart contracts was first proposed by cross-domain law workers, cryptology researchers, NickSzabo (NickSzabo) in 1994. This technology has not been used in the real industry for the first time due to the lack of programmable digital systems and related technologies, until the advent of blockchain technology and etherhouses provided reliable execution environments for it. Due to the block chain type account book adopted by the block chain technology, the generated data cannot be falsified or deleted, and account book data are continuously added to the whole account book, so that the traceability of historical data is ensured; meanwhile, the decentralized operation mechanism avoids the influence of centralized factors. The intelligent contract based on the block chain technology not only can exert the advantages of the intelligent contract in the aspects of cost and efficiency, but also can avoid the interference of malicious behaviors on the normal execution of the contract. The intelligent contract is written into the block chain in a digitalized form, and the characteristics of the block chain technology guarantee that the whole process of storage, reading and execution is transparent, traceable and not falsifiable.
A smart contract is essentially a piece of program that can be executed by a computer. The smart contracts, like computer programs that are widely used today, may be written in a high-level language (e.g., C language, C + + language, etc.). Program code of an intelligent contract written in a high-level language is generally converted by a "compiler" into "machine code" that can be recognized and executed by a CPU of a computer, and such machine code (alternatively referred to as "microprocessor instructions") can be executed by the CPU. This approach is commonly referred to as "compilation execution.
Compilation execution generally does not have cross-platform extensibility. Since there are CPUs of different manufacturers, brands and generations, and the instruction sets supported by these different CPUs are different in many cases, such as the x86 instruction set, the ARM instruction set, etc., and the instruction sets supported by CPUs of the same manufacturer and different generations (such as intel CPUs of different generations) are not identical, the machine codes converted by compilers on different CPUs may be different for the same program code written in the same high-level language. Specifically, in the process of converting program codes written in a high-level language into machine codes, a compiler performs optimization in combination with characteristics of a specific CPU instruction set (such as a vector instruction set) to improve the speed of program execution, and such optimization is often related to specific CPU hardware. Thus, the same machine code, one may run on x86, but the other may not run on ARM; even the same x86 platform, instruction sets are continually enriched and expanded over time, which results in different machine code runs on different generations of x86 platforms. Furthermore, since executing machine code requires the CPU to be scheduled by the os kernel, machine code supporting execution under different os may be different even if it is the same hardware.
Unlike compilation execution, there is also a way of running programs that "interpret execution. Such as the Java language, compiles Java source code into standard byte codes (bytecodes) by a Java compiler, where the compiler does not target any actual instruction set of the hardware processor, but rather defines an abstract set of standard instruction sets. The compiled standard bytecode generally cannot be directly run on a hardware CPU, so a virtual machine, i.e. JVM, is introduced, and the JVM runs on a specific hardware processor to interpret and execute the compiled standard bytecode.
JVM is an abbreviation of Java Virtual Machine, and is an imaginary computer, which is often implemented by simulating various computer functions on an actual computer. The JVM shields information related to a specific hardware platform, an operating system, and the like, so that the Java program can be run on various platforms without modification only by generating standard bytecodes which can be run on the Java virtual machine.
A very important feature of the Java language is independence from the platform. The use of a Java virtual machine is the key to achieving this feature. A typical high-level language, if it is to be run on a different platform, needs to be compiled into at least different object codes. After the Java language virtual machine is introduced, the Java language does not need to be recompiled when running on different platforms. The Java language masks information related to a specific platform using a Java virtual machine, so that a Java language compiler can be executed on a variety of platforms without modification by only generating object codes (bytecodes) to be executed on the Java virtual machine. When executing the byte code, the Java virtual machine interprets the byte code into machine instruction execution on a specific platform. This is why Java is able to "compile once, run everywhere".
The JVM runs on a specific hardware processor, is responsible for the interpretation and execution of bytecodes for the specific processor running, and masks up these underlying differences, presenting the developer with a standard development specification. The JVM, when executing bytecodes, actually eventually interprets the bytecodes into machine instruction execution on a particular platform. Specifically, after receiving the input bytecode, the JVM interprets each instruction sentence by sentence and translates the interpreted instruction into a machine code suitable for the current machine to run, and these processes are interpreted and executed by, for example, an Interpreter called Interpreter. In this way, the developer writing the Java program does not need to consider on which hardware platform the written program code will run. The development of the JVM itself is done by a professional developer of the Java organization to adapt the JVM to different processor architectures. To date, the mainstream processor architectures have limited number, such as X86, ARM, RISC-V, MIPS. After a professional developer transplants the JVMs onto platforms supporting these specific hardware, the Java program can theoretically run on all machines. The JVM migration work is usually provided by a professional in the Java development organization, which greatly relieves the Java application developer of the burden.
Interpretive execution brings cross-platform portability, but because execution of bytecodes goes through the process of JVM intermediate translation, execution efficiency is not as high as the above compilation execution efficiency, and the difference in efficiency can sometimes even reach several tens of times.
Fig. 1 shows the common points and different points of compilation execution and interpretation execution. Whether interpreted or compiled, or physical or virtual, it is not possible for an application program to be read, understood, and then executed as if it were human. Most of the program code needs to go through the steps of fig. 1 before the object code of the physical machine or the instruction set that the virtual machine can execute. The branch from the top to the left in fig. 1 is the generation process of the program code to the target machine code in the conventional compilation principle, and the branch from the top to the right is the process of the interpreted execution. Nowadays, languages based on a physical machine, a Java virtual machine, or other High-Level Language virtual machines (HLLVM) other than Java mostly follow the idea based on the modern classical compilation principle, and before execution, lexical analysis and syntax analysis processing are performed on program source codes to convert the source codes into Abstract Syntax Trees (AST). For implementation of a specific language, the lexical analysis, the syntactic analysis and the subsequent optimizer and object code generator can be selected to be independent of the execution engine to form a complete compiler for implementation, and the representation is C/C + + language. Alternatively, some of the steps (e.g., the steps prior to generating the abstract syntax tree) may be implemented as a semi-independent compiler, such as the Java language. Or all the steps and the execution engines are packaged in a closed black box in a centralized mode, such as most JavaScript executors.
To achieve as good a compromise between cross-platform portability and high performance as possible, the concept of Just-In-time compiler (JIT) is proposed. The core idea of JIT is "how to efficiently avoid repetitive work in interpreting instructions". There is a large amount of repeatedly executed code in a computer program, for example, some computing "functions" may be called many times in a loop during the execution of a program. If it is an interpretive execution, each execution of the loop process translates this function from bytecode to machine code. However, in practice, the machine code generated by this function in tens of translations is the same. Naturally, after the first translation, the machine code of the translated function is cached, and in the subsequent re-execution process, the cached code is directly used without the need of re-translation, so that the execution efficiency can be improved.
On the contrary, some functions are executed only once during the program running period (for example, the initialization is started), so that the functions do not need to be cached and can be directly interpreted and executed once. Thus, a core module in the JIT technology is "hot spot analysis", which analyzes which codes are executed multiple times during program execution, and thus caches the translated machine codes. For operations that are performed a small number of times, no caching is required. This may result in an optimal balance between execution efficiency and memory overhead.
In addition, another core module in JIT technology is compilation optimization (or optimized compilation). The directly translated machine code is not optimized by combining the context, only the high-frequency machine code is cached, and the performance improvement is limited. Further optimization of the compiler may be performed if better performance is to be achieved. The way of compiling the optimization generally requires relatively more time to implement.
The working principle of JIT is shown, for example, in fig. 2. The Java source code is compiled by a Java Compiler to generate a Java bytecode, and is distributed to two execution paths (JIT Compiler and interproerter) after hot spot analysis. The code determined as the hot spot (high-frequency execution) is compiled in the JIT compiler to obtain a machine code, cached and executed, and generally executed by the CPU under the control of an Operating System (OS). The low frequency input Interpreter (Interpreter) translates the code into machine code and is executed by the CPU under the control of the OS.
Due to the context of the program code itself, a large optimization space often exists in the compiling process. The execution efficiency of the optimized machine code is far higher than that of the directly translated machine code. Compiler optimization is necessary if better performance is to be achieved. The process of JIT compiler compilation may be time consuming. In particular, the process of JIT Compiler compiling bytecode for the first time can be time consuming and even not as efficient as interpretation. Then, for some java programs, if the hot spot is not very prominent, i.e. the overall execution frequency is not very high, and the overall execution flow is very long, it is difficult for JIT to exert the advantage of compiling execution.
In view of the above advantages, the JIT compilation has become an important means for improving the execution efficiency of programs outside the blockchain, but due to the consistency requirement of the blockchain technology on each node, "how to integrate the JIT compilation into the blockchain to improve the execution efficiency of the intelligent contracts" has become an urgent problem to be solved in the field of blockchain.
In the related art, if it is required to JIT compile an intelligent contract in a blockchain network, it is generally required to JIT compile the bytecode of the intelligent contract by itself from each blockchain node after the bytecode of the intelligent contract is deployed to each blockchain node, and upgrade the deployed bytecode to JIT-compiled machine code. Since this approach requires that each block link point JIT compile the bytecode separately, a lot of block chain processing resources are occupied.
In addition, the intelligent contracts in the blockchain are usually compiled by users, and then are deployed by sending contract deployment transactions. In other words, the ownership of the smart contract pertains to the user's individual. Therefore, after a block link point compiles an intelligent contract into machine code through JIT compilation, it is generally required that a user sends an upgrade instruction for characterizing permission to upgrade bytecode into machine code to the corresponding block link point, and then the block link point can perform an operation of upgrading the deployed bytecode into machine code. However, in the related art, since it is necessary for each block link point to perform JIT coding operation, when sending the upgrade instruction, the user is also required to send the upgrade instruction to each block link point, which occupies a large amount of transmission resources.
Therefore, the present specification proposes an intelligent contract upgrading method, so that when JIT compilation is applied to the blockchain technique, it is not necessary to occupy a large amount of blockchain processing resources, nor a large amount of transmission resources.
FIG. 3 is a flowchart illustrating a method for intelligent contract upgrade, according to an exemplary embodiment of the present description. The method may comprise the steps of:
step 302, all blockchain nodes in the blockchain network respectively acquire contract deployment transactions containing byte codes, and deploy corresponding intelligent contracts based on the contract deployment transactions, wherein the contract deployment transactions are generated in response to contract deployment requests of users.
Similar to the related art, this specification requires that the bytecode of the intelligent contract be preferentially deployed. In actual operation, a user can compile byte codes of an intelligent contract by himself and enable a client to generate contract deployment transactions based on the byte codes in a mode of sending contract deployment requests to the client used by the user. The client may send the generated contract deployment transaction to any block chain node, so that any block chain node performs transaction consensus on the contract deployment transaction, and after the consensus passes, each block chain node performs deployment on the bytecode included therein.
As can be seen from the above, in the related art, after the byte code is deployed at each block link point, each block link point needs to perform JIT compilation on the byte code, so that more block chain processing resources are occupied, and a user needs to send an upgrade instruction for an intelligent contract to each block link point.
In view of this, in the present application, instead of performing JIT compilation separately on each block chain node, a node in the block chain network performs JIT compilation and then sends the compiled machine code to each block chain node in the block chain network, so that each block chain node does not need to perform JIT compilation operation separately, thereby reducing occupation of processing resources of the block chain in the JIT compilation process. And if and only if the certain node receives the upgrading indication of the user owning the intelligent contract ownership, the compiled machine code is sent to each block chain node in the block chain network, so that the condition that the user needs to send the upgrading indication to each block chain node is avoided.
Step 304, performing JIT compilation on the bytecode by a first block link point in the block chain network to obtain a machine code of the intelligent contract.
In this specification, the above-described block link point responsible for JIT coding of the intelligent contract is referred to as a first block chain node.
In practical applications, not all intelligent contracts need to be compiled into machine code. Thus, the first block link point may determine whether to JIT compile the smart contract in a contract deployment transaction according to actual demand.
In an embodiment, the first block link point may perform JIT compilation on the bytecode included in the contract deployment transaction to obtain the machine code of the intelligent contract, upon receiving indication information sent by the user to indicate that the bytecode of the intelligent contract is compiled into the machine code. In this embodiment, the controllability of contract upgrade is further improved, which is equivalent to the process of controlling JIT compilation by the user.
In another embodiment, the first block link point may determine, in a case where the intelligent contract deployment transaction is received, whether an indication identifier for indicating that the bytecode of the intelligent contract is compiled into machine code is included in the intelligent contract transaction, and in a case where the indication identifier is included, JIT-compile the bytecode included in the contract deployment transaction. In this embodiment, the user can inform the first blockchain node that the bytecode in the contract deployment transaction needs to be JIT compiled by simply adding a corresponding indication identifier in the contract deployment transaction, without additionally sending an indication message as in the above embodiment.
In yet another embodiment, the first block link point may determine whether JIT compilation of bytecodes in the contract deployment transaction is required according to an initiator of the contract deployment transaction or a type of business data included in the contract deployment transaction. Specifically, the first block link point may perform JIT compilation on the bytecode in the contract deployment transaction if it is determined that the received contract deployment transaction is initiated by a predefined specific user; alternatively, the first block link point may JIT compile bytecode in the contract deployment transaction if it is determined that the business data included in the received contract deployment transaction belongs to a predefined business type.
In the present specification, the timing of executing JIT compilation may also be determined according to actual circumstances.
In one embodiment, the first block link point may start JIT compiling the bytecode of the intelligent contract after determining that the bytecode of the intelligent contract is completely deployed. This approach is equivalent to performing the deployment of bytecodes and JIT compilation of bytecodes in sequence.
In another embodiment, the first block link point may JIT compile the bytecode of the intelligent contract with a relatively free time if it is determined that the bytecode of the intelligent contract is completely deployed. For example, the bytecode of the smart contract may be JIT compiled when the first chunk link point does not need to process transactions.
In yet another embodiment, JIT compilation and contract deployment operations for bytecodes may be performed in parallel. In other words, the first blockchain node may JIT compile the bytecode in the contract deployment transaction simultaneously as it is deployed to the respective blockchain nodes. In the embodiment, because the two operations are executed in parallel, the machine code of the intelligent contract can be quickly obtained, and then the deployed bytecode is more timely upgraded.
In this description, a first blockchain node may compile all bytecodes in a contract deployment transaction when JIT compiling the bytecodes of an intelligent contract; or, the first block link node may preferentially perform hotspot analysis on the bytecode in the contracted deployment transaction by using the characteristics of JIT compilation, and then compile the hotspot bytecode (high-frequency execution bytecode) determined by the hotspot analysis; still alternatively, because the contract code itself has a larger optimization space due to the context, the first block link point may perform optimized compilation on the bytecode included in the contract deployment transaction when performing JIT compilation on the bytecode of the intelligent contract, so as to improve the execution efficiency of the compiled machine code.
And 306, respectively acquiring contract upgrading transactions containing the machine codes by all block chain nodes in the block chain network, and upgrading the contract codes corresponding to the intelligent contracts from the byte codes to the machine codes based on the contract upgrading transactions, wherein the contract upgrading transactions are generated in response to contract upgrading requests of the users.
In this specification, contract upgrade transactions to upgrade deployed bytecode to machine code are each generated in response to a user-initiated contract upgrade request.
In one embodiment, the first block link point may return a notification message to the user that JIT compilation for the smart contract is completed, and the notification message includes machine code obtained through JIT compilation. The user, upon receiving the notification message, may send a contract upgrade request to a client used by the user to instruct the client to generate a contract upgrade transaction for the smart contract based on the machine code included in the notification message. On the basis, the client can send the contract upgrading transaction to any blockchain node in the blockchain network so as to upgrade the deployed bytecode into machine code through the any blockchain node.
In another embodiment, the first blockchain node may still return a notification message that JIT compilation has been completed to the user after completing JIT compilation for the smart contract, but the notification message does not include the JIT compiled machine code; after receiving the notification message, the user may send a contract upgrading request for the intelligent contract to a second block link node in the block chain network, and after receiving the contract upgrading request, the second block chain node may generate a contract upgrading transaction for the intelligent contract based on the machine code obtained by JIT compilation. In this embodiment, the second blockchain node and the first blockchain node may be the same node or different nodes. Wherein, under the condition of the same node, the node which is equivalent to the node responsible for JIT compilation and the node which is responsible for generating contract upgrading transaction are the same node, therefore, the machine code obtained by JIT compilation can be obtained without interaction between the nodes; in the case of different nodes, the node responsible for JIT compilation and the node responsible for generating the contract upgrade transaction are different nodes, and therefore, before the contract upgrade transaction is generated, the first blockchain node needs to transmit the machine code obtained through JIT compilation to the second blockchain node, so that the second blockchain node generates the contract upgrade transaction based on the received machine code.
In yet another embodiment, a user may actively initiate a progress query request for JIT compilation to a first blockchain node to determine whether JIT compilation for a smart contract has been completed. The first chunk link point may return to the user the execution progress of the JIT compilation upon receiving the progress query request. Wherein the user initiates a contract upgrade request for the intelligent contract if it is determined by the execution progress that JIT compilation for the intelligent contract is completed. The intelligent contract upgrade request may be sent to a second blockchain node in the blockchain network to generate a contract upgrade transaction from the second blockchain node based on JIT compiled machine code. Similar to the previous embodiment, the second blockchain node and the first blockchain node may be the same node or different nodes. How to generate the contract upgrade transaction under different conditions has been described in detail in the previous embodiment, and is not described in detail in this embodiment.
It is to be noted that, in order to send the contract upgrade transaction to each blockchain node, all nodes in the blockchain network may perform a transaction consensus on the contract upgrade transaction, so as to send the contract upgrade transaction containing the machine code to each blockchain node if the consensus passes.
In actual operation, when any blockchain node in the blockchain network upgrades the bytecode to the machine code, a contract address of the intelligent contract needs to be determined preferentially, and then the deployed bytecode corresponding to the contract address is replaced by the machine code, so as to upgrade the intelligent contract.
In practical applications, the intelligent contracts deployed in the blockchain network are likely to be invoked by users at any time. When the deployed intelligent contract is called, the intelligent contract is still deployed in the corresponding contract address in the form of byte codes, wherein the intelligent contract may not be upgraded; it is also possible that it has been upgraded to be deployed in the corresponding contract address in the form of machine code. It should be understood that for intelligent contracts deployed in different forms, calls need to be made in different ways.
Specifically, when a third blockchain node in the blockchain network receives a call transaction for an intelligent contract, all nodes in the blockchain network may perform transaction consensus on the call transaction, and in the case that the consensus passes, all blockchain nodes may determine a contract address of the intelligent contract to be called according to the call transaction, so as to obtain a contract code of the called intelligent contract through the contract address. Under the condition that the acquired contract code is a byte code, each block chain link point can interpret and execute the byte code so as to realize the calling of the intelligent contract; and in the case that the acquired contract code is the machine code, each block link point can directly execute the acquired machine code. The third blockchain node may be the same node as the first blockchain node, or may be a different node.
It should be noted that, when the obtained contract code is a machine code, all the obtained machine codes do not have to be executed, but the machine code to be executed may be determined according to the called function/code block included in the call transaction. In other words, only machine code of the contract code of the acquired smart contract corresponding to the called function/code block may be executed.
In addition, in order to enable each blockchain node in the blockchain network to perform a contract upgrading operation on a corresponding intelligent contract in a received contract upgrading transaction, the chain code run by each blockchain node usually includes contract upgrading logic code for upgrading the intelligent contract code from bytecode to machine code according to the received contract upgrading transaction.
It should be emphasized that the technical solution in this specification can be applied to the conventional architecture of the block chain technology, that is, all the block chain nodes in the block chain network are formed by deploying block chain codes on the corresponding entity devices, and in most cases, each node corresponds to one entity device; the technical solution of the present specification may also be applied to a baas (block chain as a service) architecture in a block chain technology, that is, all nodes in a block chain network are formed by deploying block chain codes on a virtual machine implemented in a cloud through a cloud service, and block chain link points do not need to correspond to corresponding physical devices one to one.
When the technical solution of the present specification is applied to a BaaS architecture, it is equivalent to that the first block link point is mounted in a virtual machine, and at this time, a JIT compiling service may be pre-deployed in the virtual machine corresponding to the first block link point, so as to perform JIT compiling on a bytecode of an intelligent contract.
According to the technical scheme, after the block chain network in the specification acquires the contract deployment transaction, on one hand, the byte codes in the contract deployment transaction are deployed to each block chain node; on the other hand, the byte codes in the contract deployment transaction are subjected to JIT compiling through the included first block link point so as to obtain the machine codes of the corresponding intelligent contracts. On the basis, the first block chain link point can send contract upgrading transactions containing compiled machine codes to each block chain node under the condition that an upgrading instruction of a user is received, so that deployed byte codes are upgraded into the machine codes by each block chain link point.
It should be understood that the technical solution of the present specification is equivalent to JIT compiling the bytecode of the intelligent contract only by one node in the blockchain network, and synchronizing the compiled machine code to each blockchain node by generating a contract upgrade transaction after the completion of the compilation, so as to upgrade the bytecode to the machine code by each blockchain node. Obviously, by the technical solution of the present specification, a situation that each block link point needs to perform JIT compiling operation separately in the related art is avoided, and occupation of block chain processing resources by JIT compiling is reduced.
In addition, according to the technical scheme of the specification, the upgrading operation of upgrading the byte codes into the machine codes can be completed only by sending the upgrading instruction for upgrading the intelligent contract to any block chain node in the block chain network, the condition that the upgrading instruction needs to be sent to each block chain link point in the related technology is avoided, and further the occupation of transmission resources is reduced.
In order to realize the intelligent contract upgrading method, the specification also provides a block chain system. The block chain system is used to implement the above-mentioned scheme, most of the operation modes are similar to the previous embodiment, and how to perform JIT compilation, how to generate a contract upgrade transaction, and the like can refer to the description of the previous embodiment, and are not described in the next embodiment again.
Fig. 4 illustrates a blockchain system according to an exemplary embodiment of the present disclosure, and as shown in fig. 4, the blockchain system 4 includes: a plurality of blockchain nodes; wherein the content of the first and second substances,
each blockchain node in the blockchain system respectively acquires a contract deployment transaction containing byte codes and deploys a corresponding intelligent contract based on the contract deployment transaction, wherein the contract deployment transaction is generated in response to a contract deployment request of a user;
carrying out JIT compiling on the byte code by any block chain link point in the block chain system to obtain a machine code of the intelligent contract;
and all the block chain nodes in the block chain system respectively acquire contract upgrading transactions containing the machine codes, and upgrade the contract codes corresponding to the intelligent contracts from the byte codes to the machine codes based on the contract upgrading transactions, wherein the contract upgrading transactions are generated in response to contract upgrading requests of the users.
As described above, the specification requires that the bytecode of the intelligent contract be preferentially deployed. In actual operation, a user can compile byte codes of an intelligent contract by himself and enable a client to generate contract deployment transactions based on the byte codes in a mode of sending contract deployment requests to the client used by the user. The client may send the generated contract deployment transaction to any blockchain node in the blockchain system 4, so that the any blockchain node performs transaction consensus on the contract deployment transaction, and after the consensus passes, each blockchain node performs deployment on the bytecode included therein.
As described above, the block chain node responsible for JIT coding of the intelligent contract in this specification may be any node in the block chain system. For example, the any block link point may be the node 41 in fig. 4, that is, the node 41 is the first block link node in the previous embodiment.
As described above, the first block link point may perform JIT compilation on the bytecode included in the contract deployment transaction to obtain the machine code of the intelligent contract, upon receiving the instruction information sent by the user to instruct the bytecode of the intelligent contract to be compiled into the machine code. Alternatively, the first block link point may determine, when the intelligent contract deployment transaction is received, whether an indication identifier indicating that the bytecode of the intelligent contract is compiled into machine code is included in the intelligent contract transaction, and may perform JIT compilation on the bytecode included in the contract deployment transaction when the indication identifier is included. Or, the first block link point may determine whether JIT compiling is required for the bytecode in the contract deployment transaction according to the initiator of the contract deployment transaction or the type of the service data included in the contract deployment transaction.
As described above, the first block link point may start JIT compiling the bytecode of the intelligent contract after determining that the bytecode of the intelligent contract is completely deployed. The first block link point may also JIT compile the bytecode of the intelligent contract with a relatively free time in a case where it is determined that the bytecode of the intelligent contract is deployed to completion.
As described above, the user may passively receive a notification message that indicates that JIT compilation for the smart contract is completed, which may or may not include compiled machine code, returned by the first blockchain node. Wherein, in the event that the machine code is included in the notification message, the contract upgrade transaction may be generated by a client used by the user; and in the event that machine code is not included in the notification message, the contract upgrade transaction may be generated by the second chunk link node that received the contract upgrade request. The second blockchain node may be the same as the first blockchain node, and if both are the node 41; the two blockchain nodes may also be different nodes from the first blockchain node, such as node 42.
As described above, the user may also actively initiate a progress query request for JIT compilation to the first blockchain node to determine whether JIT compilation for the smart contract has been completed. Wherein the user initiates a contract upgrade request for the intelligent contract upon determining that JIT compilation for the intelligent contract is complete.
As described above, the intelligent contracts deployed in the blockchain system are likely to be invoked by users at any time. When the deployed intelligent contract is called, the intelligent contract is still deployed in the corresponding contract address in the form of byte codes, wherein the intelligent contract may not be upgraded; it is also possible that the upgrade has already been deployed in the corresponding contract address in the form of machine code. Specifically, when a third blockchain node in the blockchain network receives a call transaction for an intelligent contract, all nodes in the blockchain network may perform transaction consensus on the call transaction, and in the case that the consensus passes, all blockchain nodes may determine a contract address of the intelligent contract to be called according to the call transaction, so as to obtain a contract code of the called intelligent contract through the contract address. Under the condition that the acquired contract code is a byte code, each block chain link point can interpret and execute the byte code so as to realize the calling of the intelligent contract; and in the case that the acquired contract code is the machine code, each block link point can directly execute the acquired machine code. The third blockchain node may be the same as the first blockchain node, and for example, both the third blockchain node and the first blockchain node are nodes 41; the third blockchain node may also be a different node from the first blockchain node, such as node 43.
As described above, the above-mentioned blockchain system can be based on the conventional architecture of the blockchain technology, that is, all blockchain nodes in the blockchain system are formed by deploying blockchain codes on corresponding physical devices, and in most cases, each node corresponds to one physical device; the above-mentioned blockchain system may also be based on a baas (blockchain as a service) architecture in the blockchain technology, that is, all nodes in the blockchain system are formed by deploying blockchain codes on a virtual machine implemented in a cloud through a cloud service, and the blockchain nodes do not need to correspond to corresponding physical devices one by one.
As can be seen from the blockchain system, after acquiring a contract deployment transaction, the blockchain system in this specification deploys the bytecode in the contract deployment transaction to each blockchain node; on the other hand, the byte codes in the contract deployment transaction are subjected to JIT compiling through the included first block link point so as to obtain the machine codes of the corresponding intelligent contracts. On the basis, the first block chain link point can send contract upgrading transactions containing compiled machine codes to each block chain node under the condition that an upgrading instruction of a user is received, so that deployed byte codes are upgraded into the machine codes by each block chain link point. In this way, the problem of wasting block chain processing resources caused by the need to perform JIT compilation in each block chain node point respectively and the problem of occupying a large amount of transmission resources caused by the need of users to send upgrading instructions to each block chain node point respectively in the related art are avoided.
Next, a technical solution of the present specification will be described by taking, as an example, a user actively sending a JIT compiled progress query to a block link node in a block link network.
FIG. 5 is an interaction diagram illustrating an intelligent contract upgrade method in accordance with an exemplary embodiment of the present specification. The method may comprise the steps of:
step 501, a client sends a contract deployment transaction to a first block link node in a block chain network.
In this embodiment, the user may compile the byte code of the smart contract that needs to be deployed on the client used by the user. After compiling the byte codes of the intelligent contract, the user can initiate a deployment instruction aiming at the intelligent contract to the client so that the client generates contract deployment transaction based on the byte codes of the intelligent contract under the instruction of the deployment instruction.
In practical applications, a contract deployment control may be included on the client so that a user may initiate a contract deployment request to the client through the contract deployment control. Specifically, after detecting that the contract deployment control is triggered, the client may determine that the user needs to deploy the corresponding intelligent contract to the blockchain network, and therefore, a contract deployment transaction may be generated based on the bytecode compiled by the user and sent to a first blockchain node in the blockchain network, so as to deploy the bytecode of the intelligent contract to each blockchain node through the first blockchain node. The first block chain node is any node in the block chain network.
At step 502, the first block link node and other nodes in the block link network agree on a contract deployment transaction so that each block link node deploys the bytecode included in the contract deployment transaction.
It should be understood that, after receiving a contract deployment transaction, the first blockchain node needs to perform transaction consensus on the contract deployment transaction preferentially, and when the consensus passes, then sends the contract deployment transaction to each blockchain node, so that each blockchain node deploys the bytecode included in the transaction.
It should be noted that after each blockchain node receives the contract deployment transaction, the blockchain node completes the deployment of the intelligent contract by saving the bytecode included in the transaction to the corresponding contract address.
At step 503, the first block link node JIT compiles the bytecode in the contract deployment transaction to obtain a corresponding machine code.
In this embodiment, JIT compilation may be performed while the bytecode of the smart contract is deployed; or JIT compiling can be carried out after byte code compiling of the intelligent contract is completed. How to JIT compile the bytecode of the smart contract can be determined by those skilled in the art according to actual needs.
At step 504, the client sends a progress query request for JIT compilation to the first blockchain node.
In this embodiment, a user actively sends a request for a query for the degree of progress to the first block link point through the client to know whether JIT compilation for the smart contract has been completed. After receiving the progress query request, the first blockchain node returns the current execution progress of the JIT compilation to the client.
In step 505, the first block link point determines the execution progress of JIT compilation and returns to the client.
It should be stated that the execution progress returned to the client by the first blockchain node may be: a scale for indicating that JIT compilation has been completed in the smart contract; it can also be: an indication of whether JIT compilation for the smart contract has been completed. How to return execution progress can be determined by those skilled in the art according to actual situations.
In step 506, the ue sends an upgrade indication to the first block link point when it is determined that JIT compilation is complete.
After receiving the execution progress returned by the first block link point, the client can display the execution progress so that the user can know whether the JIT compiling for the intelligent contract is completed. If the intelligent contract upgrading is finished, the user can indicate the client to send an upgrading instruction aiming at the intelligent contract to the first block chain link point by triggering the corresponding control.
In step 507, after receiving the upgrade instruction, the first blockchain node generates a contract upgrade transaction based on the machine code obtained by JIT compilation.
In this embodiment, after receiving an upgrade instruction sent by the client, the first blockchain node may generate a contract upgrade transaction based on the compiled machine code.
And step 508, the first block chain link and other nodes in the block chain network perform transaction consensus on the contract upgrading transaction so that each block chain link can upgrade the deployed byte codes into machine codes contained in the contract upgrading transaction.
In this embodiment, after generating a contract upgrade transaction, the first blockchain node may perform transaction consensus with other nodes in the blockchain network, and send the contract upgrade transaction to other nodes when the consensus passes, so that each blockchain link point replaces a deployed bytecode in a contract address with a machine code in the contract upgrade transaction, thereby completing upgrade for an intelligent contract.
According to the technical scheme, after the user sends the compiled intelligent contract to the block chain nodes, the block chain nodes can perform transaction consensus on the contract deployment transaction containing the intelligent contract with other nodes on one hand, so that the byte codes of the intelligent contract are respectively deployed by the block chain nodes under the condition that the consensus passes; on the other hand, the block link point performs JIT coding on the bytecode to obtain the machine code of the intelligent contract. The execution progress of JIT compilation is actively inquired and obtained by a user, and the user can automatically select time to send an upgrade instruction to the block chain node under the condition of determining that the JIT compilation is completed, so that the block chain node performs contract upgrade on the deployed byte code based on the machine code obtained by the JIT compilation. Obviously, by this method, it is not necessary to separately perform JIT coding from each block link node as required in the related art, and occupation of block link processing resources is reduced. Furthermore, as the upgrading indication is sent by the user by selecting time, the controllability of the user on contract upgrading operation is further improved.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, systems, and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage, graphene storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
As will be appreciated by one skilled in the art, one or more embodiments of the present description may be provided as a method, system, or computer program product. Accordingly, one or more embodiments of the present description may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, one or more embodiments of the present description may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
One or more embodiments of the present description may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. One or more embodiments of the present specification can also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment. In the description of the specification, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the specification. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
The above description is intended to be illustrative of one or more embodiments of the disclosure, and is not intended to limit the scope of one or more embodiments of the disclosure. Various modifications and alterations to one or more embodiments described herein will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement or the like made within the spirit and principle of the present specification should be included in the scope of the claims.

Claims (13)

1. An intelligent contract upgrading method comprises the following steps:
all blockchain nodes in the blockchain network respectively acquire contract deployment transactions containing byte codes and deploy corresponding intelligent contracts based on the contract deployment transactions, wherein the contract deployment transactions are generated in response to contract deployment requests of users;
performing JIT (just in time) compilation on the byte code by using a first block chain node in the block chain network to obtain a machine code of the intelligent contract, and providing the machine code to all block chain nodes in the block chain network;
all blockchain nodes in the blockchain network upgrade contract codes corresponding to the intelligent contracts from the bytecode to the machine codes based on contract upgrade transactions including the machine codes, the contract upgrade transactions being generated in response to contract upgrade requests of the users.
2. The method of claim 1, a first block link node in the block chain network JIT-compiles the bytecode, comprising:
the first block link point JIT compiles the bytecode in the contract deployment transaction in response to an indication message sent by the user to indicate that the bytecode of the intelligent contract is compiled into machine code;
the first blockchain node JIT compiles bytecode in the contract deployment transaction if determining that the contract deployment transaction contains an indication mark for indicating that bytecode of the intelligent contract is compiled into machine code;
the first blockchain node JIT compiles bytecode in the contract deployment transaction if it is determined that the contract deployment transaction was initiated by a predefined specific user; alternatively, the first and second electrodes may be,
the first blockchain node JIT compiles bytecodes in the contract deployment transaction if it is determined that the business data included in the contract deployment transaction belongs to a predefined business type.
3. The method of claim 1, a first block link node in the block chain network JIT-compiles the bytecode, comprising:
after determining that the byte codes of the intelligent contracts are deployed, the first blockchain node starts JIT compiling on the byte codes of the intelligent contracts; alternatively, the first and second liquid crystal display panels may be,
the first blockchain node JIT compiles the bytecode of the intelligent contract with a relatively idle time period if it is determined that the bytecode is completely deployed.
4. The method of claim 1, a first block link node in the block chain network JIT-compiles the bytecode, comprising:
the first block link node compiles all bytecodes contained in the contract deployment transaction;
the first block chain link point performs hotspot analysis on byte codes contained in the contract deployment transaction and compiles the obtained hotspot byte codes; and/or the presence of a gas in the gas,
the first block link point optimally compiles bytecode contained in the contract deployment transaction.
5. The method of claim 1, further comprising:
the first blockchain node returns a notification message that the JIT compilation is completed to the user, wherein the notification message comprises a machine code obtained by the JIT compilation;
and the contract upgrading transaction is generated by a client corresponding to the user based on the machine code contained in the notification message under the condition of receiving a contract upgrading request sent by the user.
6. The method of claim 1, further comprising:
the first blockchain node returns a notification message to the user that the JIT compilation is completed;
generating, by a second blockchain node in the blockchain network, the contract upgrade transaction based on the machine code obtained by the JIT compilation, when receiving a contract upgrade request sent by the user;
the first block chain node and the second block chain node are the same node or different nodes.
7. The method of claim 1, further comprising:
the first block chain link point returns the execution progress of the JIT compilation to the user in response to the user-initiated progress query request for the JIT compilation;
wherein the contract upgrade request is initiated by the user upon determining that the JIT compilation has been completed.
8. The method of claim 1, any blockchain node in the blockchain network upgrading contract code corresponding to the smart contract from the bytecode to the machine code based on a contract upgrade transaction that includes the machine code, comprising:
and any blockchain node in the blockchain network determines a contract address of the intelligent contract, and replaces the deployed byte codes corresponding to the contract address with machine codes contained in the contract upgrading transaction.
9. The method of claim 1, further comprising:
a third blockchain node in the blockchain network receives an invocation transaction for the intelligent contract; the third block chain node and the first block chain node are the same node or different nodes;
all block chain nodes in the block chain network determine a contract address of the intelligent contract according to the call transaction so as to obtain a contract code of the intelligent contract;
wherein, in the case that the contract code is determined to be the byte code, each block link node interprets and executes the byte code; each block link point directly executes the machine code if the contract code is determined to be the machine code.
10. The method of claim 9, each block link point directly executing the machine code, comprising:
each block link point executes the machine code of the corresponding called function/code block in the intelligent contract.
11. The method of claim 1, wherein chain code of block chain link point operation in the block chain network comprises contract upgrading logic code, and the contract upgrading logic code is used for upgrading contract code of the intelligent contract from byte code to machine code according to the acquired contract upgrading transaction.
12. The method of claim 1, wherein the first chunk link point is mounted on a virtual machine, and a JIT compiling service is pre-deployed in the virtual machine, and is used for JIT compiling byte codes of the smart contract.
13. A blockchain system, comprising: a plurality of blockchain nodes; wherein the content of the first and second substances,
each blockchain node in the blockchain system respectively acquires a contract deployment transaction containing byte codes and deploys a corresponding intelligent contract based on the contract deployment transaction, wherein the contract deployment transaction is generated in response to a contract deployment request of a user;
performing JIT compiling on the byte code by any block chain link point in the block chain system to obtain a machine code of the intelligent contract, and providing the machine code to all block chain nodes in a block chain network;
all blockchain nodes in the blockchain system upgrade contract codes corresponding to the intelligent contracts from the bytecode to the machine codes based on contract upgrade transactions including the machine codes, the contract upgrade transactions being generated in response to contract upgrade requests of the users.
CN202110510888.3A 2021-05-11 2021-05-11 Intelligent contract upgrading method and block chain system Active CN113220327B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110510888.3A CN113220327B (en) 2021-05-11 2021-05-11 Intelligent contract upgrading method and block chain system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110510888.3A CN113220327B (en) 2021-05-11 2021-05-11 Intelligent contract upgrading method and block chain system

Publications (2)

Publication Number Publication Date
CN113220327A CN113220327A (en) 2021-08-06
CN113220327B true CN113220327B (en) 2022-09-16

Family

ID=77094780

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110510888.3A Active CN113220327B (en) 2021-05-11 2021-05-11 Intelligent contract upgrading method and block chain system

Country Status (1)

Country Link
CN (1) CN113220327B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113220326B (en) * 2021-05-11 2022-09-16 支付宝(杭州)信息技术有限公司 Intelligent contract upgrading method and block chain system

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413304A (en) * 2019-07-31 2019-11-05 中国工商银行股份有限公司 The hot upgrade method of intelligent contract and device based on block chain network
CN111538521A (en) * 2020-04-24 2020-08-14 中国工商银行股份有限公司 Intelligent contract deployment and transaction method and device
CN111770113A (en) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 Method for executing intelligent contract, block chain node and node equipment
CN111770204A (en) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 Method for executing intelligent contract, block chain node and storage medium
CN111770116A (en) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 Method for executing intelligent contract, block chain node and storage medium
CN111768184A (en) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 Method for executing intelligent contract and block link point
CN111770206A (en) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 Method for deploying intelligent contract, block chain node and storage medium
CN111814202A (en) * 2020-08-31 2020-10-23 支付宝(杭州)信息技术有限公司 Method for executing intelligent contract, block chain node and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10684873B2 (en) * 2018-06-12 2020-06-16 Oracle International Corporation Efficient data decoding using runtime specialization
CN111770205B (en) * 2020-08-31 2020-12-04 支付宝(杭州)信息技术有限公司 Method, block chain node, system and storage medium for executing intelligent contract

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110413304A (en) * 2019-07-31 2019-11-05 中国工商银行股份有限公司 The hot upgrade method of intelligent contract and device based on block chain network
CN111538521A (en) * 2020-04-24 2020-08-14 中国工商银行股份有限公司 Intelligent contract deployment and transaction method and device
CN111770113A (en) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 Method for executing intelligent contract, block chain node and node equipment
CN111770204A (en) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 Method for executing intelligent contract, block chain node and storage medium
CN111770116A (en) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 Method for executing intelligent contract, block chain node and storage medium
CN111768184A (en) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 Method for executing intelligent contract and block link point
CN111770206A (en) * 2020-08-31 2020-10-13 支付宝(杭州)信息技术有限公司 Method for deploying intelligent contract, block chain node and storage medium
CN111814202A (en) * 2020-08-31 2020-10-23 支付宝(杭州)信息技术有限公司 Method for executing intelligent contract, block chain node and storage medium

Also Published As

Publication number Publication date
CN113220327A (en) 2021-08-06

Similar Documents

Publication Publication Date Title
CN111770113B (en) Method for executing intelligent contract, block chain node and node equipment
CN111770206B (en) Method for deploying intelligent contract, block chain node and storage medium
CN111814202B (en) Method for executing intelligent contract, block chain node and storage medium
US5675804A (en) System and method for enabling a compiled computer program to invoke an interpretive computer program
CN111770116B (en) Method for executing intelligent contract, block chain node and storage medium
CN111770205B (en) Method, block chain node, system and storage medium for executing intelligent contract
CN111815310B (en) Method for executing intelligent contract, block chain node and storage medium
CN111768187A (en) Method for deploying intelligent contract, block chain node and storage medium
CN111770204B (en) Method for executing intelligent contract, block chain node and storage medium
CN111768184A (en) Method for executing intelligent contract and block link point
CN113220326B (en) Intelligent contract upgrading method and block chain system
CN111815330A (en) Method for deploying intelligent contract, block chain node and storage medium
CN113220327B (en) Intelligent contract upgrading method and block chain system
CN111768200A (en) Method for deploying intelligent contract, block chain node and storage medium
CN111770202B (en) Method for executing intelligent contract, block chain node and storage medium
EP3961438B1 (en) Method for executing smart contract, blockchain node, and storage medium
CN111768183B (en) Method for executing intelligent contract, block chain node and storage medium
CN116931947A (en) Method for optimizing wasm byte code, execution method, computer equipment and storage 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
GR01 Patent grant
GR01 Patent grant