CN114327403A - Development method and device of intelligent contract and electronic equipment - Google Patents

Development method and device of intelligent contract and electronic equipment Download PDF

Info

Publication number
CN114327403A
CN114327403A CN202111604806.8A CN202111604806A CN114327403A CN 114327403 A CN114327403 A CN 114327403A CN 202111604806 A CN202111604806 A CN 202111604806A CN 114327403 A CN114327403 A CN 114327403A
Authority
CN
China
Prior art keywords
intelligent contract
virtual machine
machine system
temporary
development environment
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
CN202111604806.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.)
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 CN202111604806.8A priority Critical patent/CN114327403A/en
Publication of CN114327403A publication Critical patent/CN114327403A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Stored Programmes (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application is applicable to the technical field of computer application, and provides a development method and a device of an intelligent contract and electronic equipment, wherein the method comprises the following steps: the integrated development environment system sends a temporary intelligent contract to the virtual machine system, and the temporary intelligent contract is used for indicating the virtual machine system to deploy the temporary intelligent contract to obtain an executable file simulating the intelligent contract; the integrated development environment system sends a debugging instruction to the virtual machine system, wherein the debugging instruction is used for indicating the virtual machine system to run the executable file of the simulation intelligent contract and generate a running result; and the integrated development environment system acquires the operation result fed back by the virtual machine system, and debugs the temporary intelligent contract based on the operation result to obtain a complete intelligent contract. By the method and the device, the requirement of the precondition for developing the intelligent contract and the complexity of the debugging process can be reduced, and the developing efficiency of the intelligent contract can be improved.

Description

Development method and device of intelligent contract and electronic equipment
Technical Field
The application belongs to the technical field of computer application, and particularly relates to a development method and device of an intelligent contract and electronic equipment.
Background
With the application scenarios of the blockchain technology becoming rich and diversified, the development of intelligent contract program codes becomes one of the main types of application program development at present. A smart contract is a piece of program code that can run automatically, allowing developers to develop individually according to a particular protocol, business, or logic.
Smart contracts, like ordinary program code, are compiled and debugged before deployment. Because the intelligent contract needs to be deployed on the alliance chain, before the intelligent contract is developed, an alliance chain architecture needs to be designed, the intelligent contract is tested based on the alliance chain architecture, and then the intelligent contract which passes the test is deployed on the alliance chain; the requirements of the precondition for developing the intelligent contract are high, the debugging process is complex, and the development efficiency of the intelligent contract is low.
Disclosure of Invention
The embodiment of the application provides a development method and device of an intelligent contract and an electronic device, and can improve the development efficiency of the intelligent contract.
In a first aspect, the present application provides a method for developing an intelligent contract, which may include:
the method comprises the steps that an integrated development environment system sends a temporary intelligent contract to a virtual machine system, wherein the temporary intelligent contract is used for indicating the virtual machine system to deploy the temporary intelligent contract to obtain an executable file of a simulation intelligent contract corresponding to the temporary intelligent contract;
the integrated development environment system sends a debugging instruction to the virtual machine system, wherein the debugging instruction is used for indicating the virtual machine system to run the executable file of the simulated intelligent contract and generate a running result;
and the integrated development environment system acquires the operation result fed back by the virtual machine system, and debugs the temporary intelligent contract based on the operation result to obtain the complete intelligent contract.
In one possible implementation manner of the first aspect, after the integrated development environment system sends the temporary smart contract to the virtual machine system, the method further includes:
the integrated development environment system sends a compiling instruction to the virtual machine system, wherein the compiling instruction is used for instructing the virtual machine system to compile the simulated intelligent contract to obtain an executable file of the simulated intelligent contract;
and the integrated development environment system receives a successful compiling message fed back by the virtual machine system.
In a possible implementation manner of the first aspect, the debugging instruction includes a call command;
the integrated development environment system sends debugging instructions to the virtual machine system, and the debugging instructions comprise:
and the integrated development environment sends a calling command to the virtual machine system based on a preset data communication protocol, wherein the calling command is used for calling a simulation interface method of the simulation intelligent contract, and the simulation interface method is used for calling an original interface method of the temporary intelligent contract.
In a possible implementation manner of the first aspect, before the debugging the temporary smart contract based on the operation result, the method further includes:
receiving a breakpoint call instruction input by a user;
sending a single step debugging instruction to the virtual machine system according to the breakpoint calling instruction, and acquiring a single step operation result of the virtual machine system after the virtual machine system operates based on the single step debugging instruction;
correspondingly, the debugging the temporary intelligent contract based on the operation result comprises:
performing single step debugging on the temporary intelligent contract according to the single step operation result; wherein the run result comprises the single-step run result.
In a second aspect, the present application provides a method for developing an intelligent contract, which may include:
the virtual machine system receives a temporary intelligent contract sent by the integrated development environment system, and deploys the temporary intelligent contract to obtain an executable file simulating the intelligent contract;
the virtual machine system receives a debugging instruction sent by the integrated development environment system, and runs the executable file of the simulated intelligent contract according to the debugging instruction to generate a running result;
and the virtual machine system feeds back the running result to the integrated development environment system, wherein the running result is used for indicating the integrated development environment system to debug the temporary intelligent contract and obtain the complete intelligent contract.
In a possible implementation manner of the second aspect, the deploying the temporary intelligent contract to obtain an executable file simulating an intelligent contract includes:
the virtual machine system carries out simulation processing on the temporary intelligent contract to obtain a simulated intelligent contract;
and compiling the simulated intelligent contract by the virtual machine system based on the compiling instruction sent by the integrated development environment system to obtain an executable file of the simulated intelligent contract.
In one possible implementation of the second aspect, the debug instruction comprises a call command;
the step of operating the executable file of the simulation intelligent contract according to the debugging instruction to generate an operation result comprises the following steps:
the virtual machine system calls a simulation interface method of the simulation intelligent contract according to the call command in the debugging instruction, wherein the simulation interface method is used for calling an original interface method of the temporary intelligent contract;
executing code logic in the executable file based on the calling of the original interface method to generate the running result;
the calling command is sent by the integrated development environment system based on a preset data communication protocol, and the service of the data communication protocol interface is configured when the virtual machine deploys the temporary intelligent contract.
In a possible implementation manner of the second aspect, before the virtual machine system feeds back the running result to the integrated development environment system, the method further includes:
the virtual machine system receives a single-step debugging instruction sent by the integrated development environment system, wherein the single-step debugging instruction is generated by the integrated development environment system based on a breakpoint call instruction input by a user;
the virtual machine system executes the executable file in a single step according to the single step debugging instruction to obtain a single step operation result;
correspondingly, the virtual machine system feeds back the operation result to the integrated development environment system, and the operation result includes:
the virtual machine system feeds back the single step operation result to the integrated development environment system; the single-step operation result is used for instructing the integrated development environment system to carry out single-step debugging on the temporary intelligent contract; wherein the run result comprises the single-step run result.
In a third aspect, an embodiment of the present application provides an apparatus for developing an intelligent contract, where the apparatus may include:
the system comprises a sending unit, a receiving unit and a processing unit, wherein the sending unit is used for sending a temporary intelligent contract to a virtual machine system, and the temporary intelligent contract is used for indicating the virtual machine system to be deployed to obtain an executable file simulating an intelligent contract;
the calling unit is used for sending a debugging instruction to the virtual machine system, and the debugging instruction is used for indicating the virtual machine system to run the executable file of the simulated intelligent contract and generate a running result;
and the debugging unit is used for acquiring the operation result fed back by the virtual machine system and debugging the temporary intelligent contract based on the operation result to obtain the complete intelligent contract.
In a fourth aspect, an embodiment of the present application provides an apparatus for developing an intelligent contract, where the apparatus may include:
the system comprises a receiving unit, a generating unit and a processing unit, wherein the receiving unit is used for receiving a temporary intelligent contract sent by an integrated development environment system and deploying the temporary intelligent contract to obtain an executable file simulating the intelligent contract;
the execution unit is used for receiving a debugging instruction sent by the integrated development environment system, and operating the executable file of the simulated intelligent contract according to the debugging instruction to generate an operation result;
and the feedback unit is used for feeding back the operation result to the integrated development environment system, and the operation result is used for indicating the integrated development environment system to debug the temporary intelligent contract and obtain the complete intelligent contract.
In a fifth aspect, the present application provides an electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, the processor implementing the method of the first or second aspect when executing the computer program.
In a sixth aspect, an embodiment of the present application provides an intelligent contract development system, where the intelligent contract development system includes an integrated development environment system and a virtual machine system; the integrated development environment system is configured to perform the steps of the method according to any of the first aspect, and the virtual machine system is configured to perform the steps of the method according to any of the second aspect.
In a seventh aspect, this application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the method of the first aspect or the second aspect.
In an eighth aspect, embodiments of the present application provide a computer program product, which, when run on a terminal device, causes the terminal device to perform the method of the first aspect or the second aspect.
It is understood that the beneficial effects of the second to eighth aspects can be seen from the description of the first aspect, and are not described herein again.
Compared with the prior art, the application has the beneficial effects that: according to the method and the system, the integrated development environment system deploys the temporary intelligent contract into the virtual machine, the virtual machine system runs the executable file by calling the executable file simulating the intelligent contract after the virtual machine is deployed, and feeds back the running result, and the temporary intelligent contract can be directly debugged based on the running result; before developing the intelligent contract, the framework of a union chain is not required to be designed as a carrier for deploying the temporary intelligent contract, the debugging of the temporary intelligent contract can be completed through the butt joint of the integrated development environment system and the virtual machine system, the requirement of the precondition for developing the intelligent contract and the complexity of the debugging process can be reduced, and the development efficiency of the intelligent contract is improved; has strong usability and practicability.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the embodiments or the prior art descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without inventive exercise.
Fig. 1 is a schematic flowchart architecture diagram of a system application scenario provided in an embodiment of the present application;
FIG. 2 is a schematic overall flow chart of a method for developing an intelligent contract provided in an embodiment of the present application;
FIG. 3 is a flowchart illustrating a method for developing an intelligent contract according to an embodiment of the present disclosure;
FIG. 4 is a flowchart illustrating a method for developing an intelligent contract according to an embodiment of the present disclosure;
FIG. 5 is a schematic diagram of a virtual machine system deployment intelligence contract provided by an embodiment of the present application;
FIG. 6 is a schematic diagram of a virtual machine system compiling an intelligent contract according to an embodiment of the present application;
fig. 7 is a schematic diagram of an interface calling layer in a virtual machine system according to an embodiment of the present application;
FIG. 8 is a schematic diagram illustrating an overall interaction of non-single-stepping provided by an embodiment of the present application;
FIG. 9 is a schematic diagram illustrating single-step debugging in an interaction process according to an embodiment of the present application;
fig. 10 is a schematic structural diagram of a device for developing an intelligent contract provided in an embodiment of the present application;
fig. 11 is a schematic structural diagram of a device for developing an intelligent contract provided in an embodiment of the present application;
fig. 12 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
fig. 13 is a schematic structural diagram of an intelligent contract development system provided in an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
Before describing the embodiments of the present application, some related terms will first be briefly described:
1. federation chain: a block chain whose consensus process is controlled by a preselected node. Common federation chains include hyper account federation chains hyperchain, fabric, and BCOS (Be credit, Open & Secure, block chain underlying technology Open source platform).
2. A federation chain management platform (Blockchain as a Service platform): the method provides deployment and configuration of alliance link nodes under multiple organizations in a specific network environment, and realizes a platform for managing the nodes of all the organizations.
Fabric: is a super ledger framework contributed by IBM. It is an implementation of a block chain technique combined using existing mature techniques. Is a modular architecture that allows pluggable implementation of various functions. Has powerful container technology to carry intelligent contracts written in various mainstream languages.
4, Golang: is an open source programming language, and makes the software easy to construct, reliable and efficient.
5. Smart contracts (also known as chain codes): is a computer protocol intended to propagate, validate or execute contracts in an informational manner. Smart contracts allow trusted transactions to be conducted without third parties, which transactions are traceable and irreversible. The chaincode is a program written in Go language.
6. Integrated Development Environment (IDE): the application program is used for providing a program development environment and generally comprises tools such as a code editor, a compiler, a debugger and a graphical user interface. The integrated development software service set integrates a code compiling function, an analyzing function, a compiling function, a debugging function and the like.
7. Software Development Kit (SDK), Software Development Kit: is a collection of development tools used by software engineers to create application software for a particular software package, software framework, hardware platform, operating system, etc.
Mock smart contracts: the standard Fabric gold Smart contract enters into the gold code with Hypertext Transfer Protocol (HTTP) service generated after virtual machine simulation Mock.
Delve (dlv): is a debugger of the Go programming language.
The intelligent contract is an important component of the block chain, is a service bearer and is responsible for specific service logic. In blockchain Fabric, the smart contract is also called chain code (chainode), i.e., on-chain code; in the blockchain application, the access, modification and account book inquiry are all completed by calling deployed chain codes, the book is generally written by using a Golang language, and an intelligent contract is called by an SDK provided by a blockchain Fabric official, so that codes for specifying an interface are realized.
The smart contract written in the Golang language in blockchain Fabric can also be a Fabric golden smart contract. The Fabric gold smart contract, like other common program code, needs to be compiled and debugged before deployment. But in contrast to normal programs, smart contracts are not deployed directly on the computer operating system, but rather need to be deployed on a federation chain. That is, for the development of the intelligent contract, if the contract code needs to be debugged and called, a federation chain (Fabric) needs to be deployed first, and the intelligent contract is deployed on the federation chain.
On the one hand, in the stage of intelligent contracts being developed into code, the intelligent contract code is not complete, but needs to face the reverse order of creating a federation chain in advance and deploying the intelligent contracts. Therefore, a Fabric alliance chain needs to be built first to serve as the environment preposition, so that the requirement on the preposition condition is high, and the development efficiency of the intelligent contract is low.
The normal development logic should be to debug the code and then to compile and deploy on the real alliance chain. As shown in fig. 1 (a), a developer first writes code of an intelligent contract based on an Integrated Development Environment (IDE) system, then debugs the intelligent contract code in Development, and tests and calls the intelligent contract, and after passing, deploys the complete intelligent contract to a federation chain.
On the other hand, at present, the conventional Fabric golden smart contract development process: except that a set of Fabric alliance chain environment needs to be set up first, intelligent contract codes are deployed on an alliance chain, intelligent contracts are called through an official SDK, and whether the intelligent contracts meet expectations or not is evaluated logically on the basis of returned codes; and if the contract code does not conform to the contract code, continuously and repeatedly deploying and calling until the intelligent contract code is written. In addition, the intelligent contract codes passing the test are deployed on the alliance chain, and the temporary intelligent contracts deployed in the original test are sometimes required to be cleaned.
Based on the traditional development mode, each debugging needs to deploy the intelligent contract code in the current development to the Fabric alliance, then access the intelligent contract on the alliance chain through the SDK, and analyze whether the temporary intelligent contract in the current deployment meets the expectation through the returned data. If the code amount is large and the logic is complex, a large amount of time cost can be consumed by the test work; resulting in a slow development speed of the smart contract.
Also during the test, an official SDK test is required. For developers, not only the intelligent contract code is written, but also client test code is written by using an SDK provided by an official party, and the intelligent contract is tested through the test code. Increasing the complexity of smart contract development.
Also, for complex logic, the code may need to be refined step by step through single-step debugging. However, the traditional development mode based on deployment on the alliance chain cannot perform single-step debugging, and only can perform function debugging integrally. Increasing the complexity of the debugging process.
Based on the problems, the method for developing the intelligent contract is provided, and the functions of compiling, simulated deployment, simulated calling and simulated debugging of the Fabric golden intelligent contract are realized by combining the online IDE system with the virtual machine system supporting the golden language, so that the debugging requirement in the development process of the intelligent contract is met.
As shown in fig. 1 (b), a flowchart of a system application scenario provided in an embodiment of the present application is schematically illustrated. And sending the written intelligent contract to a virtual machine system in an Integrated Development Environment (IDE) system, and indicating the virtual machine system to deploy, wherein the intelligent contract is compiled in the deployment process of the virtual machine system to obtain an executable file (or a file of binary codes) of the intelligent contract. The virtual machine system is configured with core processes such as receiving an intelligent contract, compiling the intelligent contract and deploying the intelligent contract; the virtual machine system can also establish a simulation process for running the executable file of the compiled intelligent contract in the deployment process, a process for running the executable file when the IDE system debugs the interface of the intelligent contract, and the like.
It should be noted that, when the IDE system debugs the interface of the intelligent contract, a call instruction is sent to the virtual machine system, and interface data returned by the virtual machine system is received, and the IDE system debugs the intelligent contract based on whether the interface data is in line with expectations, so as to obtain a complete intelligent contract.
In conjunction with the system framework shown in fig. 1 (b), as shown in fig. 2, the embodiment of the present application provides an overall flow diagram of a method for developing an intelligent contract. The user writes the intelligent contract based on the IDE system, the IDE system receives an editing instruction input by the user and generates a program code of a temporary intelligent contract, and the temporary intelligent contract is the intelligent contract which is not debugged. And the IDE system sends the temporary intelligent contract to the virtual machine system and indicates the virtual machine system to deploy the temporary intelligent contract, and after the deployment is completed, the IDE system calls an interface of the temporary intelligent contract and acquires a running result (or fed-back interface data) of the temporary intelligent contract fed back by the virtual machine. And the IDE system identifies whether the operation result accords with a preset expected value, if not, receives the information input by the user for rewriting the intelligent contract to debug the intelligent contract, and finishes compiling the intelligent contract to obtain the complete intelligent contract when the operation result accords with the expected value, and the development process of the intelligent contract is finished.
According to the method and the system, functions of compiling, deploying, calling, debugging and the like of the intelligent contract are achieved through interaction of the IDE system and the virtual machine system, the framework of a alliance chain does not need to be designed in advance, multiple deployments on the alliance chain are not needed, the intelligent contract does not need to be debugged through an official SDK developed by a client side, the requirement of precondition for developing the intelligent contract is lowered, the developing speed of the intelligent contract is improved, and particularly the developing efficiency of the intelligent contract is greatly improved for the intelligent contract with large code quantity and complex logic.
It should be noted that the integrated development environment system may be an independent entity terminal, and executes the flow of the above corresponding method; the integrated development environment system can also be a software system for front-end visualization on the electronic device, and the electronic device is used as a physical carrier of the integrated development environment system to execute the flow of the corresponding method. The virtual machine system can be an independent entity terminal and executes the flow of the corresponding method; the virtual machine system can also be a back-end software system of the same electronic equipment as the IDE system, and executes the flow of the corresponding method based on the electronic equipment; the virtual machine system may also be a set of software systems on a different terminal device, such as a server. The electronic device serving as the integrated development environment system of the entity terminal or the physical carrier of the integrated development environment system, and the electronic device serving as the virtual machine system of the entity terminal or the physical carrier of the virtual machine system may be any computing device such as a desktop computer, a notebook computer, a palm computer, a cloud server, and the like, and are not limited specifically herein. In addition, the present application does not specifically limit the form in which the IDE system and the virtual machine system exist with each other.
Based on the above summary, the following describes the flow of the development method of the intelligent contract provided by the present application in detail.
As shown in fig. 3, a schematic flow chart of the intelligent contract development method provided in the embodiment of the present application is shown. It should be understood that the method execution subject can be the IDE system itself or an electronic device where the integrated development environment system is located as a software system, and for clarity of description, the IED system itself is taken as an example and described as the execution subject. The method may comprise the steps of:
s301, the integrated development environment system sends a temporary intelligent contract to the virtual machine system.
In some embodiments, the temporary intelligent contracts are contracts that are not developed in force, such as contracts that were written by developers without debugging or with partial debugging. And the integrated development environment system sends the temporary intelligent contract to the virtual machine system and instructs the virtual machine system to deploy the temporary intelligent contract.
Illustratively, the integrated development environment system is a software function at the front end of the electronic equipment, receives coding information input by a user through an interactive interface, and generates a code of a corresponding intelligent contract; meanwhile, a deployment control can be further arranged on the integrated development environment interface, after a code of the temporary intelligent contract is generated for the first time or the code is partially debugged, the integrated development environment system can receive a deployment instruction input by a user through clicking a deployment space, and the code of the temporary intelligent contract is sent to the virtual machine system.
The virtual machine system may be a back-end software system of the same electronic device as the integrated development environment system, and the front-end integrated development environment system sends the temporary intelligent contract to the back-end virtual machine system through an internal data transmission protocol. Or the virtual machine system can also be a separate server, and the integrated development environment system performs data transmission with the virtual machine system in the server in a wired or wireless manner and sends the code of the temporary intelligent contract to the virtual machine system.
Illustratively, the virtual machine system is a virtual alliance chain environment, and comprises a core process for receiving and deploying the intelligent contract, a process for running the intelligent contract and the like, wherein the process is created in a debugging process. The virtual machine system may start a deployment process based on the temporary intelligent contract sent by the integrated development environment system, and obtain an executable file of the simulated intelligent contract corresponding to the temporary intelligent contract after deployment is completed, where the executable file may be a file of a binary code.
The executable file simulating the intelligent contract is obtained by encapsulating and compiling the temporary intelligent contract by the virtual machine system.
In some embodiments, after the integrated development environment system sends the temporary smart contract to the virtual machine system, the method further comprises:
the integrated development environment system sends a compiling instruction to the virtual machine system, wherein the compiling instruction is used for instructing the virtual machine system to compile the simulated intelligent contract to obtain an executable file of the simulated intelligent contract; and the integrated development environment system receives a successful compiling message fed back by the virtual machine system.
For example, a compiling control may be set in an operation interface of the integrated development environment system, and the integrated development environment system sends the compiling instruction to the virtual machine system by receiving an instruction input by a user clicking the compiling control, and starts a compiling process in the virtual machine system.
It should be noted that, when the virtual machine system receives the temporary intelligent contract to be deployed, the virtual machine system also encapsulates the original code of the temporary intelligent contract during the deployment process to obtain a code format that can be run in the virtual machine, that is, a simulated intelligent contract; the integrated development environment system sends a compiling instruction to the virtual machine system, and the virtual machine system compiles the simulated intelligent contract according to the compiling instruction to obtain an executable file of the simulated intelligent contract; and returning the successfully compiled message to the integrated development environment system, and displaying the successfully compiled message by the integrated development environment system through a visual operation interface so as to send prompt information to developers.
S302, the integrated development environment system sends a debugging instruction to the virtual machine system.
In some embodiments, the smart contracts are also debugged before the developed smart contracts are deployed on the blockchain.
The debugging instruction is used for instructing the virtual machine system to run the executable file simulating the intelligent contract and generate a running result.
Illustratively, the integrated development environment system's manipulation interface of can be provided with the debugging control. And when the integrated development environment system receives an instruction input by a developer through clicking the debugging control, the integrated development environment system sends a debugging instruction to the virtual machine system. The debugging instruction is used for indicating the virtual machine system to establish and start a process for running the intelligent contract; thereby operating the executable file simulating the intelligent contract and generating an operation result.
In some embodiments, the debug instruction comprises a call command; the integrated development environment system sends debugging instructions to the virtual machine system, and the debugging instructions comprise:
and the integrated development environment sends a calling command to the virtual machine system based on a preset data communication protocol, wherein the calling command is used for calling a simulation interface method of the simulation intelligent contract, and the simulation interface method is used for calling an original interface method of the temporary intelligent contract.
In some embodiments, the integrated development environment system needs to call the original interface method of the temporary intelligent contract during the debugging process of the temporary intelligent contract, so as to run the actual logic of the temporary intelligent contract in the virtual machine system.
For example, the preset data communication Protocol may be a hypertext Transfer Protocol (HTTP). Based on the data communication protocol, the calling of the simulation intelligent contract in the virtual machine system by the integrated development environment system can be realized, and the debugging of the temporary intelligent contract can be realized without the need that a developer writes a client test code by using an SDK provided by an official party, so that the complexity of the development process of the intelligent contract is reduced; the debugging of the intelligent contract based on the SDK is not needed, and the development efficiency of the intelligent contract is improved.
It should be noted that the virtual machine system is further provided with an HTTP service, so that when the integrated development environment system calls the simulated intelligent contract of the virtual machine system, the simulated interface method for calling the simulated intelligent contract may be accessed through the HTTP interface of the simulated intelligent contract, and then the original interface method of the original temporary intelligent contract is called.
And S303, the integrated development environment system acquires the operation result fed back by the virtual machine system, and debugs the temporary intelligent contract based on the operation result to obtain the complete intelligent contract.
In some embodiments, the running result is a result of the integrated development environment system running the real logic of the temporary intelligent contract. For example, when debugging the interface of the intelligent contract, the IDE system calls the interface method of the temporary intelligent contract; the virtual machine system returns the data called by the corresponding interface method after running the logic of the temporary intelligent contract based on the calling of the IDE system; the data is the result of the run.
Illustratively, the IDE system debugs the code of the temporary intelligent contract based on the results of the run. After receiving the running result fed back by the virtual machine system, the IDE system can display the running result on the operation interface. In one case, the IDE system displays the operation result to a developer, the developer judges whether the operation result meets the expectation, and receives a confirmation instruction or a modification instruction input by the developer; in another case, the IED system may determine whether the operation result meets a preset expected value in the system, and after comparison, directly output a prompt message indicating that the operation result is correct or wrong, and the developer may input a confirmation instruction or a modification instruction based on the prompt message to complete the debugging of the temporary intelligent contract. Wherein, the complete intelligent contract is a contract which can be deployed on a alliance chain after being debugged and perfected.
In addition, the execution result may include an overall execution result of the smart contract, an execution result of invoking each interface method, or an execution result of invoking each step in each interface method.
In some embodiments, before the debugging the temporary smart contract based on the execution result, the method further comprises:
receiving a breakpoint call instruction input by a user; and sending a single step debugging instruction to the virtual machine system according to the breakpoint call instruction, and acquiring a single step operation result of the virtual machine system after the virtual machine system operates based on the single step debugging instruction.
Correspondingly, the debugging the temporary intelligent contract based on the operation result comprises:
and performing single-step debugging on the temporary intelligent contract according to the single-step operation result.
In some embodiments, the IDE system may set a breakpoint of the code of the temporary intelligent contract based on the operable interface receiving a breakpoint setting input by the user for the temporary intelligent contract; the IDE system receives a breakpoint call instruction input by a user (or a developer), and the breakpoint call instruction is used for generating a single-step debugging instruction when the IDE system debugs the temporary intelligent contract and sending the single-step debugging instruction to the virtual machine system. The single step debugging instruction is used for instructing the virtual machine system to gradually run the real logic of the temporary intelligent contract according to the set breakpoint and generate a single step running result.
For example, the IDE system may display the single-step operation result on the operation interface, so that the developer inputs the information of the single-step debugging to the temporary intelligent contract according to the single-step operation result, and the IDE system debugs the single-step code corresponding to the temporary intelligent contract according to the information.
It should be understood that the IDE system may call the entire real logic of the temporary intelligent contract in the virtual machine system and obtain the entire running result, may also perform single-step debugging on the temporary intelligent contract, call the real logic of the temporary intelligent contract in a single step and obtain the single-step running result, and may also call multiple steps in a section of logic method to obtain the multiple-step running result corresponding to the section of logic method. The running result can correspond to a breakpoint set by a user on the operation interface, and the specifically set step length is not specifically limited.
It should also be understood that, since the IDE system sets the breakpoint of the temporary intelligent contract, the virtual machine system runs to the breakpoint to stop running during running the original logic (real logic) of the temporary intelligent contract, and the IDE system sends a single-step debugging instruction to the virtual machine system based on the breakpoint call instruction input by the user, and single-steps the original logic (real logic) of the temporary intelligent contract in the virtual machine, and simultaneously the virtual machine runs the original logic (real logic) of the temporary intelligent contract in a single step.
For example, the IDE system may first invoke an overall temporary intelligent contract to obtain an overall operational result; if the running result is abnormal, calling single-step program logic in the temporary intelligent contract in a single step according to the set breakpoint to obtain a single-step running result or calling multi-step program logic in the temporary intelligent contract in multiple steps to obtain a multi-step running result; and debugging and perfecting the temporary intelligent contract based on the single-step operation result or the multi-step operation result.
Based on the process of performing single-step debugging on the temporary intelligent contract, especially for the intelligent contract code with complex logic, the code of the intelligent contract can be gradually perfected, and the accuracy and controllability of intelligent contract debugging are improved, so that the reliability and stability of the intelligent contract code can be ensured.
As shown in fig. 4, a schematic flow chart of the intelligent contract development method provided in the embodiment of the present application is shown. It should be understood that the method execution subject may be the virtual machine system itself or an electronic device where the virtual machine system is located as a software system, and for clarity of description, the virtual machine system itself is taken as an example and described as the execution subject. Based on the part having the same implementation principle as the method shown in fig. 3, detailed description of the specific process is omitted here. The method may comprise the steps of:
s401, the virtual machine system receives a temporary intelligent contract sent by the integrated development environment system, deploys the temporary intelligent contract and obtains an executable file simulating the intelligent contract.
In some embodiments, the virtual machine system has a virtual federation chain environment with core processes such as receiving code for the intelligent contracts, checking the format of the intelligent contracts, and compiling the intelligent contracts. And simultaneously, after the deployment of the intelligent contract is completed, a process for operating the intelligent contract code can be established according to a call command in the debugging function of the integrated development environment system.
In some embodiments, the deploying the temporary intelligent contract to obtain an executable file simulating an intelligent contract includes:
the virtual machine system carries out simulation processing on the temporary intelligent contract to obtain a simulated intelligent contract; and compiling the simulated intelligent contract by the virtual machine system based on the compiling instruction sent by the integrated development environment system to obtain an executable file of the simulated intelligent contract.
In some embodiments, a virtual machine system has a virtual federation chain environment and can receive intelligent contracts and package the intelligent contracts into simulated intelligent contracts that can be compiled and run by itself.
Illustratively, a virtual machine system changes the deployment of smart contract code written in the Golang language to a way that the virtual machine emulates the Mock deployment. The virtual machine system utilizes a simulation Mock processing method commonly used by alliance chain Fabric to simulate (encapsulate) an initialization interface method Init in an original code (or a real contract code) of a temporary intelligent contract of Golang language and an interface method Invock of transaction execution, and adds a simulated interface of the Mock Init method and an interface of the Mock Invock method on the basis of the original code of the temporary intelligent contract to obtain the simulated intelligent contract.
It should be understood that the process of performing simulation processing on the temporary intelligent contract is essentially a process of simulating a calling interactive object (such as the interface method) in the temporary intelligent contract; and judging whether the debugging process can pass through by simulating the called interactive object in the debugging process so as to verify whether the interaction between the simulated object and the debugging process can meet the expectation or reach the expected value.
In addition, in the process of simulating the temporary intelligent contract by the virtual machine system, the HTTP service is added in the code of the simulated intelligent contract, so that the IDE system can call the simulated interface method by calling the HTTP service interface, and the original interface method of the temporary intelligent contract can be indirectly called.
Specifically, the virtual machine system receives a compiling instruction sent by the IDE system, and compiles the intelligent simulation contract. The compilation process refers to converting the source code of the temporary smart contract into computer-executable bytecode (or binary code).
Illustratively, the virtual machine system only encapsulates the temporary intelligent contract by an interface method, the actual original logic of the temporary intelligent contract is not changed, the temporary intelligent contract code received by the virtual machine system is still written based on the gold language, the compiling process on the analog intelligent contract is substantially the compiling process on the gold language code, and the compiling on the analog intelligent contract can be completed through parameter-free compiling (go build). The method comprises the steps of searching a source code file of a simulated intelligent contract of a Golang language of the simulated intelligent contract, compiling based on a go build method, generating an executable file (a file of binary codes), and then running the file of the binary codes by a virtual machine.
Based on the implementation mode, in the development process of the intelligent contract, the intelligent contract code in the current development is not required to be deployed on the Fabric alliance firstly every time of debugging, then the intelligent contract on the alliance chain is accessed through the SDK, whether the temporary intelligent contract deployed at present is in accordance with the expectation or not is analyzed through the returned data, and if the code amount is large and the logic is complex, a large amount of time cost can be consumed in the debugging process. Based on simulation (encapsulation) processing of the virtual machine on the temporary intelligent contract and how to add HTTP protocol service in the code of the simulated intelligent contract, in each debugging process, only the temporary intelligent contract code in the current development needs to be simulated through the virtual machine for Mock deployment, and then the interface of the contract is directly called through the IDE, so that the debugging process is realized, a large amount of debugging time cost is reduced, and the development speed of the intelligent contract is improved.
S402, the virtual machine system receives a debugging instruction sent by the integrated development environment system, and runs the executable file of the simulated intelligent contract according to the debugging instruction to generate a running result.
In some embodiments, the debugging instructions are generated by the integrated development environment system based on instructions input by a user through clicking a debugging control on the visualized operation interface. And after receiving the debugging instruction, the virtual machine system creates and starts a process for running the executable file simulating the intelligent contract and generates a running result.
The debug instruction may include a single-step debug instruction, and the execution result may include a single-step execution result. After the integrated development environment system sets a breakpoint for program operation, a single step debugging instruction can be sent to the virtual machine system; and the virtual machine system only runs the program logic of the binary code in one step from the binary code corresponding to the set breakpoint according to the single step debugging instruction, and generates a corresponding single step running result.
In some embodiments, the debug instruction comprises a call command;
the step of operating the executable file of the simulation intelligent contract according to the debugging instruction to generate an operation result comprises the following steps:
the virtual machine system calls a simulation interface method of the simulation intelligent contract according to the call command in the debugging instruction, wherein the simulation interface method is used for calling an original interface method of the temporary intelligent contract; and executing code logic in the executable file based on the calling of the original interface method to generate the running result.
The calling command is sent by the integrated development environment system based on a preset data communication protocol, and the service of the data communication protocol interface is configured when the virtual machine deploys the temporary intelligent contract.
For example, the simulation interface method may be an interface method obtained by encapsulating an original interface method of the temporary intelligent contract. For example, two interface methods that an intelligent contract must implement: an initialized interface method Init and an interface method Invock that performs transactions. After the virtual machine system packages the two original interface methods, simulated interface methods MockInit and MockInvock are obtained. The preset data communication protocol may be an HTTP protocol.
As shown in fig. 7, an exemplary diagram of an interface calling layer in a virtual machine system according to the embodiment of the present application is provided. After being processed by simulation (packaging), the temporary intelligent contract can comprise an HTTP interface layer, a simulation interface layer (comprising a simulation interface) and original code logic (comprising an original interface) of the temporary intelligent contract. After receiving the call command, the virtual machine can enable the IDE system to access and call through an HTTP interface service simulating a Mock smart contract based on the HTTP service. The IDE system calls to the HTTP interface layer of the emulated smart contract, and thus may call to the emulated interface (mocknit or mockswitch) of the emulated interface layer, and further calls to the original interface (Init or Invoke) and the original code logic of the temporary smart contract.
And S403, the virtual machine system feeds back the running result to the integrated development environment system, and the running result is used for indicating the integrated development environment system to debug the temporary intelligent contract and obtain the complete intelligent contract.
In some embodiments, before the virtual machine system feeds back the execution result to the integrated development environment system, the method further comprises:
the virtual machine system receives a single-step debugging instruction sent by the integrated development environment system, wherein the single-step debugging instruction is generated by the integrated development environment system based on a breakpoint call instruction input by a user; the virtual machine system executes the executable file in a single step according to the single step debugging instruction to obtain a single step operation result; correspondingly, the virtual machine system feeds back the operation result to the integrated development environment system, and the operation result includes: feeding back the single step operation result to the integrated development environment system; the single-stepping operation result is used for instructing the integrated development environment system to perform single-stepping on the temporary intelligent contract.
Wherein the run result comprises the single-step run result.
Based on the implementation manner of the above embodiment, the interaction process between the IDE system and the virtual machine system in each stage of developing the intelligent contract is described below through an interaction diagram.
A deployment phase:
as shown in fig. 5, a schematic diagram of a virtual machine system deployment intelligence contract provided in an embodiment of the present application is shown. The IDE system sends the temporary intelligent contract to the virtual machine system and instructs the virtual machine system to deploy the temporary intelligent contract. Firstly, the virtual machine system carries out simulation processing on a temporary intelligent contract to obtain a simulated (Mock) intelligent contract; then compiling the simulation intelligent contract to obtain the executable file. The virtual machine system runs the executable file simulating the intelligent contract, the executable file simulating the intelligent contract is run on the virtual machine system to show that the deployment is successful, and the virtual machine system feeds back information for completing the deployment to the IDE system.
And (3) compiling:
as shown in fig. 6, the virtual machine system provided in the embodiment of the present application compiles a schematic diagram of an intelligent contract. And in the process of deploying the temporary intelligent contract by the virtual machine system, a compiling process is also included. The IDE system sends a compile instruction to the virtual machine system. And compiling the simulation intelligent contract by the virtual machine system (through go build) to obtain an executable file, and feeding back information for completing the compiling to the IDE system.
A debugging stage:
as shown in fig. 8, an overall interaction diagram of non-single-step debugging provided in the embodiment of the present application is shown. The overall interaction diagram may include:
1. the IDE system sends the temporary intelligent contract to the virtual machine system and instructs deployment of the temporary intelligent contract.
2. The virtual machine system can determine to finish deployment after normally operating the simulation intelligent contract.
3. And the virtual machine system feeds back the information for completing the deployment to the IDE system.
4. The IDE system performs non-single step debugging on the temporary intelligent contract and calls an interface simulating the intelligent contract.
5. And the virtual machine system runs the original code logic of the temporary intelligent contract based on the call of the IDE system to the interface to obtain interface call data.
6. And the virtual machine system feeds the interface calling data back to the IDE system as the running result of the primary code logic.
As shown in fig. 9, a schematic diagram of single-step debugging in an interaction process provided in the embodiment of the present application is shown. The interaction diagram of the single step debugging can comprise:
1. the IDE system sends the temporary intelligent contract to the virtual machine system and instructs deployment of the temporary intelligent contract.
2. The virtual machine system can determine to finish deployment after normally operating the simulation intelligent contract.
3. And the virtual machine system feeds back the information for completing the deployment to the IDE system.
4. The IDE system initiates the function of debugging.
5. The virtual machine system is connected to the simulation intelligence contract through a debugger (Delve).
6. And the virtual machine system feeds back a successful connection message to the IDE system.
7. The IDE system sets program breakpoints according to instructions input by a user and invokes an interface simulating an intelligent contract.
8. The virtual machine system runs the simulated intelligent contract and stops the program from running at the breakpoint.
9. The virtual machine system returns the prompt message of the program interruption to the IDE system.
10. The IDE system begins stepping through a series of single-step debugs based on the breakpoint.
According to the method and the system, the interaction between the IDE system and the virtual machine system realizes the functions of compiling, deploying, calling, debugging and the like of the intelligent contract, the framework of a alliance chain does not need to be designed in advance, multiple deployments on the alliance chain are not needed, and the intelligent contract does not need to be debugged through an official SDK developed by a client, so that the requirement of the precondition of intelligent contract development is reduced, the development speed of the intelligent contract is improved, and particularly, the development efficiency of the intelligent contract is greatly improved for the intelligent contract with large code quantity and complex logic; meanwhile, based on the process of performing single-step debugging on the temporary intelligent contract, especially for the intelligent contract code with complex logic, the code of the intelligent contract can be gradually perfected, and the accuracy and controllability of intelligent contract debugging are improved, so that the reliability and stability of the intelligent contract code can be ensured.
It should be understood that, the sequence numbers of the steps in the foregoing embodiments do not imply an execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of the embodiments of the present application.
Fig. 10 shows a block diagram of the intelligent contract development apparatus provided in the embodiment of the present application, which corresponds to the development method of the intelligent contract described in the above embodiment, and for convenience of explanation, only the parts related to the embodiment of the present application are shown.
Referring to fig. 10, the apparatus includes:
a sending unit 101, configured to send a temporary intelligent contract to a virtual machine system, where the temporary intelligent contract is used to instruct the virtual machine system to perform deployment, so as to obtain an executable file simulating an intelligent contract;
the invoking unit 102 is configured to send a debugging instruction to the virtual machine system, where the debugging instruction is used to instruct the virtual machine system to run the executable file of the simulated intelligent contract and generate a running result;
and the debugging unit 103 is configured to obtain the operation result fed back by the virtual machine system, and debug the temporary intelligent contract based on the operation result to obtain the complete intelligent contract.
Fig. 11 shows a block diagram of an intelligent contract development apparatus provided in the embodiment of the present application, which corresponds to the development method of an intelligent contract described in the above embodiment, and for convenience of explanation, only the parts related to the embodiment of the present application are shown.
Referring to fig. 11, the apparatus includes:
the receiving unit 111 is configured to receive a temporary intelligent contract sent by the integrated development environment system, and deploy the temporary intelligent contract to obtain an executable file simulating the intelligent contract;
an execution unit 112, configured to receive a debugging instruction sent by the integrated development environment system, and run the executable file of the simulated intelligent contract according to the debugging instruction, so as to generate a running result;
a feedback unit 113, configured to feed back the operation result to the integrated development environment system, where the operation result is used to instruct the integrated development environment system to debug the temporary intelligent contract and obtain a complete intelligent contract.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
The embodiments of the present application further provide a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the computer program implements the steps in the above-mentioned method embodiments.
The embodiments of the present application provide a computer program product, which when running on a mobile terminal, enables the mobile terminal to implement the steps in the above method embodiments when executed.
Fig. 12 is a schematic structural diagram of an electronic device 12 according to an embodiment of the present application. As shown in fig. 12, the electronic apparatus 12 of this embodiment includes: at least one processor 120 (only one shown in fig. 12), a memory 121, and a computer program 122 stored in the memory 121 and executable on the at least one processor 120, the steps in the above embodiments being implemented when the computer program 122 is executed by the processor 120.
The electronic device 12 may be a desktop computer, a notebook, a palm top computer, a cloud server, or other computing devices. The electronic device 12 may include, but is not limited to, a processor 120 and a memory 121. Those skilled in the art will appreciate that fig. 12 is merely an example of electronic device 12 and does not constitute a limitation of electronic device 12 and may include more or fewer components than shown, or some components may be combined, or different components, such as input output devices, network access devices, etc.
The Processor 120 may be a Central Processing Unit (CPU), and the Processor 120 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 121 may be an internal storage unit of the electronic device 12 in some embodiments, such as a hard disk or a memory of the electronic device 12. The memory 121 may also be an external storage device of the electronic device 12 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the electronic device 12. Further, the memory 121 may also include both an internal storage unit and an external storage device of the electronic device 12. The memory 121 is used for storing an operating system, an application program, a BootLoader (BootLoader), data, and other programs, such as program codes of the computer programs. The memory 121 may also be used to temporarily store data that has been output or is to be output.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium and can implement the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing apparatus/terminal apparatus, a recording medium, computer Memory, Read-Only Memory (ROM), Random Access Memory (RAM), an electrical carrier signal, a telecommunications signal, and a software distribution medium. Such as a usb-disk, a removable hard disk, a magnetic or optical disk, etc. In certain jurisdictions, computer-readable media may not be an electrical carrier signal or a telecommunications signal in accordance with legislative and patent practice.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Fig. 13 is a schematic structural diagram of an intelligent contract development system 13 according to an embodiment of the present application, where the intelligent contract development system 13 includes an integrated development environment system 131 disposed at a front end and a virtual machine system 132 disposed at a back end. The integrated development environment system 131 is used to compile, invoke and debug intelligent contracts of the blockchain, and the virtual machine system 132 is used to perform simulation processing, deployment and operation based on the intelligent contracts sent by the integrated development environment system, and feed back an operation result for debugging to the integrated development environment system 131.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/network device and method may be implemented in other ways. For example, the above-described apparatus/network device embodiments are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implementing, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not implemented. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.

Claims (13)

1. A method for developing an intelligent contract, the method comprising:
the method comprises the steps that an integrated development environment system sends a temporary intelligent contract to a virtual machine system, wherein the temporary intelligent contract is used for indicating the virtual machine system to deploy the temporary intelligent contract to obtain an executable file of a simulation intelligent contract corresponding to the temporary intelligent contract;
the integrated development environment system sends a debugging instruction to the virtual machine system, wherein the debugging instruction is used for indicating the virtual machine system to run the executable file of the simulated intelligent contract and generate a running result;
and the integrated development environment system acquires the operation result fed back by the virtual machine system, and debugs the temporary intelligent contract based on the operation result to obtain the complete intelligent contract.
2. The method of claim 1, wherein after the integrated development environment system sends a temporary smart contract to a virtual machine system, the method further comprises:
the integrated development environment system sends a compiling instruction to the virtual machine system, wherein the compiling instruction is used for instructing the virtual machine system to compile the simulated intelligent contract to obtain an executable file of the simulated intelligent contract;
and the integrated development environment system receives a successful compiling message fed back by the virtual machine system.
3. The method of claim 1, wherein the debug instruction comprises a call command;
the integrated development environment system sends debugging instructions to the virtual machine system, and the debugging instructions comprise:
and the integrated development environment sends a calling command to the virtual machine system based on a preset data communication protocol, wherein the calling command is used for calling a simulation interface method of the simulation intelligent contract, and the simulation interface method is used for calling an original interface method of the temporary intelligent contract.
4. The method of any of claims 1-3, wherein prior to the debugging the temporary smart contract based on the execution result, the method further comprises:
receiving a breakpoint call instruction input by a user;
sending a single step debugging instruction to the virtual machine system according to the breakpoint calling instruction, and acquiring a single step operation result of the virtual machine system after the virtual machine system operates based on the single step debugging instruction;
correspondingly, the debugging the temporary intelligent contract based on the operation result comprises:
performing single step debugging on the temporary intelligent contract according to the single step operation result;
wherein the run result comprises the single-step run result.
5. A method for developing an intelligent contract, the method comprising:
the virtual machine system receives a temporary intelligent contract sent by the integrated development environment system, and deploys the temporary intelligent contract to obtain an executable file simulating the intelligent contract;
the virtual machine system receives a debugging instruction sent by the integrated development environment system, and runs the executable file of the simulated intelligent contract according to the debugging instruction to generate a running result;
and the virtual machine system feeds back the running result to the integrated development environment system, wherein the running result is used for indicating the integrated development environment system to debug the temporary intelligent contract and obtain the complete intelligent contract.
6. The method of claim 5, wherein deploying the temporary smart contract to obtain an executable file that emulates a smart contract comprises:
the virtual machine system carries out simulation processing on the temporary intelligent contract to obtain a simulated intelligent contract;
and compiling the simulated intelligent contract by the virtual machine system based on the compiling instruction sent by the integrated development environment system to obtain an executable file of the simulated intelligent contract.
7. The method of claim 5, wherein the debug instruction comprises a call command;
the step of operating the executable file of the simulation intelligent contract according to the debugging instruction to generate an operation result comprises the following steps:
the virtual machine system calls a simulation interface method of the simulation intelligent contract according to the call command in the debugging instruction, wherein the simulation interface method is used for calling an original interface method of the temporary intelligent contract;
executing code logic in the executable file based on the calling of the original interface method to generate the running result;
the calling command is sent by the integrated development environment system based on a preset data communication protocol, and the service of the data communication protocol interface is configured when the virtual machine deploys the temporary intelligent contract.
8. The method of any of claims 5 to 7, wherein prior to the virtual machine system feeding back the execution results to the integrated development environment system, the method further comprises:
the virtual machine system receives a single-step debugging instruction sent by the integrated development environment system, wherein the single-step debugging instruction is generated by the integrated development environment system based on a breakpoint call instruction input by a user;
the virtual machine system executes the executable file in a single step according to the single step debugging instruction to obtain a single step operation result;
correspondingly, the virtual machine system feeds back the operation result to the integrated development environment system, and the operation result includes:
the virtual machine system feeds back the single step operation result to the integrated development environment system; the single-step operation result is used for instructing the integrated development environment system to carry out single-step debugging on the temporary intelligent contract;
wherein the run result comprises the single-step run result.
9. An apparatus for developing an intelligent contract, the apparatus comprising:
the system comprises a sending unit, a receiving unit and a processing unit, wherein the sending unit is used for sending a temporary intelligent contract to a virtual machine system, and the temporary intelligent contract is used for indicating the virtual machine system to be deployed to obtain an executable file simulating an intelligent contract;
the calling unit is used for sending a debugging instruction to the virtual machine system, and the debugging instruction is used for indicating the virtual machine system to run the executable file of the simulated intelligent contract and generate a running result;
and the debugging unit is used for acquiring the operation result fed back by the virtual machine system and debugging the temporary intelligent contract based on the operation result to obtain the complete intelligent contract.
10. An apparatus for developing an intelligent contract, the apparatus comprising:
the system comprises a receiving unit, a generating unit and a processing unit, wherein the receiving unit is used for receiving a temporary intelligent contract sent by an integrated development environment system and deploying the temporary intelligent contract to obtain an executable file simulating the intelligent contract;
the execution unit is used for receiving a debugging instruction sent by the integrated development environment system, and operating the executable file of the simulated intelligent contract according to the debugging instruction to generate an operation result;
and the feedback unit is used for feeding back the operation result to the integrated development environment system, and the operation result is used for indicating the integrated development environment system to debug the temporary intelligent contract and obtain the complete intelligent contract.
11. An electronic device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the steps of the method according to any of claims 1 to 4 or 5 to 8 are implemented when the computer program is executed by the processor.
12. A computer-readable storage medium, in which a computer program is stored, which, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 4 or 5 to 8.
13. An intelligent contract development system, characterized in that the intelligent contract development system comprises an integrated development environment system and a virtual machine system; the integrated development environment system is configured to perform the steps of the method according to any one of claims 1 to 4, and the virtual machine system is configured to perform the steps of the method according to any one of claims 5 to 8.
CN202111604806.8A 2021-12-24 2021-12-24 Development method and device of intelligent contract and electronic equipment Pending CN114327403A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111604806.8A CN114327403A (en) 2021-12-24 2021-12-24 Development method and device of intelligent contract and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111604806.8A CN114327403A (en) 2021-12-24 2021-12-24 Development method and device of intelligent contract and electronic equipment

Publications (1)

Publication Number Publication Date
CN114327403A true CN114327403A (en) 2022-04-12

Family

ID=81012375

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111604806.8A Pending CN114327403A (en) 2021-12-24 2021-12-24 Development method and device of intelligent contract and electronic equipment

Country Status (1)

Country Link
CN (1) CN114327403A (en)

Similar Documents

Publication Publication Date Title
Larsen et al. The overture initiative integrating tools for VDM
Cottenier et al. The motorola WEAVR: Model weaving in a large industrial context
Wong et al. The ABS tool suite: modelling, executing and analysing distributed adaptable object-oriented systems
Balasubramanian et al. Polyglot: modeling and analysis for multiple statechart formalisms
CN110362490B (en) Automatic testing method and system for integrating iOS and Android mobile applications
Dévai et al. Textual, Executable, Translatable UML.
Tiwari et al. Reuse: reducing test effort
Goli et al. Automated design understanding of SystemC-based virtual prototypes: Data extraction, analysis and visualization
CN108287720B (en) Software compiling method, device, equipment and storage medium
Zeng et al. Graphical model debugger framework for embedded systems
Zhang et al. Automated unit testing intelligent agents in PDT
Van Mierlo et al. Explicit modelling of a parallel DEVS experimentation environment.
CN114840410A (en) Test analysis method and device, computer equipment and storage medium
KR20110037140A (en) System for providing virtual development environment for embedded software
CN114327403A (en) Development method and device of intelligent contract and electronic equipment
US20080300846A1 (en) Methods and apparatus for hardware simulation and design verification
Lee et al. A New Integrated Software Development Environment Based on SDL, MSC, and CHILL for Large‐scale Switching Systems
Benz AspectT: aspect-oriented test case instantiation
Iber et al. Ubtl UML testing profile based testing language
Faria et al. Techniques and toolset for conformance testing against UML sequence diagrams
Mansurov et al. A scenario based approach to the evolution of telecommunications software
Mansurov et al. Dynamic scenario-based approach to re-engineering of legacy telecommunication software
Digerås Integration between Optima and Farkle and verification with a use case about file storage stack integration in a quality of service manager in OSE
Zhang et al. Tsmart-BIPEX: An Integrated Graphical Design Toolkit for Software Systems.
Barbie Reporting of performance tests in a continuous integration environment

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