CN112685136A - Intelligent contract operation method, device, equipment and storage medium - Google Patents

Intelligent contract operation method, device, equipment and storage medium Download PDF

Info

Publication number
CN112685136A
CN112685136A CN202110018109.8A CN202110018109A CN112685136A CN 112685136 A CN112685136 A CN 112685136A CN 202110018109 A CN202110018109 A CN 202110018109A CN 112685136 A CN112685136 A CN 112685136A
Authority
CN
China
Prior art keywords
virtual machine
contract
target
intelligent contract
running
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
CN202110018109.8A
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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202110018109.8A priority Critical patent/CN112685136A/en
Publication of CN112685136A publication Critical patent/CN112685136A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application discloses an intelligent contract operation method, an intelligent contract operation device, equipment and a storage medium, and relates to the technical field of block chains, wherein the method comprises the following steps: receiving a running request of a target intelligent contract, wherein the running request comprises a target contract type of the target intelligent contract; determining a primary virtual machine in an idle state from a pre-constructed virtual machine pool; selecting a target virtual machine corresponding to the target contract type from the primary virtual machines; setting the state of a target virtual machine as a working state; and running the target intelligent contract by using the target virtual machine in the working state. By utilizing the technical scheme provided by the embodiment of the application, the virtual machine can be effectively reused, and the overall operation efficiency and the system performance of the block chain platform are improved.

Description

Intelligent contract operation method, device, equipment and storage medium
Technical Field
The present application relates to the field of block chain technologies, and in particular, to an intelligent contract running method, apparatus, device, and storage medium.
Background
With the development of blockchain technology, business models based on blockchain networks are becoming more common, and an intelligent contract deployed on a blockchain is a computer protocol intended to propagate, verify or execute contracts in an informational manner; in the related art, when an intelligent contract runs, a temporary virtual machine is usually created for executing an intelligent contract code, and after the intelligent contract runs, the virtual machine is not used until the intelligent contract is recovered and destroyed by a system. However, in the related art, when an intelligent contract is run, creating a virtual machine has a large time overhead, CPU resources are also consumed, and repeatedly creating and destroying a virtual machine increases a system garbage collection burden, which seriously affects system performance in the running process of the intelligent contract. Therefore, there is a need to provide a more reliable or efficient solution.
Disclosure of Invention
The application provides an intelligent contract operation method, an intelligent contract operation device, an intelligent contract operation equipment and a storage medium, which can realize effective multiplexing of a virtual machine for operating an intelligent contract, and further improve the overall operation efficiency and system performance of a block chain platform.
In one aspect, the present application provides an intelligent contract running method, including:
receiving a running request of a target intelligent contract, wherein the running request comprises a target contract type of the target intelligent contract;
determining a primary virtual machine in an idle state from a pre-constructed virtual machine pool;
selecting a target virtual machine corresponding to the target contract type from the primarily selected virtual machines;
setting the state of the target virtual machine as a working state;
and running the target intelligent contract by utilizing the target virtual machine in the working state.
Another aspect provides an intelligent contract running apparatus, including:
a run request receiving module configured to execute receiving a run request of a target intelligent contract, the run request including a target contract type of the target intelligent contract;
the initial selection virtual machine determining module is configured to execute the initial selection virtual machine which is determined to be in an idle state from a pre-constructed virtual machine pool;
a target virtual machine determination module configured to execute selection of a target virtual machine corresponding to the target contract type from the primary virtual machines;
a first state setting module configured to perform setting of a state of the target virtual machine to an operating state;
an intelligent contract running module configured to execute running the target intelligent contract with the target virtual machine in a working state.
Another aspect provides an intelligent contract running apparatus, including a processor and a memory, where the memory stores at least one instruction or at least one program, and the at least one instruction or the at least one program is loaded and executed by the processor to implement the intelligent contract running method as described above.
Another aspect provides a computer-readable storage medium, in which at least one instruction or at least one program is stored, and the at least one instruction or the at least one program is loaded and executed by a processor to implement the intelligent contract execution method as described above.
The intelligent contract operation method, the intelligent contract operation device, the intelligent contract operation equipment and the intelligent contract operation storage medium have the following technical effects:
according to the method and the device, the virtual machine pool is constructed in advance, when the operation request of the target intelligent contract is received, the target virtual machine in the idle state corresponding to the target contract type of the target intelligent contract can be directly selected to operate the target intelligent contract, effective multiplexing of the virtual machine can be realized, the system overhead during operation of the follow-up intelligent contract is greatly saved, the operation efficiency of the intelligent contract is improved, and the throughput of the whole block chain network is further improved.
Drawings
In order to more clearly illustrate the technical solutions and advantages of the embodiments of the present application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative efforts.
FIG. 1 is a schematic diagram of an application environment provided by an embodiment of the present application;
FIG. 2 is a schematic flow chart diagram illustrating a method for operating an intelligent contract according to an embodiment of the present disclosure;
fig. 3 is a schematic flowchart of a process for pre-building a virtual machine pool according to an embodiment of the present application;
fig. 4 is a schematic flowchart of determining initialization capacity according to an embodiment of the present application;
fig. 5 is a schematic flowchart of creating, in the empty virtual machine pool, virtual machines in the initialized capacity and idle states to obtain the virtual machine pool according to the embodiment of the present application;
fig. 6 is a schematic flowchart of a virtual machine pool updating method according to an embodiment of the present application;
FIG. 7 is a schematic flow chart diagram illustrating another method for operating an intelligent contract according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an intelligent contract running apparatus provided in an embodiment of the present application;
fig. 9 is a schematic structural diagram of another intelligent contract running device provided in an embodiment of the present application;
fig. 10 is a hardware block diagram of a server implementing an intelligent contract running method according to an embodiment of the present application.
Detailed Description
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 only a part of the embodiments of the present application, and not all of the 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.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or server that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The blockchain is a novel application mode of computer technologies such as distributed data storage, point-to-point transmission, a consensus mechanism and an encryption algorithm. A block chain (Blockchain), which is essentially a decentralized database, is a series of data blocks associated by using a cryptographic method, and each data block contains information of a batch of network transactions, so as to verify the validity (anti-counterfeiting) of the information and generate a next block. The blockchain may include a blockchain underlying platform, a platform product services layer, and an application services layer.
The block chain underlying platform can comprise processing modules such as user management, basic service, intelligent contract and operation monitoring. The user management module is responsible for identity information management of all blockchain participants, and comprises public and private key generation maintenance (account management), key management, user real identity and blockchain address corresponding relation maintenance (authority management) and the like, and under the authorization condition, the user management module supervises and audits the transaction condition of certain real identities and provides rule configuration (wind control audit) of risk control; the basic service module is deployed on all block chain node equipment and used for verifying the validity of the service request, recording the service request to storage after consensus on the valid request is completed, for a new service request, the basic service firstly performs interface adaptation analysis and authentication processing (interface adaptation), then encrypts service information (consensus management) through a consensus algorithm, transmits the service information to a shared account (network communication) completely and consistently after encryption, and performs recording and storage; the intelligent contract module is responsible for registering and issuing contracts, triggering the contracts and executing the contracts, developers can define contract logics through a certain programming language, issue the contract logics to a block chain (contract registration), call keys or other event triggering and executing according to the logics of contract clauses, complete the contract logics and simultaneously provide the function of upgrading and canceling the contracts; the operation monitoring module is mainly responsible for deployment, configuration modification, contract setting, cloud adaptation in the product release process and visual output of real-time states in product operation, such as: alarm, monitoring network conditions, monitoring node equipment health status, and the like.
The platform product service layer provides basic capability and an implementation framework of typical application, and developers can complete block chain implementation of business logic based on the basic capability and the characteristics of the superposed business. The application service layer provides the application service based on the block chain scheme for the business participants to use.
Referring to fig. 1, fig. 1 is a schematic diagram of an application environment according to an embodiment of the present disclosure, and as shown in fig. 1, the application environment may include a plurality of blockchain nodes 101.
In this embodiment, each blockchain node 101 may be deployed with a virtual machine pool, and in an alternative embodiment, the blockchain node may include a client device of a smart phone, a desktop computer, a tablet computer, a notebook computer, a smart speaker, a digital assistant, an Augmented Reality (AR)/Virtual Reality (VR) device, a smart wearable device, or the like. In an optional embodiment, the block link node may include an independent physical server, or may be a server cluster or a distributed system formed by a plurality of physical servers, or may be a cloud server providing basic cloud computing services such as a cloud service, a cloud database, cloud computing, a cloud function, a cloud storage, a network service, cloud communication, a middleware service, a domain name service, a security service, a CDN (Content delivery network), a big data and artificial intelligence platform, and the like.
An intelligent contract running method is described below, and fig. 2 is a flow chart of an intelligent contract running method provided in an embodiment of the present application, and the present specification provides the method operation steps as described in the embodiment or the flow chart, but more or less operation steps can be included based on conventional or non-creative labor. The order of steps recited in the embodiments is merely one manner of performing the steps in a multitude of orders and does not represent the only order of execution. In practice, the system or server product may be implemented in a sequential or parallel manner (e.g., parallel processor or multi-threaded environment) according to the embodiments or methods shown in the figures. Specifically, as shown in fig. 2, the method may include:
s201: and receiving a running request of the target intelligent contract.
In this embodiment, the target intelligent contract may be an intelligent contract that needs to be currently operated among the intelligent contracts deployed on the block link points. The run request may include a target contract type for the target intelligent contract; the target contract type may be a contract type of the target intelligent contract.
In practice, smart contracts are a computerized agreement that is a term that can execute a contract, by deploying code on a shared ledger for execution when certain conditions are met. In practical application, different users often use different programming languages to write intelligent contracts according to respective requirements, and correspondingly, the intelligent contracts deployed on the block link points can correspond to a plurality of different contract types.
In a particular embodiment, the contract types of the smart contracts may include, but are not limited to, a Solidity contract, a go (programming language) contract, a js (programming language) contract, a wasm (programming language) contract, and the like. Specifically, the intelligent contract with the contract type being a solid contract may be an intelligent contract written in a solid programming language. An intelligent contract with a contract type of go may be an intelligent contract written in a go programming language. An intelligent contract with a contract type of js contract may be an intelligent contract written in the js programming language. An intelligent contract with a contract type of wasm contract may be an intelligent contract written in a wasm programming language.
S203: and determining the primary virtual machine in an idle state from a pre-constructed virtual machine pool.
In this embodiment of the present specification, a virtual machine pool may be constructed in advance. In a specific embodiment, the method may further include: the step of pre-building a virtual machine pool, as shown in fig. 3, the pre-building a virtual machine pool may include:
s301: generating an empty virtual machine pool with preset capacity;
s303: determining an initialization capacity;
s305: and creating the virtual machines with the initialized capacity in the idle state in the empty virtual machine pool to obtain the virtual machine pool.
In this embodiment of the present specification, the preset capacity may represent an upper limit of the number of virtual machines accommodated in the empty virtual machine pool. Specifically, the empty virtual machine pool may be a data structure capable of accommodating a preset capacity of virtual machines, and in an alternative embodiment, the data structure may include, but is not limited to, a data structure in the form of an array or a map (key-value pair).
In this embodiment of the present specification, the number of virtual machines (i.e., initialization capacity) to be built may be preset in combination with actual application requirements. Accordingly, the pool of virtual machines may be a data structure that includes virtual machines that initialize a capacity number of idle states. The initialization capacity is less than or equal to a preset capacity.
In this embodiment of this specification, in order to facilitate multiplexing of subsequent virtual machines, two states may be maintained for a virtual machine: an idle state and an active state. Specifically, the virtual machine in the working state may be a virtual machine running an intelligent contract. The virtual machine in the idle state may be a virtual machine that is not currently running the intelligent contract and may be invoked to run the intelligent contract.
In a specific embodiment, as shown in fig. 4, the determining the initialization capacity may include:
s3031: determining a contract type of a deployed intelligent contract;
s3033: when the contract types comprise at least two contract types, determining an intelligent contract quantity of each contract type;
s3035: setting the number of virtual machines corresponding to each contract type according to the intelligent contract number of each contract type;
s3037: and taking the sum of the number of the virtual machines corresponding to the at least two contract types as the initialization capacity.
In this embodiment of the present specification, in order to effectively meet different requirements of different users, a corresponding virtual machine may be created in combination with a contract type of an intelligent contract deployed on a blockchain node. In this embodiment of the present specification, in consideration of that when intelligent contracts of at least two contract types are deployed on a block link point, the subsequent requirements on virtual machines are different due to different numbers of intelligent contracts of different contract types, and correspondingly, in this embodiment of the present specification, the number of virtual machines corresponding to each contract type may be set in combination with the number of intelligent contracts of each contract type. Specifically, the number of smart contracts and the number of corresponding virtual machines may be in direct proportion. In an optional embodiment, the number of intelligent contracts may be used as the corresponding number of virtual machines, and in addition, a ratio between the number of intelligent contracts and the corresponding number of virtual machines may also be preset, for example, 2:1, which may be specifically set in combination with an actual application requirement.
In a specific embodiment, as shown in fig. 5, the creating, in the empty virtual machine pool, the virtual machines in the initialized capacity and idle states, and obtaining the virtual machine pool may include:
s3051: creating virtual machines of the corresponding type corresponding to the number of the corresponding virtual machines for the intelligent contract of each contract type;
s3053: setting the state of the created virtual machine to be an idle state, and obtaining the virtual machines with the initialized capacity in the idle state;
s3055: and adding the virtual machines with the initialized capacity in the idle state into the empty virtual machine pool to obtain the virtual machine pool.
In this embodiment of the present specification, the virtual machine of the type corresponding to each intelligent contract may be a virtual machine capable of running a programming language corresponding to the contract type, and in a specific embodiment, for example, the wasm contract corresponds to a wasm virtual machine; the js contract corresponds to a js virtual machine.
In the above embodiment, by constructing the virtual machine pool in advance, the system overhead in the running of the subsequent intelligent contract can be greatly saved, so that the running efficiency of the intelligent contract is improved, the contract types of the intelligent contract deployed by the block chain node and the intelligent contract quantity corresponding to each contract type are combined to determine the corresponding type and the corresponding quantity of the created virtual machine, different requirements of different users can be met, and the flexibility of the block chain node in responding to various service requirements is greatly improved.
In an alternative embodiment, as shown in fig. 6, the method further includes:
s307: determining an updated contract type of an updated intelligent contract in response to the intelligent contract updating instruction;
s309: when the virtual machine pool does not have the idle virtual machine matched with the update contract type, determining the number of the virtual machines corresponding to the update contract type according to the preset capacity and the initialization capacity;
s311: creating a virtual machine number corresponding to the update contract type;
s313: setting the states of the virtual machines with the number corresponding to the update contract type as idle states;
s315: and updating the virtual machine pool based on the virtual machines with the number corresponding to the update contract type in the idle state.
In practical application, when a new intelligent contract is deployed on a blockchain node, whether a virtual machine needs to be newly built can be judged by combining with an update contract type of the updated intelligent contract (i.e. a contract type of the newly deployed intelligent contract). In a specific embodiment, in order to facilitate the subsequent fast running of the newly deployed intelligent contract, when an idle virtual machine matching the update contract type does not exist in the virtual machine pool, the number of virtual machines corresponding to the update contract type is determined according to the preset capacity and the initialization capacity. Specifically, it may be determined whether the virtual machine pool may further accommodate more virtual machines by combining the preset capacity and the initialization capacity, and when the preset capacity is greater than the initialization capacity, a capacity difference between the preset capacity and the initialization capacity may be determined; in an alternative embodiment, the capacity difference may be used as the number of virtual machines corresponding to the update contract type; optionally, a numerical value smaller than the capacity difference may be selected as the number of virtual machines corresponding to the update contract type.
In an alternative embodiment, when there are virtual machines in the pool of virtual machines in an idle state that match the update contract type, no new virtual machine may be created.
In the embodiment of the specification, the virtual machines of the corresponding types are created when the intelligent contracts are deployed, so that the system overhead during the running of the subsequent intelligent contracts can be greatly saved, and the running efficiency of the intelligent contracts is further improved.
S205: and selecting a target virtual machine corresponding to the target contract type from the initially selected virtual machines.
In this embodiment of the present specification, a target virtual machine corresponding to the target contract type may be selected from the initially selected virtual machines.
In addition, it should be noted that, when there is no virtual machine in the idle state corresponding to the target contract type in the pre-constructed virtual machine pool, a virtual machine corresponding to the target contract type may be newly created, so as to run the intelligent contract based on the newly created virtual machine.
S207: and setting the state of the target virtual machine as a working state.
In this embodiment, in order to avoid an abnormal situation caused by that the same virtual machine is used to process different intelligent contracts at the same time, the state of the target virtual machine may be set to be a working state.
S209: and running the target intelligent contract by utilizing the target virtual machine in the working state.
In a specific embodiment, the operation request further includes contract interface information and contract identification information; the running the target intelligent contract by using the target virtual machine in the working state comprises:
and controlling the target virtual machine in the working state to load a contract code corresponding to the contract identification information so as to enable the target virtual machine to execute the contract code according to the contract interface information.
In a specific embodiment, as shown in fig. 7, the method further includes:
s211: when the target virtual machine runs the target intelligent contract, setting the state of the target virtual machine to be an idle state;
s213: and carrying out initialization setting on the target virtual machine.
In this embodiment, initializing the target virtual machine may include clearing contract codes in the target virtual machine to avoid a data pollution problem caused when the target virtual machine is subsequently used to run other intelligent contracts.
As can be seen from the technical solutions provided by the embodiments of the present specification, the present specification can directly select the target virtual machine in the idle state corresponding to the target contract type of the target intelligent contract to run the target intelligent contract by constructing the virtual machine pool in advance when receiving the running request of the target intelligent contract, so as to implement effective multiplexing of the virtual machine, greatly save the system overhead during running of the subsequent intelligent contract, improve the running efficiency of the intelligent contract, and further improve the throughput of the whole block chain network.
An embodiment of the present application further provides an intelligent contract running apparatus, as shown in fig. 8, the apparatus includes:
a run request receiving module 810 that may be configured to perform receiving a run request for a target intelligent contract, the run request including a target contract type for the target intelligent contract;
a primary virtual machine determination module 820, which may be configured to perform determining a primary virtual machine in an idle state from a pool of pre-built virtual machines;
a target virtual machine determination module 830 configured to perform selecting a target virtual machine corresponding to the target contract type from the initially selected virtual machines;
a first state setting module 840, which may be configured to perform setting a state of the target virtual machine to a working state;
an intelligent contract running module 850 may be configured to execute running the target intelligent contract with the target virtual machine in a working state.
In an optional embodiment, the apparatus further comprises:
the virtual machine pool generating module is configured to execute generation of an empty virtual machine pool with a preset capacity, and the preset capacity represents an upper limit of the number of virtual machines accommodated in the empty virtual machine pool;
an initialization capacity determination module configured to perform determining an initialization capacity, the initialization capacity being less than or equal to the preset capacity;
and the virtual machine pool creating module is configured to execute the virtual machines in the empty virtual machine pool, create the initialized capacity of the virtual machines in the idle state, and obtain the virtual machine pool.
In an optional embodiment, the initialization capacity determination module comprises:
a contract type determination unit configured to execute a contract type of the intelligent contract determined to be deployed;
an intelligent contract quantity determination unit configured to perform, when the contract types include at least two contract types, determining an intelligent contract quantity for each contract type;
the virtual machine number setting unit is configured to execute setting of the virtual machine number corresponding to each contract type according to the intelligent contract number of each contract type;
an initialization capacity determination unit configured to execute a sum of the number of virtual machines corresponding to the at least two contract types as the initialization capacity.
In an optional embodiment, the virtual machine pool creating module includes:
a virtual machine creating unit configured to execute creating a corresponding number of virtual machines of a corresponding type for the intelligent contract of each contract type;
the state setting unit is configured to set the created state of the virtual machine to an idle state, and obtain the virtual machines in the idle states with the initialization capacity;
and the virtual machine adding unit is configured to add the virtual machines in the initial capacity idle states in the empty virtual machine pool to obtain the virtual machine pool.
In an optional embodiment, the apparatus further comprises:
the update contract type determining module is configured to execute determining an update contract type of an updated intelligent contract in response to the intelligent contract update instruction;
the virtual machine number determining module is configured to determine the number of virtual machines corresponding to the update contract type according to the preset capacity and the initialization capacity when the virtual machine in the idle state matched with the update contract type does not exist in the virtual machine pool;
a virtual machine creation module configured to perform creation of virtual machines of a number corresponding to the update contract type;
the second state setting module is configured to set the states of the virtual machines with the number corresponding to the update contract type into idle states;
and the virtual machine pool updating module is configured to execute the virtual machines with the number corresponding to the update contract type in the idle state, and update the virtual machine pool.
In an alternative embodiment, as shown in fig. 9, the apparatus further comprises:
a third state setting module 860 configured to perform setting the state of the target virtual machine to an idle state when the target virtual machine runs the target smart contract;
an initialization setting module 870 configured to perform initialization setting of the target virtual machine.
In an optional embodiment, the operation request further includes contract interface information and contract identification information; the intelligent contract running module 850 is specifically configured to execute the contract code corresponding to the contract identification information, which controls the target virtual machine in the working state to load, so that the target virtual machine executes the contract code according to the contract interface information.
The device and method embodiments in the device embodiment are based on the same application concept.
The embodiment of the application provides an intelligent contract running server, which comprises a processor and a memory, wherein at least one instruction or at least one program is stored in the memory, and the at least one instruction or the at least one program is loaded and executed by the processor to realize the intelligent contract running method provided by the above method embodiment.
The memory may be used to store software programs and modules, and the processor may execute various functional applications and data processing by operating the software programs and modules stored in the memory. The memory can mainly comprise a program storage area and a data storage area, wherein the program storage area can store an operating system, application programs needed by functions and the like; the storage data area may store data created according to use of the apparatus, and the like. Further, the memory may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory may also include a memory controller to provide the processor access to the memory.
The method provided by the embodiment of the application can be executed in a mobile terminal, a computer terminal, a server or a similar operation device.Taking an example of the operation on a server, fig. 10 is a hardware structure block diagram of a server implementing the intelligent contract operation method according to the embodiment of the present application. As shown in fig. 10, the server 1000 may have a relatively large difference due to different configurations or performances, and may include one or more Central Processing Units (CPUs) 1010 (the processor 1010 may include but is not limited to a Processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 1030 for storing data, and one or more storage media 1020 (e.g., one or more mass storage devices) for storing applications 1023 or data 1022. Memory 1030 and storage media 1020 may be, among other things, transient or persistent storage. The program stored in the storage medium 1020 may include one or more modules, each of which may include a series of instruction operations for a server. Still further, the central processor 1010 may be configured to communicate with the storage medium 1020 and execute a series of instruction operations in the storage medium 1020 on the server 1000. The Server 1000 may also include one or more power supplies 1060, one or more wired or wireless network interfaces 1050, one or more input-output interfaces 1040, and/or one or more operating systems 1021, such as a Windows ServerTM,Mac OS XTM,UnixTM,LinuxTM,FreeBSDTMAnd so on.
Input-output interface 1040 may be used to receive or transmit data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the server 1000. In one example, i/o Interface 1040 includes a Network adapter (NIC) that may be coupled to other Network devices via a base station to communicate with the internet. In one example, the input/output interface 1040 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
It will be understood by those skilled in the art that the structure shown in fig. 10 is merely illustrative and is not intended to limit the structure of the electronic device. For example, server 1000 may also include more or fewer components than shown in FIG. 10, or have a different configuration than shown in FIG. 10.
Embodiments of the present application also provide a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the various alternative implementations described above.
Embodiments of the present application further provide a storage medium that can be disposed in a device to store at least one instruction related to implementing an intelligent contract running method in the method embodiments, or at least one program, where the at least one instruction or the at least one program is loaded and executed by the processor to implement the intelligent contract running method provided in the method embodiments.
Alternatively, in this embodiment, the storage medium may be located in at least one network server of a plurality of network servers of a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, which can store program codes.
According to the embodiment of the intelligent contract operation method, the intelligent contract operation device, the server or the storage medium, the virtual machine pool is constructed in advance, when the operation request of the target intelligent contract is received, the target virtual machine in the idle state corresponding to the target contract type of the target intelligent contract can be directly selected to operate the target intelligent contract, effective multiplexing of the virtual machine can be achieved, system overhead during operation of the follow-up intelligent contract is greatly saved, operation efficiency of the intelligent contract is improved, and throughput of the whole block chain network is further improved.
It should be noted that: the sequence of the embodiments of the present application is only for description, and does not represent the advantages and disadvantages of the embodiments. And specific embodiments thereof have been described above. Other embodiments are within the scope of the following claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve desirable results. In addition, the processes depicted in the accompanying figures do not necessarily require the particular order shown, or sequential order, to achieve desirable results. In some embodiments, multitasking and parallel processing may also be possible or may be advantageous.
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, as for the device, arrangement, storage medium and server embodiments, since they are substantially similar to the method embodiments, the description is relatively simple, and reference may be made to the partial description of the method embodiments for relevant points.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware to implement the above embodiments, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk, an optical disk, or the like.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the protection scope of the present application.

Claims (10)

1. An intelligent contract running method, characterized in that the method comprises:
receiving a running request of a target intelligent contract, wherein the running request comprises a target contract type of the target intelligent contract;
determining a primary virtual machine in an idle state from a pre-constructed virtual machine pool;
selecting a target virtual machine corresponding to the target contract type from the primarily selected virtual machines;
setting the state of the target virtual machine as a working state;
and running the target intelligent contract by utilizing the target virtual machine in the working state.
2. The method of claim 1, further comprising:
generating an empty virtual machine pool with a preset capacity, wherein the preset capacity represents the upper limit of the number of virtual machines accommodated in the empty virtual machine pool;
determining an initialization capacity, wherein the initialization capacity is less than or equal to the preset capacity;
and creating the virtual machines with the initialized capacity in the idle state in the empty virtual machine pool to obtain the virtual machine pool.
3. The method of claim 2, wherein the determining an initialization capacity comprises:
determining a contract type of a deployed intelligent contract;
when the contract types comprise at least two contract types, determining an intelligent contract quantity of each contract type;
setting the number of virtual machines corresponding to each contract type according to the intelligent contract number of each contract type;
and taking the sum of the number of the virtual machines corresponding to the at least two contract types as the initialization capacity.
4. The method of claim 3, wherein the creating, in the empty virtual machine pool, the initialized capacity of the virtual machines in the idle state, and wherein obtaining the virtual machine pool comprises:
creating virtual machines of the corresponding type corresponding to the number of the corresponding virtual machines for the intelligent contract of each contract type;
setting the state of the created virtual machine to be an idle state, and obtaining the virtual machines with the initialized capacity in the idle state;
and adding the virtual machines with the initialized capacity in the idle state into the empty virtual machine pool to obtain the virtual machine pool.
5. The method of claim 2, further comprising:
determining an updated contract type of an updated intelligent contract in response to the intelligent contract updating instruction;
when the virtual machine pool does not have the idle virtual machine matched with the update contract type, determining the number of the virtual machines corresponding to the update contract type according to the preset capacity and the initialization capacity;
creating a virtual machine number corresponding to the update contract type;
setting the states of the virtual machines with the number corresponding to the update contract type as idle states;
and updating the virtual machine pool based on the virtual machines with the number corresponding to the update contract type in the idle state.
6. The method of claim 1, further comprising:
when the target virtual machine runs the target intelligent contract, setting the state of the target virtual machine to be an idle state;
and carrying out initialization setting on the target virtual machine.
7. The method of any of claims 1 to 6, wherein the run request further comprises contract interface information and contract identification information; the running the target intelligent contract by using the target virtual machine in the working state comprises:
and controlling the target virtual machine in the working state to load a contract code corresponding to the contract identification information so as to enable the target virtual machine to execute the contract code according to the contract interface information.
8. An intelligent contract execution apparatus, comprising:
a run request receiving module configured to execute receiving a run request of a target intelligent contract, the run request including a target contract type of the target intelligent contract;
the initial selection virtual machine determining module is configured to execute the initial selection virtual machine which is determined to be in an idle state from a pre-constructed virtual machine pool;
a target virtual machine determination module configured to execute selection of a target virtual machine corresponding to the target contract type from the primary virtual machines;
a first state setting module configured to perform setting of a state of the target virtual machine to an operating state;
an intelligent contract running module configured to execute running the target intelligent contract with the target virtual machine in a working state.
9. An intelligent contract running apparatus, characterized in that the apparatus comprises a processor and a memory, wherein at least one instruction or at least one program is stored in the memory, and the at least one instruction or the at least one program is loaded and executed by the processor to realize the intelligent contract running method according to any one of claims 1 to 7.
10. A computer-readable storage medium, wherein at least one instruction or at least one program is stored in the storage medium, and the at least one instruction or the at least one program is loaded by a processor and executed to implement the intelligent contract execution method according to any one of claims 1 to 7.
CN202110018109.8A 2021-01-07 2021-01-07 Intelligent contract operation method, device, equipment and storage medium Pending CN112685136A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110018109.8A CN112685136A (en) 2021-01-07 2021-01-07 Intelligent contract operation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110018109.8A CN112685136A (en) 2021-01-07 2021-01-07 Intelligent contract operation method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112685136A true CN112685136A (en) 2021-04-20

Family

ID=75456239

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110018109.8A Pending CN112685136A (en) 2021-01-07 2021-01-07 Intelligent contract operation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112685136A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115174589A (en) * 2022-05-20 2022-10-11 网易(杭州)网络有限公司 Selection method and device of block chain virtual machine, electronic equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104202419A (en) * 2014-09-18 2014-12-10 温武少 Method for dynamic allocation of virtual machines for cloud computing system
CN106815060A (en) * 2017-01-19 2017-06-09 携程旅游网络技术(上海)有限公司 Virtual machine distribution method and system
CN109241359A (en) * 2018-08-18 2019-01-18 深圳市网心科技有限公司 Block chain node device, block catenary system, block data processing system and method
CN109460283A (en) * 2018-10-24 2019-03-12 南京米好信息安全有限公司 The distribution method of virtual machine under a kind of cloud computing environment
CN110297689A (en) * 2019-05-06 2019-10-01 百度在线网络技术(北京)有限公司 Intelligent contract executes method, apparatus, equipment and medium
CN111033468A (en) * 2019-03-26 2020-04-17 阿里巴巴集团控股有限公司 System and method for implementing different types of blockchain contracts
CN111736954A (en) * 2020-06-24 2020-10-02 陈鹏 Multi-intelligent contract virtual machine implementation method, multi-intelligent contract virtual machine and system

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104202419A (en) * 2014-09-18 2014-12-10 温武少 Method for dynamic allocation of virtual machines for cloud computing system
CN106815060A (en) * 2017-01-19 2017-06-09 携程旅游网络技术(上海)有限公司 Virtual machine distribution method and system
CN109241359A (en) * 2018-08-18 2019-01-18 深圳市网心科技有限公司 Block chain node device, block catenary system, block data processing system and method
CN109460283A (en) * 2018-10-24 2019-03-12 南京米好信息安全有限公司 The distribution method of virtual machine under a kind of cloud computing environment
CN111033468A (en) * 2019-03-26 2020-04-17 阿里巴巴集团控股有限公司 System and method for implementing different types of blockchain contracts
CN110297689A (en) * 2019-05-06 2019-10-01 百度在线网络技术(北京)有限公司 Intelligent contract executes method, apparatus, equipment and medium
CN111736954A (en) * 2020-06-24 2020-10-02 陈鹏 Multi-intelligent contract virtual machine implementation method, multi-intelligent contract virtual machine and system

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115174589A (en) * 2022-05-20 2022-10-11 网易(杭州)网络有限公司 Selection method and device of block chain virtual machine, electronic equipment and storage medium
CN115174589B (en) * 2022-05-20 2023-11-03 网易(杭州)网络有限公司 Selection method and device of blockchain virtual machine, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN108305072B (en) Method, apparatus, and computer storage medium for deploying a blockchain network
CN112527912B (en) Data processing method and device based on block chain network and computer equipment
CN110838065A (en) Transaction data processing method and device
CN110673938B (en) Task processing method, system, server and storage medium
CN111639309B (en) Data processing method and device, node equipment and storage medium
CN111736872A (en) Gray scale release upgrading method and device, computer system and readable storage medium
CN113110864B (en) Application program updating method and device and storage medium
CN109995523B (en) Activation code management method and device and activation code generation method and device
CN112288423A (en) Aggregation payment method and system of distributed framework
CN104410699A (en) Resource management method and system of open type cloud computing
CN112099917B (en) Regulation and control system containerized application operation management method, system, equipment and medium
CN110908812A (en) Business data processing method and device, readable storage medium and computer equipment
CN112256989A (en) Page loading method and device based on offline package, terminal equipment and storage medium
CN111651121A (en) Data logic calculation method and device, electronic equipment and storage medium
CN115129423A (en) Resource management method, device, equipment and storage medium
De et al. BCoT: introduction to blockchain-based internet of things for industry 5.0
CN112685136A (en) Intelligent contract operation method, device, equipment and storage medium
CN116737393B (en) Resource deployment method and device, storage medium and electronic equipment
CN113129002A (en) Data processing method and equipment
JP2010244358A (en) Rewriting system for thin client master, rewriting method for thin client master, and thin client
CN111951112A (en) Intelligent contract execution method based on block chain, terminal equipment and storage medium
CN110290206A (en) A kind of distributed computing system and method for cafe environment
CN112988852B (en) Block chain-based data management method, device and medium
Kaur et al. Docker and its features
CN115701078A (en) Cross-chain transaction processing method and device, electronic 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
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40042480

Country of ref document: HK