Ethereum privacy-preserving transaction pre-execution system based on Intel SGX
By building an Ethereum privacy-preserving transaction pre-execution system using Intel SGX, and leveraging the SGX remote proof mechanism and Wasm sandbox technology, the privacy issues of user transactions in the Ethereum transaction pre-execution service are resolved, achieving a balance between privacy protection and performance.
Patent Information
- Application Number
- CN202410985353.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-23
- Publication Date
- 2024-11-05
- Estimated Expiration
- 2044-07-23
AI Technical Summary
The privacy of user transaction content cannot be effectively protected in Ethereum transaction pre-execution services, posing risks of deanonymization and leakage of transaction content to be uploaded to the blockchain.
Intel SGX technology is used to build trading simulation enclaves and strategy analysis enclaves. A secure and reliable communication channel is established through the SGX remote proof mechanism to ensure that user trading content is not obtained by service providers throughout the entire workflow. Wasm sandbox technology is used to protect the execution results of strategy analysis code.
It achieves privacy protection for user transaction content during the transaction pre-execution service, reduces communication overhead, and maintains acceptable latency and throughput in terms of performance.
Smart Images

Figure CN118520506B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information security technologies, and in particular to an Ethereum privacy protection transaction pre-execution system based on Intel SGX. Background Art
[0002] The Ethereum transaction pre-execution system aims to help Ethereum users understand the transactions they are about to sign through transaction simulation execution to prevent them from encountering unexpected behaviors such as phishing attacks. The system generally consists of two components, a transaction simulation component and an optional strategy analysis component. The transaction simulation component is responsible for simulating the execution of user transactions based on the latest block, and recording detailed execution information such as execution path and state access as the transaction simulation result. Currently, Ethereum infrastructure companies such as Alchemy and Blocknative have launched their own transaction simulation products. The strategy analysis component conducts further strategy analysis (such as phishing detection, etc.) on the transaction simulation results, thereby providing users with information feedback with more advanced semantics. The strategy analysis component is optional, and different Ethereum transaction pre-execution service providers have their own proprietary analysis strategies. At present, commercial Ethereum transaction pre-execution services have become an important basic component of the Ethereum community.
[0003] However, user transactions often contain sensitive information of users, which makes Ethereum users worry about privacy threats such as anonymization and leakage of transaction contents to be uploaded to the chain when using Ethereum transaction pre-execution services. However, there is currently no corresponding privacy protection solution. Summary of the invention
[0004] In view of the shortcomings of the prior art, the present invention proposes an Ethereum privacy-preserving transaction pre-execution system based on Intel SGX. The system uses Intel SGX to ensure that the service provider cannot obtain the content of user transactions during the entire workflow of the transaction pre-execution service (including transaction simulation and strategy analysis).
[0005] The specific technical solutions are as follows:
[0006] An Ethereum privacy-preserving transaction pre-execution system based on Intel SGX, comprising a transaction simulation enclave and a policy analysis enclave; the interaction between the transaction simulation enclave and the policy analysis enclave, and between the user and the transaction simulation enclave is carried out through a secure and trusted communication channel established based on the SGX remote attestation mechanism;
[0007] The transaction simulation enclave includes two service interfaces, one for receiving a transaction pre-execution request proposed by a user, and the other for receiving registration information of the strategy analysis enclave; the Ethereum Geth client running inside the transaction simulation enclave is used to simulate and execute the user transaction in the transaction pre-execution request to obtain a transaction simulation result; the transaction simulation enclave sends a strategy analysis request to the strategy analysis enclave and waits for a response, wherein the strategy analysis request includes a transaction simulation result; after receiving the response from the strategy analysis enclave, the transaction simulation enclave aggregates the strategy analysis result and the transaction simulation result as the final result, and sends the final result to the user;
[0008] The policy analysis enclave includes two service interfaces, one for receiving the policy analysis code and its underlying data and configuration information distributed by the service provider, the configuration information including: the IP address list of the transaction simulation enclave, the signature and signature public key of the policy analysis code, and the transaction simulation result field required by the policy analysis code; the policy analysis enclave uses the signature public key that has been verified for signature correctness upon receipt as the policy id for identifying the identity of the policy analysis code; the other service interface is used for the transaction simulation enclave to submit a policy analysis request; the policy analysis enclave registers the policy id and the transaction simulation result field information required by the policy analysis code to the corresponding transaction simulation enclave based on the IP address list of the transaction simulation enclave provided; the policy analysis enclave runs the policy analysis code through its internally integrated Wasm runtime, and after performing policy analysis on the transaction simulation result in the policy analysis request, the policy analysis enclave returns the policy analysis result to the transaction simulation enclave.
[0009] Furthermore, when returning the final result, the transaction simulation enclave only returns the strategy analysis result and the transaction simulation result corresponding to the transaction simulation result field specified by the user;
[0010] When the policy analysis enclave is registered with the transaction simulation enclave, the transaction simulation result field specified by the service provider in the configuration information is sent to the transaction simulation enclave; the transaction simulation enclave accordingly only sends the corresponding simulation result field to the policy analysis enclave.
[0011] Furthermore, the Wasm runtime in the strategy analysis enclave includes two host interfaces and one system interface provided for the strategy analysis code, wherein one host interface is used to input transaction simulation results, and the other host interface is used to output strategy analysis results, and the system interface is used for the strategy analysis code to perform read-only access to its underlying data.
[0012] Furthermore, there are multiple transaction simulation enclaves and policy analysis enclaves. According to the service provider configuration, a single transaction simulation enclave simultaneously establishes connections with multiple policy analysis enclaves containing different policy analysis codes, and a single policy analysis enclave is simultaneously registered with multiple transaction simulation enclaves to serve user requests.
[0013] Furthermore, the two service interfaces set by the transaction simulation enclave and the service interface provided by the policy analysis enclave to connect to the service provider are both HTTPS service interfaces, and their TLS layer protocol uses RA-TLS; the service interface provided by the policy analysis enclave to connect to the transaction simulation enclave is an HTTP service interface, and the interactive data between the two is encrypted using the session key negotiated based on the SGX remote attestation mechanism during the registration of the policy analysis enclave to the transaction simulation enclave.
[0014] An Ethereum privacy protection method based on Intel SGX is implemented according to the Ethereum privacy protection transaction pre-execution system based on Intel SGX, characterized in that the interaction between the user and the transaction simulation enclave, between the transaction simulation enclave and the policy analysis enclave, and between the service provider and the policy analysis enclave is carried out through a secure and trusted communication channel established based on the SGX remote proof mechanism; during the execution of all steps of the method, the transaction simulation enclave continuously monitors the Ethereum network and imports the latest Ethereum block, updates the local Ethereum world state based on the latest Ethereum block, and encrypts and stores the Ethereum block data and the Ethereum world state in the host system; the method comprises the following steps:
[0015] S1. Initialization: The policy analysis enclave receives the policy analysis code and its underlying data and configuration information distributed by the service provider and verified by the signature correctness of the policy analysis enclave, and loads the underlying data of the policy analysis code into the memory file system in the policy analysis enclave; the policy analysis enclave transmits the policy ID identifying the identity of the policy analysis code and the transaction simulation result field information required by the policy analysis code to the transaction simulation enclave according to the IP address list of the transaction simulation enclave indicated in the configuration information, and completes the registration; during the registration process, the transaction simulation enclave verifies the correctness of the registration through the SGX remote attestation mechanism, and negotiates a session key with the policy analysis enclave. All subsequent communications between the transaction simulation enclave and the policy analysis enclave are encrypted using the session key;
[0016] S2: The user sends a transaction pre-execution request to the transaction simulation enclave, where the transaction pre-execution request includes: a user transaction list, a strategy ID list, and a transaction simulation result field to be returned;
[0017] S3: The transaction simulation enclave receives the transaction pre-execution request, simulates the execution of each user transaction in the user transaction list, and generates a transaction simulation result; during the simulation execution process, the transaction simulation enclave reads the Ethereum block data and Ethereum world state from the host system according to demand;
[0018] S4: The transaction simulation enclave sends a policy analysis request to the corresponding policy analysis enclave according to the policy ID list, and waits for a response from the policy analysis enclave; the policy analysis request includes the transaction simulation result required by the policy analysis enclave;
[0019] S5: The policy analysis enclave receives the policy analysis request, creates a new Wasm runtime instance and loads the policy analysis code into the instance; during the execution of the policy analysis code, the policy analysis code obtains the transaction simulation result in the policy analysis request from the policy analysis enclave, and read-only accesses its underlying data through the Wasm system interface, performs policy analysis on the transaction simulation result, and outputs the policy analysis result to the policy analysis enclave;
[0020] S6: The policy analysis enclave returns the obtained policy analysis results to the transaction simulation enclave and destroys the Wasm runtime instance created in S5;
[0021] S7: After receiving the response from the policy analysis enclave, the transaction simulation enclave aggregates the policy analysis result and the transaction simulation result corresponding to the transaction simulation result field to be returned as the final result, and sends the final result to the user.
[0022] Furthermore, the transaction simulation enclave performs a verifiable encryption operation on the Ethereum world state, and then saves the Ethereum world state output to the host system for persistent storage; in the S3, the transaction simulation enclave reads and decrypts the Ethereum world state from the host system as needed; the key for the verifiable encryption operation uses the SGX sealing key of the transaction simulation enclave.
[0023] Furthermore, in S1, the service provider compiles the policy analysis code into Wasm bytecode format, signs the Wasm bytecode with a private key, and adds the signature and the signature public key to the configuration information of the policy analysis code; then the service provider makes a distribution request to distribute the policy analysis code compiled into Wasm bytecode format and its underlying data and configuration information to the policy analysis enclave; after receiving the distribution request, the policy analysis enclave verifies the correctness of the signature. If the verification is successful, it receives all the contents in the service provider's distribution request and uses the signature public key as the identity of the policy analysis code, i.e., the policy id; otherwise, the service provider's distribution request is rejected.
[0024] An electronic device includes a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, they are used to implement the Ethereum privacy protection method based on Intel SGX.
[0025] A computer-readable storage medium having a computer program stored therein, wherein the computer program implements the Ethereum privacy protection method based on Intel SGX when executed by a processor.
[0026] The beneficial effects of the present invention are:
[0027] (1) The present invention utilizes Intel SGX and Wasm sandbox technology to ensure that service providers cannot obtain the content of user transactions during the entire workflow of transaction pre-execution services (including transaction simulation and strategy analysis), thereby protecting the privacy of Ethereum users when using transaction pre-execution services.
[0028] (2) The system of the present invention can be directly deployed on the existing Intel processor platform to improve the user privacy protection capability of the Ethereum transaction pre-execution system. BRIEF DESCRIPTION OF THE DRAWINGS
[0029] Figure 1 It is a schematic diagram of an Ethereum privacy protection transaction pre-execution system based on Intel SGX and its flow chart proposed in an embodiment of the present invention.
[0030] Figure 2 It is a structural schematic diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present application clearer, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0032] In the following description, reference is made to “one specific embodiment”, which describes a subset of all possible embodiments, but it can be understood that “one specific embodiment” describes the same subset or different subsets of all possible embodiments and can be combined with each other without conflict.
[0033] Unless otherwise defined, all technical science and technology used herein have the same meaning as commonly understood by those skilled in the art of the present invention. The terms used herein are only for the purpose of describing the embodiments of the present invention and are not intended to limit the present invention.
[0034] Before further describing the embodiments of the present invention in detail, the nouns and terms involved in the embodiments of the present invention are described. The nouns and terms involved in the embodiments of the present invention are subject to the following explanations.
[0035] (1) Intel SGX is a technology developed to meet the needs of the trusted computing industry. Intel SGX provides an isolated trusted execution environment (technical personnel in this field refer to it as an Enclave) for sensitive code and data at the hardware level, making it impossible for the outside world (including the owner of the computing platform) to obtain or tamper with the content of sensitive code and data during operation. In addition, Intel SGX also provides a remote attestation mechanism and a sealing mechanism. The remote attestation mechanism allows remote users to authenticate the Enclave and establish a secure and trusted communication channel with it, while the sealing mechanism allows the Enclave to encrypt and save data to the persistent storage of the host system. Since Intel SGX ensures the confidentiality and integrity of the code and data in the Enclave through hardware isolation, the performance overhead brought by Intel SGX is very limited.
[0036] (2) WebAssembly, or Wasm for short, is a new format that is portable, small in size, fast in loading, and Web-compatible. It is a Web-oriented binary instruction format that can run in a Web browser and can also be used as a standalone virtual machine or container format.
[0037] Based on the above architecture, the present invention proposes an Ethereum privacy protection transaction pre-execution system based on Intel SGX, such as Figure 1As shown, the system includes a transaction simulation enclave and a policy analysis enclave. The interactions between users and transaction simulation enclaves, between transaction simulation enclaves and policy analysis enclaves, and between service providers and policy analysis enclaves are all carried out through secure and trusted communication channels established based on the SGX remote attestation mechanism to ensure the confidentiality and integrity of data communications. The transaction simulation enclave corresponds to the transaction simulation component in the existing transaction pre-execution system, and uses Intel SGX to prevent service providers from obtaining user transaction content during the processing of transaction simulation tasks; the policy analysis enclave corresponds to the policy analysis component in the existing transaction pre-execution system, and uses Intel SGX to prevent service providers from obtaining transaction simulation results, and uses Wasm sandbox technology to prevent the service provider's policy analysis code from actively leaking the simulation results of user transactions.
[0038] Specifically, the transaction simulation enclave includes two HTTPS service interfaces, one for receiving transaction pre-execution requests from users, and the other for receiving registration information of the policy analysis enclave. The TLS layer protocols of these two HTTPS service interfaces both use the RA-TLS architecture. The RA-TLS architecture was proposed by Intel, which integrates the SGX remote attestation mechanism into the TLS connection establishment process, allowing remote entities (including users and enclaves) to complete the verification of the identity of an enclave during the process of establishing a TLS connection with the enclave. The TLS channel finally established is a secure and reliable communication channel for the remote entity.
[0039] The Ethereum Geth client running inside the transaction simulation enclave simulates the execution of transactions based on the latest Ethereum block, and is used to simulate the execution of user transactions in the transaction pre-execution request to obtain the transaction simulation result; wherein, the Ethereum Geth client uses the Geth tracer mechanism to collect the transaction execution information required by the policy analysis enclave as the transaction simulation result output for subsequent transmission to the policy analysis enclave. The transaction execution information required by the policy analysis enclave includes: contract call, state reading and writing, event throwing, contract creation or contract destruction. The transaction simulation enclave sends a policy analysis request to the policy analysis enclave and waits for a response. The policy analysis request includes the transaction simulation result. After receiving the response from the policy analysis enclave, the transaction simulation enclave aggregates the policy analysis result and the transaction simulation result as the final result, and sends the final result to the user.
[0040] The policy analysis Enclave includes two service interfaces. One is used to receive the policy analysis code and its underlying data and configuration information distributed by the service provider. This service interface is an HTTPS service interface, and its TLS layer protocol uses the RA-TLS architecture. The configuration information includes: the IP address list of the transaction simulation Enclave, the signature and signature public key of the policy analysis code, and the transaction simulation result field required by the policy analysis code. The policy analysis Enclave uses the signature public key that has been verified for signature correctness upon receipt as the policy id that identifies the identity of the policy analysis code. The other service interface is used for the transaction simulation Enclave to submit policy analysis requests. This service interface is an HTTP service interface, but the interaction between the two will be encrypted using the key negotiated by the two when the policy analysis Enclave is registered with the transaction simulation Enclave.
[0041] The policy analysis enclave registers the policy id and the transaction simulation result field information required by the policy analysis code to the corresponding transaction simulation enclave based on the IP address list of the transaction simulation enclave. This process is encrypted based on the session key negotiated by the SGX remote attestation mechanism. The policy analysis enclave is integrated with the Wasm runtime, which includes two host interfaces and a customized Wasm system interface (i.e., WASI interface). One host interface recv_input is used for the policy analysis code to obtain the transaction simulation result input from the policy analysis enclave, and the other host interface send_output is used for the policy analysis code to output the policy analysis result. The WASI interface is used for the policy analysis code to read-only access its underlying data. The policy analysis enclave loads the policy analysis code into the Wasm runtime for execution. During the execution process, the policy analysis code performs policy analysis on the transaction simulation result in the policy analysis request to obtain the policy analysis result, and the policy analysis enclave returns the policy analysis result to the transaction simulation enclave.
[0042] Furthermore, when submitting a transaction pre-execution request to the transaction simulation Enclave, the user chooses to specify the transaction simulation result fields to be returned. When the transaction simulation Enclave returns the final result, it only returns the policy analysis results and the transaction simulation result fields corresponding to the transaction simulation result fields specified by the user. The service provider specifies the transaction simulation result fields required by the policy analysis code in the configuration information submitted to the policy analysis Enclave; when the policy analysis Enclave registers with the transaction simulation Enclave, it sends the transaction simulation result fields specified by the service provider to the transaction simulation Enclave; accordingly, the transaction simulation Enclave only sends the corresponding simulation result fields to the policy analysis Enclave.
[0043] Furthermore, there are multiple transaction simulation enclaves and policy analysis enclaves. According to the service provider configuration, a single transaction simulation enclave simultaneously establishes connections with multiple policy analysis enclaves containing different policy analysis codes, and a single policy analysis enclave is simultaneously registered with multiple transaction simulation enclaves to serve user requests.
[0044] Based on the above-mentioned Ethereum privacy protection transaction pre-execution system based on Intel SGX, an embodiment of the present invention proposes an Ethereum privacy protection method based on Intel SGX. During the execution of all steps of the method, the transaction simulation Enclave continuously monitors the Ethereum network and imports the latest Ethereum block, updates the local Ethereum world state based on the latest Ethereum block, thereby maintaining synchronization with the Ethereum network; then encrypts and stores the Ethereum block data and the Ethereum world state in the disk in the host system for persistent storage, and the subsequent transaction simulation Enclave can read from the host system as needed. Among them, before outputting the Ethereum world state to the host system, the transaction simulation Enclave performs a verifiable encryption operation on the Ethereum world state, and the encryption key is the SGX sealing key of the transaction simulation Enclave, so that only the transaction simulation Enclave can decrypt the Ethereum world state.
[0045] The Ethereum privacy protection method based on Intel SGX specifically includes the following steps:
[0046] S1: The service provider creates transaction simulation Enclave and policy analysis Enclave instances as needed. For the policy analysis Enclave, perform the following initialization operations:
[0047] (1.1) The service provider compiles the policy analysis code into Wasm bytecode format, signs the generated Wasm bytecode with a private key, and adds the signature and the signature public key to the configuration information of the policy analysis code.
[0048] (1.2) The service provider makes a distribution request through the HTTPS service interface provided by the policy analysis enclave, and distributes the policy analysis code compiled into Wasm bytecode and its underlying data and configuration information to the policy analysis enclave.
[0049] (1.3) After receiving the distribution request from the service provider, the policy analysis enclave first verifies the correctness of the signature of the policy analysis code based on the signature public key in the configuration information of the policy analysis code. If the verification is successful, all the contents in the service provider's distribution request are received, and the signature public key is used as the identity of the policy analysis code (ie, the policy id). Otherwise, the service provider's distribution request is rejected. After the signature correctness verification is successful, the underlying data of the policy analysis code must be loaded into the memory file system within the policy analysis enclave to allow subsequent policy analysis codes to read-only access the underlying data through the WASI interface.
[0050] (1.4) The policy analysis enclave transmits the policy ID that identifies the policy analysis code and the transaction simulation result field information required by the policy analysis code to the transaction simulation enclave according to the IP address list of the transaction simulation enclave indicated in the configuration information to complete the registration, so that the transaction simulation enclave can correctly distribute the transaction simulation results to the policy analysis enclave containing the policy analysis code specified by the user during the service provision process, and only distribute the necessary transaction simulation result fields, thereby reducing communication overhead. During the registration process, the transaction simulation enclave uses the SGX remote attestation mechanism to verify that the registered one is indeed the policy analysis enclave, and generates a session key with the policy analysis enclave through the key exchange algorithm. All subsequent communications between the transaction simulation enclave and the policy analysis enclave are encrypted using the session key.
[0051] S2: The user sends a transaction pre-execution request to the transaction simulation Enclave through the HTTPS service interface provided by the transaction simulation Enclave. The content of the transaction pre-execution request includes: user transaction list, strategy ID list, and transaction simulation result field to be returned.
[0052] S3: After receiving the user's transaction pre-execution request, the transaction simulation enclave simulates the execution of each user transaction in the user transaction list of the transaction pre-execution request and generates a transaction simulation result. During the simulation execution process, the transaction simulation enclave reads the Ethereum block data and Ethereum world state from the host system according to demand.
[0053] S4: The transaction simulation enclave sends a policy analysis request to the corresponding policy analysis enclave according to the policy id list in the transaction pre-execution request, and waits for the response of the policy analysis enclave; the policy analysis request contains the simulation result of the user transaction. For each policy analysis enclave, the transaction simulation enclave only passes the transaction simulation result fields it needs to reduce communication overhead.
[0054] S5: After receiving the policy analysis request from the transaction simulation Enclave, the policy analysis Enclave creates a new Wasm runtime instance and loads the policy analysis code into the instance. During the policy analysis process, the policy analysis code obtains the transaction simulation results in the policy analysis request from the policy analysis Enclave through the recv_input interface. After the policy analysis code performs policy analysis on the transaction simulation results, it outputs the policy analysis results to the policy analysis Enclave through the send_output interface. During the execution process, the policy analysis code can also read-only access the underlying data stored in the policy analysis Enclave memory file system through the WASI interface.
[0055] S6: The policy analysis enclave returns the policy analysis results output by the obtained policy analysis code to the transaction simulation enclave, and destroys the Wasm runtime instance created in S5.
[0056] S7: The transaction simulation enclave aggregates the responses of the policy analysis enclave (i.e., the policy analysis results returned by the policy analysis enclave), aggregates the policy analysis results and the transaction simulation results corresponding to the transaction simulation result fields that need to be returned as the final result, and sends the final result to the user. Among them, for the transaction simulation results, the transaction simulation enclave only returns the transaction simulation result fields required by the user to reduce communication overhead.
[0057] In order to prove that the system of the present invention can meet the performance requirements while meeting the requirements of privacy protection, the latency and throughput of the transaction simulation enclave and the policy analysis enclave are tested based on the real user transaction data set.
[0058] In order to test the performance of the transaction simulation Enclave, the Ethereum block state of the transaction simulation Enclave is first paused at block 17786030, and a group of transactions are selected from the 4000 blocks after block 17786030 as the data set for the experiment. The selection criteria are: the transaction can be simulated and executed successfully based on block 17786030 without rollback. Thus, an experimental data set containing 91,520 transactions was finally collected and generated. Then 192 concurrent connections were used to send the transactions in the experimental data set to the transaction simulation Enclave to test its latency and throughput. In addition, a transaction simulation component that was not protected by the system of the present invention was also run, and the same experimental process was carried out as a benchmark for performance overhead.
[0059] Table 1 shows the final results of the performance test. As can be seen from Table 1, the security protection of the transaction simulation Enclave brings 26 milliseconds of latency overhead and 38% throughput overhead to the transaction simulation component, and the performance overhead is acceptable.
[0060] Table 1 Performance test results of transaction simulation Enclave latency and throughput
[0061]
[0062] In order to test the performance of the policy analysis Enclave, three scenarios, namely phishing detection, compliance detection and attack detection, were selected for performance testing experiments. First, the sample policy analysis code for these three scenarios was implemented. Then, the transaction simulation results (a total of 91,520) generated in the aforementioned transaction simulation Enclave performance test experiment were used as the experimental data set for the policy analysis Enclave performance test experiment, and 192 concurrent connections were used to send the transaction simulation results in the experimental data set to the policy analysis Enclave to test its latency and throughput. Table 2 shows the final results of the performance test. As can be seen from Table 2, the policy analysis Enclave can provide the same order of magnitude of latency and throughput as the transaction simulation Enclave, indicating that the policy analysis Enclave can match the latency and throughput of the transaction simulation Enclave.
[0063] Table 2 Performance test results of Enclave latency and throughput for policy analysis
[0064]
[0065] like Figure 2 As shown, an electronic device provided by an embodiment of the present invention includes a memory and one or more processors. The memory stores executable code. When the one or more processors execute the executable code, it is used to implement the Ethereum privacy protection method based on Intel SGX in the above embodiment.
[0066] An electronic device proposed in the present invention can be applied to any device with data processing capability, and the device with data processing capability can be a device or apparatus such as a computer. The electronic device can be implemented by software, or by hardware or a combination of software and hardware. Taking software implementation as an example, as a device in a logical sense, the processor of any device with data processing capability reads the corresponding computer program instructions in the non-volatile memory into the memory and runs them. From the hardware level, if Figure 2 As shown, it is a hardware structure diagram of an electronic device of the present invention, in which any device with data processing capability is located, except Figure 2In addition to the processor, memory, network interface, and non-volatile memory shown, any device with data processing capabilities in which the device of the present invention is located in the embodiments may also include other hardware, which will not be described in detail.
[0067] For the electronic device embodiment, since it basically corresponds to the method embodiment, the relevant parts can refer to the partial description of the method embodiment. The electronic device embodiment described above is only schematic, and 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 modules can be selected according to actual needs to achieve the purpose of the scheme of the present invention. Ordinary technicians in this field can understand and implement it without paying creative work.
[0068] An embodiment of the present invention also provides a computer-readable storage medium on which a program is stored. When the program is executed by a processor, the Ethereum privacy protection method based on Intel SGX in the above embodiment is implemented.
[0069] The computer-readable storage medium may be an internal storage unit of any device with data processing capability in any of the aforementioned embodiments, such as a hard disk or a memory. The computer-readable storage medium may also be an external storage device of any device with data processing capability, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), an SD card, a flash card (Flash Card), etc. equipped on the device. Furthermore, the computer-readable storage medium may also include both an internal storage unit and an external storage device of any device with data processing capability. The computer-readable storage medium is used to store computer programs and other programs and data required by any device with data processing capability, and may also be used to temporarily store data that has been output or is to be output.
[0070] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.
[0071] The above description is only the preferred embodiment of the present invention, which enables those skilled in the art to understand or implement the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various changes and variations, and the various modifications to these embodiments will be obvious to those skilled in the art. The general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention shall be included in the protection scope of the present invention.
Claims
1. An Ethereum privacy protection transaction pre-execution system based on Intel SGX, characterized in that: It includes a transaction simulation enclave and a strategy analysis enclave. The interaction between the transaction simulation enclave and the strategy analysis enclave, and between the user and the transaction simulation enclave is carried out through a secure and trusted communication channel established based on the SGX remote attestation mechanism. The transaction simulation enclave includes two service interfaces, one for receiving a transaction pre-execution request proposed by a user, and the other for receiving registration information of the strategy analysis enclave; the Ethereum Geth client running inside the transaction simulation enclave is used to simulate and execute the user transaction in the transaction pre-execution request to obtain a transaction simulation result; the transaction simulation enclave sends a strategy analysis request to the strategy analysis enclave and waits for a response, wherein the strategy analysis request includes a transaction simulation result; after receiving the response from the strategy analysis enclave, the transaction simulation enclave aggregates the strategy analysis result and the transaction simulation result as the final result, and sends the final result to the user; The policy analysis enclave includes two service interfaces, one for receiving the policy analysis code and its underlying data and configuration information distributed by the service provider, the configuration information including: the IP address list of the transaction simulation enclave, the signature and signature public key of the policy analysis code, and the transaction simulation result field required by the policy analysis code; the policy analysis enclave uses the signature public key that has been verified for signature correctness upon receipt as the policy id for identifying the identity of the policy analysis code; the other service interface is used for the transaction simulation enclave to submit a policy analysis request; the policy analysis enclave registers the policy id and the transaction simulation result field information required by the policy analysis code to the corresponding transaction simulation enclave based on the IP address list of the transaction simulation enclave provided; the policy analysis enclave runs the policy analysis code through its internally integrated Wasm runtime, and after performing policy analysis on the transaction simulation result in the policy analysis request, the policy analysis enclave returns the policy analysis result to the transaction simulation enclave.
2. The Intel SGX-based Ethereum privacy protection transaction pre-execution system according to claim 1, characterized in that: When returning the final result, the transaction simulation enclave only returns the strategy analysis result and the transaction simulation result corresponding to the transaction simulation result field specified by the user; When the policy analysis enclave is registered with the transaction simulation enclave, the transaction simulation result field specified by the service provider in the configuration information is sent to the transaction simulation enclave; the transaction simulation enclave accordingly only sends the corresponding transaction simulation result to the policy analysis enclave.
3. The Intel SGX-based Ethereum privacy protection transaction pre-execution system according to claim 1, characterized in that: The Wasm runtime in the strategy analysis enclave includes two host interfaces and one system interface provided for the strategy analysis code, wherein one host interface is used to input transaction simulation results, and the other host interface is used to output strategy analysis results, and the system interface is used for the strategy analysis code to perform read-only access to its underlying data.
4. The Intel SGX-based Ethereum privacy protection transaction pre-execution system according to claim 1, characterized in that: There are multiple transaction simulation enclaves and policy analysis enclaves. According to the service provider configuration, a single transaction simulation enclave simultaneously establishes connections with multiple policy analysis enclaves containing different policy analysis codes, and a single policy analysis enclave is simultaneously registered with multiple transaction simulation enclaves to serve user requests.
5. The Intel SGX-based Ethereum privacy protection transaction pre-execution system according to claim 1, characterized in that: The two service interfaces set by the transaction simulation enclave and the service interface provided by the policy analysis enclave to connect to the service provider are both HTTPS service interfaces, and their TLS layer protocol uses RA-TLS; the service interface provided by the policy analysis enclave to connect to the transaction simulation enclave is an HTTP service interface, and the interactive data between the policy analysis enclave and the transaction simulation enclave is encrypted using the session key negotiated based on the SGX remote attestation mechanism during the registration of the policy analysis enclave to the transaction simulation enclave.
6. An Ethereum privacy protection method based on Intel SGX, implemented according to the Ethereum privacy protection transaction pre-execution system based on Intel SGX according to any one of claims 1-5, characterized in that: The interactions between the user and the transaction simulation enclave, between the transaction simulation enclave and the strategy analysis enclave, and between the service provider and the strategy analysis enclave are all carried out through a secure and trusted communication channel established based on the SGX remote attestation mechanism; during the execution of all steps of the method, the transaction simulation enclave continuously monitors the Ethereum network and imports the latest Ethereum block, updates the local Ethereum world state based on the latest Ethereum block, and encrypts and stores the Ethereum block data and the Ethereum world state in the host system; The method comprises the following steps: S1. Initialization: The policy analysis enclave receives the policy analysis code and its underlying data and configuration information distributed by the service provider and verified by the signature correctness of the policy analysis enclave, and loads the underlying data of the policy analysis code into the memory file system in the policy analysis enclave; the policy analysis enclave transmits the policy ID identifying the identity of the policy analysis code and the transaction simulation result field information required by the policy analysis code to the transaction simulation enclave according to the IP address list of the transaction simulation enclave indicated in the configuration information, and completes the registration; during the registration process, the transaction simulation enclave verifies the correctness of the registration through the SGX remote attestation mechanism, and negotiates a session key with the policy analysis enclave. All subsequent communications between the transaction simulation enclave and the policy analysis enclave are encrypted using the session key; S2: The user sends a transaction pre-execution request to the transaction simulation enclave, where the transaction pre-execution request includes: a user transaction list, a strategy ID list, and a transaction simulation result field to be returned; S3: The transaction simulation enclave receives the transaction pre-execution request, simulates the execution of each user transaction in the user transaction list, and generates a transaction simulation result; during the simulation execution process, the transaction simulation enclave reads the Ethereum block data and Ethereum world state from the host system according to demand; S4: The transaction simulation enclave sends a policy analysis request to the corresponding policy analysis enclave according to the policy ID list, and waits for a response from the policy analysis enclave; the policy analysis request includes the transaction simulation result required by the policy analysis enclave; S5: The policy analysis enclave receives the policy analysis request, creates a new Wasm runtime instance and loads the policy analysis code into the instance; during the execution of the policy analysis code, the policy analysis code obtains the transaction simulation result in the policy analysis request from the policy analysis enclave, and read-only accesses its underlying data through the Wasm system interface, performs policy analysis on the transaction simulation result, and outputs the policy analysis result to the policy analysis enclave; S6: The policy analysis enclave returns the obtained policy analysis results to the transaction simulation enclave and destroys the Wasm runtime instance created in S5; S7: After receiving the response from the policy analysis enclave, the transaction simulation enclave aggregates the policy analysis result and the transaction simulation result corresponding to the transaction simulation result field to be returned as the final result, and sends the final result to the user.
7. The Ethereum privacy protection method based on Intel SGX according to claim 6, characterized in that: The transaction simulation enclave performs a verifiable encryption operation on the Ethereum world state, and then saves the Ethereum world state output to the host system for persistent storage; in S3, the transaction simulation enclave reads and decrypts the Ethereum world state from the host system as needed; the key for the verifiable encryption operation uses the SGX sealing key of the transaction simulation enclave.
8. The Ethereum privacy protection method based on Intel SGX according to claim 6, characterized in that: In S1, the service provider compiles the policy analysis code into Wasm bytecode format, signs the Wasm bytecode with a private key, and adds the signature and the signature public key to the configuration information of the policy analysis code; then the service provider makes a distribution request to distribute the policy analysis code compiled into Wasm bytecode format and its underlying data and configuration information to the policy analysis enclave; The policy analysis enclave verifies the correctness of the signature after receiving the distribution request. If the verification is successful, it accepts all the contents in the distribution request from the service provider and uses the signature public key as the identity of the policy analysis code, namely the policy id; otherwise, it rejects the distribution request from the service provider.
9. An electronic device, characterized in that: It includes a memory and one or more processors, wherein the memory stores executable code, and when the one or more processors execute the executable code, it is used to implement the Ethereum privacy protection method based on Intel SGX as described in any one of claims 6-8.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by the processor, it implements the Ethereum privacy protection method based on Intel SGX as described in any one of claims 6-8.
