A blockchain smart contract deployment method, device and storage medium

By encrypting and storing smart contracts in a trusted execution environment on the blockchain, the problem of security vulnerabilities and content errors during smart contract deployment is solved, ensuring the confidentiality and integrity of smart contracts.

CN114924752BActive Publication Date: 2024-10-15INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202210598754.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-05-30
Publication Date
2024-10-15
Estimated Expiration
2042-05-30

AI Technical Summary

Technical Problem

The deployment of smart contracts on the blockchain involves the risk of security vulnerabilities and content errors. The lack of effective supervision results in the contract content being artificially modified, affecting its confidentiality and non-modifiable nature.

Method used

Verify the identity and environment of the target virtual machine by deploying nodes in the trusted execution environment, use encrypted channels to transmit smart contracts, and generate and store encrypted symmetric storage keys in the target virtual machine to ensure that smart contracts are transmitted and stored during the transmission and storage process. security and integrity.

Benefits of technology

It realizes the safe transmission and storage of smart contracts, shields the implementation logic of the contract, ensures its confidentiality and integrity, and prevents unauthorized modification and tampering.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114924752B_ABST
    Figure CN114924752B_ABST
Patent Text Reader

Abstract

The present invention relates to a blockchain smart contract deployment method, device and storage medium. In the present invention, a virtual machine running a smart contract is run in a trusted execution environment, and a user calls a smart contract through a smart contract calling interface, and can only view the smart contract calling interface, shielding the implementation logic of the smart contract, and effectively protecting the smart contract; the smart contract is deployed from the deployment node to the target virtual machine, and the process of deploying from the target virtual machine to the virtual machine is encrypted and transmitted, and the third smart contract called based on the contract address is double-encrypted; the third smart contract accessible by the interface is in ciphertext form and is encrypted by two layers, ensuring the confidentiality of the smart contract code, and the smart contract code is not easy to be modified, ensuring its integrity.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of smart contract deployment technology, and in particular to a blockchain smart contract deployment method, device and storage medium. Background Art

[0002] Blockchain is an infrastructure that stores chain data in the form of a distributed ledger with the characteristics of decentralization, immutability, traceability, and collective maintenance. It mainly includes consensus mechanisms, smart contracts, encryption algorithms, distributed storage and other technologies.

[0003] Smart contracts are middleware for blockchain applications to interact with blockchain systems. They are a set of commitments defined in digital form, including protocols on which contract participants can execute these commitments. Smart contracts can be implemented through virtual machine deployment. For example, Ethereum provides a centralized virtual machine (Ethereum Virtual Machine, EVM) to handle smart contracts on the blockchain. EVM supports the execution of multiple Turing-complete high-level languages ​​such as Sodility and LISP Like Language (LLL), providing a good infrastructure for the development of smart contracts. In the blockchain system, since smart contracts are "computer transaction protocols that execute contract terms", each node can execute data writing and reading. This will make all vulnerabilities, including security vulnerabilities, visible and may not be quickly fixed. Since each node can execute the deployment, upgrade and call of smart contracts on the chain, there are risks such as errors in contract content and artificial modification of smart contract terms due to the lack of effective supervision. Therefore, with the development of blockchain consortium chains, there is an urgent need for a standardized deployment management mechanism for smart contracts on the blockchain to ensure the confidentiality and immutability of smart contracts. Summary of the invention

[0004] In order to solve the above technical problems or at least partially solve the above technical problems, the present invention provides a blockchain smart contract deployment method, device and storage medium.

[0005] In a first aspect, the present invention provides a blockchain smart contract deployment method, comprising: after a deployment node verifies that a target virtual machine in a blockchain cluster is in a trusted execution environment, the smart contract to be deployed is encrypted by a first communication key generated by the deployment node to obtain a first smart contract, and the first smart contract is sent to the target virtual machine for deployment via a first secure channel between the deployment node and the target virtual machine: the target virtual machine decrypts the first smart contract to obtain a second smart contract and a contract address of the second smart contract, generates a symmetric storage key using the contract address of the second smart contract, encrypts the corresponding second smart contract using the symmetric storage key to obtain a third smart contract, stores the third smart contract in a file system of the target virtual machine, and establishes a mapping relationship between the contract address of the third smart contract and the second smart contract; the target virtual machine encrypts the symmetric storage key using a root key generated in the trusted execution environment and stores it;

[0006] After the target virtual machine obtains the second smart contract, it verifies that the remaining virtual machines are in a trusted execution environment, encrypts the second smart contract with the second communication key generated by the target virtual machine to obtain a fourth smart contract, and sends the fourth smart contract to the remaining virtual machines in the blockchain cluster via the second secure channel between the target virtual machine and the remaining virtual machines in the blockchain cluster for deployment. The deployment process of the fourth smart contract on the remaining virtual machines is consistent with the deployment process of the first smart contract on the target virtual machine.

[0007] Furthermore, when an old smart contract in a blockchain cluster is upgraded, the deployment node verifies that a target virtual machine in the blockchain cluster is in a trusted execution environment and that the old smart contract in the blockchain cluster is complete and legal, and then uses the third communication key generated by the deployment node to encrypt the smart contract to be upgraded to obtain a fifth smart contract;

[0008] The fifth smart contract is sent to the target virtual machine for deployment via the first secure channel between the deployment node and the target virtual machine: the target virtual machine decrypts the fifth smart contract to obtain the sixth smart contract, the target virtual machine uses the root key to decrypt the encrypted symmetric storage key of the old smart contract, and uses the decrypted symmetric storage key to encrypt the corresponding sixth smart contract to obtain the seventh smart contract, and stores the seventh smart contract in the target virtual machine file system, and establishes a mapping relationship between the contract address of the seventh smart contract and the old smart contract;

[0009] After the target virtual machine obtains the sixth smart contract, it verifies that the remaining virtual machines are in a trusted execution environment, encrypts the sixth smart contract using the fourth communication key generated by the target virtual machine to obtain an eighth smart contract, and sends the eighth smart contract to the remaining virtual machines in the blockchain cluster via the second secure channel between the target virtual machine and the remaining virtual machines in the blockchain cluster for deployment. The deployment process of the eighth smart contract on the remaining virtual machines is consistent with the deployment process of the fifth smart contract on the target virtual machine.

[0010] Furthermore, the deployment node verifies the integrity and legality of the old smart contract in the blockchain cluster: the deployment node obtains the hash value of the old contract in the virtual machine where the old smart contract is deployed in the blockchain cluster, and compares the hash value with the preset hash value reference value to see if they are consistent. If they are consistent, the integrity and legality of the old smart contract are verified.

[0011] Furthermore, the method for verifying whether the virtual machine is in a trusted execution environment is: using the first secure channel or the second secure channel to send a challenge message encrypted by a corresponding communication key to the virtual machine to be verified as being in a trusted execution environment, and the virtual machine to be verified as being in a trusted execution environment responds to the challenge message and feeds back proof information containing virtual machine environment measurement information; parsing the proof information to obtain the virtual machine environment measurement information, and judging whether the virtual machine is in a trusted execution environment based on the environment measurement information.

[0012] Furthermore, before the deployment node uses the first secure channel to send the smart contract encrypted by the corresponding communication key to the target virtual machine for deployment, the target virtual machine obtains the identity information of the deployment node, and uses the identity information to verify that the deployment node has the authority to deploy the smart contract before allowing the deployment node to send the smart contract encrypted by the corresponding communication key to the target virtual machine via the first secure channel for deployment.

[0013] Furthermore, the root key generated by each virtual machine in the blockchain cluster in the trusted execution environment is different, and the root key cannot be obtained from outside the trusted execution environment.

[0014] Furthermore, the user calls the smart contract deployed in the virtual machine through the smart contract calling interface. The request parameters passed by the smart contract calling interface include the contract address of the called smart contract, the contract method function and parameters of the called smart contract. The third smart contract or the seventh smart contract deployed in the virtual machine is obtained through the contract address, and the encrypted symmetric storage key of the third smart contract or the encrypted symmetric storage key of the seventh smart contract in the virtual machine is obtained. The encrypted symmetric storage key is decrypted using the root key of the virtual machine, and the decrypted symmetric storage key is used to decrypt the third smart contract or the seventh smart contract for execution. The smart contract calling interface returns the execution result of the called smart contract.

[0015] Furthermore, after the virtual machine verifies that the request parameters passed by the smart contract interface are legal, it calls the smart contract for execution according to the request parameters.

[0016] In a second aspect, the present invention provides a device for implementing a blockchain smart contract deployment method, comprising: at least one processing unit, a storage unit and an interface unit, wherein the processing unit, the storage unit and the interface unit are connected via a bus unit; the storage unit stores a computer program, and the processing unit reads and executes the computer program from the storage unit to implement the blockchain smart contract deployment method.

[0017] In a third aspect, the present invention provides a storage medium for implementing a blockchain smart contract deployment method, on which a computer program is stored, and the blockchain smart contract deployment method is implemented when the computer program is executed by a processor.

[0018] The above technical solution provided by the embodiment of the present invention has the following advantages compared with the prior art:

[0019] In the present invention, a virtual machine running a smart contract is run in a trusted execution environment. When a user calls a smart contract through a smart contract calling interface, he can only view the smart contract calling interface, shielding the implementation logic of the smart contract. The smart contract is deployed from the deployment node to the target virtual machine, and is encrypted and transmitted in the process of being deployed from the target virtual machine to the virtual machine, thereby ensuring the security of the smart contract during the transmission process. The target virtual machine decrypts the first smart contract to obtain the second smart contract and the contract address of the second smart contract, generates a symmetric storage key using the contract address of the second smart contract, encrypts the corresponding second smart contract using the symmetric storage key to obtain a third smart contract, stores the third smart contract in the file system of the target virtual machine, and establishes a mapping relationship between the contract address of the third smart contract and the second smart contract. The target virtual machine encrypts the symmetric storage key using the root key generated in the trusted execution environment and stores it. The third smart contract accessible by the smart contract calling interface is in ciphertext form and is encrypted by two layers, thereby ensuring the confidentiality of the smart contract code, and the smart contract code is not easily modified, thereby ensuring its integrity. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.

[0021] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0022] Figure 1 and Figure 2 A flowchart of a blockchain smart contract deployment method provided by an embodiment of the present invention;

[0023] Figure 3 and Figure 4 A flowchart of upgrading a smart contract in a blockchain smart contract deployment method is provided for an embodiment of the present invention;

[0024] Figure 5A schematic diagram of a device for implementing a blockchain smart contract deployment method is provided for an embodiment of the present invention. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0026] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0027] Example 1

[0028] An embodiment of the present invention provides a blockchain smart contract deployment method, comprising:

[0029] See also Figure 1 As shown, S1, write a smart contract and a smart contract calling class of the smart contract on the deployment node, wherein the smart contract calling class is used to build a smart contract calling interface.

[0030] S2, the deployment node generates a first communication key and establishes a first secure channel between the deployment node and a target virtual machine in the blockchain cluster.

[0031] S3, the deployment node verifies whether the target virtual machine is in a trusted execution environment. The deployment node uses the first secure channel to send a challenge message encrypted by the first communication key to the target virtual machine to be verified to be in a trusted execution environment. The target virtual machine to be verified to be in a trusted execution environment responds to the challenge message and feeds back proof information containing the target virtual machine's environmental measurement information; the proof information is parsed to obtain the target virtual machine's environmental measurement information, and based on the environmental measurement information, it is determined whether the target virtual machine is in a trusted execution environment. If the target virtual machine is in a trusted execution environment, S4 is executed, otherwise the deployment is terminated.

[0032] S4, the target virtual machine obtains the identity information of the deployment node, and uses the identity information to verify whether the deployment node has the authority to deploy smart contracts. If it has the authority to deploy smart contracts, S5 is executed, otherwise the deployment is terminated. In the specific implementation process, the deployment node sends the measurement value of the encrypted identity information to the target virtual machine. The measurement value of the identity information is obtained by processing the identity information with a hash algorithm. The target virtual machine detects the measurement value of the decrypted encrypted identity information and determines whether the measurement value of the identity information of the deployment node exists in a preset measurement value set, where the measurement value in the measurement value set is the measurement value of the identity information of the deployment node with authority. If it exists, it is determined that the target virtual machine has the authority to deploy smart contracts.

[0033] S5, the deployment node encrypts the smart contract to be deployed using the first communication key generated by the deployment node to obtain a first smart contract, where the first smart contract is a smart contract in ciphertext form.

[0034] S6: The deployment node sends the first smart contract in encrypted form to the target virtual machine via the first secure channel between the deployment node and the target virtual machine.

[0035] See also Figure 2 As shown, after the target virtual machine receives the first smart contract in ciphertext form, S7, the target virtual machine decrypts the first smart contract to obtain the second smart contract in plaintext form and obtains the contract address of the second smart contract.

[0036] S8, using the contract address of the second smart contract to generate a symmetric storage key, and using the symmetric storage key to encrypt the corresponding second smart contract to obtain a third smart contract in ciphertext form.

[0037] S9, store the third smart contract in the file system of the target virtual machine, and establish a mapping relationship between the contract address of the third smart contract and the second smart contract; the smart contract calls the interface to pass the request parameter contract address to obtain the third smart contract in ciphertext form.

[0038] S10, the target virtual machine uses the root key generated in the trusted execution environment to encrypt and store the symmetric storage key; in the specific implementation process, the root key generated by each virtual machine in the blockchain cluster in the trusted execution environment is different, and the root key cannot be obtained from outside the trusted execution environment. The symmetric storage key for decrypting the third smart contract is encrypted by the root key, realizing double-layer encryption of the third smart contract.

[0039] S11, the target virtual machine generates a second communication key, and a second secure channel is established between the target virtual machine and the other virtual machines in the blockchain cluster. After decrypting the first smart contract to obtain the second smart contract, the target virtual machine synchronously executes S11 to deploy the smart contract to other virtual machines in the blockchain cluster.

[0040] S12, the target virtual machine verifies whether the remaining virtual machines are in a trusted execution environment. Specifically, the deployment node uses the second secure channel to send a challenge message encrypted by the second communication key to the virtual machine to be verified to be in a trusted execution environment, and the virtual machine to be verified to be in a trusted execution environment responds to the challenge message and feeds back proof information containing virtual machine environment measurement information; the proof information is parsed to obtain virtual machine environment measurement information, and the environment measurement information is calculated by the virtual machine environment information through a hash algorithm, and whether the virtual machine is in a trusted execution environment is determined based on the environment measurement information. If the virtual machine is in a trusted execution environment, S13 is executed, otherwise the deployment is terminated.

[0041] S13, the target virtual machine encrypts the second smart contract with the second communication key generated by the target virtual machine to obtain a fourth smart contract.

[0042] S14, the target virtual machine sends the fourth smart contract to the remaining virtual machines in the blockchain cluster for deployment via the second secure channel between the target virtual machine and the remaining virtual machines in the blockchain cluster. The deployment process of the fourth smart contract on the remaining virtual machines is consistent with the deployment process of the first smart contract on the target virtual machine.

[0043] See also Figure 2 As shown, when the old smart contract in the blockchain cluster is upgraded, the blockchain smart contract deployment method includes:

[0044] See also Figure 3 As shown, S101, write an upgraded smart contract on the deployment node.

[0045] S102, the deployment node generates a third communication key and establishes a first secure channel between the deployment node and a target virtual machine in the blockchain cluster.

[0046] S103, the deployment node verifies whether the target virtual machine is in a trusted execution environment. The deployment node uses the first secure channel to send a challenge message encrypted by the third communication key to the target virtual machine to be verified to be in a trusted execution environment. The target virtual machine to be verified to be in a trusted execution environment responds to the challenge message and feeds back proof information containing the target virtual machine's environmental measurement information; the proof information is parsed to obtain the target virtual machine's environmental measurement information, and based on the environmental measurement information, it is determined whether the target virtual machine is in a trusted execution environment. If the target virtual machine is in a trusted execution environment, S4 is executed, otherwise the deployment is terminated.

[0047] S104, the deployment node verifies whether the old smart contract in the blockchain cluster is complete and legal. Specifically, the deployment node obtains the hash value of the old contract in the virtual machine where the old smart contract is deployed in the blockchain cluster, and compares the hash value with the preset hash value reference value to see if they are consistent. If they are consistent, the old smart contract is verified to be complete and legal. If the old smart contract is complete and legal, S105 is executed, otherwise the deployment is terminated.

[0048] S105, the target virtual machine obtains the identity information of the deployment node, and uses the identity information to verify whether the deployment node has the authority to deploy the smart contract. If it has the authority to deploy the smart contract, S106 is executed, otherwise the deployment is terminated.

[0049] S106, using the third communication key generated by the deployment node to encrypt the smart contract to be upgraded to obtain a fifth smart contract, where the fifth smart contract is a smart contract in ciphertext form.

[0050] S107, the deployment node sends the fifth smart contract in encrypted form to the target virtual machine via the first secure channel between the deployment node and the target virtual machine.

[0051] See also Figure 4 As shown, after the target virtual machine receives the fifth smart contract in ciphertext form, S108, the target virtual machine decrypts the fifth smart contract to obtain a sixth smart contract in plaintext form.

[0052] S109, the target virtual machine uses the root key to decrypt the encrypted symmetric storage key of the old smart contract, and uses the decrypted symmetric storage key to encrypt the corresponding sixth smart contract to obtain the seventh smart contract.

[0053] S110, store the seventh smart contract in the target virtual machine file system, and establish a mapping relationship between the contract address of the seventh smart contract and the old smart contract; the smart contract calls the interface to pass the request parameter contract address to obtain the seventh smart contract in ciphertext form.

[0054] S111, the target virtual machine generates a fourth communication key, and a second secure channel is established between the target virtual machine and the remaining virtual machines in the blockchain cluster. After decrypting the fifth smart contract to obtain the sixth smart contract, the target virtual machine synchronously executes S111 to deploy the smart contract to other virtual machines in the blockchain cluster.

[0055] S112, the target virtual machine verifies whether the remaining virtual machines are in a trusted execution environment. Specifically, the deployment node uses the second secure channel to send a challenge message encrypted by the fourth communication key to the virtual machine to be verified to be in a trusted execution environment, and the virtual machine to be verified to be in a trusted execution environment responds to the challenge message and feeds back proof information containing virtual machine environment measurement information; the proof information is parsed to obtain the virtual machine environment measurement information, and whether the virtual machine is in a trusted execution environment is determined based on the environment measurement information. If the virtual machine is in a trusted execution environment, S113 is executed, otherwise the deployment is terminated.

[0056] S113, the target virtual machine encrypts the sixth smart contract with the fourth communication key generated by the target virtual machine to obtain an eighth smart contract.

[0057] S114, the target virtual machine sends the eighth smart contract to the remaining virtual machines in the blockchain cluster for deployment via the second secure channel between the target virtual machine and the remaining virtual machines in the blockchain cluster. The deployment process of the eighth smart contract on the remaining virtual machines is consistent with the deployment process of the fifth smart contract on the target virtual machine.

[0058] The user terminal communicates with the virtual machine in the blockchain cluster. The user calls the smart contract deployed in the virtual machine through the smart contract calling interface. The request parameters passed by the smart contract calling interface include the contract address of the called smart contract, the contract method function and parameters of the called smart contract. After the virtual machine verifies that the request parameters passed by the user through the smart contract interface are legal, it calls the smart contract for execution according to the request parameters. The virtual machine obtains the third smart contract or the seventh smart contract deployed in the virtual machine through the contract address, obtains the encrypted symmetric storage key of the third smart contract or the encrypted symmetric storage key of the seventh smart contract in the virtual machine, and uses the root key of the virtual machine to decrypt the encrypted symmetric storage key, and uses the decrypted symmetric storage key to decrypt the third smart contract or the seventh smart contract for execution. The smart contract calling interface returns the execution result of the called smart contract to the user.

[0059] Example 2

[0060] See also Figure 5 As shown, the present invention provides a device for implementing a blockchain smart contract deployment method, comprising: at least one processing unit, a storage unit and an interface unit, wherein the processing unit, the storage unit and the interface unit are connected via a bus unit; the storage unit stores a computer program, and the processing unit reads and executes the computer program from the storage unit to implement the blockchain smart contract deployment method. Through the interface unit, a secure channel with nodes in a blockchain cluster can be constructed.

[0061] Example 3

[0062] An embodiment of the present invention provides a storage medium for implementing a blockchain smart contract deployment method, on which a computer program is stored. When the computer program is executed by a processor, the blockchain smart contract deployment method is implemented.

[0063] In the present invention, a virtual machine running a smart contract is run in a trusted execution environment. When a user calls a smart contract through a smart contract calling interface, he can only view the smart contract calling interface, shielding the implementation logic of the smart contract. The smart contract is deployed from the deployment node to the target virtual machine, and is encrypted and transmitted in the process of being deployed from the target virtual machine to the virtual machine, thereby ensuring the security of the smart contract during the transmission process. The target virtual machine decrypts the first smart contract to obtain the second smart contract and the contract address of the second smart contract, generates a symmetric storage key using the contract address of the second smart contract, encrypts the corresponding second smart contract using the symmetric storage key to obtain a third smart contract, stores the third smart contract in the file system of the target virtual machine, and establishes a mapping relationship between the contract address of the third smart contract and the second smart contract. The target virtual machine encrypts the symmetric storage key using the root key generated in the trusted execution environment and stores it. The third smart contract accessible by the smart contract calling interface is in ciphertext form and is encrypted by two layers, thereby ensuring the confidentiality of the smart contract code, and the smart contract code is not easily modified, thereby ensuring its integrity.

[0064] In the embodiments provided by the present invention, it should be understood that the disclosed structures or methods can be implemented in other ways. For example, the structural embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, structures or units, which can be electrical, mechanical or other forms.

[0065] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0066] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0067] The foregoing is merely a specific embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Therefore, the present invention will not be limited to the embodiments shown herein, but rather to the widest scope consistent with the principles and novel features claimed herein.

Claims

1. A blockchain smart contract deployment method, characterized in that: include: After the deployment node verifies that a target virtual machine in the blockchain cluster is in a trusted execution environment, the deployment node encrypts the smart contract to be deployed using the first communication key generated by the deployment node to obtain a first smart contract, and sends the first smart contract to the target virtual machine for deployment via the first secure channel between the deployment node and the target virtual machine: wherein the method of verifying whether the virtual machine is in the trusted execution environment is: using the first secure channel or the second secure channel to send a challenge message encrypted by the corresponding communication key to the virtual machine to be verified to be in the trusted execution environment, and the virtual machine to be verified to be in the trusted execution environment responds to the challenge message and feeds back proof information containing virtual machine environment measurement information; parsing the proof information to obtain virtual machine environment measurement information, and judging whether the virtual machine is in the trusted execution environment based on the environment measurement information; The target virtual machine decrypts the first smart contract to obtain the second smart contract and the contract address of the second smart contract, generates a symmetric storage key using the contract address of the second smart contract, encrypts the corresponding second smart contract using the symmetric storage key to obtain a third smart contract, stores the third smart contract in the file system of the target virtual machine, and establishes a mapping relationship between the contract address of the third smart contract and the second smart contract; the target virtual machine encrypts the symmetric storage key using the root key generated in the trusted execution environment and stores it; After the target virtual machine obtains the second smart contract, it verifies that the remaining virtual machines are in a trusted execution environment, encrypts the second smart contract with the second communication key generated by the target virtual machine to obtain a fourth smart contract, and sends the fourth smart contract to the remaining virtual machines in the blockchain cluster via the second secure channel between the target virtual machine and the remaining virtual machines in the blockchain cluster for deployment. The deployment process of the fourth smart contract on the remaining virtual machines is consistent with the deployment process of the first smart contract on the target virtual machine.

2. The blockchain smart contract deployment method according to claim 1, characterized in that: When an old smart contract in a blockchain cluster is upgraded, the deployment node verifies that a target virtual machine in the blockchain cluster is in a trusted execution environment and that the old smart contract in the blockchain cluster is complete and legal, and then uses the third communication key generated by the deployment node to encrypt the smart contract to be upgraded to obtain a fifth smart contract; The fifth smart contract is sent to the target virtual machine for deployment via the first secure channel between the deployment node and the target virtual machine: the target virtual machine decrypts the fifth smart contract to obtain the sixth smart contract, the target virtual machine uses the root key to decrypt the encrypted symmetric storage key of the old smart contract, and uses the decrypted symmetric storage key to encrypt the corresponding sixth smart contract to obtain the seventh smart contract, and stores the seventh smart contract in the target virtual machine file system, and establishes a mapping relationship between the contract address of the seventh smart contract and the old smart contract; After the target virtual machine obtains the sixth smart contract, it verifies that the remaining virtual machines are in a trusted execution environment, encrypts the sixth smart contract using the fourth communication key generated by the target virtual machine to obtain an eighth smart contract, and sends the eighth smart contract to the remaining virtual machines in the blockchain cluster via the second secure channel between the target virtual machine and the remaining virtual machines in the blockchain cluster for deployment. The deployment process of the eighth smart contract on the remaining virtual machines is consistent with the deployment process of the fifth smart contract on the target virtual machine.

3. The blockchain smart contract deployment method according to claim 2, characterized in that: The process of deploying nodes to verify the integrity and legality of old smart contracts in the blockchain cluster: the deployment node obtains the hash value of the old contract in the virtual machine where the old smart contract is deployed in the blockchain cluster, and compares the hash value with the preset hash value reference value to see if they are consistent. If they are consistent, the integrity and legality of the old smart contract are verified.

4. The blockchain smart contract deployment method according to claim 1 or 2, characterized in that: Before the deployment node uses the first secure channel to send the smart contract encrypted by the corresponding communication key to the target virtual machine for deployment, the target virtual machine obtains the identity information of the deployment node, and uses the identity information to verify that the deployment node has the authority to deploy the smart contract before allowing the deployment node to send the smart contract encrypted by the corresponding communication key to the target virtual machine for deployment via the first secure channel.

5. The blockchain smart contract deployment method according to claim 1, characterized in that: The root key generated by each virtual machine in the blockchain cluster in the trusted execution environment is different, and the root key cannot be obtained from outside the trusted execution environment.

6. The blockchain smart contract deployment method according to claim 1, characterized in that: The user calls the smart contract deployed in the virtual machine through the smart contract calling interface. The request parameters passed by the smart contract calling interface include the contract address of the called smart contract, the contract method function and parameters of the called smart contract. The third smart contract or the seventh smart contract deployed in the virtual machine is obtained through the contract address, and the encrypted symmetric storage key of the third smart contract or the encrypted symmetric storage key of the seventh smart contract in the virtual machine is obtained. The encrypted symmetric storage key is decrypted using the root key of the virtual machine, and the decrypted symmetric storage key is used to decrypt the third smart contract or the seventh smart contract for execution. The smart contract calling interface returns the execution result of the called smart contract.

7. The blockchain smart contract deployment method according to claim 6, characterized in that: After the virtual machine verifies that the request parameters passed by the smart contract interface are legal, it calls the smart contract for execution according to the request parameters.

8. A device for implementing a blockchain smart contract deployment method, characterized in that: include: At least one processing unit, a storage unit and an interface unit, wherein the processing unit, the storage unit and the interface unit are connected via a bus unit; the storage unit stores a computer program, and the processing unit reads and executes the computer program from the storage unit to implement any blockchain smart contract deployment method as claimed in claims 1-7.

9. A storage medium for implementing a blockchain smart contract deployment method, on which a computer program is stored, characterized in that: When the computer program is executed by a processor, it implements the blockchain smart contract deployment method as claimed in any one of claims 1 to 7.