Smart Contract Execution in Trusted Execution Environment
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Current blockchain platforms face challenges in balancing privacy and performance, with existing solutions often sacrificing performance for privacy or vice versa, and encountering difficulties in managing smart contract execution and results due to inadequate privacy protection.
Innovation Solution
Implementing a method and apparatus that utilize a trusted execution environment (TEE) to manage smart contracts on a blockchain, where encrypted contract codes are decrypted and executed only if not marked as managed, and the execution results are stored securely, ensuring adequate privacy protection and regulatory control over smart contract content.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If encrypted contract codes are stored on the blockchain to protect privacy, then privacy protection is improved, but smart contract execution and management become difficult
Solution Approach 1:
A Trusted Execution Environment (TEE) is introduced as an intermediary between the blockchain and smart contract execution. The TEE securely stores decryption keys and executes encrypted smart contract codes without exposing them to the public blockchain, thus maintaining privacy while enabling execution. The TEE acts as a mediator that allows the system to both protect encrypted contract codes and execute them when needed.
2Reliability
If all smart contracts are encrypted to ensure privacy, then privacy protection is improved, but regulatory control and management capability deteriorate
Solution Approach 1:
The system differentiates between managed and unmanaged smart contracts by applying different handling approaches. Managed smart contracts (those requiring regulatory control) are decrypted and executed in the TEE with their results stored on the blockchain, while unmanaged contracts remain encrypted. This local differentiation allows the system to provide privacy protection where needed while maintaining regulatory control where required.
3Productivity
If decryption keys are stored in the TEE to enable execution of encrypted contracts, then smart contract execution is improved, but security risks increase
Solution Approach 1:
The TEE is pre-configured with decryption keys before any smart contract execution occurs. The keys are securely stored in the TEE's protected memory space, and the TEE's hardware architecture prevents unauthorized access or extraction of these keys. This beforehand preparation ensures that when encrypted smart contracts need to be executed, the decryption infrastructure is already in place and secured, eliminating the need for dynamic key management that would introduce security risks.
Data Source
AI summary
A computer-implemented method includes: in response to a first client device invoking a transaction with respect to a target smart contract, obtaining, by a blockchain node device in a blockchain, encrypted contract codes of the target smart contract; transmitting the encrypted contract codes of the target smart contract to a trusted execution environment; in response to determining that the target smart contract is not a managed smart contract, extracting a decryption key stored in the trusted execution environment, in which the decryption key corresponds to the encrypted contract codes of the target smart contract; decrypting the encrypted contract codes of the target smart contract; executing the decrypted contract codes of the target smart contract in the trusted execution environment; encrypting the execution result; and transmitting the encrypted execution result to the distributed ledgers of the blockchain for storage.


