CN112612482A - Method, device, equipment and storage medium for executing intelligent contract - Google Patents

Method, device, equipment and storage medium for executing intelligent contract Download PDF

Info

Publication number
CN112612482A
CN112612482A CN202011585209.0A CN202011585209A CN112612482A CN 112612482 A CN112612482 A CN 112612482A CN 202011585209 A CN202011585209 A CN 202011585209A CN 112612482 A CN112612482 A CN 112612482A
Authority
CN
China
Prior art keywords
intelligent contract
machine code
executing
codes
machine
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011585209.0A
Other languages
Chinese (zh)
Inventor
邱炜伟
李伟
黄方蕾
张珂杰
何奇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Hangzhou Qulian Technology Co Ltd
Original Assignee
Hangzhou Qulian Technology 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 Hangzhou Qulian Technology Co Ltd filed Critical Hangzhou Qulian Technology Co Ltd
Priority to CN202011585209.0A priority Critical patent/CN112612482A/en
Publication of CN112612482A publication Critical patent/CN112612482A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • 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
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code
    • G06F8/37Compiler construction; Parser generation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/425Lexical analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/447Target code generation
    • 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/445Program loading or initiating
    • G06F9/44568Immediately runnable code
    • G06F9/44578Preparing or optimising for loading

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application relates to a method, a device, equipment and a storage medium for executing an intelligent contract, wherein the method comprises the following steps: receiving a creating request for creating an intelligent contract, wherein the creating request comprises byte codes of the intelligent contract; deploying the intelligent contract according to the creation request, compiling the byte codes into machine codes through a Golgi assembler, and storing the machine codes; and executing the machine code corresponding to the intelligent contract when the intelligent contract is executed. The method and the device are used for improving the execution rate of executing the intelligent contract.

Description

Method, device, equipment and storage medium for executing intelligent contract
Technical Field
The present application relates to the field of block chain technologies, and in particular, to a method, an apparatus, a device, and a storage medium for executing an intelligent contract.
Background
The current block chain technology is gradually known by people and applied to various fields and links of social production, and an intelligent contract is taken as a key technology in the technical field of the block chain and occupies a considerable proportion in the whole block chain technology and category.
In the prior art, an intelligent contract is executed by compiling a program code into a machine code before the program runs and accelerating the execution of the intelligent contract by using an action of executing the machine code (AOT). It can be seen that AOT is just a conventional direction for converting bytecode into machine code to speed up execution of intelligent contracts, and no specific implementation is made.
Disclosure of Invention
The application provides a method, a device, equipment and a storage medium for executing an intelligent contract, which are used for improving the execution rate of executing the intelligent contract.
In a first aspect, the present application provides a method for executing an intelligent contract, which is applied to a blockchain node, and the method includes:
receiving a creating request for creating an intelligent contract, wherein the creating request comprises byte codes of the intelligent contract;
deploying the intelligent contract according to the creation request, compiling the byte codes into machine codes through a Golgi assembler, and storing the machine codes;
and executing the machine code corresponding to the intelligent contract when the intelligent contract is executed.
Optionally, before compiling the bytecode into a machine code by a Golong assembler, the method further includes:
converting the bytecode into an intermediate language between the bytecode and the machine code, wherein the intermediate language is an equivalent code of the bytecode, which can be translated into the machine code.
Optionally, converting the bytecode into an intermediate language between the bytecode and the machine code, including:
and converting the byte codes into an abstract syntax tree AST by adopting syntactic analysis and lexical analysis, and converting the AST into the intermediate language.
Optionally, compiling the bytecode into a machine code by a Golong assembler, including:
compiling, by the Golong assembler, the intermediate language into the machine code.
Optionally, storing the machine code comprises:
storing the machine code in a cache, and/or storing the machine code on a disk.
Optionally, when the intelligent contract is executed, executing the machine code corresponding to the intelligent contract includes:
when the intelligent contract is executed, judging whether a machine code corresponding to the intelligent contract exists in the cache and/or the disk;
if so, extracting the machine code corresponding to the intelligent contract from the cache and/or the disk, and executing the machine code corresponding to the intelligent contract;
otherwise, the step of compiling the byte codes into machine codes through a Golging assembler and storing the machine codes is executed.
Optionally, after the bytecode is compiled into a machine code by a Golong assembler, the method further includes:
and writing the byte code into an account book.
In a second aspect, the present application provides an apparatus for executing an intelligent contract, comprising:
the system comprises a receiving module, a creating module and a sending module, wherein the receiving module is used for receiving a creating request for creating an intelligent contract, and the creating request comprises byte codes of the intelligent contract;
the deployment module is used for deploying the intelligent contract according to the creation request, compiling the byte codes into machine codes through a Golgi assembler and storing the machine codes;
and the execution module is used for executing the machine code corresponding to the intelligent contract when the intelligent contract is executed.
In a third aspect, the present application provides an electronic device, comprising: the system comprises a processor, a communication component, a memory and a communication bus, wherein the processor, the communication component and the memory are communicated with each other through the communication bus; the memory for storing a computer program; the processor is configured to execute the program stored in the memory to implement the method for executing the intelligent contract according to the first aspect.
In a fourth aspect, the present application provides a computer-readable storage medium storing a computer program implementing the method for executing an intelligent contract according to the first aspect.
Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: the method provided by the embodiment of the application is applied to a block chain node, and comprises the steps of receiving a creation request for creating an intelligent contract, wherein the creation request comprises a byte code of the intelligent contract; according to the method, the intelligent contract is deployed according to the creation request, the byte codes are compiled into the machine codes through the Golgi assembler, and the machine codes are stored; when the intelligent contract is executed, the machine codes of the intelligent contract are executed, when the intelligent contract is deployed, the byte codes are compiled into the machine codes, and when the intelligent contract is executed, the machine codes corresponding to the intelligent contract are directly executed, so that the compiling performance consumption and the memory consumption during the operation of the intelligent contract can be saved, and the efficiency of executing the intelligent contract is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention.
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.
FIG. 1 is a schematic diagram of a system for executing intelligent contracts according to an embodiment of the present application;
FIG. 2 is a block chain structure in the present application;
FIG. 3 is a block chain network functional structure diagram according to an embodiment of the present application;
FIG. 4 is a flow chart illustrating a method for executing an intelligent contract according to an embodiment of the present application;
FIG. 5 is a schematic diagram illustrating a deployment flow of an intelligent contract in an embodiment of the present application;
FIG. 6 is a schematic diagram illustrating an execution flow of an intelligent contract according to an embodiment of the present application;
FIG. 7 is a schematic structural diagram of an apparatus for executing an intelligent contract according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device in an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
In the following description, reference is made to "one embodiment" which describes a subset of all possible embodiments, but it is understood that "one embodiment" describes the same subset or a different subset of all possible embodiments, and may be combined with each other without conflict.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this invention belongs. The terminology used herein is for the purpose of describing embodiments of the invention only and is not intended to be limiting of the invention.
Before further detailed description of the embodiments of the present invention, terms and expressions referred to in the embodiments of the present invention are described, and the terms and expressions referred to in the embodiments of the present invention are applicable to the following explanations.
(1) Transactions (transactions), equivalent to the computer term "Transaction," include operations that need to be committed to a blockchain network for execution and do not refer solely to transactions in the context of commerce, which embodiments of the present invention follow in view of the convention in blockchain technology that colloquially uses the term "Transaction.
For example, a deployment (deployment) transaction is used to install a specified smart contract to a node in a blockchain network and is ready to be invoked; the Invoke (Invoke) transaction is used to append records of the transaction in the blockchain by invoking the smart contract and to perform operations on the state database of the blockchain, including update operations (including adding, deleting, and modifying key-value pairs in the state database) and query operations (i.e., querying key-value pairs in the state database).
(2) A Block chain (Blockchain) is a storage structure for encrypted, chained transactions formed from blocks (blocks).
(3) A Blockchain Network (Blockchain Network) incorporates new blocks into a set of nodes of a Blockchain in a consensus manner.
(4) Ledger (legger) is a general term for blockchains (also called Ledger data) and state databases synchronized with blockchains. Wherein, the blockchain records the transaction in the form of a file in a file system; the state database records the transaction in the blockchain in the form of different types of Key (Key) Value pairs for supporting quick query of the transaction in the blockchain.
(5) Intelligent Contracts (Smart Contracts), also called chain codes (chainodes) or application codes, are programs deployed in nodes of a blockchain network (or called blockchain nodes), and the nodes execute the intelligent Contracts called in received transactions to update or query key-value data of a state database.
(6) Consensus (Consensus), a process in a blockchain network, is used to agree on transactions in a block among a plurality of nodes involved, the agreed block is to be appended to the end of the blockchain, and the mechanisms for achieving Consensus include Proof of workload (PoW, Proof of Work), Proof of rights and interests (PoS, Proof of equity (DPoS), Proof of right of stock (DPoS), Proof of Elapsed Time (PoET, Proof of Elapsed Time), and so on.
An exemplary application of the block chain network provided by the embodiment of the present invention is described below, as shown in fig. 1, fig. 1 is a schematic diagram of a system for executing an intelligent contract provided by the embodiment of the present invention, and includes a block chain network 101, a consensus node 102, an authentication center 103, a service agent 104, a client node 104-1, a service agent 105, and a client node 105-1, which are described below respectively:
the type of blockchain network 101 is flexible and may be any of a public chain, a private chain, or a federation chain, for example. Taking a public link as an example, electronic devices such as a user terminal and a server of any service agent can access the blockchain network 101 without authorization; taking a federation chain as an example, an electronic device (e.g., a terminal/server) under the jurisdiction of a service entity after obtaining authorization may access the blockchain network 101, and at this time, become a client node in the blockchain network 101.
In some embodiments, the client node 104 may act as a mere watcher of the blockchain network 101, i.e., provides functionality to support a business entity to initiate a transaction (e.g., for uplink storage of data or querying of data on a chain), and may be implemented by default or selectively (e.g., depending on the specific business requirements of the business entity) for the functions of the consensus node 102 of the blockchain network 101, such as a ranking function, a consensus service, and an accounting function, etc. Therefore, the data and the service processing logic of the service subject can be migrated to the blockchain network 101 to the maximum extent, and the credibility and traceability of the data and service processing process are realized through the blockchain network 101.
Consensus nodes in blockchain network 101 receive transactions submitted from different business entities, such as client node 104-1 of business entity 104 shown in fig. 1, perform the transactions to update the ledger or query the ledger, and various intermediate or final results of performing the transactions may be returned for display in client node 104-1 of business entity 104.
For example, client node 104-1 may subscribe to events of interest in blockchain network 101, such as transactions occurring in a particular organization/channel in blockchain network 101, and corresponding transaction notifications are pushed by consensus node 102 to client node 104-1, thereby triggering corresponding business logic in client node 104-1.
As an example of a block chain, as shown in fig. 2, fig. 2 is a schematic structural diagram of a block chain in a block chain network 101 according to an embodiment of the present invention, where a header of each block may include hash values of all transactions in the block and also include hash values of all transactions in a previous block, a record of a newly generated transaction is filled in the block and is added to a tail of the block chain after being identified by nodes in the block chain network, so as to form a chain growth, and a chain structure based on hash values between blocks ensures tamper resistance and forgery prevention of transactions in the block.
An exemplary functional architecture of a blockchain network provided by the embodiment of the present invention is described below, as shown in fig. 3, fig. 3 is a schematic functional architecture diagram of a blockchain network 101 provided by the embodiment of the present invention, and includes an application layer 301, a consensus layer 302, a network layer 303, a data layer 304, and a resource layer 305, which are described below:
the application layer 301 encapsulates various services that the blockchain network can implement, including tracing, crediting, and verifying transactions.
The consensus layer 302 encapsulates the functions of the mechanism by which the nodes 102 in the blockchain network 101 agree on a block (i.e., a consensus mechanism), transaction management, and ledger management. The consensus mechanism comprises consensus algorithms such as POS, POW and DPOS, and the pluggable consensus algorithm is supported. The transaction management is used for verifying the digital signature carried in the transaction received by the node 101, verifying the identity information of the service body 104, and determining whether the service body has the authority to perform the transaction (reading the relevant information from the service body identity management) according to the identity information; for the service agents authorized to access the blockchain network 101, the service agents all have digital certificates issued by the certificate authority, and the service agents sign the submitted transactions by using private keys in the digital certificates of the service agents, so that the legal identities of the service agents are declared. The ledger administration is used to maintain blockchains and state databases. For the block with the consensus, adding the block to the tail of the block chain; executing the transaction in the acquired consensus block, updating the key-value pairs in the state database when the transaction comprises an update operation, querying the key-value pairs in the state database when the transaction comprises a query operation and returning a query result to the client node of the business entity. Supporting query operations for multiple dimensions of a state database, comprising: querying the chunk based on the chunk sequence number (e.g., hash value of the transaction); inquiring the block according to the block hash value; inquiring a block according to the transaction serial number; inquiring the transaction according to the transaction serial number; inquiring account data of a business main body according to an account (serial number) of the business main body; and inquiring the block chain in the channel according to the channel name.
The network layer 303 encapsulates the functions of a point-to-point (P2P, point) network protocol, a data propagation mechanism and a data verification mechanism, an access authentication mechanism, and service agent identity management.
The P2P network protocol implements communication between nodes 102 in the blockchain network 101, the data propagation mechanism ensures propagation of transactions in the blockchain network 101, and the data verification mechanism implements reliability of data transmission between the nodes 102 based on cryptography methods (e.g., digital certificates, digital signatures, public/private key pairs); the access authentication mechanism is used for authenticating the identity of a service subject added to the block chain network 101 according to an actual service scene, and endowing the service subject with the authority of accessing the block chain network 101 when the authentication is passed; the business entity 104 identity management is used to store the identity of the business entity 104 that is allowed to access the blockchain network 101, as well as the permissions (e.g., the types of transactions that can be initiated).
Data layer 304 encapsulates various data structures that implement ledgers, including blockchains implemented in files in a file system, key-value type state databases, and presence certificates (e.g., hash trees for transactions in blocks).
The resource layer 305 encapsulates the computing, storage, and communication resources that implement each node 102 in the blockchain network 101.
Based on the above architecture, the embodiments of the present invention provide the following implementation manners.
The embodiment of the application provides a method for executing an intelligent contract, which is applied to a block chain node, and the specific implementation of the method is as shown in fig. 4:
specifically, it should be noted that the examples in the present application are only for examples and are not intended to limit the scope of protection, and are not individually described in the examples.
Step 401, receiving a creation request for creating an intelligent contract, where the creation request includes a bytecode of the intelligent contract.
Specifically, the user may locally write an intelligent contract to be deployed in a high-level programming language, compile the written intelligent contract into a bytecode, and send the compiled bytecode to the blockchain network 101.
Of course, the user may also directly write the intelligent contract in the high-level programming language on the node of the block chain, and the node of the block chain invokes a pre-stored compiler, and the intelligent contract is compiled into the byte code by using the compiler.
And step 402, deploying an intelligent contract according to the creation request, compiling the byte codes into machine codes through a Golgi assembler, and storing the machine codes.
In particular, Golong is a programming language that is strongly static, compiled, concurrent, and has garbage collection functionality.
The Golong assembler supports cross-platform compilation, allowing source code to be compiled into a binary file that can be executed on a target system, architecture.
In one embodiment, the bytecode is converted into an intermediate language between the bytecode and the machine code before the bytecode is compiled into the machine code by a Golong assembler, wherein the intermediate language is an equivalent code of the bytecode that can be translated into the machine code.
Specifically, the intermediate language is an intermediate language which can be identified by a Golgi assembler, the Golgi assembler is adopted, and the byte codes are converted into the intermediate language corresponding to the Golgi assembler.
In a specific embodiment, the bytecode is converted into an Abstract Syntax Tree (AST) by using syntax analysis and lexical analysis, the AST is converted into an intermediate language, and then a series of optimization processes are performed on the intermediate language converted from the AST, for example, common expression deletion, dead code deletion, constant combination and the like, so as to obtain a final intermediate language.
Specifically, lexical analysis is performed first and syntactic analysis is performed.
Parsing simply translates the source code into tokens (tokens), and the token type classification of Golong includes: the method comprises the steps of splitting a source code according to a set rule by using variable names, word sizes, operational characters, separators and keywords to achieve the purpose of word segmentation.
And after lexical analysis, obtaining a token sequence, and obtaining the AST through the token sequence.
In one embodiment, the final intermediate language is compiled into machine code by a Golong assembler.
Specifically, the final intermediate language is intermediate code (IR) with Static Single Assignment (SSA) property. The Golging assembler calls corresponding functions according to a preset architecture to convert the intermediate codes into machine codes.
Specifically, Golong assembler can be embedded into the block chain nodes in advance, and directly called to convert the intermediate code into the machine code.
In one embodiment, the bytecode is compiled by the Golging assembler into machine code, which is stored in a cache and/or on disk for later recall.
In one embodiment, the bytecode is written into the ledger after being compiled into machine code by a Golong assembler.
The following describes the deployment process of the intelligent contract specifically with reference to fig. 5:
step 501, a creation request for creating an intelligent contract is received to deploy the intelligent contract.
Step 502, converting the byte code into a corresponding intermediate code of the Golong assembler.
Step 503, converting the intermediate code into a machine code by using a Golong assembler.
At step 504, the machine code is stored in a cache, and/or on disk.
And step 403, executing the machine code corresponding to the intelligent contract when the intelligent contract is executed.
In a specific embodiment, when the intelligent contract is executed, whether a machine code corresponding to the intelligent contract exists in a cache and/or a disk is judged; if so, extracting the machine code corresponding to the intelligent contract from the cache and/or the disk, and executing the machine code corresponding to the intelligent contract; otherwise, the steps of compiling the byte code into machine code by a Golong assembler and storing the machine code are performed.
Specifically, if the machine code corresponding to the intelligent contract does not exist in the cache and/or the disk, the byte code is compiled into the machine code through the Golong assembler, the machine code is stored in the cache and/or the disk, and then the stored machine code corresponding to the intelligent contract is executed.
Specifically, whether a machine code corresponding to the intelligent contract exists in a cache and/or a disk is judged; if yes, extracting the machine code corresponding to the intelligent contract from the cache and/or the disk, and executing the machine code corresponding to the intelligent contract, wherein the method specifically comprises the following steps:
and judging whether the cache has a machine code corresponding to the intelligent contract.
And if so, extracting the machine code corresponding to the intelligent contract from the cache, and executing the machine code corresponding to the intelligent contract.
Otherwise, judging whether the machine code corresponding to the intelligent contract exists in the disk, if so, extracting the machine code corresponding to the intelligent contract from the disk, and executing the machine code corresponding to the intelligent contract, otherwise, compiling the byte code into the machine code through a Golgi assembler, storing the machine code in a cache and/or the disk, and then executing the stored machine code corresponding to the intelligent contract.
The following describes the execution flow of the smart contract specifically with reference to fig. 6:
step 601, receiving an execution request for executing the intelligent contract to execute the intelligent contract.
Step 602, extracting the machine code corresponding to the intelligent contract from the cache or the disk.
And 603, executing the machine code corresponding to the intelligent contract to obtain an execution result.
The method provided by the embodiment of the application is applied to a block chain node, and comprises the steps of receiving a creation request for creating an intelligent contract, wherein the creation request comprises a byte code of the intelligent contract; according to the method, the intelligent contract is deployed according to the creation request, the byte codes are compiled into the machine codes through the Golgi assembler, and the machine codes are stored; when the intelligent contract is executed, the machine codes of the intelligent contract are executed, when the intelligent contract is deployed, the byte codes are compiled into the machine codes, and when the intelligent contract is executed, the machine codes corresponding to the intelligent contract are directly executed, so that the compiling performance consumption and the memory consumption during the operation of the intelligent contract can be saved, and the efficiency of executing the intelligent contract is improved.
The embodiment of the present application further provides a device for executing an intelligent contract, and specific implementation of the device may refer to the description of the method embodiment, and repeated details are not described again, as shown in fig. 7, the device mainly includes:
a receiving module 701, configured to receive a creation request for creating an intelligent contract, where the creation request includes a bytecode of the intelligent contract.
And the deployment module 702 is used for deploying the intelligent contract according to the creation request, compiling the byte codes into machine codes through a Golgi assembler, and storing the machine codes.
The executing module 703 is configured to execute a machine code corresponding to the intelligent contract when the intelligent contract is executed.
Based on the same concept, an embodiment of the present application further provides an electronic device, as shown in fig. 8, the electronic device mainly includes: a processor 801, a communication component 802, a memory 803, and a communication bus 804, wherein the processor 801, the communication component 802, and the memory 803 communicate with each other via the communication bus 804. Wherein, the memory 803 stores the program which can be executed by the processor 801, the processor 801 executes the program stored in the memory 803, and the following steps are realized: receiving a creating request for creating an intelligent contract, wherein the creating request comprises byte codes of the intelligent contract; deploying an intelligent contract according to the creation request, compiling the byte codes into machine codes through a Golgi assembler, and storing the machine codes; and executing the machine code corresponding to the intelligent contract when the intelligent contract is executed.
The communication bus 804 mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 804 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 8, but this is not intended to represent only one bus or type of bus.
The communication component 802 is used for communication between the electronic device and other devices described above.
The Memory 803 may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor 801.
The Processor 801 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc., and may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components.
In a further embodiment of the present application, a computer-readable storage medium is also provided, in which a computer program is stored, which, when running on a computer, causes the computer to execute the method of intelligent contracts described in the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wirelessly (e.g., infrared, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more of the available media. The available media may be magnetic media (e.g., floppy disks, hard disks, tapes, etc.), optical media (e.g., DVDs), or semiconductor media (e.g., solid state drives), among others.
It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A method of executing intelligent contracts, applied to blockchain nodes, the method comprising:
receiving a creating request for creating an intelligent contract, wherein the creating request comprises byte codes of the intelligent contract;
deploying the intelligent contract according to the creation request, compiling the byte codes into machine codes through a Golgi assembler, and storing the machine codes;
and executing the machine code corresponding to the intelligent contract when the intelligent contract is executed.
2. The method of executing intelligent contracts according to claim 1, wherein prior to compiling the bytecode into machine code by a Golong assembler, further comprising:
converting the bytecode into an intermediate language between the bytecode and the machine code, wherein the intermediate language is an equivalent code of the bytecode, which can be translated into the machine code.
3. The method of executing an intelligent contract according to claim 2, wherein translating the bytecode into an intermediate language between the bytecode and the machine code comprises:
and converting the byte codes into an abstract syntax tree AST by adopting syntactic analysis and lexical analysis, and converting the AST into the intermediate language.
4. A method of executing intelligent contracts according to claim 3, characterized in that compiling said bytecodes into machine code by a Golong assembler comprises:
compiling, by the Golong assembler, the intermediate language into the machine code.
5. The method of executing smart contracts according to any one of claims 1-4, wherein storing the machine code comprises:
storing the machine code in a cache, and/or storing the machine code on a disk.
6. The method for executing an intelligent contract according to claim 5, wherein executing the machine code corresponding to the intelligent contract comprises:
when the intelligent contract is executed, judging whether a machine code corresponding to the intelligent contract exists in the cache and/or the disk;
if so, extracting the machine code corresponding to the intelligent contract from the cache and/or the disk, and executing the machine code corresponding to the intelligent contract;
otherwise, the step of compiling the byte codes into machine codes through a Golging assembler and storing the machine codes is executed.
7. The method of intelligent contract execution according to claim 1, wherein after compiling the bytecode into machine code by a Golong assembler, further comprising:
and writing the byte code into an account book.
8. An apparatus for executing an intelligent contract, comprising:
the system comprises a receiving module, a creating module and a sending module, wherein the receiving module is used for receiving a creating request for creating an intelligent contract, and the creating request comprises byte codes of the intelligent contract;
the deployment module is used for deploying the intelligent contract according to the creation request, compiling the byte codes into machine codes through a Golgi assembler and storing the machine codes;
and the execution module is used for executing the machine code corresponding to the intelligent contract when the intelligent contract is executed.
9. An electronic device, comprising: the system comprises a processor, a communication component, a memory and a communication bus, wherein the processor, the communication component and the memory are communicated with each other through the communication bus;
the memory for storing a computer program;
the processor, configured to execute the program stored in the memory, to implement the method of executing a smart contract of any of claims 1-7.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method of carrying out an intelligent contract of any one of claims 1 to 7.
CN202011585209.0A 2020-12-28 2020-12-28 Method, device, equipment and storage medium for executing intelligent contract Pending CN112612482A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011585209.0A CN112612482A (en) 2020-12-28 2020-12-28 Method, device, equipment and storage medium for executing intelligent contract

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011585209.0A CN112612482A (en) 2020-12-28 2020-12-28 Method, device, equipment and storage medium for executing intelligent contract

Publications (1)

Publication Number Publication Date
CN112612482A true CN112612482A (en) 2021-04-06

Family

ID=75248528

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011585209.0A Pending CN112612482A (en) 2020-12-28 2020-12-28 Method, device, equipment and storage medium for executing intelligent contract

Country Status (1)

Country Link
CN (1) CN112612482A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113805889A (en) * 2021-08-27 2021-12-17 成都质数斯达克科技有限公司 Intelligent contract calling execution method, device, equipment and readable storage medium
CN114004611A (en) * 2021-10-29 2022-02-01 郑州师范学院 Stream type payment acceleration method, system and storage medium based on FPGA

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108536445A (en) * 2018-03-28 2018-09-14 成都链安科技有限公司 Increasingly automated Formal Verification system and method towards block chain intelligence contract
CN109299587A (en) * 2018-09-11 2019-02-01 平安科技(深圳)有限公司 Algorithm protection method, device, equipment and storage medium based on go language
CN109523383A (en) * 2018-10-30 2019-03-26 广州斯拜若科技有限公司 A kind of intelligence contract converting system and method
CN110096338A (en) * 2019-05-10 2019-08-06 百度在线网络技术(北京)有限公司 Intelligent contract executes method, apparatus, equipment and medium
CN110390213A (en) * 2019-07-31 2019-10-29 中国工商银行股份有限公司 The security deployment method and system of intelligent contract under block chain network environment
US20200142693A1 (en) * 2018-11-07 2020-05-07 International Business Machines Corporation Transparent code processing
CN111381938A (en) * 2020-05-29 2020-07-07 支付宝(杭州)信息技术有限公司 Method and system for executing intelligent contracts in block chain based on basic instruction set
WO2020188494A1 (en) * 2019-03-18 2020-09-24 Reliance Jio Infocomm Limited Systems and methods for virtual distributed ledger networks
CN112070608A (en) * 2020-08-20 2020-12-11 财付通支付科技有限公司 Information processing method, information processing apparatus, information processing medium, and electronic device
CN112104709A (en) * 2020-08-28 2020-12-18 腾讯科技(深圳)有限公司 Intelligent contract processing method, device, medium and electronic equipment

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108536445A (en) * 2018-03-28 2018-09-14 成都链安科技有限公司 Increasingly automated Formal Verification system and method towards block chain intelligence contract
CN109299587A (en) * 2018-09-11 2019-02-01 平安科技(深圳)有限公司 Algorithm protection method, device, equipment and storage medium based on go language
CN109523383A (en) * 2018-10-30 2019-03-26 广州斯拜若科技有限公司 A kind of intelligence contract converting system and method
US20200142693A1 (en) * 2018-11-07 2020-05-07 International Business Machines Corporation Transparent code processing
WO2020188494A1 (en) * 2019-03-18 2020-09-24 Reliance Jio Infocomm Limited Systems and methods for virtual distributed ledger networks
CN110096338A (en) * 2019-05-10 2019-08-06 百度在线网络技术(北京)有限公司 Intelligent contract executes method, apparatus, equipment and medium
CN110390213A (en) * 2019-07-31 2019-10-29 中国工商银行股份有限公司 The security deployment method and system of intelligent contract under block chain network environment
CN111381938A (en) * 2020-05-29 2020-07-07 支付宝(杭州)信息技术有限公司 Method and system for executing intelligent contracts in block chain based on basic instruction set
CN112070608A (en) * 2020-08-20 2020-12-11 财付通支付科技有限公司 Information processing method, information processing apparatus, information processing medium, and electronic device
CN112104709A (en) * 2020-08-28 2020-12-18 腾讯科技(深圳)有限公司 Intelligent contract processing method, device, medium and electronic equipment

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113805889A (en) * 2021-08-27 2021-12-17 成都质数斯达克科技有限公司 Intelligent contract calling execution method, device, equipment and readable storage medium
CN114004611A (en) * 2021-10-29 2022-02-01 郑州师范学院 Stream type payment acceleration method, system and storage medium based on FPGA

Similar Documents

Publication Publication Date Title
US11611560B2 (en) Systems, methods, and apparatuses for implementing consensus on read via a consensus on write smart contract trigger for a distributed ledger technology (DLT) platform
CN109766722B (en) Method for constructing intelligent contract in block chain
CN107368259B (en) Method and device for writing service data into block chain system
CN109299131B (en) Spark query method and system supporting trusted computing
US8239954B2 (en) Access control based on program properties
JP2021525931A (en) Efficient verification for blockchain
KR20200010287A (en) Replicable Smart Contracts with Termination Conditions
US9152796B2 (en) Dynamic analysis interpreter modification for application dataflow
CN108694189B (en) Management of commonly owned database systems
CN110727712A (en) Data processing method and device based on block chain network, electronic equipment and storage medium
US11018853B2 (en) Workflow management via distributed ledgers and smart contracts
WO2022095518A1 (en) Automatic interface test method and apparatus, and computer device and storage medium
CN112612482A (en) Method, device, equipment and storage medium for executing intelligent contract
CN110544042A (en) Book management method and device based on block chain network
CN112818014A (en) Block chain data analysis method and device and electronic equipment
CN115114372A (en) Data processing method, device and equipment based on block chain and readable storage medium
CN112639745A (en) Scalable pre-analysis of dynamic applications
CN112363997B (en) Data version management method, device and storage medium
CN106020923B (en) SELinux strategy compiling method and system
CN111339193A (en) Category coding method and device
CN111273920A (en) Method and device for writing data into installation package and storage medium
CN116644122A (en) Data transaction processing method, device, computer equipment and storage medium
CN115378605A (en) Data processing method and device based on block chain
CN115328509A (en) Algorithm changing method, device, computer equipment and storage medium
CN112925589B (en) Calling method and device of expansion interface

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