WO2020199177A1 - Method and apparatus for running smart contract - Google Patents

Method and apparatus for running smart contract Download PDF

Info

Publication number
WO2020199177A1
WO2020199177A1 PCT/CN2019/081423 CN2019081423W WO2020199177A1 WO 2020199177 A1 WO2020199177 A1 WO 2020199177A1 CN 2019081423 W CN2019081423 W CN 2019081423W WO 2020199177 A1 WO2020199177 A1 WO 2020199177A1
Authority
WO
WIPO (PCT)
Prior art keywords
smart contract
execution environment
smart
crl
running
Prior art date
Application number
PCT/CN2019/081423
Other languages
French (fr)
Chinese (zh)
Inventor
谢美伦
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to PCT/CN2019/081423 priority Critical patent/WO2020199177A1/en
Priority to CN201980054120.0A priority patent/CN112567414A/en
Publication of WO2020199177A1 publication Critical patent/WO2020199177A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof

Definitions

  • This application relates to the field of blockchain technology, and more specifically, to a method and device for running smart contracts.
  • Blockchain is a new application model of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain technology can solve the problems of high trust cost and risk of centralization.
  • Ethereum is an open source public blockchain platform with smart contract functions. It provides a decentralized virtual machine through its dedicated cryptocurrency Ether to process point-to-point smart contracts, becoming the blockchain 2.0 representative.
  • a smart contract is a collection of code and data, and can also be called a "programmable contract”.
  • smart contracts are defined by program coding and preset operating conditions; when the operating conditions are triggered, the behavior is executed.
  • the "intelligence" is the execution intelligence, that is, if a certain preset condition is reached, the contract will run automatically.
  • the security of smart contracts in the blockchain completely depends on the security mechanism of the host's Linux/Windows system.
  • the present application provides a method and device for running a smart contract.
  • the method provides an execution environment that meets the security level for the smart contract, thereby improving the security of the smart contract during operation.
  • a device for running a smart contract can be applied to a blockchain network and includes an acquisition module and a processing module.
  • the acquisition module is used to obtain a smart contract that has a security level requirement;
  • a processing module is used to configure an execution environment for the smart contract that meets the requirements according to predefined rules;
  • the processing module is also used to Run the smart contract in the execution environment.
  • the smart contract running device provides different security levels of execution environments for smart contracts, so that when configuring the execution environment for the smart contract, the smart contract can be configured to meet its requirements for the execution environment according to predefined rules.
  • the execution environment required by the security level and then the smart contract is run in the execution environment, thereby improving the security of the smart contract runtime.
  • a system on chip can be configured in a blockchain node.
  • the SoC can provide at least one execution environment of Trustzone, Bowmore, or SEE formed by eSE or inSE. Trustzone or Bowmore The execution environment is called trusted execution environment (TEE), and the execution environment corresponding to eSE or inSE is called secure execution environment (SEE).
  • TEE trusted execution environment
  • SEE secure execution environment
  • the SoC can also provide a rich execution environment (rich execution environment). environment, REE).
  • the safety level of SEE is higher than that of TEE
  • the safety level of TEE is higher than that of REE.
  • the predefined rules include: different types of smart contracts correspond to execution environments of different security levels.
  • the security level of the execution environment that can be configured for financial-level smart contracts is higher than the security level of the execution environment configured for system-level smart contracts, and the execution environment configured for system-level smart contracts
  • the security level of is higher than the security level of the execution environment configured for ordinary smart contracts.
  • the execution environment configured for the smart contract meets the requirements of the smart contract for the security level of the execution environment, and then the smart contract is run in the execution environment , Thereby improving the security of smart contract runtime.
  • the smart contract has undergone an encryption operation
  • the processing module is further used to perform a decryption operation on the smart contract in the execution environment.
  • the provider of the smart contract can encrypt the binary file of the smart contract after generating the binary file of the smart contract.
  • the blockchain node Before the blockchain node runs the binary file of the smart contract, it first needs to decrypt the binary file of the smart contract, and the binary file of the smart contract obtained after running the decryption operation.
  • the smart contract has undergone a signature operation
  • the processing module is further used to perform a verification signature operation on the smart contract in the execution environment.
  • a public key infrastructure (PKI) system can be used to The smart contract performs the signature operation.
  • PKI public key infrastructure
  • the blockchain node needs to verify the smart contract before running the smart contract. Only when the blockchain node passes the verification of the signed smart contract, the blockchain node Only then will the binary file of the smart contract be run to manage whether to run the smart contract.
  • the obtaining module is also used to: obtain a certificate revocation list CRL, in which the relevant information of the smart contract that has been revoked is stored in the CRL; the processing module is also used to: terminate according to the CRL Run the smart contract.
  • the relevant information of the revoked smart contract is added to the certificate revocation In the certificate revocation list (CRL), the blockchain node can determine whether to stop running the smart contract according to whether the CRL includes relevant information about a certain smart contract, so as to manage whether to stop running the smart contract.
  • CRL certificate revocation list
  • the related information of the smart contract includes the serial number and revocation time of the certificate of the smart contract that has been revoked.
  • the CRL is stored in at least one of a replay protection memory block RPMB, an electrically programmable fuse Efuse module, or a one-time programmable OTP memory.
  • the CRL is stored in a safer storage area.
  • the processing module is also used to encrypt the private data generated in the blockchain using homomorphic encryption technology or zero-knowledge proof technology.
  • the operator used is a hardened Pairing operator.
  • the operator used is a hardened Pairing operator, thereby improving the performance of the encryption service.
  • the predefined rule includes at least one of the following: ordinary-level smart contracts correspond to rich execution environment REE; or, system-level smart contracts correspond to trusted execution environment TEE; or, financial-level smart contracts correspond to security Execution environment SEE.
  • a method for running a smart contract is provided.
  • the method can be applied to a blockchain network.
  • the method is executed by any blockchain node in the blockchain network, including: obtaining a smart contract, the smart The contract has a security level requirement; according to predefined rules, the smart contract is configured with an execution environment that meets the requirements; the smart contract is run in the execution environment.
  • the smart contract is configured with an execution environment that meets its security level requirements for the execution environment according to predefined rules, and then the smart contract is run in the execution environment, thereby improving the security of the smart contract during operation.
  • the predefined rules include: different types of smart contracts correspond to execution environments of different security levels.
  • the security level of the execution environment that can be configured for financial-level smart contracts is higher than the security level of the execution environment configured for system-level smart contracts, and the execution environment configured for system-level smart contracts
  • the security level of is higher than the security level of the execution environment configured for ordinary smart contracts.
  • the execution environment configured for the smart contract meets the requirements of the smart contract for the security level of the execution environment, and then the smart contract is run in the execution environment , Thereby improving the security of smart contract runtime.
  • the smart contract has undergone an encryption operation
  • the method further includes: performing a decryption operation on the smart contract in the execution environment before running the smart contract in the execution environment.
  • the smart contract provider can encrypt the smart contract’s binary file after generating the smart contract’s binary file.
  • the blockchain node before the blockchain node runs the binary file of the smart contract, it first needs to decrypt the binary file of the smart contract, and the binary file of the smart contract obtained after the decryption operation is run.
  • the smart contract has undergone a signature operation
  • the method further includes: performing a verification signature operation on the smart contract in the execution environment before running the smart contract in the execution environment.
  • a public key infrastructure (PKI) system can be used to The smart contract performs the signature operation.
  • PKI public key infrastructure
  • the blockchain node needs to verify the smart contract before running the smart contract. Only when the blockchain node passes the verification of the signed smart contract, the blockchain node Only then will the binary file of the smart contract be run to manage whether to run the smart contract.
  • the method further includes: obtaining a certificate revocation list CRL, in which the relevant information of the smart contract that has been revoked is stored in the CRL; and terminating the operation of the smart contract according to the CRL.
  • the relevant information of the revoked smart contract is added to the certificate revocation In the certificate revocation list (CRL), the blockchain node can determine whether to stop running the smart contract according to whether the CRL includes relevant information about a certain smart contract, so as to manage whether to stop running the smart contract.
  • CRL certificate revocation list
  • the relevant information of the smart contract includes the serial number and revocation time of the certificate of the smart contract that has been revoked.
  • the CRL is stored in a replay protected memory block (RPMB), an electrically programmable fuse Efuse module, or one-time programmable (OTP).
  • RPMB replay protected memory block
  • OTP one-time programmable
  • the CRL is stored in the RPMB, Efuse module or OTP memory, so that the CRL is stored in at least one of the safer storage areas.
  • the method further includes: using homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain.
  • the operator used is a hardened Pairing operator.
  • the operator used is a hardened Pairing operator, thereby improving the performance of the encryption service.
  • the predefined rule execution environment includes at least one of the following:
  • Ordinary-level smart contracts correspond to the rich execution environment REE; or, system-level smart contracts correspond to the trusted execution environment TEE; or, financial-level smart contracts correspond to the secure execution environment SEE.
  • a device for running a smart contract can be applied to a blockchain network.
  • the device includes: a memory for storing programs; a processor for executing programs stored in the memory.
  • the processor is used to execute the method in the first aspect or each implementation manner of the first aspect.
  • the processor includes CPU and SE.
  • CPU is used to form TEE and REE
  • SE is used to form SEE.
  • a computer-readable medium stores program code for device execution, and the program code includes a method for executing the first aspect or each implementation manner of the first aspect.
  • a computer program product containing instructions is provided.
  • the computer program product runs on a computer, the computer executes the method in the first aspect or the implementation manners of the first aspect.
  • a device for running a smart contract is provided.
  • the device can be applied to a blockchain network.
  • the device includes a CPU and an SE, and is used to jointly execute the method in the first aspect or the implementation manners of the first aspect.
  • Figure 1 is a schematic block diagram of a system architecture applicable to the present application
  • Figure 2 is a schematic flow chart of the method for running a smart contract provided by the present application
  • FIG. 3 is a simplified schematic diagram of a software system architecture provided by an embodiment of the present application.
  • FIG. 4 is a schematic block diagram of a device for running a smart contract provided by an embodiment of the application
  • Fig. 5 is another schematic block diagram of a device for running a smart contract provided by an embodiment of the application.
  • the provider of a smart contract can be a person or unit that has the right to allow others to use the smart contract.
  • the provider of a smart contract can be the author of the smart contract.
  • Smart contract is a concept in the blockchain. It is a computer protocol that spreads, verifies, or executes the contract in an informatized manner, or a set of commitments defined in digital form, including an agreement on which contract participants can execute these commitments .
  • the management center can be a hairstyle platform for smart contracts.
  • the provider of the smart contract can publish and license the smart contract in the management center, and the user can browse, view, and download the smart contract in the management center.
  • the network architecture shown in FIG. 1 includes a smart contract provider 110, a management center 120, a subscriber 130, and a blockchain network 140.
  • the blockchain network includes multiple blockchain nodes, for example, the blockchain network 140 Including blockchain nodes 1401, 1402 and 1403.
  • the provider 110 of the smart contract can provide an installable smart contract to the management center 120, and the provider 110 of the smart contract has the right to allow others to obtain the smart contract.
  • the provider 110 of the smart contract can obtain permission from the author of the smart contract. Others obtain the right of their smart contract, so that the smart contract provider 110 has the right to allow others to use the smart contract.
  • the user 130 can install a smart contract for a specific blockchain node through the management center 120.
  • the communication in the system architecture and the communication between the smart contract provider 110, the user 130 and the management center 120 can be based on any wired and/or wireless network, including but not limited to the Internet, wide area network, city Local area network, local area network, virtual private network, etc.
  • each blockchain node in the blockchain network 140 may be an electronic device, for example, it may be a fixed device or a mobile device, where the fixed device may be, for example, a server or a desktop computer, or a mobile device.
  • the fixed device may be, for example, a server or a desktop computer, or a mobile device.
  • it can be a smart phone, a tablet computer, a portable computer, etc.
  • FIG. 2 shows a schematic flowchart of the method 200 for running a smart contract provided by an embodiment of the present application.
  • the method includes at least steps 201 to 203.
  • Step 201 Obtain a smart contract, which has a security level requirement, that is, a security requirement.
  • the security requirement can be built into the device in the form of parameters, specifically in the cache or storage unit of the device, or the security requirement of the smart contract can be carried in the smart contract so that the device can obtain the security requirement.
  • the parameter built into the device may be a lookup table. After the acquired smart contract is acquired by the device, the security requirements corresponding to the smart contract can be found through the lookup table.
  • obtaining a smart contract can be considered as Aberco’s obtaining the basic information and parameters of the smart contract, that is, the type, application scenario, function, version or some other basic parameters of the contract.
  • obtaining the smart contract may include directly obtaining the security requirements.
  • obtaining a smart contract may also include obtaining a complete smart contract, for example, directly obtaining a smart contract issued by a smart contract provider or a management center.
  • Step 202 Configure an execution environment that meets the requirement for the smart contract according to a predefined rule.
  • Step 203 Run the smart contract in the execution environment.
  • the foregoing execution environment may include a rich execution environment (REE), a trusted execution environment (TEE), and a secure execution environment (SEE).
  • REE rich execution environment
  • TEE trusted execution environment
  • SEE secure execution environment
  • the safety level of SEE is higher than that of TEE
  • the safety level of TEE is higher than that of REE.
  • an execution environment can be configured for the smart contract in the blockchain node according to predefined rules, and the execution environment meets the requirements of the smart contract for the security level of the execution environment.
  • a higher security execution environment for example, REE
  • REE can be configured for the smart contracts in the blockchain nodes according to predefined rules.
  • the predefined rules may include: different types of smart contracts correspond to execution environments of different security levels. Under normal circumstances, different types of smart contracts have different requirements for the security level of the execution environment. For example, the security level of the execution environment of the financial-level smart contract is usually higher than that of the system-level smart contract. Requirements, the security level of the execution environment of the system-level smart contract is usually higher than the security level of the execution environment of the ordinary smart contract. In other words, if the security level of the execution environment configured for the financial-level smart contract is low, the execution environment may not be able to guarantee the security during the operation of the financial-level smart contract.
  • the security level of the execution environment that can be configured for financial-level smart contracts is higher than the security level of the execution environment configured for system-level smart contracts, which is the execution environment configured for system-level smart contracts
  • the security level of is higher than the security level of the execution environment configured for ordinary smart contracts.
  • TEE can be configured as the execution environment for system-level smart contracts
  • SEE as the execution environment for financial-level smart contracts
  • REE as the execution environment for ordinary-level smart contracts.
  • a system on chip SoC
  • SoC system on chip
  • TEE The execution environment of Trustzone or Bowmore is called TEE
  • SEE the execution environment corresponding to eSE or inSE
  • the SoC can be configured in the smart phone, and the smart phone provides at least one of the execution environments of Trustzone, Bowmore, or SEE formed by eSE or inSE through the SoC.
  • the foregoing SoC may support running an instruction set based on an advanced RISC machine (ARM) architecture, and an SoC that supports running an instruction set based on the ARM architecture is called an ARM-based SoC.
  • ARM advanced RISC machine
  • Figure 3 shows a simplified schematic diagram of the three-tier security architecture of REE+TEE+SEE, where REE is a rich execution environment, running security-insensitive programs and storing security-insensitive data, and there are certain security risks; TEE is trusted execution Environment, run security-sensitive programs and save security-sensitive data, provide a certain level of security isolation, SEE is a secure execution environment, run high security programs such as financial payments and save high security data such as financial payments, and provide a higher level of security isolation.
  • the aforementioned secure execution environment can be used as the SEE layer in the software system architecture in FIG. 3.
  • the trusted execution environment and the general operating system software environment (such as the Android system environment) respectively serve as the TEE layer and the REE layer in the software system architecture in FIG. 3.
  • There are two independent software systems between the trusted execution environment and the general operating system software and there is security isolation, and the security isolation is very good.
  • General operating system software and running programs of general application software based on the operating system cannot freely access the trusted execution environment.
  • the trusted execution environment can exchange data with the secure execution environment.
  • the aforementioned ordinary application software may include various non-secure payment-related software, such as instant messaging software, games, office software, e-book software, or audio and video streaming media players.
  • the blockchain node 1401 can be a smart contract according to the type of the smart contract.
  • Contract configuration execution environment For example, when the smart contract is a system-level smart contract, the blockchain node 1401 can configure TEE as the execution environment of the smart contract; or, when the smart contract is a financial-level smart contract, the blockchain node 1401 can configure the SEE as The execution environment of the smart contract.
  • the blockchain node 1401 runs the smart contract in the execution environment configured for the smart contract.
  • what the user 130 obtains from the management center 120 may be the binary file of the smart contract, that is, the smart contract provider 110 is in
  • the source code of the smart contract can be compiled to generate the binary file of the smart contract, and the binary file of the smart contract is provided to the management center 120, so that the user 130 can obtain it from the management center 120 Is the binary file of the smart contract.
  • the blockchain node 1401 is running the binary file of the smart contract in the execution environment configured for the smart contract.
  • the provider 110 of the smart contract may use the key pair negotiated with the blockchain network after generating the binary file of the smart contract.
  • the binary file of the contract is encrypted.
  • the blockchain node 1401 first needs to decrypt the binary file of the smart contract before running the binary file of the smart contract.
  • the binary file of the smart contract obtained after running the decryption operation.
  • the method 200 may further include: decrypting the smart contract in the execution environment.
  • the complete life cycle of the smart contract includes deployment, storage, operation, and shutdown.
  • the public key infrastructure (PKI) system is used to compare the smart contract. Carry out signature operations, verification operations, and revocation operations to realize the complete life cycle management of smart contracts.
  • the provider 110 of the smart contract may perform a signature operation on the binary file of the smart contract after generating the binary file of the smart contract.
  • the blockchain node 1401 first needs to check the binary file of the smart contract before deploying, storing and running the binary file of the smart contract.
  • the blockchain node 1401 will deploy, store and run the smart contract only when the blockchain node 1401 passes the verification of the smart contract that has been signed.
  • the method 200 may further include: verifying and signing the smart contract in the execution environment.
  • the provider 110 of the smart contract can encrypt the binary file of the smart contract. After the encryption operation is completed, the smart contract The provider 110 can sign the binary file of the encrypted smart contract.
  • the blockchain node 1401 passes the verification of the smart contract that has undergone the signature operation, before running the binary file of the smart contract, it first needs to decrypt the binary file of the smart contract that has passed the verification, and finally run The binary file of the smart contract obtained after the decryption operation.
  • a device for example, a server for storing a certificate revocation list (CRL) can be deployed in the cloud to determine whether the smart contract has been revoked To manage. For example, when a certain smart contract has a problem or the latest version of the smart contract exists, the device can add the relevant information of the smart contract to the CRL, which means that the smart contract has been revoked.
  • CRL certificate revocation list
  • the blockchain node 1401 Before running the smart contract, the blockchain node 1401 can determine whether the relevant information of the smart contract is stored in the CRL. If the relevant information of the smart contract is included in the CRL, the blockchain node 1401 will stop running the smart contract. At this point, the method 200 may further include: obtaining a CRL; determining whether to terminate the operation of the smart contract according to the CRL, and the CRL stores relevant information of the revoked smart contract; if the CRL includes the relevant information of the smart contract To terminate the operation of the smart contract.
  • the CRL can be stored in the blockchain node 1401, and the blockchain node 1401 can obtain the CRL from the device storing the CRL by polling, and store the obtained CRL locally, or the blockchain node 1401 It can also receive the CRL sent by the device storing the CRL, and store the obtained CRL locally.
  • the blockchain node 1401 can store the CRL in a safer local storage area.
  • the storage area may include replay protected memory block (RPMB) and electrically programmable Fuse Efuse module or one-time programmable (OTP) memory.
  • RPMB replay protected memory block
  • OTP one-time programmable
  • the related information of the smart contract stored in the CRL may be the serial number and revocation time of the certificate of the smart contract, where the serial number of the certificate of the smart contract may be allocated by the management center 120 for the smart contract.
  • the method 200 may further include: using homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain.
  • homomorphic encryption technology or zero-knowledge proof technology can be used to encrypt the private data generated in the blockchain, and the private data generated in the blockchain can be encrypted.
  • the private key used can be generated in the SEE environment.
  • the operator for example, the pairing operator used when encrypting the private data generated in the blockchain can be hardened, that is, the operator can be passed through the hardware To achieve, thereby improving the performance of encryption services.
  • the program that calls the above-mentioned operator can be configured to run in an execution environment with higher security.
  • the program that calls the aforementioned operator can be configured to run in the TEE or SEE.
  • the device 300 for running a smart contract can be applied to the blockchain network 140 and includes an acquisition module 301 and a processing module 302.
  • the obtaining module 301 is used to obtain a smart contract, which has a security level requirement.
  • the processing module 302 is configured to provide an execution environment for the smart contract to meet the requirements according to predefined rules.
  • the processing module 302 is also used to run the smart contract in the execution environment.
  • the predefined rules include: different types of smart contracts correspond to execution environments of different security levels.
  • the smart contract has undergone an encryption operation
  • the processing module 302 is further configured to perform a decryption operation on the smart contract in the execution environment.
  • the smart contract has undergone a signature operation
  • the processing module 302 is further configured to perform a verification signature operation on the smart contract in the execution environment.
  • the acquisition module 301 is also used to: obtain a certificate revocation list CRL, in which the relevant information of the smart contract that has been revoked is stored; the processing module 302 is also used to: terminate the operation of the smart contract according to the CRL contract.
  • the related information of the smart contract includes the serial number and revocation time of the certificate of the smart contract that has been revoked.
  • the CRL is stored in at least one of a replay protection memory block RPMB, an electrically programmable fuse Efuse module, or a one-time programmable OTP memory.
  • processing module 302 is further configured to use homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain.
  • the private key used when encrypting the private data generated in the blockchain may be generated in the execution environment provided by the SE.
  • the used operator is a hardened Pairing operator.
  • the predefined rule includes at least one of the following: ordinary-level smart contracts correspond to rich execution environment REE; or, system-level smart contracts correspond to trusted execution environment TEE; or, financial-level smart contracts correspond to secure execution environment SEE.
  • the above-mentioned functions of the device 300 for running a smart contract in the embodiment of the present application can be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD).
  • the PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof.
  • the method of running a smart contract shown in FIG. 2 can also be implemented through software.
  • the device-side device 300 that runs the smart contract and its various modules may also be software modules.
  • the device 300 for running a smart contract may correspond to the method described in the embodiment of the present application, and the above-mentioned and other operations and/or functions of each unit in the device 300 for running the smart contract are intended to realize the For the sake of brevity, the corresponding process executed by the blockchain node in the method shown here will not be repeated here.
  • FIG. 5 is a schematic block diagram of a device 400 for running a smart contract provided by an embodiment of the application.
  • the device 400 for running a smart contract includes a processor 401, a memory 402, a communication interface 403, and a bus 404.
  • the processor 401, the memory 402, and the communication interface 403 communicate through the bus 404, and may also communicate through other means such as wireless transmission.
  • the memory 402 is used to store instructions, and the processor 401 is used to execute instructions stored in the memory 402.
  • the memory 402 stores program code 4021, and the processor 401 can call the program code 4021 stored in the memory 402 to execute the method for running a smart contract shown in FIG. 2.
  • the processor 401 may be built into the SoC; or, the device 400 for running the smart contract includes the processor 401 and another independent SoC (not shown in the figure).
  • the device 400 running the smart contract provides at least one of the execution environments of Trustzone, Bowmore, or SEE formed by eSE or inSE through the SoC.
  • the processor 401 is configured to call the communication interface 403 to perform the following actions: obtain a smart contract, which has a security level requirement.
  • the processor 401 is further configured to configure an execution environment that meets the requirements for the smart contract according to predefined rules.
  • the processor 401 is also used to run the smart contract in the execution environment.
  • the processor 401 may include various types of processors, such as a CPU and a secure element (SE), where the CPU runs necessary software, for example, the CPU runs TEE software to form a Trustzone or Bowmore environment, and the SE runs necessary security software to form a SEE.
  • the CPU can also run a general operating system, such as Android/Windows to form a REE.
  • the processor 401 may also include other types of processors, such as a DSP, a microprocessor, or a microcontroller.
  • the processor 401 includes a CPU and an SE
  • the CPU can obtain a smart contract, and the CPU configures an execution environment for the smart contract that meets its requirements according to the type of the smart contract.
  • the smart contract is a financial-level smart contract
  • the CPU can configure the SE environment for the financial-level smart contract, specifically the SEE corresponding to eSE or inSE, and the CPU can communicate with the SE to make the execution environment corresponding to the eSE or inSE Run this financial-level smart contract in
  • the above SE may have independent processors, memory, and storage units, where the SE and the above CPU may be integrated in one chip, or may also be integrated on different chips.
  • the aforementioned CPU can be used to run general operating system software and communicate with the SE under the action of the aforementioned general operating system software.
  • the predefined rules include: different types of smart contracts correspond to execution environments of different security levels.
  • the smart contract has undergone an encryption operation
  • the processor 401 is further configured to perform a decryption operation on the smart contract in the execution environment.
  • the smart contract has undergone a signature operation
  • the processor 401 is further configured to perform a verification signature operation on the smart contract in the execution environment.
  • the processor 401 is further configured to call the communication interface 403 to perform the following actions: obtain a certificate revocation list CRL, in which the relevant information of the smart contract that has been revoked is stored; the processor 401 is also configured to: According to the CRL, the smart contract is terminated.
  • the related information of the smart contract includes the serial number and revocation time of the certificate of the smart contract that has been revoked.
  • the CRL is stored in at least one of a replay protection memory block RPMB, an electrically programmable fuse Efuse module, or a one-time programmable OTP memory.
  • the processor 401 is further configured to use homomorphic encryption technology or zero-knowledge proof technology to encrypt private data generated in the blockchain.
  • the private key used when encrypting the private data generated in the blockchain may be generated in the execution environment provided by the SE.
  • the used operator is a hardened Pairing operator.
  • the predefined rule includes at least one of the following: ordinary-level smart contracts correspond to rich execution environment REE; or, system-level smart contracts correspond to trusted execution environment TEE; or, financial-level smart contracts correspond to secure execution environment SEE.
  • the memory 402 may include a read-only memory and a random access memory, and provides instructions and data to the processor 401.
  • the memory 402 may also include non-volatile random access memory.
  • the memory 402 may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may be read-only memory (ROM), programmable read-only memory (ROM,
  • PROM erasable programmable read-only memory
  • EPROM erasable PROM
  • flash memory electrically erasable programmable read-only memory
  • the volatile memory may be random access memory (RAM), which is used as an external cache.
  • RAM random access memory
  • SRAM static random access memory
  • DRAM dynamic random access memory
  • SDRAM synchronous dynamic random access memory
  • Double data rate synchronous dynamic random access memory double data date SDRAM, DDR SDRAM
  • enhanced SDRAM enhanced synchronous dynamic random access memory
  • SLDRAM synchronous connection dynamic random access memory
  • direct rambus RAM direct rambus RAM
  • the bus 404 may also include a power bus, a control bus, and a status signal bus. However, for clear description, various buses are marked as the bus 404 in FIG. 5.
  • the device 400 for running a smart contract may correspond to the device 300 for running a smart contract in the embodiment of the present application, and may correspond to the blockchain node in the method shown in FIG. 2 of the embodiment of the present application.
  • the various modules and other operations and/or functions of the device 400 for running a smart contract are designed to implement the routing in FIG. 2
  • the operation steps of the method executed by the block chain node are not repeated here for the sake of brevity.
  • the device for running smart contracts in the embodiments of this application may be a node device in a blockchain network, or, it may not be the device itself, but a component or module or chip in the device.
  • This application does not deal with this. Specially limited.
  • the foregoing embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination.
  • the above-mentioned embodiments may be implemented in the form of a computer program product in whole or in part.
  • the computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on the computer, the processes or functions described in the embodiments of the present application are generated in whole or in part.
  • the computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices.
  • the computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium.
  • the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website site, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.).
  • the computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more sets of available media.
  • the usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium.
  • the semiconductor medium may be a solid state drive (SSD).
  • the disclosed system, device, and method may be implemented in other ways.
  • the device embodiments described above are only illustrative.
  • the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not run.
  • the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
  • each unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
  • the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium.
  • the technical solution of this application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) run all or part of the steps of the methods described in the various embodiments of the present application.
  • the aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code .

Abstract

Disclosed is an apparatus (300) for running a smart contract, which can be applied to a blockchain network (140). By means of the apparatus (300) for running a smart contract, execution environments at different security levels are provided for a smart contract, such that when an execution environment is configured for the smart contract, the execution environment that satisfies a security level requirement of the smart contract for the execution environment can be configured for the smart contract according to a predefined rule, so as to run the smart contract in the execution environment, thereby improving the security when the smart contract is run.

Description

运行智能合约的方法和装置Method and device for running smart contract 技术领域Technical field
本申请涉及区块链技术领域,并且更具体地,涉及一种运行智能合约的方法和装置。This application relates to the field of blockchain technology, and more specifically, to a method and device for running smart contracts.
背景技术Background technique
区块链是分布式数据存储、点对点传输、共识机制、和加密算法等计算机技术的新型应用模式,区块链技术能够解决信任成本高、中心化有风险这两类问题。Blockchain is a new application model of computer technology such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain technology can solve the problems of high trust cost and risk of centralization.
以太坊(Ethereum)是一个开源的有智能合约功能的公共区块链平台,通过其专用加密货币以太币(Ether)提供去中心化的虚拟机来处理点对点的智能合约,成为区块链2.0的代表。智能合约是代码和数据的集合,也可以称为“可编程合约”。通常而言,智能合约是通过程序编码定义的,并且预设了运行条件;当触发运行条件时执行行为。其中的“智能”是执行上的智能,也就是说,如果达到某个预设条件,则合约自动运行。现阶段区块链中智能合约的安全性完全依赖主机的Linux/Windows系统的安全机制。Ethereum is an open source public blockchain platform with smart contract functions. It provides a decentralized virtual machine through its dedicated cryptocurrency Ether to process point-to-point smart contracts, becoming the blockchain 2.0 representative. A smart contract is a collection of code and data, and can also be called a "programmable contract". Generally speaking, smart contracts are defined by program coding and preset operating conditions; when the operating conditions are triggered, the behavior is executed. The "intelligence" is the execution intelligence, that is, if a certain preset condition is reached, the contract will run automatically. At this stage, the security of smart contracts in the blockchain completely depends on the security mechanism of the host's Linux/Windows system.
发明内容Summary of the invention
本申请提供一种运行智能合约的方法与装置,该方法通过为智能合约提供满足该安全等级的执行环境,从而提高智能合约运行时的安全性。The present application provides a method and device for running a smart contract. The method provides an execution environment that meets the security level for the smart contract, thereby improving the security of the smart contract during operation.
第一方面,提供了一种运行智能合约的装置,该装置可以应用于区块链网络中,包括获取模块与处理模块。其中,获取模块,用于获取智能合约,该智能合约具有安全等级的要求;处理模块,用于根据预定义的规则,为该智能合约配置满足该要求的执行环境;该处理模块,还用于在该执行环境中运行该智能合约。In the first aspect, a device for running a smart contract is provided. The device can be applied to a blockchain network and includes an acquisition module and a processing module. Among them, the acquisition module is used to obtain a smart contract that has a security level requirement; a processing module is used to configure an execution environment for the smart contract that meets the requirements according to predefined rules; the processing module is also used to Run the smart contract in the execution environment.
基于上述技术方案,通过上述运行智能合约的装置为智能合约提供不同安全等级的执行环境,使得在为智能合约配置执行环境时,可以根据预定义的规则,为智能合约配置满足其对执行环境的安全等级要求的执行环境,进而在该执行环境中运行智能合约,从而提高智能合约运行时的安全性。Based on the above technical solution, the smart contract running device provides different security levels of execution environments for smart contracts, so that when configuring the execution environment for the smart contract, the smart contract can be configured to meet its requirements for the execution environment according to predefined rules. The execution environment required by the security level, and then the smart contract is run in the execution environment, thereby improving the security of the smart contract runtime.
例如,可以通过在区块链节点中配置片上系统(system on chip,SoC),该SoC可以提供Trustzone、Bowmore、或由eSE或inSE形成的SEE等执行环境中至少一个,可以将Trustzone、或Bowmore执行环境称为可信执行环境(trusted execution environment,TEE),将eSE或inSE对应的执行环境称为安全执行环境(secure execution environment,SEE),此外,该SoC还可以提供富执行环境(rich execution environment,REE)。其中,SEE的安全等级高于TEE的安全等级,TEE的安全等级高于REE的安全等级。For example, a system on chip (SoC) can be configured in a blockchain node. The SoC can provide at least one execution environment of Trustzone, Bowmore, or SEE formed by eSE or inSE. Trustzone or Bowmore The execution environment is called trusted execution environment (TEE), and the execution environment corresponding to eSE or inSE is called secure execution environment (SEE). In addition, the SoC can also provide a rich execution environment (rich execution environment). environment, REE). Among them, the safety level of SEE is higher than that of TEE, and the safety level of TEE is higher than that of REE.
在一种可能的实现方式中,该预定义的规则包括:不同类型的智能合约对应不同安全等级的执行环境。In a possible implementation manner, the predefined rules include: different types of smart contracts correspond to execution environments of different security levels.
例如,为了提高智能合约运行过程中的安全性,可以为金融级智能合约配置的执行环境的安全等级高于为系统级智能合约配置的执行环境的安全等级,为系统级智能合约配置 的执行环境的安全等级高于为普通级智能合约配置的执行环境的安全等级。For example, in order to improve the security during the operation of smart contracts, the security level of the execution environment that can be configured for financial-level smart contracts is higher than the security level of the execution environment configured for system-level smart contracts, and the execution environment configured for system-level smart contracts The security level of is higher than the security level of the execution environment configured for ordinary smart contracts.
基于上述技术方案,通过为不同类型的智能合约配置不同安全等级的执行环境,从而使得为智能合约配置的执行环境满足智能合约对执行环境的安全等级的要求,进而在该执行环境中运行智能合约,从而提高智能合约运行时的安全性。Based on the above technical solutions, by configuring execution environments of different security levels for different types of smart contracts, the execution environment configured for the smart contract meets the requirements of the smart contract for the security level of the execution environment, and then the smart contract is run in the execution environment , Thereby improving the security of smart contract runtime.
在一种可能的实现方式中,该智能合约经过了加密操作,该处理模块还用于:在该执行环境对该智能合约进行解密操作。In a possible implementation manner, the smart contract has undergone an encryption operation, and the processing module is further used to perform a decryption operation on the smart contract in the execution environment.
基于上述技术方案,为了防止逆向泄露智能合约的运行逻辑和数据处理流程,智能合约的提供者在生成智能合约的二进制文件后,可以对智能合约的二进制文件进行加密操作,在这种情况下,区块链节点在运行智能合约的二进制文件之前,首先需要对智能合约的二进制文件进行解密操作,运行解密操作之后获得的智能合约的二进制文件。Based on the above technical solution, in order to prevent the reverse leakage of the operation logic and data processing flow of the smart contract, the provider of the smart contract can encrypt the binary file of the smart contract after generating the binary file of the smart contract. In this case, Before the blockchain node runs the binary file of the smart contract, it first needs to decrypt the binary file of the smart contract, and the binary file of the smart contract obtained after running the decryption operation.
在一种可能的实现方式中,该智能合约经过了签名操作,该处理模块还用于:在该执行环境中对该智能合约进行验证签名操作。In a possible implementation manner, the smart contract has undergone a signature operation, and the processing module is further used to perform a verification signature operation on the smart contract in the execution environment.
基于上述技术方案,为了管理智能合约的完整的生命周期(例如,智能合约的完整的生命周期包括部署、存储、运行与停止运行),可以采用公钥基础设施(public key infrastructure,PKI)体系对智能合约进行签名操作,此时,区块链节点在运行智能合约之前,需要对智能合约进行验签操作,只有当区块链节点对经过签名操作的智能合约验签通过时,区块链节点才会运行智能合约的二进制文件,从而对是否运行智能合约进行管理。Based on the above technical solutions, in order to manage the complete life cycle of a smart contract (for example, the complete life cycle of a smart contract includes deployment, storage, operation, and shutdown), a public key infrastructure (PKI) system can be used to The smart contract performs the signature operation. At this time, the blockchain node needs to verify the smart contract before running the smart contract. Only when the blockchain node passes the verification of the signed smart contract, the blockchain node Only then will the binary file of the smart contract be run to manage whether to run the smart contract.
在一种可能的实现方式中,该获取模块还用于:获取证书吊销列表CRL,该CRL中保存了已经被吊销的该智能合约的相关信息;该处理模块还用于:根据该CRL,终止运行该智能合约。In a possible implementation, the obtaining module is also used to: obtain a certificate revocation list CRL, in which the relevant information of the smart contract that has been revoked is stored in the CRL; the processing module is also used to: terminate according to the CRL Run the smart contract.
基于上述技术方案,为了管理智能合约的完整的生命周期(例如,智能合约的完整的生命周期包括部署、存储、运行与停止运行),通过将已经被吊销的智能合约的相关信息添加在证书吊销列表(certificate revocation list,CRL)中,从而使得区块链节点可以根据CRL中是否包括某个智能合约的相关信息,确定是否停止运行该智能合约,从而对是否停止运行智能合约进行管理。Based on the above technical solution, in order to manage the complete life cycle of the smart contract (for example, the complete life cycle of the smart contract includes deployment, storage, operation and shutdown), the relevant information of the revoked smart contract is added to the certificate revocation In the certificate revocation list (CRL), the blockchain node can determine whether to stop running the smart contract according to whether the CRL includes relevant information about a certain smart contract, so as to manage whether to stop running the smart contract.
在一种可能的实现方式中,该智能合约的相关信息包括已经被吊销的该智能合约的证书的序列号与吊销时间。In a possible implementation, the related information of the smart contract includes the serial number and revocation time of the certificate of the smart contract that has been revoked.
在一种可能的实现方式中,该CRL存储在重放保护内存块RPMB、电可编程熔丝Efuse模块或一次性可编程OTP存储器中的至少一个中。In a possible implementation manner, the CRL is stored in at least one of a replay protection memory block RPMB, an electrically programmable fuse Efuse module, or a one-time programmable OTP memory.
基于上述技术方案,通过将CRL保存在RPMB、Efuse模块或OTP存储器,从而使得CRL保存在较为安全的存储区域。Based on the above technical solution, by storing the CRL in the RPMB, Efuse module or OTP memory, the CRL is stored in a safer storage area.
在一种可能的实现方式中,该处理模块还用于:使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密。In a possible implementation, the processing module is also used to encrypt the private data generated in the blockchain using homomorphic encryption technology or zero-knowledge proof technology.
在一种可能的实现方式中,该使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密时,使用的算子为硬化后的Pairing算子。In a possible implementation, when using homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain, the operator used is a hardened Pairing operator.
基于上述技术方案,通过在使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密时,使用的算子为硬化后的Pairing算子,从而提高加密业务的性能。Based on the above technical solution, when the private data generated in the blockchain is encrypted by using homomorphic encryption technology or zero-knowledge proof technology, the operator used is a hardened Pairing operator, thereby improving the performance of the encryption service.
在一种可能的实现方式中,该预定义的规则包括如下至少一个:普通级智能合约对应富执行环境REE;或,系统级智能合约对应可信执行环境TEE;或,金融级智能合约对应 安全执行环境SEE。In a possible implementation, the predefined rule includes at least one of the following: ordinary-level smart contracts correspond to rich execution environment REE; or, system-level smart contracts correspond to trusted execution environment TEE; or, financial-level smart contracts correspond to security Execution environment SEE.
第二方面,提供了一种运行智能合约的方法,该方法可以应用在区块链网络中,该方法由区块链网络中的任意一个区块链节点执行,包括:获取智能合约,该智能合约具有安全等级的要求;根据预定义的规则,为该智能合约配置满足该要求的执行环境;在该执行环境中运行该智能合约。In the second aspect, a method for running a smart contract is provided. The method can be applied to a blockchain network. The method is executed by any blockchain node in the blockchain network, including: obtaining a smart contract, the smart The contract has a security level requirement; according to predefined rules, the smart contract is configured with an execution environment that meets the requirements; the smart contract is run in the execution environment.
例如,为了提高智能合约运行过程中的安全性,可以根据预定义的规则,为区块链节点中的智能合约均配置安全等级较高的执行环境。For example, in order to improve the security during the operation of smart contracts, it is possible to configure execution environments with higher security levels for smart contracts in the blockchain nodes according to predefined rules.
基于上述技术方案,通过根据预定义的规则,为智能合约配置满足其对执行环境的安全等级要求的执行环境,进而在该执行环境中运行智能合约,从而提高智能合约运行时的安全性。Based on the above technical solution, the smart contract is configured with an execution environment that meets its security level requirements for the execution environment according to predefined rules, and then the smart contract is run in the execution environment, thereby improving the security of the smart contract during operation.
在一种可能的实现方式中,该预定义的规则包括:不同类型的智能合约对应不同安全等级的执行环境。In a possible implementation manner, the predefined rules include: different types of smart contracts correspond to execution environments of different security levels.
例如,为了提高智能合约运行过程中的安全性,可以为金融级智能合约配置的执行环境的安全等级高于为系统级智能合约配置的执行环境的安全等级,为系统级智能合约配置的执行环境的安全等级高于为普通级智能合约配置的执行环境的安全等级。For example, in order to improve the security during the operation of smart contracts, the security level of the execution environment that can be configured for financial-level smart contracts is higher than the security level of the execution environment configured for system-level smart contracts, and the execution environment configured for system-level smart contracts The security level of is higher than the security level of the execution environment configured for ordinary smart contracts.
基于上述技术方案,通过为不同类型的智能合约配置不同安全等级的执行环境,从而使得为智能合约配置的执行环境满足智能合约对执行环境的安全等级的要求,进而在该执行环境中运行智能合约,从而提高智能合约运行时的安全性。Based on the above technical solutions, by configuring execution environments of different security levels for different types of smart contracts, the execution environment configured for the smart contract meets the requirements of the smart contract for the security level of the execution environment, and then the smart contract is run in the execution environment , Thereby improving the security of smart contract runtime.
在一种可能的实现方式中,该智能合约经过了加密操作,该方法还包括:在该执行环境中运行该智能合约之前,在该执行环境对该智能合约进行解密操作。In a possible implementation manner, the smart contract has undergone an encryption operation, and the method further includes: performing a decryption operation on the smart contract in the execution environment before running the smart contract in the execution environment.
基于上述技术方案,为了防止智能合约被逆向泄露智能合约的运行逻辑和数据处理流程,智能合约的提供者在生成智能合约的二进制文件后,可以对智能合约的二进制文件进行加密操作,在这种情况下,区块链节点在运行智能合约的二进制文件之前,首先需要对智能合约的二进制文件进行解密操作,运行解密操作之后获得的智能合约的二进制文件。Based on the above technical solutions, in order to prevent the smart contract from being reversed to leak the smart contract’s operating logic and data processing flow, the smart contract provider can encrypt the smart contract’s binary file after generating the smart contract’s binary file. In this case, before the blockchain node runs the binary file of the smart contract, it first needs to decrypt the binary file of the smart contract, and the binary file of the smart contract obtained after the decryption operation is run.
在一种可能的实现方式中,该智能合约经过了签名操作,该方法还包括:在该执行环境中运行该智能合约之前,在该执行环境中对该智能合约进行验证签名操作。In a possible implementation manner, the smart contract has undergone a signature operation, and the method further includes: performing a verification signature operation on the smart contract in the execution environment before running the smart contract in the execution environment.
基于上述技术方案,为了管理智能合约的完整的生命周期(例如,智能合约的完整的生命周期包括部署、存储、运行与停止运行),可以采用公钥基础设施(public key infrastructure,PKI)体系对智能合约进行签名操作,此时,区块链节点在运行智能合约之前,需要对智能合约进行验签操作,只有当区块链节点对经过签名操作的智能合约验签通过时,区块链节点才会运行智能合约的二进制文件,从而对是否运行智能合约进行管理。Based on the above technical solutions, in order to manage the complete life cycle of a smart contract (for example, the complete life cycle of a smart contract includes deployment, storage, operation, and shutdown), a public key infrastructure (PKI) system can be used to The smart contract performs the signature operation. At this time, the blockchain node needs to verify the smart contract before running the smart contract. Only when the blockchain node passes the verification of the signed smart contract, the blockchain node Only then will the binary file of the smart contract be run to manage whether to run the smart contract.
在一种可能的实现方式中,该方法还包括:获取证书吊销列表CRL,该CRL中保存了已经被吊销的该智能合约的相关信息;根据该CRL,终止运行该智能合约。In a possible implementation, the method further includes: obtaining a certificate revocation list CRL, in which the relevant information of the smart contract that has been revoked is stored in the CRL; and terminating the operation of the smart contract according to the CRL.
基于上述技术方案,为了管理智能合约的完整的生命周期(例如,智能合约的完整的生命周期包括部署、存储、运行与停止运行),通过将已经被吊销的智能合约的相关信息添加在证书吊销列表(certificate revocation list,CRL)中,从而使得区块链节点可以根据CRL中是否包括某个智能合约的相关信息,确定是否停止运行该智能合约,从而对是否停止运行智能合约进行管理。Based on the above technical solution, in order to manage the complete life cycle of the smart contract (for example, the complete life cycle of the smart contract includes deployment, storage, operation and shutdown), the relevant information of the revoked smart contract is added to the certificate revocation In the certificate revocation list (CRL), the blockchain node can determine whether to stop running the smart contract according to whether the CRL includes relevant information about a certain smart contract, so as to manage whether to stop running the smart contract.
在一种可能的实现方式中,该智能合约的相关信息包括已经被吊销的该智能合约的证 书的序列号与吊销时间。In a possible implementation, the relevant information of the smart contract includes the serial number and revocation time of the certificate of the smart contract that has been revoked.
在一种可能的实现方式中,该CRL存储在重放保护内存块(replay protected memory block,RPMB)、电可编程熔丝Efuse模块或一次性可编程(one time programmable,OTP)中。In a possible implementation manner, the CRL is stored in a replay protected memory block (RPMB), an electrically programmable fuse Efuse module, or one-time programmable (OTP).
基于上述技术方案,通过将CRL保存在RPMB、Efuse模块或OTP存储器,从而使得CRL保存在较为安全的存储区域中的至少一个中。Based on the above technical solution, the CRL is stored in the RPMB, Efuse module or OTP memory, so that the CRL is stored in at least one of the safer storage areas.
在一种可能的实现方式中,该方法还包括:使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密。In a possible implementation, the method further includes: using homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain.
在一种可能的实现方式中,该使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密时,使用的算子为硬化后的Pairing算子。In a possible implementation, when using homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain, the operator used is a hardened Pairing operator.
基于上述技术方案,通过在使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密时,使用的算子为硬化后的Pairing算子,从而提高加密业务的性能。Based on the above technical solution, when the private data generated in the blockchain is encrypted by using homomorphic encryption technology or zero-knowledge proof technology, the operator used is a hardened Pairing operator, thereby improving the performance of the encryption service.
在一种可能的实现方式中,该预定义的规则执行环境包括如下至少一个:In a possible implementation manner, the predefined rule execution environment includes at least one of the following:
普通级智能合约对应富执行环境REE;或,系统级智能合约对应可信执行环境TEE;或,金融级智能合约对应安全执行环境SEE。Ordinary-level smart contracts correspond to the rich execution environment REE; or, system-level smart contracts correspond to the trusted execution environment TEE; or, financial-level smart contracts correspond to the secure execution environment SEE.
第三方面,提供一种运行智能合约的装置,该装置可以应用于区块链网络中,该装置包括:存储器,用于存储程序;处理器,用于执行存储器存储的程序,当存储器存储的程序被执行时,处理器用于执行第一方面或第一方面各实现方式中的方法。该处理器包括CPU和SE。CPU用于形成TEE和REE,SE用于形成SEE。In a third aspect, a device for running a smart contract is provided. The device can be applied to a blockchain network. The device includes: a memory for storing programs; a processor for executing programs stored in the memory. When the program is executed, the processor is used to execute the method in the first aspect or each implementation manner of the first aspect. The processor includes CPU and SE. CPU is used to form TEE and REE, SE is used to form SEE.
第四方面,提供一种计算机可读介质,该计算机可读介质存储用于设备执行的程序代码,该程序代码包括用于执行第一方面或第一方面各实现方式中的方法。In a fourth aspect, a computer-readable medium is provided, and the computer-readable medium stores program code for device execution, and the program code includes a method for executing the first aspect or each implementation manner of the first aspect.
第五方面,提供一种包含指令的计算机程序产品,当该计算机程序产品在计算机上运行时,使得计算机执行上述第一方面或第一方面各实现方式中的方法。In a fifth aspect, a computer program product containing instructions is provided. When the computer program product runs on a computer, the computer executes the method in the first aspect or the implementation manners of the first aspect.
第六方面,提供一种运行智能合约的装置,该装置可以应用于区块链网络中,该装置包括:CPU和SE,用于联合执行第一方面或第一方面各实现方式中的方法。In a sixth aspect, a device for running a smart contract is provided. The device can be applied to a blockchain network. The device includes a CPU and an SE, and is used to jointly execute the method in the first aspect or the implementation manners of the first aspect.
本申请在上述各方面提供的实现方式的基础上,还可以进行进一步组合以提供更多实现方式。On the basis of the implementation manners provided by the above aspects, this application can be further combined to provide more implementation manners.
附图说明Description of the drawings
图1是适用于本申请的系统架构的示意性框图;Figure 1 is a schematic block diagram of a system architecture applicable to the present application;
图2是本申请提供的运行智能合约的方法的示意性流程图;Figure 2 is a schematic flow chart of the method for running a smart contract provided by the present application;
图3是本申请实施例提供的一种软件系统架构的简化示意图;FIG. 3 is a simplified schematic diagram of a software system architecture provided by an embodiment of the present application;
图4为本申请实施例提供的运行智能合约的装置的示意性框图;4 is a schematic block diagram of a device for running a smart contract provided by an embodiment of the application;
图5为本申请实施例提供的运行智能合约的装置的另一示意性框图。Fig. 5 is another schematic block diagram of a device for running a smart contract provided by an embodiment of the application.
具体实施方式detailed description
下面将结合附图,对本申请中的技术方案进行描述。在此之前,首先对本申请实施例涉及的以下名词进行简单介绍。The technical solution in this application will be described below in conjunction with the drawings. Before that, firstly, the following terms involved in the embodiments of the present application will be briefly introduced.
智能合约的提供者,可以是具有许可他人使用智能合约的权利的人或单位,例如,智 能合约的提供者可以是智能合约的作者。智能合约则是区块链之中的概念,是以信息化方式传播、验证或者执行合约的计算机协议,或者是一套以数字形式定义的承诺,包括合约参与方可以在上面执行这些承诺的协议。The provider of a smart contract can be a person or unit that has the right to allow others to use the smart contract. For example, the provider of a smart contract can be the author of the smart contract. Smart contract is a concept in the blockchain. It is a computer protocol that spreads, verifies, or executes the contract in an informatized manner, or a set of commitments defined in digital form, including an agreement on which contract participants can execute these commitments .
管理中心,可以是智能合约的发型平台,例如,智能合约的提供者能够在管理中心中发布并且许可使用智能合约,而用户能够在管理中心中浏览、查看以及下载智能合约。The management center can be a hairstyle platform for smart contracts. For example, the provider of the smart contract can publish and license the smart contract in the management center, and the user can browse, view, and download the smart contract in the management center.
下面结合图1对适用于本申请实施例的系统架构进行介绍。图1中所示网络架构包括智能合约的提供者110、管理中心120、用户(subscriber)130与区块链网络140,区块链网络包括多个区块链节点,例如,区块链网络140包括区块链节点1401、1402与1403。The following describes the system architecture applicable to the embodiment of the present application with reference to FIG. 1. The network architecture shown in FIG. 1 includes a smart contract provider 110, a management center 120, a subscriber 130, and a blockchain network 140. The blockchain network includes multiple blockchain nodes, for example, the blockchain network 140 Including blockchain nodes 1401, 1402 and 1403.
智能合约的提供者110可以向管理中心120提供可安装的智能合约,智能合约的提供者110具有许可他人获取智能合约的权利,例如,智能合约的提供者110可以从智能合约的作者处获得许可他人获取其智能合约的权利,从而智能合约的提供者110具有许可他人使用智能合约的权利,用户130可以通过管理中心120为特定的区块链节点安装某个智能合约。The provider 110 of the smart contract can provide an installable smart contract to the management center 120, and the provider 110 of the smart contract has the right to allow others to obtain the smart contract. For example, the provider 110 of the smart contract can obtain permission from the author of the smart contract. Others obtain the right of their smart contract, so that the smart contract provider 110 has the right to allow others to use the smart contract. The user 130 can install a smart contract for a specific blockchain node through the management center 120.
在本申请实施例中,在系统架构中的通信以及智能合约的提供者110、用户130与管理中心120之间的通信可以基于任何有线和/或无线网络,包括但不限于因特网、广域网、城域网、局域网以及虚拟专用网络等。In the embodiment of the present application, the communication in the system architecture and the communication between the smart contract provider 110, the user 130 and the management center 120 can be based on any wired and/or wireless network, including but not limited to the Internet, wide area network, city Local area network, local area network, virtual private network, etc.
在本申请实施例中,区块链网络140中的每个区块链节点可以是电子设备,例如,可以是固定设备或移动设备,其中,固定设备例如可以是是服务器或台式计算机,移动设备例如可以是智能手机、平板电脑、便携式计算机等。In the embodiment of the present application, each blockchain node in the blockchain network 140 may be an electronic device, for example, it may be a fixed device or a mobile device, where the fixed device may be, for example, a server or a desktop computer, or a mobile device. For example, it can be a smart phone, a tablet computer, a portable computer, etc.
下面结合图2对本申请实施例提供的运行智能合约的方法200进行介绍,图2示出了本申请实施例提供的运行智能合约的方法200的示意性流程图,该方法至少包括步骤201至步骤203。The following describes the method 200 for running a smart contract provided by an embodiment of the present application with reference to FIG. 2. FIG. 2 shows a schematic flowchart of the method 200 for running a smart contract provided by an embodiment of the present application. The method includes at least steps 201 to 203.
步骤201,获取智能合约,该智能合约具有安全等级的要求,即安全要求。该安全要求可以参数的方式内置于装置内,具体内置于装置的缓存或存储单元中,或者该智能合约的安全要求可以携带在该智能合约内部以便装置得到该安全要求。例如,内置于装置的参数可以是一个查找表,当获取智能合约被装置获取后,可以通过查找表找到对应于此智能合约的安全要求。在本领域,由于智能合约是一种安全的协议,获取智能合约可以认为是阿伯阔获取智能合约的基本信息参数信息,即该合约的类型、应用场景、功能、版本或其他一些基本参数,以便据此判断其安全要求。或者,获取智能合约可以是包括直接获取所述安全要求。另外,获取智能合约也可包括获取完整的智能合约,例如直接获取智能合约的提供者或管理中心发布的智能合约。Step 201: Obtain a smart contract, which has a security level requirement, that is, a security requirement. The security requirement can be built into the device in the form of parameters, specifically in the cache or storage unit of the device, or the security requirement of the smart contract can be carried in the smart contract so that the device can obtain the security requirement. For example, the parameter built into the device may be a lookup table. After the acquired smart contract is acquired by the device, the security requirements corresponding to the smart contract can be found through the lookup table. In this field, because a smart contract is a secure protocol, obtaining a smart contract can be considered as Aberco’s obtaining the basic information and parameters of the smart contract, that is, the type, application scenario, function, version or some other basic parameters of the contract. In order to judge its safety requirements accordingly. Or, obtaining the smart contract may include directly obtaining the security requirements. In addition, obtaining a smart contract may also include obtaining a complete smart contract, for example, directly obtaining a smart contract issued by a smart contract provider or a management center.
步骤202,根据预定义的规则,为该智能合约配置满足该要求的执行环境。Step 202: Configure an execution environment that meets the requirement for the smart contract according to a predefined rule.
步骤203,在该执行环境中运行该智能合约。上述执行环境可以包括富执行环境(rich execution environment,REE)、可信执行环境(trusted execution environment,TEE)与安全执行环境(secure execution environment,SEE)。其中,SEE的安全等级高于TEE的安全等级,TEE的安全等级高于REE的安全等级。Step 203: Run the smart contract in the execution environment. The foregoing execution environment may include a rich execution environment (REE), a trusted execution environment (TEE), and a secure execution environment (SEE). Among them, the safety level of SEE is higher than that of TEE, and the safety level of TEE is higher than that of REE.
在本申请实施例中,可以根据预定义的规则,为区块链节点中的智能合约配置执行环境,该执行环境满足智能合约对执行环境的安全等级的要求。例如,为了提高智能合约运行过程中的安全性,可以根据预定义的规则,为区块链节点中的智能合约均配置安全等级 较高的执行环境(例如,REE)。In the embodiments of the present application, an execution environment can be configured for the smart contract in the blockchain node according to predefined rules, and the execution environment meets the requirements of the smart contract for the security level of the execution environment. For example, in order to improve the security during the operation of the smart contract, a higher security execution environment (for example, REE) can be configured for the smart contracts in the blockchain nodes according to predefined rules.
作为示例而非限定,该预定义的规则可以包括:不同类型的智能合约对应不同安全等级的执行环境。通常情况下,不同类型的智能合约对执行环境的安全等级的要求是不同的,例如,金融级智能合约对执行环境的安全等级的要求通常要高于系统级智能合约对执行环境的安全等级的要求,系统级智能合约对执行环境的安全等级的要求通常要高于普通级智能合约对执行环境的安全等级的要求。换句话说,如果为金融级智能合约配置的执行环境的安全等级较低时,该执行环境可能无法保证金融级智能合约运行过程中的安全性。因此,为了提高智能合约运行过程中的安全性,可以为金融级智能合约配置的执行环境的安全等级高于为系统级智能合约配置的执行环境的安全等级,为系统级智能合约配置的执行环境的安全等级高于为普通级智能合约配置的执行环境的安全等级。As an example and not a limitation, the predefined rules may include: different types of smart contracts correspond to execution environments of different security levels. Under normal circumstances, different types of smart contracts have different requirements for the security level of the execution environment. For example, the security level of the execution environment of the financial-level smart contract is usually higher than that of the system-level smart contract. Requirements, the security level of the execution environment of the system-level smart contract is usually higher than the security level of the execution environment of the ordinary smart contract. In other words, if the security level of the execution environment configured for the financial-level smart contract is low, the execution environment may not be able to guarantee the security during the operation of the financial-level smart contract. Therefore, in order to improve the security during the operation of smart contracts, the security level of the execution environment that can be configured for financial-level smart contracts is higher than the security level of the execution environment configured for system-level smart contracts, which is the execution environment configured for system-level smart contracts The security level of is higher than the security level of the execution environment configured for ordinary smart contracts.
例如,可以将TEE配置为系统级智能合约的执行环境,将SEE配置为金融级智能合约的执行环境,将REE配置为普通级智能合约的执行环境。作为示例而非限定,可以通过在区块链节点中配置片上系统(system on chip,SoC),该SoC可以提供Trustzone、Bowmore、或由eSE或inSE形成的SEE等执行环境中的至少一个,可以将Trustzone或Bowmore执行环境称为TEE,将eSE或inSE对应的执行环境称为SEE。例如,当区块链节点为智能手机时,可以通过在智能手机中配置SoC,该智能手机通过该SoC提供Trustzone、Bowmore、或由eSE或inSE形成的SEE等执行环境中的至少一个。作为示例而非限定,上述SoC可以支持运行基于精简指令集机器(advanced risc machine,ARM)架构的指令集,将支持运行基于ARM架构的指令集的SoC称为基于ARM的SoC。For example, TEE can be configured as the execution environment for system-level smart contracts, SEE as the execution environment for financial-level smart contracts, and REE as the execution environment for ordinary-level smart contracts. As an example and not a limitation, a system on chip (SoC) can be configured in the blockchain node, and the SoC can provide at least one of the execution environments of Trustzone, Bowmore, or SEE formed by eSE or inSE. The execution environment of Trustzone or Bowmore is called TEE, and the execution environment corresponding to eSE or inSE is called SEE. For example, when the blockchain node is a smart phone, the SoC can be configured in the smart phone, and the smart phone provides at least one of the execution environments of Trustzone, Bowmore, or SEE formed by eSE or inSE through the SoC. As an example and not a limitation, the foregoing SoC may support running an instruction set based on an advanced RISC machine (ARM) architecture, and an SoC that supports running an instruction set based on the ARM architecture is called an ARM-based SoC.
图3示出了REE+TEE+SEE的三层安全架构的简化示意图,其中REE为富执行环境,运行安全不敏感的程序和保存安全不敏感数据,存在一定的安全风险;TEE为可信执行环境,运行安全敏感程序和保存安全敏感数据,提供一定级别的安全隔离,SEE为安全执行环境,运行金融支付等高安全程序和保存金融支付等高安全数据,提供更高级别的安全隔离。Figure 3 shows a simplified schematic diagram of the three-tier security architecture of REE+TEE+SEE, where REE is a rich execution environment, running security-insensitive programs and storing security-insensitive data, and there are certain security risks; TEE is trusted execution Environment, run security-sensitive programs and save security-sensitive data, provide a certain level of security isolation, SEE is a secure execution environment, run high security programs such as financial payments and save high security data such as financial payments, and provide a higher level of security isolation.
上述安全执行环境可以作为图3中的软件系统架构中的SEE层。而可信执行环境与通用操作系统软件环境(如安卓系统环境)则分别作为图3中的软件系统架构中的TEE层和REE层。可信执行环境与通用操作系统软件之间分别是两个独立的软件系统,存在安全隔离,且安全隔离性很好。通用操作系统软件和基于该操作系统的普通应用软件的运行程序,不能随意访问该可信执行环境。可信执行环境则可以与安全执行环境之间进行数据交互。因此,通用操作系统软件、可信执行环境、与安全执行环境之间均存在安全隔离,使得通用操作系统软件或基于该软件的普通应用软件的运行程序对可信执行环境和安全执行环境的访问不是随意的,即便所述访问被执行,也需要经过特定的软件或硬件的安全接口,并且可信执行环境与安全执行环境之间的安全隔离度相对更低,操作相对方便。上述普通应用软件可以包括各类非安全支付相关的软件,如即时通信软件、游戏、办公软件、电子书软件或音视频流媒体播放器等。The aforementioned secure execution environment can be used as the SEE layer in the software system architecture in FIG. 3. The trusted execution environment and the general operating system software environment (such as the Android system environment) respectively serve as the TEE layer and the REE layer in the software system architecture in FIG. 3. There are two independent software systems between the trusted execution environment and the general operating system software, and there is security isolation, and the security isolation is very good. General operating system software and running programs of general application software based on the operating system cannot freely access the trusted execution environment. The trusted execution environment can exchange data with the secure execution environment. Therefore, there is security isolation between the general operating system software, the trusted execution environment, and the secure execution environment, so that the general operating system software or the running program of the common application software based on the software can access the trusted execution environment and the secure execution environment It is not arbitrary. Even if the access is executed, it needs to go through a specific software or hardware security interface, and the security isolation between the trusted execution environment and the safe execution environment is relatively low, and the operation is relatively convenient. The aforementioned ordinary application software may include various non-secure payment-related software, such as instant messaging software, games, office software, e-book software, or audio and video streaming media players.
在步骤202中,当用户130为区块链网络140中的某个区块链节点(例如,区块链节点1401)安装了智能合约,区块链节点1401可以根据智能合约的类型,为智能合约配置执行环境。例如,当智能合约为系统级智能合约时,区块链节点1401可以将TEE配置为智能合约的执行环境;或者,当智能合约为金融级智能合约时,区块链节点1401可以将 SEE配置为智能合约的执行环境。In step 202, when the user 130 installs a smart contract for a certain blockchain node (for example, the blockchain node 1401) in the blockchain network 140, the blockchain node 1401 can be a smart contract according to the type of the smart contract. Contract configuration execution environment. For example, when the smart contract is a system-level smart contract, the blockchain node 1401 can configure TEE as the execution environment of the smart contract; or, when the smart contract is a financial-level smart contract, the blockchain node 1401 can configure the SEE as The execution environment of the smart contract.
在步骤203中,区块链节点1401在为智能合约配置的执行环境中运行智能合约。作为示例而非限定,用户130在为区块链网络140中的区块链节点1401安装智能合约之前,从管理中心120中获取的可以是智能合约的二进制文件,即智能合约的提供者110在完成智能合约的源代码的编写之后,可以对该智能合约的源代码进行编译,生成智能合约的二进制文件,将智能合约的二进制文件提供给管理中心120,从而使得用户130从管理中心120中获取的为智能合约的二进制文件,此时,区块链节点1401在为智能合约配置的执行环境中运行的是智能合约的二进制文件。In step 203, the blockchain node 1401 runs the smart contract in the execution environment configured for the smart contract. As an example and not a limitation, before the user 130 installs the smart contract for the blockchain node 1401 in the blockchain network 140, what the user 130 obtains from the management center 120 may be the binary file of the smart contract, that is, the smart contract provider 110 is in After the source code of the smart contract is written, the source code of the smart contract can be compiled to generate the binary file of the smart contract, and the binary file of the smart contract is provided to the management center 120, so that the user 130 can obtain it from the management center 120 Is the binary file of the smart contract. At this time, the blockchain node 1401 is running the binary file of the smart contract in the execution environment configured for the smart contract.
在本申请实施例中,为了防止逆向泄露智能合约的运行逻辑和数据处理流程,智能合约的提供者110在生成智能合约的二进制文件后,可以采用与区块链网络协商好的密钥对智能合约的二进制文件进行加密操作。在这种情况下,当智能合约的二进制文件被智能合约的提供者110执行加密操作时,区块链节点1401在运行智能合约的二进制文件之前,首先需要对智能合约的二进制文件进行解密操作,运行解密操作之后获得的智能合约的二进制文件。此时,方法200还可以包括:在执行环境对智能合约进行解密操作。In the embodiment of the present application, in order to prevent the reverse leakage of the operation logic and data processing flow of the smart contract, the provider 110 of the smart contract may use the key pair negotiated with the blockchain network after generating the binary file of the smart contract. The binary file of the contract is encrypted. In this case, when the binary file of the smart contract is encrypted by the provider 110 of the smart contract, the blockchain node 1401 first needs to decrypt the binary file of the smart contract before running the binary file of the smart contract. The binary file of the smart contract obtained after running the decryption operation. At this time, the method 200 may further include: decrypting the smart contract in the execution environment.
在本申请实施例中,为了管理智能合约的完整的生命周期,智能合约的完整的生命周期包括部署、存储、运行与停止运行,采用公钥基础设施(public key infrastructure,PKI)体系对智能合约进行签名操作、验签操作以及吊销操作,从而实现对智能合约的完整的生命周期的管理。In the embodiment of this application, in order to manage the complete life cycle of the smart contract, the complete life cycle of the smart contract includes deployment, storage, operation, and shutdown. The public key infrastructure (PKI) system is used to compare the smart contract. Carry out signature operations, verification operations, and revocation operations to realize the complete life cycle management of smart contracts.
作为示例而非限定,为了确定是否运行智能合约,智能合约的提供者110在生成智能合约的二进制文件之后,可以以对智能合约的二进制文件进行签名操作。在这种情况下,当智能合约的二进制文件被智能合约的提供者110执行签名操作时,区块链节点1401在部署、存储与运行智能合约的二进制文件之前,首先需要对智能合约的二进制文件进行验签操作,只有当区块链节点1401对经过签名操作的智能合约验签通过时,区块链节点1401才会部署、存储与运行智能合约。此时,方法200还可以包括:在执行环境中对智能合约进行验证签名操作。As an example and not a limitation, in order to determine whether to run a smart contract, the provider 110 of the smart contract may perform a signature operation on the binary file of the smart contract after generating the binary file of the smart contract. In this case, when the binary file of the smart contract is signed by the provider 110 of the smart contract, the blockchain node 1401 first needs to check the binary file of the smart contract before deploying, storing and running the binary file of the smart contract. During the verification operation, the blockchain node 1401 will deploy, store and run the smart contract only when the blockchain node 1401 passes the verification of the smart contract that has been signed. At this time, the method 200 may further include: verifying and signing the smart contract in the execution environment.
需要说明的是,上述步骤解密操作与验签操作在具体实现时可以结合在一起使用,例如,智能合约的提供者110可以对智能合约的二进制文件进行加密操作,在加密操作完成之后,智能合约的提供者110可以对经过加密操作的智能合约的二进制文件进行签名操作。在这种情况下,区块链节点1401对经过签名操作的智能合约验签通过后,在运行智能合约的二进制文件之前,首先需要对验签通过的智能合约的二进制文件进行解密操作,最终运行解密操作之后获得的智能合约的二进制文件。It should be noted that the decryption operation and the verification operation of the above steps can be used together in specific implementation. For example, the provider 110 of the smart contract can encrypt the binary file of the smart contract. After the encryption operation is completed, the smart contract The provider 110 can sign the binary file of the encrypted smart contract. In this case, after the blockchain node 1401 passes the verification of the smart contract that has undergone the signature operation, before running the binary file of the smart contract, it first needs to decrypt the binary file of the smart contract that has passed the verification, and finally run The binary file of the smart contract obtained after the decryption operation.
在本申请实施例中,为了确定是否停止运行智能合约,可以在云端部署用于存储证书吊销列表(certificate revocation list,CRL)的设备(例如,服务器),该设备用于对智能合约是否被吊销进行管理。例如,当某个智能合约出现问题或者存在该智能合约的最新版本时,该设备可以将该智能合约的相关信息添加在CRL中,代表该智能合约已经被吊销。In this embodiment of the application, in order to determine whether to stop running the smart contract, a device (for example, a server) for storing a certificate revocation list (CRL) can be deployed in the cloud to determine whether the smart contract has been revoked To manage. For example, when a certain smart contract has a problem or the latest version of the smart contract exists, the device can add the relevant information of the smart contract to the CRL, which means that the smart contract has been revoked.
区块链节点1401在运行智能合约之前,可以确定智能合约的相关信息是否保存在CRL中,如果CRL中包括智能合约的相关信息,则区块链节点1401会停止运行智能合约。此时,方法200还可以包括:获取CRL;根据该CRL,确定是否终止运行该智能合约,该CRL中保存了已经被吊销的智能合约的相关信息;如果该CRL中包括该智能合约的相 关信息,终止运行该智能合约。Before running the smart contract, the blockchain node 1401 can determine whether the relevant information of the smart contract is stored in the CRL. If the relevant information of the smart contract is included in the CRL, the blockchain node 1401 will stop running the smart contract. At this point, the method 200 may further include: obtaining a CRL; determining whether to terminate the operation of the smart contract according to the CRL, and the CRL stores relevant information of the revoked smart contract; if the CRL includes the relevant information of the smart contract To terminate the operation of the smart contract.
例如,CRL可以保存在区块链节点1401中,区块链节点1401可以通过轮询的方式向存储有CRL的设备获取CRL,并将获取到的CRL存储在本地,或者,区块链节点1401还可以接收存储有CRL的设备发送的CRL,并将获取到的CRL存储在本地。例如,区块链节点1401在获取到CRL后,可以将CRL保存在本地的较为安全的存储区域,例如,该存储区域可以包括重放保护内存块(replay protected memory block,RPMB)、电可编程熔丝Efuse模块或一次性可编程(one time programmable,OTP)存储器。作为示例而非限定,CRL中保存的智能合约的相关信息可以是智能合约的证书的序列号与吊销时间,其中,智能合约的证书的序列号可以是管理中心120为智能合约分配的。For example, the CRL can be stored in the blockchain node 1401, and the blockchain node 1401 can obtain the CRL from the device storing the CRL by polling, and store the obtained CRL locally, or the blockchain node 1401 It can also receive the CRL sent by the device storing the CRL, and store the obtained CRL locally. For example, after the blockchain node 1401 obtains the CRL, it can store the CRL in a safer local storage area. For example, the storage area may include replay protected memory block (RPMB) and electrically programmable Fuse Efuse module or one-time programmable (OTP) memory. As an example and not limitation, the related information of the smart contract stored in the CRL may be the serial number and revocation time of the certificate of the smart contract, where the serial number of the certificate of the smart contract may be allocated by the management center 120 for the smart contract.
在本申请实施例中,方法200还可以包括:使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密。当对区块链中产生的隐私数据进行加密时,可以使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密,对区块链中产生的隐私数据进行加密时所使用的私钥可以是在SEE环境中生成的。In the embodiment of the present application, the method 200 may further include: using homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain. When encrypting the private data generated in the blockchain, homomorphic encryption technology or zero-knowledge proof technology can be used to encrypt the private data generated in the blockchain, and the private data generated in the blockchain can be encrypted. The private key used can be generated in the SEE environment.
为了提高加密业务的性能,可以将对区块链中产生的隐私数据进行加密时所使用的算子(例如,双线性对(Pairing)算子)进行硬化,即,将该算子通过硬件来实现,从而提高加密业务的性能。在本申请实施例中,可以将调用上述算子的程序配置在安全性较高的执行环境中运行,例如,可以将调用上述算子的程序配置在TEE或SEE中运行。In order to improve the performance of the encryption service, the operator (for example, the pairing operator) used when encrypting the private data generated in the blockchain can be hardened, that is, the operator can be passed through the hardware To achieve, thereby improving the performance of encryption services. In the embodiment of the present application, the program that calls the above-mentioned operator can be configured to run in an execution environment with higher security. For example, the program that calls the aforementioned operator can be configured to run in the TEE or SEE.
以上,结合图1至图3详细说明了本申请实施例提供的运行智能合约的方法。以下,结合图4与图5详细说明本申请实施例提供的运行智能合约的装置。Above, the method for running a smart contract provided by the embodiment of the present application has been described in detail with reference to FIGS. 1 to 3. Hereinafter, the device for running a smart contract provided by an embodiment of the present application will be described in detail with reference to FIGS. 4 and 5.
图4为本申请实施例提供的运行智能合约的装置300的示意性框图,该运行智能合约的装置300可以应用于区块链网络140中,包括获取模块301与处理模块302。4 is a schematic block diagram of a device 300 for running a smart contract provided by an embodiment of the application. The device 300 for running a smart contract can be applied to the blockchain network 140 and includes an acquisition module 301 and a processing module 302.
获取模块301,用于获取智能合约,该智能合约具有安全等级的要求。The obtaining module 301 is used to obtain a smart contract, which has a security level requirement.
处理模块302,用于根据预定义的规则,为该智能合约满足该要求的执行环境。The processing module 302 is configured to provide an execution environment for the smart contract to meet the requirements according to predefined rules.
该处理模块302,还用于在该执行环境中运行该智能合约。The processing module 302 is also used to run the smart contract in the execution environment.
可选地,该预定义的规则包括:不同类型的智能合约对应不同安全等级的执行环境。Optionally, the predefined rules include: different types of smart contracts correspond to execution environments of different security levels.
可选地,该智能合约经过了加密操作,该处理模块302还用于:在该执行环境对该智能合约进行解密操作。Optionally, the smart contract has undergone an encryption operation, and the processing module 302 is further configured to perform a decryption operation on the smart contract in the execution environment.
可选地,该智能合约经过了签名操作,该处理模块302还用于:在该执行环境中对该智能合约进行验证签名操作。Optionally, the smart contract has undergone a signature operation, and the processing module 302 is further configured to perform a verification signature operation on the smart contract in the execution environment.
可选地,该获取模块301还用于:获取证书吊销列表CRL,该CRL中保存了已经被吊销的该智能合约的相关信息;该处理模块302还用于:根据该CRL,终止运行该智能合约。Optionally, the acquisition module 301 is also used to: obtain a certificate revocation list CRL, in which the relevant information of the smart contract that has been revoked is stored; the processing module 302 is also used to: terminate the operation of the smart contract according to the CRL contract.
可选地,该智能合约的相关信息包括已经被吊销的智能合约的证书的序列号与吊销时间。Optionally, the related information of the smart contract includes the serial number and revocation time of the certificate of the smart contract that has been revoked.
可选地,该CRL存储在重放保护内存块RPMB、电可编程熔丝Efuse模块或一次性可编程OTP存储器中的至少一个中。Optionally, the CRL is stored in at least one of a replay protection memory block RPMB, an electrically programmable fuse Efuse module, or a one-time programmable OTP memory.
可选地,该处理模块302还用于:使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密。Optionally, the processing module 302 is further configured to use homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain.
示例性地,对区块链中产生的隐私数据加密时所使用的私钥可以是在SE所提供的执 行环境中生成的。Exemplarily, the private key used when encrypting the private data generated in the blockchain may be generated in the execution environment provided by the SE.
可选地,该使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密时,使用的算子为硬化后的Pairing算子。Optionally, when using homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain, the used operator is a hardened Pairing operator.
可选地,该预定义的规则包括如下至少一个:普通级智能合约对应富执行环境REE;或,系统级智能合约对应可信执行环境TEE;或,金融级智能合约对应安全执行环境SEE。Optionally, the predefined rule includes at least one of the following: ordinary-level smart contracts correspond to rich execution environment REE; or, system-level smart contracts correspond to trusted execution environment TEE; or, financial-level smart contracts correspond to secure execution environment SEE.
应理解的是,本申请实施例的运行智能合约的装置300的上述功能可以通过专用集成电路(application-specific integrated circuit,ASIC)实现,或可编程逻辑器件(programmable logic device,PLD)实现,上述PLD可以是复杂程序逻辑器件(complex programmable logical device,CPLD),现场可编程门阵列(field-programmable gate array,FPGA),通用阵列逻辑(generic array logic,GAL)或其任意组合。也可以通过软件实现图2所示的运行智能合约的方法,当通过软件实现图2所示的运行智能合约的方法时,运行智能合约的装置端设备300及其各个模块也可以为软件模块。It should be understood that the above-mentioned functions of the device 300 for running a smart contract in the embodiment of the present application can be implemented by an application-specific integrated circuit (ASIC) or a programmable logic device (PLD). The PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL) or any combination thereof. The method of running a smart contract shown in FIG. 2 can also be implemented through software. When the method of running a smart contract shown in FIG. 2 is implemented through software, the device-side device 300 that runs the smart contract and its various modules may also be software modules.
根据本申请实施例的运行智能合约的装置300可对应于执行本申请实施例中描述的方法,并且运行智能合约的装置300中的各个单元的上述和其它操作和/或功能为了实现图2所示方法中区块链节点执行的相应流程,为了简洁,在此不再赘述。The device 300 for running a smart contract according to an embodiment of the present application may correspond to the method described in the embodiment of the present application, and the above-mentioned and other operations and/or functions of each unit in the device 300 for running the smart contract are intended to realize the For the sake of brevity, the corresponding process executed by the blockchain node in the method shown here will not be repeated here.
图5为本申请实施例提供的运行智能合约的装置400的示意图框图。如图5所示,该运行智能合约的装置400包括处理器401、存储器402、通信接口403和总线404。其中,处理器401、存储器402、通信接口403通过总线404进行通信,也可以通过无线传输等其他手段实现通信。该存储器402用于存储指令,该处理器401用于执行该存储器402存储的指令。该存储器402存储程序代码4021,且处理器401可以调用存储器402中存储的程序代码4021执行图2所示的运行智能合约的方法。FIG. 5 is a schematic block diagram of a device 400 for running a smart contract provided by an embodiment of the application. As shown in FIG. 5, the device 400 for running a smart contract includes a processor 401, a memory 402, a communication interface 403, and a bus 404. Among them, the processor 401, the memory 402, and the communication interface 403 communicate through the bus 404, and may also communicate through other means such as wireless transmission. The memory 402 is used to store instructions, and the processor 401 is used to execute instructions stored in the memory 402. The memory 402 stores program code 4021, and the processor 401 can call the program code 4021 stored in the memory 402 to execute the method for running a smart contract shown in FIG. 2.
需要说明的是,在具体实现时,处理器401可以为内置于SoC内;或者,运行智能合约的装置400既包括处理器401,又包括另一独立SoC(图中未示出)。当处理器401位于SoC内,运行智能合约的装置400通过该SoC提供Trustzone、Bowmore、或由eSE或inSE形成的SEE等执行环境中的至少一个。It should be noted that in specific implementation, the processor 401 may be built into the SoC; or, the device 400 for running the smart contract includes the processor 401 and another independent SoC (not shown in the figure). When the processor 401 is located in the SoC, the device 400 running the smart contract provides at least one of the execution environments of Trustzone, Bowmore, or SEE formed by eSE or inSE through the SoC.
在一种可能的实现方式中,处理器401用于调用通信接口403执行以下动作:获取智能合约,该智能合约具有安全等级的要求。In a possible implementation manner, the processor 401 is configured to call the communication interface 403 to perform the following actions: obtain a smart contract, which has a security level requirement.
处理器401,还用于根据预定义的规则,为该智能合约配置满足该要求的执行环境。The processor 401 is further configured to configure an execution environment that meets the requirements for the smart contract according to predefined rules.
该处理器401,还用于在该执行环境中运行该智能合约。The processor 401 is also used to run the smart contract in the execution environment.
处理器401可以包括各类处理器,例如包括CPU和安全元件(secure element,SE),其中CPU运行必要的软件,例如CPU运行TEE软件形成Trustzone或Bowmore环境,SE运行必要的安全软件形成SEE。CPU还可运行一般的操作系统,例如安卓/Windows以形成REE。处理器401还可包括其他类型处理器,例如DSP、微处理器或微控制器等。The processor 401 may include various types of processors, such as a CPU and a secure element (SE), where the CPU runs necessary software, for example, the CPU runs TEE software to form a Trustzone or Bowmore environment, and the SE runs necessary security software to form a SEE. The CPU can also run a general operating system, such as Android/Windows to form a REE. The processor 401 may also include other types of processors, such as a DSP, a microprocessor, or a microcontroller.
当处理器401包括CPU和SE时,可以由CPU获取智能合约,CPU根据智能合约的类型,为该智能合约配置满足其要求的执行环境。When the processor 401 includes a CPU and an SE, the CPU can obtain a smart contract, and the CPU configures an execution environment for the smart contract that meets its requirements according to the type of the smart contract.
例如,该智能合约为金融级智能合约,CPU可以为该金融级智能合约配置SE的环境,具体为eSE或inSE对应的SEE,并且CPU可以与SE进行通信,使得在eSE或inSE对应的执行环境中运行该金融级智能合约。For example, the smart contract is a financial-level smart contract, and the CPU can configure the SE environment for the financial-level smart contract, specifically the SEE corresponding to eSE or inSE, and the CPU can communicate with the SE to make the execution environment corresponding to the eSE or inSE Run this financial-level smart contract in
需要说明的是,上述SE可以具有独立的处理器、内存与存储单元,其中,SE可以与 上述CPU共同集成在一个芯片内,或者,也可以集成在不同的芯片上。上述CPU可以用于运行通用操作系统软件,并在上述通用操作系统软件的作用下与该SE通信。It should be noted that the above SE may have independent processors, memory, and storage units, where the SE and the above CPU may be integrated in one chip, or may also be integrated on different chips. The aforementioned CPU can be used to run general operating system software and communicate with the SE under the action of the aforementioned general operating system software.
可选地,该预定义的规则包括:不同类型的智能合约对应不同安全等级的执行环境。Optionally, the predefined rules include: different types of smart contracts correspond to execution environments of different security levels.
可选地,该智能合约经过了加密操作,该处理器401,还用于:在该执行环境对该智能合约进行解密操作。Optionally, the smart contract has undergone an encryption operation, and the processor 401 is further configured to perform a decryption operation on the smart contract in the execution environment.
可选地,该智能合约经过了签名操作,该处理器401,还用于:在该执行环境中对该智能合约进行验证签名操作。Optionally, the smart contract has undergone a signature operation, and the processor 401 is further configured to perform a verification signature operation on the smart contract in the execution environment.
可选地,该处理器401还用于调用通信接口403执行以下动作::获取证书吊销列表CRL,该CRL中保存了已经被吊销的该智能合约的相关信息;该处理器401还用于:根据该CRL,终止运行该智能合约。Optionally, the processor 401 is further configured to call the communication interface 403 to perform the following actions: obtain a certificate revocation list CRL, in which the relevant information of the smart contract that has been revoked is stored; the processor 401 is also configured to: According to the CRL, the smart contract is terminated.
可选地,该智能合约的相关信息包括已经被吊销的该智能合约的证书的序列号与吊销时间。Optionally, the related information of the smart contract includes the serial number and revocation time of the certificate of the smart contract that has been revoked.
可选地,该CRL存储在重放保护内存块RPMB、电可编程熔丝Efuse模块或一次性可编程OTP存储器中的至少一个中。Optionally, the CRL is stored in at least one of a replay protection memory block RPMB, an electrically programmable fuse Efuse module, or a one-time programmable OTP memory.
可选地,该处理器401还用于:使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密。Optionally, the processor 401 is further configured to use homomorphic encryption technology or zero-knowledge proof technology to encrypt private data generated in the blockchain.
示例性地,对区块链中产生的隐私数据加密时所使用的私钥可以是在SE所提供的执行环境中生成的。Exemplarily, the private key used when encrypting the private data generated in the blockchain may be generated in the execution environment provided by the SE.
可选地,该使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密时,使用的算子为硬化后的Pairing算子。Optionally, when using homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain, the used operator is a hardened Pairing operator.
可选地,该预定义的规则包括如下至少一个:普通级智能合约对应富执行环境REE;或,系统级智能合约对应可信执行环境TEE;或,金融级智能合约对应安全执行环境SEE。Optionally, the predefined rule includes at least one of the following: ordinary-level smart contracts correspond to rich execution environment REE; or, system-level smart contracts correspond to trusted execution environment TEE; or, financial-level smart contracts correspond to secure execution environment SEE.
该存储器402可以包括只读存储器和随机存取存储器,并向处理器401提供指令和数据。存储器402还可以包括非易失性随机存取存储器。该存储器402可以是易失性存储器或非易失性存储器,或可包括易失性和非易失性存储器两者。其中,非易失性存储器可以是只读存储器(read-only memory,ROM)、可编程只读存储器(programmable ROM,The memory 402 may include a read-only memory and a random access memory, and provides instructions and data to the processor 401. The memory 402 may also include non-volatile random access memory. The memory 402 may be volatile memory or non-volatile memory, or may include both volatile and non-volatile memory. Among them, the non-volatile memory may be read-only memory (ROM), programmable read-only memory (ROM,
PROM)、可擦除可编程只读存储器(erasable PROM,EPROM)、电可擦除可编程只读存储器(electrically EPROM,EEPROM)或闪存。易失性存储器可以是随机存取存储器(random access memory,RAM),其用作外部高速缓存。通过示例性但不是限制性说明,许多形式的RAM可用,例如静态随机存取存储器(static RAM,SRAM)、动态随机存取存储器(DRAM)、同步动态随机存取存储器(synchronous DRAM,SDRAM)、双倍数据速率同步动态随机存取存储器(double data date SDRAM,DDR SDRAM)、增强型同步动态随机存取存储器(enhanced SDRAM,ESDRAM)、同步连接动态随机存取存储器(synchlink DRAM,SLDRAM)和直接内存总线随机存取存储器(direct rambus RAM,DR RAM)。PROM), erasable programmable read-only memory (erasable PROM, EPROM), electrically erasable programmable read-only memory (electrically EPROM, EEPROM) or flash memory. The volatile memory may be random access memory (RAM), which is used as an external cache. By way of exemplary but not restrictive description, many forms of RAM are available, such as static random access memory (static RAM, SRAM), dynamic random access memory (DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), Double data rate synchronous dynamic random access memory (double data date SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (synchlink DRAM, SLDRAM) and direct Memory bus random access memory (direct rambus RAM, DR RAM).
该总线404除包括数据总线之外,还可以包括电源总线、控制总线和状态信号总线等。但是为了清楚说明起见,在图5中将各种总线都标为总线404。In addition to the data bus, the bus 404 may also include a power bus, a control bus, and a status signal bus. However, for clear description, various buses are marked as the bus 404 in FIG. 5.
应理解,根据本申请实施例的运行智能合约的装置400可对应于本申请实施例中的运行智能合约的装置300,并可以对应于本申请实施例图2所示方法中的区块链节点,当 运行智能合约的装置400对应于图2所示方法中的区块链节点时,运行智能合约的装置400中的各个模块的和其它操作和/或功能分别为了实现图2中的由区块链节点执行的方法的操作步骤,为了简洁,在此不再赘述。It should be understood that the device 400 for running a smart contract according to the embodiment of the present application may correspond to the device 300 for running a smart contract in the embodiment of the present application, and may correspond to the blockchain node in the method shown in FIG. 2 of the embodiment of the present application. When the device 400 for running a smart contract corresponds to the blockchain node in the method shown in FIG. 2, the various modules and other operations and/or functions of the device 400 for running a smart contract are designed to implement the routing in FIG. 2 The operation steps of the method executed by the block chain node are not repeated here for the sake of brevity.
需要说明的是,本申请实施例中的运行智能合约的装置可以是区块链网络中节点设备,或者,也可以不是设备本身,而是设备内的部件或模块或芯片,本申请对此不作特别限定。上述实施例,可以全部或部分地通过软件、硬件、固件或其他任意组合来实现。当使用软件实现时,上述实施例可以全部或部分地以计算机程序产品的形式实现。所述计算机程序产品包括一个或多个计算机指令。在计算机上加载或执行所述计算机程序指令时,全部或部分地产生按照本申请实施例所述的流程或功能。所述计算机可以为通用计算机、专用计算机、计算机网络、或者其他可编程装置。所述计算机指令可以存储在计算机可读存储介质中,或者从一个计算机可读存储介质向另一个计算机可读存储介质传输,例如,所述计算机指令可以从一个网站站点、计算机、服务器或数据中心通过有线(例如同轴电缆、光纤、数字用户线(DSL))或无线(例如红外、无线、微波等)方式向另一个网站站点、计算机、服务器或数据中心进行传输。所述计算机可读存储介质可以是计算机能够存取的任何可用介质或者是包含一个或多个可用介质集合的服务器、数据中心等数据存储装置。所述可用介质可以是磁性介质(例如,软盘、硬盘、磁带)、光介质(例如,DVD)、或者半导体介质。半导体介质可以是固态硬盘(solid state drive,SSD)。It should be noted that the device for running smart contracts in the embodiments of this application may be a node device in a blockchain network, or, it may not be the device itself, but a component or module or chip in the device. This application does not deal with this. Specially limited. The foregoing embodiments can be implemented in whole or in part by software, hardware, firmware or any other combination. When implemented by software, the above-mentioned embodiments may be implemented in the form of a computer program product in whole or in part. The computer program product includes one or more computer instructions. When the computer program instructions are loaded or executed on the computer, the processes or functions described in the embodiments of the present application are generated in whole or in part. The computer may be a general-purpose computer, a special-purpose computer, a computer network, or other programmable devices. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions may be transmitted from a website, computer, server, or data center. Transmission to another website site, computer, server or data center via wired (such as coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (such as infrared, wireless, microwave, etc.). The computer-readable storage medium may be any available medium that can be accessed by a computer or a data storage device such as a server or a data center that includes one or more sets of available media. The usable medium may be a magnetic medium (for example, a floppy disk, a hard disk, a magnetic tape), an optical medium (for example, a DVD), or a semiconductor medium. The semiconductor medium may be a solid state drive (SSD).
本领域普通技术人员可以意识到,结合本文中所公开的实施例描述的各示例的单元及算法步骤,能够以电子硬件、或者计算机软件和电子硬件的结合来实现。这些功能究竟以硬件还是软件方式来运行,取决于技术方案的特定应用和设计约束条件。专业技术人员可以对每个特定的应用来使用不同方法来实现所描述的功能,但是这种实现不应认为超出本申请的范围。A person of ordinary skill in the art may be aware that the units and algorithm steps of the examples described in combination with the embodiments disclosed herein can be implemented by electronic hardware or a combination of computer software and electronic hardware. Whether these functions run in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians can use different methods for each specific application to implement the described functions, but such implementation should not be considered beyond the scope of this application.
所属领域的技术人员可以清楚地了解到,为描述的方便和简洁,上述描述的系统、装置和单元的具体工作过程,可以参考前述方法实施例中的对应过程,在此不再赘述。Those skilled in the art can clearly understand that, for the convenience and conciseness of description, the specific working process of the above-described system, device, and unit can refer to the corresponding process in the foregoing method embodiment, which will not be repeated here.
在本申请所提供的几个实施例中,应该理解到,所揭露的系统、装置和方法,可以通过其它的方式实现。例如,以上所描述的装置实施例仅仅是示意性的,例如,所述单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不运行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。In the several embodiments provided in this application, it should be understood that the disclosed system, device, and method may be implemented in other ways. For example, the device embodiments described above are only illustrative. For example, the division of the units is only a logical function division, and there may be other divisions in actual implementation, for example, multiple units or components can be combined or It can be integrated into another system, or some features can be ignored or not run. In addition, the displayed or discussed mutual coupling or direct coupling or communication connection may be indirect coupling or communication connection through some interfaces, devices or units, and may be in electrical, mechanical or other forms.
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。The units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the objectives of the solutions of the embodiments.
另外,在本申请各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。In addition, the functional units in each embodiment of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units may be integrated into one unit.
所述功能如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计 算机,服务器,或者网络设备等)运行本申请各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(Read-Only Memory,ROM)、随机存取存储器(Random Access Memory,RAM)、磁碟或者光盘等各种可以存储程序代码的介质。If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solution of this application essentially or the part that contributes to the existing technology or the part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including Several instructions are used to make a computer device (which may be a personal computer, a server, or a network device, etc.) run all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage media include: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), magnetic disk or optical disk and other media that can store program code .
以上所述,仅为本申请的具体实施方式,但本申请的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本申请揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本申请的保护范围之内。因此,本申请的保护范围应以所述权利要求的保护范围为准。The above are only specific implementations of this application, but the protection scope of this application is not limited to this. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed in this application. Should be covered within the scope of protection of this application. Therefore, the protection scope of this application should be subject to the protection scope of the claims.

Claims (18)

  1. 一种运行智能合约的装置,其特征在于,所述装置应用于区块链网络中,包括:A device for running smart contracts, characterized in that the device is applied to a blockchain network and includes:
    获取模块,用于获取智能合约,所述智能合约具有安全等级的要求;The obtaining module is used to obtain a smart contract, which has a security level requirement;
    处理模块,用于根据预定义的规则,为所述智能合约配置满足所述要求的执行环境;A processing module, configured to configure an execution environment for the smart contract that meets the requirements according to predefined rules;
    所述处理模块,还用于在所述执行环境中运行所述智能合约。The processing module is also used to run the smart contract in the execution environment.
  2. 根据权利要求1所述的装置,其特征在于,所述预定义的规则包括:不同类型的智能合约对应不同安全等级的执行环境。The device according to claim 1, wherein the predefined rules comprise: different types of smart contracts correspond to execution environments of different security levels.
  3. 根据权利要求1或2所述的装置,其特征在于,所述智能合约经过了加密操作,所述处理模块还用于:在所述执行环境对所述智能合约进行解密操作。The device according to claim 1 or 2, wherein the smart contract has undergone an encryption operation, and the processing module is further configured to: perform a decryption operation on the smart contract in the execution environment.
  4. 根据权利要求1至3中任一项所述的装置,其特征在于,所述智能合约经过了签名操作,所述处理模块还用于:在所述执行环境中对所述智能合约进行验证签名操作。The device according to any one of claims 1 to 3, wherein the smart contract has undergone a signature operation, and the processing module is further configured to: verify and sign the smart contract in the execution environment operating.
  5. 根据权利要求1至4中任一项所述的装置,其特征在于,所述获取模块还用于:获取证书吊销列表CRL,所述CRL中保存了已经被吊销的所述智能合约的相关信息;The device according to any one of claims 1 to 4, wherein the obtaining module is further configured to: obtain a certificate revocation list CRL, in which information related to the smart contract that has been revoked is stored in the CRL ;
    所述处理模块还用于:根据所述CRL,终止运行所述智能合约。The processing module is also used to terminate the operation of the smart contract according to the CRL.
  6. 根据权利要求5所述的装置,其特征在于,所述智能合约的相关信息包括已经被吊销的所述智能合约的证书的序列号与吊销时间。The device according to claim 5, wherein the related information of the smart contract includes the serial number and revocation time of the certificate of the smart contract that has been revoked.
  7. 根据权利要求5或6所述的装置,其特征在于,所述CRL存储在重放保护内存块RPMB、电可编程熔丝Efuse模块或一次性可编程OTP存储器中的至少一个中。The device according to claim 5 or 6, wherein the CRL is stored in at least one of a replay protection memory block RPMB, an electrically programmable fuse Efuse module, or a one-time programmable OTP memory.
  8. 根据权利要求1至7中任一项所述的装置,其特征在于,所述处理模块还用于:使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密。The device according to any one of claims 1 to 7, wherein the processing module is further configured to use homomorphic encryption technology or zero-knowledge proof technology to encrypt private data generated in the blockchain.
  9. 根据权利要求2至8中任一项所述的装置,其特征在于,所述预定义的规则包括如下至少一个:The device according to any one of claims 2 to 8, wherein the predefined rule comprises at least one of the following:
    普通级智能合约对应富执行环境REE;或,Ordinary smart contract corresponds to the rich execution environment REE; or,
    系统级智能合约对应可信执行环境TEE;或,The system-level smart contract corresponds to the trusted execution environment TEE; or,
    金融级智能合约对应安全执行环境SEE。Financial-level smart contracts correspond to the secure execution environment SEE.
  10. 一种运行智能合约的方法,其特征在于,所述方法由区块链网络中的任意一个区块链节点执行,包括:A method for running a smart contract, characterized in that the method is executed by any blockchain node in the blockchain network, and includes:
    获取智能合约,所述智能合约具有安全等级的要求;Obtain a smart contract, which has a security level requirement;
    根据预定义的规则,为所述智能合约配置满足所述要求的执行环境;According to predefined rules, configure an execution environment that meets the requirements for the smart contract;
    在所述执行环境中运行所述智能合约。Run the smart contract in the execution environment.
  11. 根据权利要求10所述的方法,其特征在于,所述预定义的规则包括:不同类型的智能合约对应不同安全等级的执行环境。The method according to claim 10, wherein the predefined rules comprise: different types of smart contracts correspond to execution environments of different security levels.
  12. 根据权利要求10或11所述的方法,其特征在于,所述智能合约经过了加密操作,所述方法还包括:The method according to claim 10 or 11, wherein the smart contract has undergone an encryption operation, and the method further comprises:
    在所述执行环境中运行所述智能合约之前,在所述执行环境对所述智能合约进行解密操作。Before running the smart contract in the execution environment, decrypt the smart contract in the execution environment.
  13. 根据权利要求10至12中任一项所述的方法,其特征在于,所述智能合约经过了 签名操作,所述方法还包括:The method according to any one of claims 10 to 12, wherein the smart contract has undergone a signature operation, and the method further comprises:
    在所述执行环境中运行所述智能合约之前,在所述执行环境中对所述智能合约进行验证签名操作。Before running the smart contract in the execution environment, verify and sign the smart contract in the execution environment.
  14. 根据权利要求10至13中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 10 to 13, wherein the method further comprises:
    获取证书吊销列表CRL,所述CRL中保存了已经被吊销的所述智能合约的相关信息;Obtain a certificate revocation list CRL, in which the relevant information of the smart contract that has been revoked is stored;
    根据所述CRL,终止运行所述智能合约。According to the CRL, terminate the operation of the smart contract.
  15. 根据权利要求14所述的方法,其特征在于,所述智能合约的相关信息包括已经被吊销的所述智能合约的证书的序列号与吊销时间。The method according to claim 14, wherein the related information of the smart contract includes the serial number and revocation time of the certificate of the smart contract that has been revoked.
  16. 根据权利要求14或15所述的方法,其特征在于,所述CRL存储在重放保护内存块RPMB、电可编程熔丝Efuse模块或一次性可编程OTP存储器中的至少一个中。The method according to claim 14 or 15, wherein the CRL is stored in at least one of a replay protection memory block RPMB, an electrically programmable fuse Efuse module, or a one-time programmable OTP memory.
  17. 根据权利要求10至16中任一项所述的方法,其特征在于,所述方法还包括:The method according to any one of claims 10 to 16, wherein the method further comprises:
    使用同态加密技术或零知识证明技术对区块链中产生的隐私数据进行加密。Use homomorphic encryption technology or zero-knowledge proof technology to encrypt the private data generated in the blockchain.
  18. 根据权利要求11至17中任一项所述的方法,其特征在于,所述预定义的规则包括如下至少一个:The method according to any one of claims 11 to 17, wherein the predefined rule comprises at least one of the following:
    普通级智能合约对应富执行环境REE;或,Ordinary smart contract corresponds to the rich execution environment REE; or,
    系统级智能合约对应可信执行环境TEE;或,The system-level smart contract corresponds to the trusted execution environment TEE; or,
    金融级智能合约对应安全执行环境SEE。Financial-level smart contracts correspond to the secure execution environment SEE.
PCT/CN2019/081423 2019-04-04 2019-04-04 Method and apparatus for running smart contract WO2020199177A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
PCT/CN2019/081423 WO2020199177A1 (en) 2019-04-04 2019-04-04 Method and apparatus for running smart contract
CN201980054120.0A CN112567414A (en) 2019-04-04 2019-04-04 Method and device for operating intelligent contract

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2019/081423 WO2020199177A1 (en) 2019-04-04 2019-04-04 Method and apparatus for running smart contract

Publications (1)

Publication Number Publication Date
WO2020199177A1 true WO2020199177A1 (en) 2020-10-08

Family

ID=72664615

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/081423 WO2020199177A1 (en) 2019-04-04 2019-04-04 Method and apparatus for running smart contract

Country Status (2)

Country Link
CN (1) CN112567414A (en)
WO (1) WO2020199177A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113627904B (en) * 2021-07-02 2023-04-07 暨南大学 Block chain and probability payment-based streaming media platform implementation method
CN113742764B (en) * 2021-11-08 2022-04-19 北京中科金财科技股份有限公司 Trusted data secure storage method, retrieval method and equipment based on block chain

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107533501A (en) * 2015-03-20 2018-01-02 里维茨公司 Use block chain automated validation appliance integrality
WO2018058441A1 (en) * 2016-09-29 2018-04-05 Nokia Technologies Oy Method and apparatus for trusted computing
CN108647009A (en) * 2018-03-22 2018-10-12 中钞信用卡产业发展有限公司杭州区块链技术研究院 Device, method and the storage medium of block chain information interaction
CN108848058A (en) * 2018-05-07 2018-11-20 众安信息技术服务有限公司 Intelligent contract processing method and block catenary system
CN109118214A (en) * 2017-06-26 2019-01-01 华为技术有限公司 The method and apparatus for running intelligent contract

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107533501A (en) * 2015-03-20 2018-01-02 里维茨公司 Use block chain automated validation appliance integrality
WO2018058441A1 (en) * 2016-09-29 2018-04-05 Nokia Technologies Oy Method and apparatus for trusted computing
CN109118214A (en) * 2017-06-26 2019-01-01 华为技术有限公司 The method and apparatus for running intelligent contract
CN108647009A (en) * 2018-03-22 2018-10-12 中钞信用卡产业发展有限公司杭州区块链技术研究院 Device, method and the storage medium of block chain information interaction
CN108848058A (en) * 2018-05-07 2018-11-20 众安信息技术服务有限公司 Intelligent contract processing method and block catenary system

Also Published As

Publication number Publication date
CN112567414A (en) 2021-03-26

Similar Documents

Publication Publication Date Title
US10943012B2 (en) Technologies for secure hardware and software attestation for trusted I/O
US10339327B2 (en) Technologies for securely binding a platform manifest to a platform
EP3458999B1 (en) Self-contained cryptographic boot policy validation
US10592670B2 (en) Technologies for provisioning and managing secure launch enclave with platform firmware
WO2020042778A1 (en) Firmware upgrade method and device
JP5497171B2 (en) System and method for providing a secure virtual machine
US11722300B2 (en) Chip, private key generation method, and trusted certification method
EP3207488B1 (en) Identifying security boundaries on computing devices
JP7179725B2 (en) Secure key management
US10609070B1 (en) Device based user authentication
CN109102401B (en) Method and device for operating intelligent contracts in block chain network
CA2925733A1 (en) Encryption and decryption processing method, apparatus, and device
JP2019517080A (en) To prevent piracy and fraud on electronic devices using hardware-based secure isolated areas
US20130019110A1 (en) Apparatus and method for preventing copying of terminal unique information in portable terminal
JP2023552421A (en) Remote management of hardware security modules
WO2019051839A1 (en) Data processing method and device
KR20220002616A (en) Encryption key orchestration between trusted containers in a multi-node cluster
US11368291B2 (en) Mutually authenticated adaptive management interfaces for interaction with sensitive infrastructure
CN111414640B (en) Key access control method and device
WO2020199177A1 (en) Method and apparatus for running smart contract
WO2022251987A1 (en) Data encryption and decryption method and apparatus
EP3720042B1 (en) Method and device for determining trust state of tpm, and storage medium
CN117397198A (en) Binding encryption key attestation
WO2021128989A1 (en) Authentication method and device
CN116821976A (en) Hard disk access method and device

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19923224

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19923224

Country of ref document: EP

Kind code of ref document: A1