CN114185556A - Intelligent contract deployment method, device, equipment and storage medium - Google Patents

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

Info

Publication number
CN114185556A
CN114185556A CN202111526552.2A CN202111526552A CN114185556A CN 114185556 A CN114185556 A CN 114185556A CN 202111526552 A CN202111526552 A CN 202111526552A CN 114185556 A CN114185556 A CN 114185556A
Authority
CN
China
Prior art keywords
file
target
code
contract
original
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
CN202111526552.2A
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.)
China Zheshang Bank Co Ltd
Original Assignee
China Zheshang Bank 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 China Zheshang Bank Co Ltd filed Critical China Zheshang Bank Co Ltd
Priority to CN202111526552.2A priority Critical patent/CN114185556A/en
Publication of CN114185556A publication Critical patent/CN114185556A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management

Abstract

The invention discloses an intelligent contract deployment method, an intelligent contract deployment device, intelligent contract deployment equipment and a storage medium, and belongs to the technical field of block chains. The method comprises the following steps: determining a first original code file from original code files of a target intelligent contract; the first original code file is a file written by referring to a target contract code dependency library in the original code file; modifying a reference code line in the first original code file to obtain a first modified code file, and compiling the first modified code file to obtain a first compiled file; determining a target compilation file of the target intelligent contract according to the first compilation file and an original compilation file of the original code file; and initiating a contract deployment transaction request containing the target compiled file to a blockchain network so that the blockchain network deploys the target intelligent contract according to the target compiled file. According to the technical scheme, the contract code dependency library is multiplexed, and the block chain data storage redundancy is reduced.

Description

Intelligent contract deployment method, device, equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of block chains, in particular to an intelligent contract deployment method, an intelligent contract deployment device, intelligent contract deployment equipment and a storage medium.
Background
The blockchain system is essentially a distributed database, compared with a traditional centralized system, the blockchain has the characteristics of decentralization, distrust and the like, the integrity and the non-tampering property of data are ensured through a cryptographic algorithm, the consistency of the data state under a large-scale network can be ensured through a distributed consensus algorithm, and the characteristics solve the problems of trust centralization and trusted value transfer on the original internet at lower cost.
The traditional blockchain system generally only accepts single-language intelligent contract deployment, such as an intelligent contract developed by an Ethenry only accepting a solid language, and an EVM intelligent contract is deployed through an EVM virtual machine. The single contract deployment form obviously improves the block chain development threshold, so that the more intuitive solution supports the deployment and calling of other languages in a mode of integrating virtual machines. The Java intelligent contract is an enhancement to the existing intelligent contract scheme, and can allow a user to solve the intelligent contract service development problem of a block chain by using a familiar application development language, reduce the language learning threshold of the user and help the user quickly reuse the existing codes to complete complex service operation.
In the process of developing the Java intelligent contract, in order to facilitate a user to complete more complex service development work, in the process of developing the contract code, various third-party code dependent libraries in the existing Java ecology are inevitably used, and the dependent libraries are imported into the intelligent contract in an import mode.
Disclosure of Invention
The invention provides an intelligent contract deployment method, an intelligent contract deployment device, equipment and a storage medium, which are used for reducing the deployment of repeated codes and reducing the storage pressure of a block chain.
In a first aspect, an embodiment of the present invention provides an intelligent contract deployment method, which is applied to a user node, and includes:
determining a first original code file from original code files of a target intelligent contract; the first original code file is a file written by referring to a target contract code dependency library in the original code file; the target contract code dependency library is stored in a block chain;
modifying a reference code line in the first original code file to obtain a first modified code file, and compiling the first modified code file to obtain a first compiled file;
determining a target compilation file of the target intelligent contract according to the first compilation file and an original compilation file of the original code file;
and initiating a contract deployment transaction request containing the target compiled file to a blockchain network so that the blockchain network deploys the target intelligent contract according to the target compiled file.
In a second aspect, an embodiment of the present invention further provides an intelligent contract deployment method, which is applied to a block chain network, and the method includes:
responding to a contract deployment transaction request which is initiated by a user node and comprises a target compiling file, and acquiring a target on-chain address from the target compiling file;
determining a target contract code dependency library from available contract code dependency libraries stored on a chain according to the target on-chain address based on the mapping relation between the identification information of the contract code dependency library and the on-chain address;
and deploying the target intelligent contract according to the target contract code dependency library and the target compiling file.
In a third aspect, an embodiment of the present invention further provides an intelligent contract deployment apparatus, configured at a user node, where the apparatus includes:
the source code file determining module is used for determining a first source code file from the source code files of the target intelligent contract; the first original code file is a file written by referring to a target contract code dependency library in the original code file; the target contract code dependency library is stored in a block chain;
the first compiled file determining module is used for modifying the reference code line in the first original code file to obtain a first modified code file, and compiling the first modified code file to obtain a first compiled file;
the target compiled file determining module is used for determining a target compiled file of the target intelligent contract according to the first compiled file and an original compiled file of the original code file;
and the transaction request initiating module is used for initiating a contract deployment transaction request containing the target compilation file to a blockchain network so as to enable the blockchain network to deploy the target intelligent contract according to the target compilation file.
In a fourth aspect, an embodiment of the present invention further provides an intelligent contract deployment apparatus configured in a blockchain network, where the apparatus includes:
the target on-chain address determining module is used for responding to a contract deployment transaction request which is initiated by a user node and comprises a target compiling file, and acquiring a target on-chain address from the target compiling file;
the target dependent library determining module is used for determining a target contract code dependent library from available contract code dependent libraries stored on a chain according to the target on-chain address based on the mapping relation between the identification information of the contract code dependent library and the on-chain address;
and the contract deployment module is used for deploying the target intelligent contract according to the target contract code dependency library and the target compiling file.
In a fifth aspect, an embodiment of the present invention further provides an electronic device, where the electronic device includes:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement an intelligent contract deployment method as provided by any of the embodiments of the invention.
In a sixth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the intelligent contract deployment method provided in any embodiment of the present invention.
According to the technical scheme, a first original code file is determined from an original code file of a target intelligent contract, the first original code file is a file written by referring to a target contract code dependency library in the original code file, the target contract code dependency library is stored in a block chain, then the referring code line in the first original code file is modified to obtain a first modified code file, the first modified code file is compiled to obtain a first compiled file, then the target compiled file of the target intelligent contract is determined according to the first compiled file and the original compiled file of the original code file, and then a contract deployment transaction request containing the target compiled file is sent to a block chain network to enable the block chain network to deploy the target intelligent contract according to the target compiled file. According to the technical scheme, the contract code dependency library is multiplexed, the storage volume of the intelligent contract data packet is effectively reduced, the block chain data storage redundancy is reduced, the performance can be improved well in the data transmission, execution and loading processes, and the data storage cost of a block chain operator is greatly reduced.
Drawings
Fig. 1A is a flowchart of an intelligent contract deployment method according to an embodiment of the present invention;
fig. 1B is a diagram for creating Java smart contracts and configuring plug-ins according to an embodiment of the present invention
Fig. 2 is a flowchart of an intelligent contract deployment method according to a second embodiment of the present invention;
fig. 3 is a flowchart of an intelligent contract deployment method according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an intelligent contract deployment apparatus according to a fourth embodiment of the present invention;
fig. 5 is a schematic structural diagram of an intelligent contract deployment apparatus according to a fifth embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device according to a sixth embodiment of the present invention.
Detailed Description
The present invention will be described in further detail with reference to the accompanying drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the invention and are not limiting of the invention. It should be further noted that, for the convenience of description, only some of the structures related to the present invention are shown in the drawings, not all of the structures.
Example one
Fig. 1A is a flowchart of an intelligent contract deployment method according to an embodiment of the present invention, and fig. 1B is a diagram of Java intelligent contract creation and plug-in configuration according to the present invention. The embodiment is applicable to the situation of how to deploy the intelligent contract, and the method can be executed by an intelligent contract deployment device, which can be implemented by software and/or hardware, and can be integrated in the electronic equipment of the user node. As shown in fig. 1A, the intelligent contract deployment method provided in this embodiment includes:
s110, determining a first original code file from the original code files of the target intelligent contract.
In this embodiment, the target intelligent contract refers to an intelligent contract that needs to be deployed in the blockchain network, and may be an intelligent contract written in JAVA programming language. The original code file refers to a source file of code written to implement the target intelligent contract, and may be, for example, all of the written java files that implement the target intelligent contract. Illustratively, a target intelligent contract written in the Java language has other member variables and other contract methods already deployed in the blockchain, in addition to inheriting parent class methods. As shown at S01 in fig. 1B, the user-created target smart contract may be a Java file constructed based on the basetrack abstract parent class in the developer SDK provided by the blockchain, which has other member variables and contract methods in addition to the inherited parent class method, as shown at S02 in fig. 1B. Can be deployed on blockchains and provide public methods for external invocation.
The first original code file is a file written by referring to a target contract code dependency library in the original code file; the target contract code dependency library is a third-party code library which is depended on by the target intelligent contract, and the target contract code dependency library is stored in the block chain; it should be noted that the target contract code dependency library referred to by the target intelligent contract is at least one in number.
Illustratively, all of the original code files are traversed, and a first original code file is determined from the original code files of the target intelligent contract. For example, in a standard Java project integrated development environment in an electronic device of a user node, taking a Maven project as an example, a service provider may be introduced into the project to provide a matched developer software development kit, and specifically, a compiled enhanced plug-in configuration may be introduced into a pom.xml file of a root directory of the project, where the compiled enhanced plug-in configuration includes the shapes of key-value pairs ("class name", "dep address") of on-chain addresses of a contract code dependency library.
Specifically, all files in the original code file are traversed, a code reference line is found for each file, whether a key value pair corresponding to a target contract code dependency library exists or not is searched for from compiling enhanced plug-in configuration according to the name of the target contract code dependency library of the code reference line, and if yes, the file is used as the first original code file.
Wherein the code reference line is a line of code written when the target contract code dependency library is referenced.
S120, modifying the reference code line in the first original code file to obtain a first modified code file, and compiling the first modified code file to obtain a first compiled file.
In this embodiment, the first modification code file refers to a source code file obtained by modifying a reference code line that refers to the target contract code dependency base.
Specifically, for each file in the first original code file, the file is traversed, and for each reference code line that references the target contract code dependency base, the address on the target chain of the target contract code dependency base is used to modify the reference code line, so that the first modified code file is obtained.
And then compiling the first modified code file to obtain a first compiled file. Meanwhile, compiling the original code file to obtain an original compiled file of the original code file.
And S130, determining a target compiling file of the target intelligent contract according to the first compiling file and the original compiling file of the original code file.
In this embodiment, the target compiled file refers to a compiled file in which the target contract code may be finally deployed in the block chain network.
Optionally, the first compiled file and the original compiled file are combined to obtain a target compiled file of the target intelligent contract.
Optionally, the first compiled file is used to replace a compiled file in the original compiled file, which has the same file name as the first compiled file, so as to obtain a target compiled file of the target intelligent contract.
S140, a contract deployment transaction request containing the target compiling file is sent to the blockchain network, so that the blockchain network deploys the target intelligent contract according to the target compiling file.
In this embodiment, the contract deployment transaction request refers to a request for instructing a blockchain network to perform contract deployment.
For example, a user node may initiate a contract deployment transaction request including a target compiled file to a blockchain network; correspondingly, the blockchain network deploys the target intelligent contract according to the target compilation file.
Illustratively, the user node may also package the target compiled file to obtain a target packaged file, and further initiate a contract deployment transaction request including the target packaged file to the blockchain network; correspondingly, the block chain network responds to the contract deployment transaction request, decompresses the target packed file to obtain a target compilation file, and deploys the target intelligent contract according to the target compilation file.
According to the technical scheme, a first original code file is determined from an original code file of a target intelligent contract, the first original code file is a file written by referring to a target contract code dependency library in the original code file, the target contract code dependency library is stored in a block chain, then the referring code line in the first original code file is modified to obtain a first modified code file, the first modified code file is compiled to obtain a first compiled file, then the target compiled file of the target intelligent contract is determined according to the first compiled file and the original compiled file of the original code file, and then a contract deployment transaction request containing the target compiled file is sent to a block chain network to enable the block chain network to deploy the target intelligent contract according to the target compiled file. According to the technical scheme, the contract code dependency library is multiplexed, the storage volume of the intelligent contract data packet is effectively reduced, the block chain data storage redundancy is reduced, the performance can be improved well in the data transmission, execution and loading processes, and the data storage cost of a block chain operator is greatly reduced.
Example two
Fig. 2 is a flowchart of an intelligent contract deployment method provided in the second embodiment of the present invention, and based on the above embodiment, further optimizes "modifying a reference code line in a first original code file to obtain a first modified code file" to provide an optional implementation. As shown in fig. 2, the intelligent contract deployment method provided in this embodiment includes:
s210, determining a first original code file from the original code files of the target intelligent contract.
S220, modifying the reference code line in the first original code file to obtain a first modified code file, and compiling the first modified code file to obtain a first compiled file.
For example, a target on-chain address of a target contract code dependency library may be determined based on a mapping relationship between identification information of the contract code dependency library and the on-chain address; and modifying the reference code line in the first original code file according to the address on the target chain to obtain a first modified code file.
The mapping relation between the identification information of the contract code dependency library and the address on the chain is configured in the compiling enhancement plug-in advance; wherein the identification information may be name information or an ID of the contract code dependency repository; an on-chain address refers to an address of a contract code dependent bank in a blockchain network. For example, the user node may obtain the on-chain address of the contract code dependency library from the block chain network, further construct a mapping relationship between the identification information of the contract code dependency library and the on-chain address according to the name information of the contract code dependency library and the on-chain address, and configure the mapping relationship in the compiling enhancement plug-in. Specifically, a user node initiates a contract query transaction request including identification information of a contract code dependency base to be queried to a block chain network; correspondingly, the block chain network responds to the contract inquiry transaction request, inquires whether the on-chain address of the contract code dependency base to be inquired exists from the block chain network according to the identification information of the contract code dependency base to be inquired, and feeds back the on-chain address of the contract code dependency base to be inquired to the user node if the on-chain address of the contract code dependency base to be inquired exists.
Specifically, the user node searches a target chain address of the target contract code dependency library from the compiling enhancement plug-in according to the mapping relation between the identification information of the contract code dependency library and the chain address; and modifying the reference code line in the first original code file according to the address on the target chain to obtain a first modified code file.
In an optional mode, the first original code file is copied to obtain a first copy code file; modifying codes in a reference code line in the first copy code file according to a dependent replacement rule and an address on a target chain to obtain a new code line; and replacing the reference code line in the first copied file with the new code line to obtain a first modified code file.
Wherein the dependency replacement rules are determined by those skilled in the art based on industry rules.
Specifically, a first original code file is copied to obtain a first copy code file; and traversing each first copy file, traversing a code line of the first copy file for each first copy file, modifying the reference code line related to the reference target contract code dependency base according to a dependency replacement rule and a target on-chain address to obtain a new code line, and replacing the reference code line by adopting the new code line to obtain a first modified file. For example, if a reference code line "import classname" referencing a target contract code dependency base exists in a first copy file, the reference code line is modified according to a dependency replacement rule and an on-chain address of the target contract code dependency base, that is, the reference code line is changed to "import lib < depaddress >. classname".
And S230, determining a target compiling file of the target intelligent contract according to the first compiling file and the original compiling file of the original code file.
Optionally, a second compiled file of the first original code file may be determined from the original compiled files of the original code file; and replacing a second compiled file in the original compiled file by the first compiled file to obtain a target compiled file.
The second compiled file refers to a compiled file belonging to the first original code file in the original compiled files of the original code file.
Specifically, according to the name of the first original code file, a second compiled file of the first original code file is determined from the original compiled files of the original code file, the second compiled file in the original compiled files is replaced by the first compiled file, and the replaced original compiled file is used as a target compiled file.
S240, a contract deployment transaction request containing the target compiling file is sent to the blockchain network, so that the blockchain network deploys the target intelligent contract according to the target compiling file.
The technical scheme includes that a first original code file is determined from an original code file of a target intelligent contract, the first original code file is a file written by a reference target contract code dependency library in the original code file, the target contract code dependency library is stored in a block chain, then a reference code line in the first original code file is modified to obtain a first modified code file, the first modified code file is compiled to obtain a first compiled file, then the target compiled file of the target intelligent contract is determined according to the first compiled file and the original compiled file of the original code file, and then a contract deployment transaction request containing the target compiled file is sent to a block chain network to enable the block chain network to deploy the target intelligent contract according to the target compiled file. According to the technical scheme, the contract code dependency library is multiplexed, the storage volume of the intelligent contract data packet is effectively reduced, the block chain data storage redundancy is reduced, the performance can be improved well in the data transmission, execution and loading processes, and the data storage cost of a block chain operator is greatly reduced.
EXAMPLE III
Fig. 3 is a flowchart of an intelligent contract deployment method according to a third embodiment of the present invention, where this embodiment is applicable to how to deploy an intelligent contract, and the method may be executed by an intelligent contract deployment apparatus, where the apparatus may be implemented by software and/or hardware, and may be integrated in an electronic device of a block chain platform. As shown in fig. 3, the intelligent contract deployment method provided in this embodiment includes:
s310, responding to a contract deployment transaction request which is initiated by a user node and comprises a target compiling file, and acquiring a target on-chain address from the target compiling file.
Specifically, the blockchain platform acquires the target on-chain address from the target compilation file in response to a contract deployment transaction request which is initiated by a user node and contains the target compilation file.
S320, determining a target contract code dependency library from the available contract code dependency libraries stored on the chain according to the target chain address based on the mapping relation between the identification information of the contract code dependency library and the chain address.
The contractable code dependent library refers to a contract code dependent library which is stored in the blockchain network and can be used when the intelligent contract is deployed.
Specifically, based on the mapping relationship between the identification information of the contract code dependency library cached by the local node and the address on the link, the target contract code dependency library is determined from the available contract code dependency libraries stored on the link according to the address on the target link as an index.
And S330, deploying the target intelligent contract according to the target contract code dependency library and the target compiling file.
Specifically, the block chain platform deploys the target intelligent contract according to the target contract code dependency base and the target compiling file.
For example, a built-in JVM virtual machine of an electronic device of a blockchain platform loads a target intelligent contract Class (written by java language) and completes the instantiation of the contract, a built-in JVM Class loader of the blockchain platform instantiates a third-party library (target contract code dependent library) with a Class full-restriction name as a reference, and an enhanced Class loader actually invoked by the built-in JVM of the blockchain platform can perform special processing on the third-party library (target contract code dependent library) modified and loaded according to a convention, extract a hash address in "lib < dep address >, and call an internal interface to acquire the Class binary content of the library through the hash address, so that instantiation can be performed.
According to the technical scheme of the embodiment of the invention, the target chain address is obtained from the target compiling file by responding to a contract deployment transaction request which is initiated by a user node and comprises the target compiling file, then the target contract code dependency base is determined from the available contract code dependency base stored on the chain according to the target chain address based on the mapping relation between the identification information of the contract code dependency base and the chain address, and then the target intelligent contract is deployed according to the target contract code dependency base and the target compiling file. By the technical scheme, the block chain data storage redundancy is reduced, the data storage cost of a block chain operator is greatly reduced, and the efficiency of a block chain network is optimized.
On the basis of the above embodiment, as an optional mode of the present invention, the deployment address of the target intelligent contract after deployment is fed back to the user node.
The deployment address refers to a hash address generated after the target intelligent contract is deployed on the blockchain.
Specifically, after the target intelligent contract is deployed, the blockchain platform generates a transaction receipt, wherein the transaction receipt comprises a deployment address, and the transaction receipt is fed back to the user node. Further, the user node may also obtain the transaction receipt through asynchronous obtaining of the transaction receipt or synchronous polling.
Example four
Fig. 4 is a schematic structural diagram of an intelligent contract deployment apparatus according to a fourth embodiment of the present invention, where this embodiment is applicable to how to deploy an intelligent contract, and the apparatus may be implemented by software and/or hardware, and may be integrated in an electronic device of a user node. As shown in fig. 4, the intelligent contract deployment apparatus provided in this embodiment includes:
an original code file determining module 410, configured to determine a first original code file from the original code files of the target intelligent contract; the first original code file is a file written by referring to a target contract code dependency library in the original code file; the target contract code dependency library is stored in the block chain;
a first compiled file determining module 420, configured to modify a reference code line in the first original code file to obtain a first modified code file, and compile the first modified code file to obtain a first compiled file;
a target compiled file determining module 430, configured to determine a target compiled file of the target intelligent contract according to the first compiled file and an original compiled file of the original code file;
the transaction request initiating module 440 is configured to initiate a contract deployment transaction request including the target compiled file to the blockchain network, so that the blockchain network deploys the target intelligent contract according to the target compiled file.
According to the technical scheme, a first original code file is determined from an original code file of a target intelligent contract, the first original code file is a file written by referring to a target contract code dependency library in the original code file, the target contract code dependency library is stored in a block chain, then the referring code line in the first original code file is modified to obtain a first modified code file, the first modified code file is compiled to obtain a first compiled file, then the target compiled file of the target intelligent contract is determined according to the first compiled file and the original compiled file of the original code file, and then a contract deployment transaction request containing the target compiled file is sent to a block chain network to enable the block chain network to deploy the target intelligent contract according to the target compiled file. According to the technical scheme, the contract code dependency library is multiplexed, the storage volume of the intelligent contract data packet is effectively reduced, the block chain data storage redundancy is reduced, the performance can be improved well in the data transmission, execution and loading processes, and the data storage cost of a block chain operator is greatly reduced.
Further, the first compiled file determining module 420 includes:
the target on-chain address determining unit is used for determining a target on-chain address of the target contract code dependency library based on the mapping relation between the identification information of the contract code dependency library and the on-chain address;
and the first modified code file determining unit is used for modifying the reference code line in the first original code file according to the address on the target chain to obtain a first modified code file.
Further, the first modified code file determining unit is specifically configured to:
copying the first original code file to obtain a first copy code file;
modifying codes in a reference code line in the first copy code file according to a dependent replacement rule and an address on a target chain to obtain a new code line;
and replacing the reference code line in the first copied file with the new code line to obtain a first modified code file.
Further, the target compiled file determining module 430 is specifically configured to:
determining a second compiled file of the first original code file from the original compiled files of the original code file;
and replacing a second compiled file in the original compiled file by the first compiled file to obtain a target compiled file.
Further, the target intelligent contract is an intelligent contract written in JAVA programming language.
The intelligent contract deployment device can execute the intelligent contract deployment method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
EXAMPLE five
Fig. 5 is a schematic structural diagram of an intelligent contract deployment apparatus according to a fifth embodiment of the present invention, where this embodiment is applicable to how to deploy an intelligent contract, and the apparatus may be implemented by software and/or hardware, and may be integrated in an electronic device of a block chain platform. As shown in fig. 5, the intelligent contract deployment method provided in this embodiment includes:
a target on-chain address determining module 510, configured to obtain a target on-chain address from a target compiled file in response to a contract deployment transaction request that includes the target compiled file and is initiated by a user node;
a target dependent library determining module 520, configured to determine a target contract code dependent library from available contract code dependent libraries stored on a chain according to a target on-chain address based on a mapping relationship between identification information of the contract code dependent library and the on-chain address;
and the contract deployment module 530 is used for deploying the target intelligent contract according to the target contract code dependency library and the target compiling file.
According to the technical scheme of the embodiment of the invention, the target chain address is obtained from the target compiling file by responding to a contract deployment transaction request which is initiated by a user node and comprises the target compiling file, then the target contract code dependency base is determined from the available contract code dependency base stored on the chain according to the target chain address based on the mapping relation between the identification information of the contract code dependency base and the chain address, and then the target intelligent contract is deployed according to the target contract code dependency base and the target compiling file. By the technical scheme, the block chain data storage redundancy is reduced, the data storage cost of a block chain operator is greatly reduced, and the efficiency of a block chain network is optimized.
Further, the apparatus further includes a deployment address feedback module, which is specifically configured to:
and feeding back the deployment address of the deployed target intelligent contract to the user node.
The intelligent contract deployment device can execute the intelligent contract deployment method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
EXAMPLE six
Fig. 6 is a schematic structural diagram of an electronic device according to a sixth embodiment of the present invention, and fig. 6 shows a block diagram of an exemplary device suitable for implementing the embodiment of the present invention. The device shown in fig. 6 is only an example and should not bring any limitation to the function and the scope of use of the embodiments of the present invention.
As shown in FIG. 6, electronic device 12 is embodied in the form of a general purpose computing device. The components of electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that couples various system components including the system memory 28 and the processing unit 16.
Bus 18 represents one or more of any of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, and a processor or local bus using any of a variety of bus architectures. By way of example, such architectures include, but are not limited to, Industry Standard Architecture (ISA) bus, micro-channel architecture (MAC) bus, enhanced ISA bus, Video Electronics Standards Association (VESA) local bus, and Peripheral Component Interconnect (PCI) bus.
Electronic device 12 typically includes a variety of computer system readable media. Such media may be any available media that is accessible by electronic device 12 and includes both volatile and nonvolatile media, removable and non-removable media.
The system memory 28 may include computer system readable media in the form of volatile memory, such as Random Access Memory (RAM)30 and/or cache memory (cache 32). The electronic device 12 may further include other removable/non-removable, volatile/nonvolatile computer system storage media. By way of example only, storage system 34 may be used to read from and write to non-removable, nonvolatile magnetic media (not shown in FIG. 6, and commonly referred to as a "hard drive"). Although not shown in FIG. 6, a magnetic disk drive for reading from and writing to a removable, nonvolatile magnetic disk (e.g., a "floppy disk") and an optical disk drive for reading from or writing to a removable, nonvolatile optical disk (e.g., a CD-ROM, DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to bus 18 by one or more data media interfaces. System memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to carry out the functions of embodiments of the invention.
A program/utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which examples or some combination thereof may comprise an implementation of a network environment. Program modules 42 generally carry out the functions and/or methodologies of embodiments described herein.
Electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboard, pointing device, display 24, etc.), with one or more devices that enable a user to interact with electronic device 12, and/or with any devices (e.g., network card, modem, etc.) that enable electronic device 12 to communicate with one or more other computing devices. Such communication may be through an input/output (I/O) interface 22. Also, the electronic device 12 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet) via the network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via the bus 18. It should be understood that although not shown in the figures, other hardware and/or software modules may be used in conjunction with electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
The processing unit 16 executes various functional applications and data processing by executing programs stored in the system memory 28, for example, to implement the intelligent contract deployment method provided by the embodiment of the present invention.
EXAMPLE seven
The seventh embodiment of the present invention further provides a computer-readable storage medium, on which a computer program (or referred to as computer-executable instructions) is stored, where the computer program is used for executing the intelligent contract deployment method provided by the embodiment of the present invention when the computer program is executed by a processor.
Computer storage media for embodiments of the invention may employ any combination of one or more computer-readable media. The computer readable medium may be a computer readable signal medium or a computer readable storage medium. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples (a non-exhaustive list) of the computer readable storage medium would include the following: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this document, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device.
A computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device.
Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Computer program code for carrying out operations for embodiments of the present invention may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
It is to be noted that the foregoing is only illustrative of the preferred embodiments of the present invention and the technical principles employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the embodiments of the present invention have been described in more detail through the above embodiments, the embodiments of the present invention are not limited to the above embodiments, and many other equivalent embodiments may be included without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (11)

1. An intelligent contract deployment method is applied to a user node and comprises the following steps:
determining a first original code file from original code files of a target intelligent contract; the first original code file is a file written by referring to a target contract code dependency library in the original code file; the target contract code dependency library is stored in a block chain;
modifying a reference code line in the first original code file to obtain a first modified code file, and compiling the first modified code file to obtain a first compiled file;
determining a target compilation file of the target intelligent contract according to the first compilation file and an original compilation file of the original code file;
and initiating a contract deployment transaction request containing the target compiled file to a blockchain network so that the blockchain network deploys the target intelligent contract according to the target compiled file.
2. The method of claim 1, wherein modifying the reference code line in the first original code file to obtain a first modified code file comprises:
determining a target chain address of a target contract code dependency library based on the mapping relation between the identification information of the contract code dependency library and the chain address;
and modifying the reference code line in the first original code file according to the address on the target chain to obtain a first modified code file.
3. The method of claim 2, wherein modifying the reference code line in the first original code file according to the address on the target chain to obtain a first modified code file comprises:
copying the first original code file to obtain a first copy code file;
modifying codes in a reference code line in the first copy code file according to a dependent replacement rule and the address on the target chain to obtain a new code line;
and replacing the reference code line in the first copied file with the new code line to obtain a first modified code file.
4. The method of claim 1, wherein determining a target compiled file of the target smart contract from the first compiled file and an original compiled file of the original code file comprises:
determining a second compiled file of the first original code file from original compiled files of the original code file;
and replacing a second compiled file in the original compiled file with the first compiled file to obtain a target compiled file.
5. The method of claim 1, wherein the target smart contract is a smart contract written in the JAVA programming language.
6. An intelligent contract deployment method is applied to a block chain network and comprises the following steps:
responding to a contract deployment transaction request which is initiated by a user node and comprises a target compiling file, and acquiring a target on-chain address from the target compiling file;
determining a target contract code dependency library from available contract code dependency libraries stored on a chain according to the target on-chain address based on the mapping relation between the identification information of the contract code dependency library and the on-chain address;
and deploying the target intelligent contract according to the target contract code dependency library and the target compiling file.
7. The method of claim 6, further comprising:
and feeding back the deployment address of the deployed target intelligent contract to the user node.
8. An intelligent contract deployment device, configured at a user node, comprising:
the source code file determining module is used for determining a first source code file from the source code files of the target intelligent contract; the first original code file is a file written by referring to a target contract code dependency library in the original code file; the target contract code dependency library is stored in a block chain;
the first compiled file determining module is used for modifying the reference code line in the first original code file to obtain a first modified code file, and compiling the first modified code file to obtain a first compiled file;
the target compiled file determining module is used for determining a target compiled file of the target intelligent contract according to the first compiled file and an original compiled file of the original code file;
and the transaction request initiating module is used for initiating a contract deployment transaction request containing the target compilation file to a blockchain network so as to enable the blockchain network to deploy the target intelligent contract according to the target compilation file.
9. An intelligent contract deployment apparatus, configured in a blockchain network, comprising:
the target on-chain address determining module is used for responding to a contract deployment transaction request which is initiated by a user node and comprises a target compiling file, and acquiring a target on-chain address from the target compiling file;
the target dependent library determining module is used for determining a target contract code dependent library from available contract code dependent libraries stored on a chain according to the target on-chain address based on the mapping relation between the identification information of the contract code dependent library and the on-chain address;
and the contract deployment module is used for deploying the target intelligent contract according to the target contract code dependency library and the target compiling file.
10. An electronic device, comprising:
one or more processors;
a memory for storing one or more programs;
when executed by the one or more processors, cause the one or more processors to implement the intelligent contract deployment method of any of claims 1-7.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the intelligent contract deployment method according to any one of claims 1-7.
CN202111526552.2A 2021-12-14 2021-12-14 Intelligent contract deployment method, device, equipment and storage medium Pending CN114185556A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111526552.2A CN114185556A (en) 2021-12-14 2021-12-14 Intelligent contract deployment method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111526552.2A CN114185556A (en) 2021-12-14 2021-12-14 Intelligent contract deployment method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114185556A true CN114185556A (en) 2022-03-15

Family

ID=80604954

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111526552.2A Pending CN114185556A (en) 2021-12-14 2021-12-14 Intelligent contract deployment method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114185556A (en)

Similar Documents

Publication Publication Date Title
CN110297689B (en) Intelligent contract execution method, device, equipment and medium
US11573776B1 (en) Extensible data transformation authoring and validation system
TWI536263B (en) Projecting native application programming interfaces of an operating system into other programming languages
US20140040856A1 (en) Apparatus, Method and System for Building Software by Composition
CN107924326B (en) Overriding migration methods of updated types
US20030093420A1 (en) Method and system for retrieving sharable information using a hierarchically dependent directory structure
US10459708B2 (en) Composing a module system and a non-module system
US10078497B2 (en) Bridging a module system and a non-module system
CN110059456B (en) Code protection method, code protection device, storage medium and electronic equipment
US10303449B2 (en) Compiling non-native constants
US20220198003A1 (en) Detecting added functionality in open source package
WO2024045382A1 (en) Implementation of reflective mechanism in blockchain
CN115629971A (en) Application development system and method
CN114138281A (en) Compiling method, device, equipment and medium of software engineering
CN109558121B (en) Interface driver development method, device, equipment and storage medium
US10496433B2 (en) Modification of context saving functions
US20120011490A1 (en) Development system
US8745605B2 (en) Execution contexts with polymorphic type implementations
US10394610B2 (en) Managing split packages in a module system
CN114185556A (en) Intelligent contract deployment method, device, equipment and storage medium
US9720660B2 (en) Binary interface instrumentation
CN114579135B (en) Installation package generation method and device
CN115292254A (en) File storage method and device, medium and electronic equipment
EP3164800B1 (en) Bridging a module system and a non-module system
Palladino et al. A Crash Course on Smart Contracts

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