Privacy protection method and apparatus for account data in blockchain
By executing transactions involving private accounts in the trusted execution environment of the blockchain, and encrypting and storing the data in external storage space, the problem of balancing privacy and performance is solved, and efficient privacy protection and security are achieved.
Patent Information
- Application Number
- PCT/CN2023/134867
- Authority / Receiving Office
- WO · WO
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-04-28
- Filing Date
- 2023-11-28
- Publication Date
- 2024-10-31
AI Technical Summary
Existing blockchain technology is difficult to address both privacy and performance challenges at the same time. Common encryption technologies are highly complex and have poor versatility, resulting in performance losses, and existing TEE solutions have limitations in efficiency.
By executing transactions involving private accounts in a trusted execution environment and encrypting and storing the account data in a target storage space outside the trusted execution environment, privacy and security are ensured while reducing the occupation of the trusted execution environment. Increase its usage.
It achieves ensuring the privacy and security of private account data in the blockchain, while reducing performance loss, improving the usage of the trusted execution environment and the storage efficiency of private account data.
Smart Images

Figure CN2023134867_31102024_PF_FP_ABST
Abstract
Description
Privacy protection method and device for account data in blockchain Technical Field
[0001] The embodiments of this specification belong to the field of blockchain technology, and more particularly to a method and apparatus for protecting the privacy of account data in a blockchain. Background Art
[0002] Blockchain technology is built on top of a transmission network (e.g., a peer-to-peer network). Nodes in these transmission networks utilize a chained data structure to verify and store data, and a distributed node consensus algorithm to generate and update data. The number of nodes in these blockchain networks may need to be increased over time.
[0003] Currently, the two biggest technical challenges for enterprise-level blockchain platforms are privacy and performance, and these two challenges are often difficult to address simultaneously. Most solutions sacrifice performance for privacy, or pursue performance without considering privacy. Common encryption technologies that address privacy issues, such as homomorphic encryption and zero-knowledge proofs, are highly complex, lack universal applicability, and can also result in significant performance losses.
[0004] Trusted Execution Environments (TEEs) offer another approach to addressing privacy concerns. TEEs act as a black box within hardware. Code and data executed within the TEE cannot be viewed by the operating system; they can only be manipulated through predefined interfaces within the code. In terms of efficiency, due to the black-box nature of TEEs, operations performed within the TEE are performed on plaintext data, rather than the complex cryptographic operations used in homomorphic encryption. This eliminates any loss in computational efficiency. Therefore, combining TEEs with blockchains can significantly improve blockchain security and privacy with minimal performance degradation. Currently, the industry is highly interested in TEE solutions, with nearly all major chip and software alliances offering their own TEE solutions, including software-based TPMs (Trusted Platform Modules) and hardware-based solutions such as Intel SGX (Software Guard Extensions), ARM Trustzone, and AMD PSP (Platform Security Processor).
[0005] Summary of the Invention
[0006] The purpose of this specification is to provide a method and device for protecting the privacy of account data in a blockchain.
[0007] According to a first aspect of one or more embodiments of this specification, a method for protecting the privacy of account data in a blockchain is proposed. The method includes: in response to a received target transaction, determining whether the target transaction involves a private account; if the target transaction involves a private account, executing the target transaction in a trusted execution environment; wherein the account data of the private account is encrypted and stored in a target storage space outside the trusted execution environment.
[0008] According to a second aspect of one or more embodiments of this specification, a privacy protection device for account data in a blockchain is proposed, the device comprising: a determination unit: in response to a received target transaction, determining whether the target transaction involves a privacy account; a first execution unit: if the target transaction involves a privacy account, executing the target transaction in a trusted execution environment; wherein the account data of the privacy account is encrypted and stored in a target storage space outside the trusted execution environment.
[0009] According to a third aspect of one or more embodiments of this specification, an electronic device is proposed, comprising: a processor; a memory for storing processor-executable instructions; wherein the processor implements the method described in the first aspect by running the executable instructions.
[0010] According to a fourth aspect of one or more embodiments of this specification, a computer-readable storage medium is provided, on which computer instructions are stored. When the instructions are executed by a processor, the steps of the method described in the first aspect are implemented.
[0011] In the embodiments of this specification, on the one hand, by determining transactions involving private accounts in the blockchain, all transactions involving private accounts can be executed in the trusted execution environment, thereby ensuring the privacy and security of the account data of the private accounts. On the other hand, since the space of the trusted execution environment is limited, storing the account data of the private accounts in the target storage space outside the trusted execution environment can reduce the occupation of the trusted execution environment and improve the utilization rate of the trusted execution environment. Moreover, since the account data is encrypted within the trusted execution environment and then stored in the target storage space, the account data of the private accounts only appears in plain text within the trusted execution environment and is in an encrypted state outside the trusted execution environment, further ensuring the privacy and security of the account data of the private accounts. BRIEF DESCRIPTION OF THE DRAWINGS
[0012] In order to more clearly illustrate the technical solutions of the embodiments of this specification, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments recorded in this specification. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0013] FIG1 is a flowchart of a method for protecting the privacy of account data in a blockchain provided by an exemplary embodiment.
[0014] FIG2 is a schematic diagram of executing a target transaction provided by an exemplary embodiment.
[0015] FIG3 is a schematic structural diagram of a device provided by an exemplary embodiment.
[0016] FIG4 is a block diagram of a privacy protection device for account data in a blockchain provided by an exemplary embodiment. DETAILED DESCRIPTION
[0017] To help those skilled in the art better understand the technical solutions in this specification, the following will provide a clear and complete description of the technical solutions in the embodiments of this specification, in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of this specification, not all of them. All other embodiments derived by those skilled in the art based on the embodiments in this specification without creative effort shall fall within the scope of protection of this specification.
[0018] Blockchains are generally categorized into three types: public, private, and consortium. Furthermore, various combinations exist, such as private + consortium, or consortium + public. Public blockchains offer the highest degree of decentralization. Participants can access data on the chain, participate in transactions, and compete for the right to record new blocks. Furthermore, participants (i.e., nodes) can freely join and exit the network and perform related operations. In contrast, private blockchains have write access controlled by a specific organization or institution, while data read access is regulated by that organization. Simply put, a private blockchain can be a weakly centralized system with a small number of participating nodes, strictly limited in scope. This type of blockchain is more suitable for internal use within a specific organization. Consortium blockchains fall somewhere between public and private blockchains, achieving "partial decentralization." Each node in a consortium chain typically has a corresponding entity or organization. Participants join the network through authorization and form a stakeholder alliance to jointly maintain the blockchain's operations.
[0019] Whether public, private, or consortium chains, all implement related functions and data interactions through transactions, with each object participating in the transaction through a corresponding account. Account types can be categorized as external accounts and contract accounts. External accounts are typically controlled by individuals or organizations and generate and initiate transactions. Contract accounts correspond to smart contracts on the blockchain. Smart contracts are contracts on public, private, or consortium blockchains that can be triggered and executed by transactions and are defined in code.
[0020] After a smart contract is created, a corresponding contract account appears on the blockchain with a specific address. The contract code and account storage are stored in this contract account. The smart contract's behavior is controlled by the contract code, while the smart contract's account storage stores the contract's state. In other words, a smart contract creates a virtual account on the blockchain that contains the contract code and account storage. When an external account generates a transaction, it can call the smart contract by adding the address of the called smart contract to the transaction's "to" field, thereby executing the smart contract's code and implementing the relevant functions. Smart contracts can be independently executed on each node in the blockchain network through a prescribed method, with all execution records and data stored on the blockchain. Therefore, when a transaction is completed, an immutable and non-lost transaction certificate is stored on the blockchain. Of course, an external account doesn't necessarily need to call a smart contract when generating a transaction; for example, the transaction can simply be used to implement a general transfer function.
[0021] Figure 1 is a flowchart of a privacy protection method for account data in a blockchain provided by an exemplary embodiment. As shown in Figure 1, the method includes at least the following steps: Step 102, in response to a received target transaction, determining whether the target transaction involves a private account.
[0022] The target transaction can be a single transaction or one of the multiple transactions contained in a block on the blockchain. The transactions in this specification can be used to implement relatively simple processing logic, such as transfer logic similar to that in related technologies. The transactions in this specification can also be used to implement relatively complex processing logic, which can be achieved with the help of the above-mentioned smart contracts. As shown in Figure 2, the local blockchain node 12 can run a virtual machine 121, which is a Turing-complete virtual machine, which means that various complex logics can be implemented through it. Users publish and call smart contracts in the blockchain on the virtual machine 121. In fact, the virtual machine 121 directly runs the virtual machine code (virtual machine bytecode, hereinafter referred to as "bytecode"). The smart contract deployed on the blockchain can be in the form of bytecode.
[0023] The target transaction can be initiated by the client and sent directly to the local blockchain node (the local blockchain node can be the blockchain node applied by the method shown in Figure 1). Taking Figure 2 as an example, the local blockchain node 12 includes a transaction / query interface that can be connected to the client 11, allowing the client 11 to submit transactions to the local blockchain node 12. Accordingly, after the transaction is completed, the local blockchain node 12 can return the transaction execution result to the client 11 through the transaction / query interface. The execution result may include execution success or failure, and may also include detailed information such as transaction logs, but this specification does not limit this.
[0024] The target transaction can also be forwarded to the local blockchain node by other blockchain nodes in the blockchain. Taking Figure 2 as an example, the above interface can be connected to other blockchain nodes, and other blockchain nodes can forward transactions to the local blockchain node 12. Similarly, other blockchain nodes can also connect to the client 11 through their own transaction / query interface to receive transactions submitted by the client 11.
[0025] The account data of a privacy account is stored in encrypted form in the target storage space. The corresponding data of a normal account is stored in plain text in the target storage space. A privacy account can be an external account or a contract account.
[0026] The privacy account involved in the target transaction includes at least one of the following: the privacy account corresponding to the account address recorded in the field of the target transaction, the privacy account involved in the smart contract called by the target transaction, and the privacy account involved in the smart contract further directly or indirectly called by the smart contract called by the target transaction.
[0027] If the account address recorded in the "to" field of a transaction corresponds to a privacy account, then the transaction involves the privacy account. If the account address recorded in the "to" field of a transaction is a smart contract, and the smart contract needs to access the account data of the privacy account during execution, then the transaction involves the privacy account. If the account address recorded in the "to" field of a transaction is smart contract A, and smart contract A needs to access smart contract B during execution, and smart contract B needs to access the account data of the privacy account during execution, then the transaction also involves the privacy account. Similarly, if the target transaction directly or indirectly accesses the account data of the privacy account during execution, then the target transaction involves the privacy account. If the privacy account is an external account, the account data of the privacy account can be external account data, including account balance and account status; if the privacy account is a contract account, the account data of the privacy account can be contract data, including contract code.
[0028] Step 104: If the target transaction involves a private account, execute the target transaction in a trusted execution environment; wherein the account data of the private account is encrypted and stored in a target storage space outside the trusted execution environment.
[0029] A Trusted Execution Environment (TEE) is a secure extension of CPU hardware that is completely isolated from the outside world. The TEE concept was first proposed by Global Platform to address the secure isolation of resources on mobile devices, providing a trusted and secure execution environment for applications, parallel to the operating system. Executing a target transaction in a TEE involves running a virtual machine within the TEE to implement the processing logic recorded in the target transaction.
[0030] The target storage space can be any storage space outside of the trusted execution environment, such as the storage hard drive corresponding to another blockchain node on the blockchain, or other storage devices. The account data of private accounts is stored in encrypted form in this target storage space, while the account data of regular accounts is stored in plain text in this target storage space.
[0031] This embodiment, on the one hand, ensures the privacy and security of the account data of the private accounts by determining the transactions involving the private accounts in the blockchain, so that all transactions involving the private accounts can be executed in the trusted execution environment. On the other hand, since the account data of the private accounts is encrypted and stored in the target storage space outside the trusted execution environment, the harm caused by the leakage of the account data of the private accounts is reduced.
[0032] In one embodiment, determining whether the target transaction involves a privacy account includes at least one of the following: executing the target transaction outside the trusted execution environment to determine the account data involved in the target transaction; determining that the target transaction involves a privacy account when the determined account data includes encrypted account data; or, pre-executing the target transaction to obtain a pre-execution read-write set of the target transaction; determining the account data involved in the target transaction based on the pre-execution read-write set of the target transaction, and determining that the target transaction involves a privacy account when the determined account data includes encrypted account data; or, obtaining the account data involved in the target smart contract recorded in the contract account of the target smart contract called by the target transaction; determining that the target transaction involves a privacy account when the determined account data includes encrypted account data; or, determining that the target transaction involves a privacy account when the target transaction is a privacy transaction.
[0033] Since the account data of a private account is stored in ciphertext, if the account data contains encrypted account data, it can be determined that the account is a private account.
[0034] In one embodiment, the target transaction is executed outside the trusted execution environment to determine the account data involved in the target transaction. If the determined account data includes encrypted account data, the target transaction is determined to involve a private account. As shown in Figure 2, the local blockchain node 12 can be divided into a regular execution environment and a trusted execution environment. After the local blockchain node 12 obtains the target transaction, it can execute the target transaction through the virtual machine 121 in the regular execution environment to verify whether the target transaction involves a private account. During the execution of the target transaction, the account data of the accounts involved in the target transaction must be obtained. If the obtained account data does not include encrypted account data, the target transaction does not involve a private account and execution of the target transaction continues. If the obtained account data includes encrypted account data, the target transaction involves a private account. Since the virtual machine 121 in the regular execution environment cannot decrypt the encrypted account data, the target transaction will be terminated and re-executed by the virtual machine 124 in the trusted execution environment. This embodiment is compatible with the related technologies for processing transactions that do not involve privacy accounts, and can also process transactions that involve privacy accounts, thereby achieving mixed processing of transactions that do and do not involve privacy accounts on the entire blockchain network.
[0035] The target transaction is pre-executed to obtain a pre-execution read-write set for the target transaction; the account data involved in the target transaction is determined based on the pre-execution read-write set, and if the determined account data includes encrypted account data, the target transaction is determined to involve a private account. The pre-execution read-write set of the target transaction includes a pre-execution read set and a pre-execution write set, and the local blockchain node can determine the account data involved in the target transaction based on the pre-execution read-write set. For example, the pre-execution read-write set can record the account address of the account involved in the target transaction, and the target transaction can access the recorded account address to determine the account data involved in the target transaction. This embodiment determines whether the target transaction involves a private account through the pre-execution read-write set of the target transaction. The resources and time consumed by pre-execution are less than those consumed by actually executing the transaction, thereby improving the efficiency of determining private accounts.
[0036] For the target smart contract called by the target exchange, the account data involved in the target smart contract recorded in the contract account of the target smart contract is obtained; if the determined account data includes encrypted account data, it is determined that the target transaction involves a private account. The target smart contract is a smart contract deployed on the blockchain called by the target exchange. When the target smart contract is deployed on the blockchain, a read-write set is generated in association with the target smart contract. The read-write set is recorded in the contract account corresponding to the target smart contract and is used to determine the account data involved in the target smart contract. This embodiment determines whether the target transaction involves a private account based on the account data recorded in the contract account of the target smart contract. Whether the target account involves a private account can be determined without executing the transaction, thereby improving the efficiency of determining the private account.
[0037] In the case where the target transaction is a private transaction, it is determined that the target transaction involves a private account. The transaction contains a transaction type field, which is used to define the transaction type of the corresponding transaction. A transaction whose field value of the transaction type field is "private transaction" is a private transaction, and a transaction whose field value of the transaction type field is "plaintext transaction" is a plaintext transaction. As shown in Figure 2, the transaction submitted by the client 11 (taking the transaction submitted by the client 11 as an example) first enters the "transaction / query interface" in the regular execution environment for type identification, and the identified plaintext transaction is left in the regular execution environment for processing, while the identified private transaction is passed to the trusted execution environment for processing. This embodiment is compatible with the processing of plaintext transactions in related technologies, and can also process private transactions in ciphertext form, thereby achieving mixed processing of plaintext transactions and private transactions on the entire blockchain network.
[0038] In one embodiment, when the target transaction involves the privacy account, the target transaction includes: a transaction for accessing the created privacy account, or a transaction for creating the privacy account.
[0039] In a public blockchain, users can freely create external accounts, and they can label their created external accounts as either regular or private accounts. Each node in the blockchain network can pre-record the type information of all external accounts. When a local blockchain node receives a target transaction, it can read the generating account information from the "from" field of the target transaction and determine whether the generating account is a regular or private account based on the pre-recorded type information.
[0040] In consortium or private blockchains, however, the creation of external accounts is subject to certain restrictions. Existing external accounts must be created before other external accounts can be created, and they cannot be created at will. During creation, it is possible to restrict ordinary accounts to creating ordinary accounts or privacy accounts, while privacy accounts can only create privacy accounts; or to restrict privacy accounts to creating ordinary accounts or privacy accounts, while ordinary accounts can only create ordinary accounts. Similarly, in consortium or private blockchain networks, each node should pre-record the type information of all external accounts. This allows the local blockchain node to read the generator account information from the transaction's "from" field upon receiving a target transaction and determine whether the generator account is an ordinary account or a privacy account based on the pre-recorded type information.
[0041] In the case where the target transaction is a transaction for accessing the created privacy account, executing the target transaction in a trusted execution environment includes: reading the encrypted account data of the privacy account into the trusted execution environment for decryption processing to obtain the plaintext account data of the privacy account; executing the target transaction in the trusted execution environment based on the obtained plaintext account data, and encrypting the obtained updated plaintext account data and storing it in the target storage space to update the encrypted account data.
[0042] If the private account's account data is encrypted using symmetric encryption and stored in the target storage space, the local blockchain node can decrypt the encrypted account data using the symmetric key of the symmetric encryption algorithm. Examples of symmetric encryption algorithms include DES, 3DES, TDEA, Blowfish, RC5, and IDEA. The symmetric key of the symmetric encryption algorithm can be generated by the private account's creator, negotiated between the client and the local blockchain node, or sent by a key management server.
[0043] If asymmetric encryption is used, i.e., the public key of an asymmetric encryption algorithm is used to encrypt the account data of a private account, then the local blockchain node can decrypt the encrypted account data using the private key of the asymmetric encryption algorithm. Examples of asymmetric encryption algorithms include RSA, Elgamal, Knapsack, Rabin, DH, and ECC (Elliptic Curve Cryptography). For example, the key for an asymmetric encryption algorithm can be a public and private key pair generated by the local blockchain node and pre-sent to the client, so that the client can encrypt the account data using the public key.
[0044] The key for the asymmetric encryption algorithm can also be generated by a key management server. Through remote attestation, the key management server sends the private key to the local blockchain node. Specifically, it can be passed to the local blockchain node's enclave. The first blockchain node can contain multiple enclaves, and the private key can be passed to a secure enclave within these enclaves; for example, the secure enclave can be a QE (Quoting Enclave) rather than an AE (Application Enclave). The public key for asymmetric encryption can be sent to the client by the key management server. The client can then use this public key to encrypt account data, and the local blockchain node can decrypt the encrypted account data using the private key to obtain the plaintext account data of the private account.
[0045] The client can also use a combination of symmetric and asymmetric encryption. For example, the client can encrypt account data using a symmetric encryption algorithm, using the symmetric key of the symmetric encryption algorithm to encrypt the account data, and then using an asymmetric encryption algorithm to encrypt the symmetric key used in the symmetric encryption algorithm. Typically, the public key of the asymmetric encryption algorithm is used to encrypt the symmetric key used in the symmetric encryption algorithm. This way, after receiving the encrypted account data, the local blockchain node can first decrypt it using the private key of the asymmetric encryption algorithm to obtain the symmetric key of the symmetric encryption algorithm. This can then be used to decrypt the plaintext account data using the symmetric key of the symmetric encryption algorithm.
[0046] As shown in Figure 2, after determining that a target transaction involves a private account, virtual machine 121 can send the target transaction to a trusted execution environment (TEE) and read the encrypted account data of the private account into the TEE for decryption, obtaining the plaintext account data of the private account. The target transaction is then executed based on the obtained plaintext account data and virtual machine 124 within the TEE. The local blockchain node can execute write cache functionality within the TEE to store the plaintext execution results in a write cache within the TEE. For example, this write cache can correspond to the "cache" shown in Figure 2. Furthermore, the local blockchain node encrypts the data in the write cache and outputs it from the TEE for storage in the target storage space 123. In which, the write cache function code can be stored in plain text in the trusted execution environment, and the plain text cache function code can be executed directly in the trusted execution environment; or, the write cache function code can be stored in cipher text outside the trusted execution environment, such as stored in the above-mentioned target storage space 123 (such as the "packaging + storage" shown in Figure 2, where "packaging" means that the local blockchain node packages the transaction into blocks outside the trusted execution environment), and the cipher text write cache function code can be read into the trusted execution environment, decrypted into plain text code in the trusted execution environment, and executed.
[0047] Write caching refers to a "buffering" mechanism provided when writing data to the target storage space 123 to avoid "impacting" the target storage space 123. For example, a buffer can be used to implement the aforementioned write caching; of course, the write caching can also be implemented using a cache, and this specification is not limited to this. In fact, because the trusted execution environment is an isolated and secure environment, and the target storage space 123 is located outside the trusted execution environment, the use of a write caching mechanism allows the data in the cache to be written to the target storage space 123 in batches, thereby reducing the number of interactions between the trusted execution environment and the target storage space 123 and improving data storage efficiency. At the same time, the trusted execution environment may need to retrieve generated data (such as the value of the contract status) during the continuous execution of each plaintext transaction content. If the data to be retrieved happens to be located in the write cache, the data can be read directly from the write cache. This can not only reduce the interaction with the target storage space 123, but also eliminate the decryption process of the data read from the target storage space 123, thereby improving data processing efficiency in the trusted execution environment.
[0048] Of course, the write cache can also be established outside the trusted execution environment. For example, the local blockchain node can execute the write cache function code outside the trusted execution environment, thereby storing the ciphertext execution result in the write cache outside the trusted execution environment, and further storing the data in the write cache to the target storage space 123. This specification does not limit this.
[0049] In one embodiment, when the target transaction is a transaction for creating the private account, executing the target transaction in a trusted execution environment includes: creating the private account in the trusted execution environment based on the account creation related information included in the target transaction, and encrypting the account data of the private account and storing it in the target storage space.
[0050] Compared to transactions that create normal accounts, transactions that create privacy accounts create accounts of the corresponding type. Methods for determining the transaction type include: adding a transaction type field to the transaction, with the corresponding field value being "create normal" for transactions that create normal accounts and "create private" for transactions that create privacy accounts. The local blockchain node can determine the transaction type and further determine the type of account to be created by identifying the value of the transaction type field. Alternatively, the transaction can include the key used to encrypt account data, and the chain code of the local blockchain node can add processing logic to "encrypt account data using the key if the transaction is determined to include the key."
[0051] This embodiment creates a private account in a trusted execution environment so that the plaintext account data during the creation process is not leaked, and encrypts the account data of the created private account and stores it in the target storage space, thereby reducing the risk of privacy exposure after the encrypted account data is leaked.
[0052] In one embodiment, when the target transaction does not involve the privacy account, the target transaction is executed outside the trusted execution environment.
[0053] As shown in Figure 2, if the target transaction does not involve a privacy account, the local blockchain node will execute the target transaction in virtual machine 121 within the regular execution environment and store the execution result in plaintext in target storage space 123. This embodiment is compatible with related technologies for processing transactions that do not involve privacy accounts while also processing transactions that do, thereby achieving hybrid processing of transactions involving and not involving privacy accounts across the entire blockchain network.
[0054] FIG3 is a schematic structural diagram of a device provided by an exemplary embodiment. Referring to FIG3 , at the hardware level, the device includes a processor 302, an internal bus 304, a network interface 306, a memory 308, and a non-volatile memory 310, and may also include hardware required for other functions. One or more embodiments of this specification may be implemented based on software, such as the processor 302 reading the corresponding computer program from the non-volatile memory 310 into the memory 308 and then running it. Of course, in addition to software implementation, one or more embodiments of this specification do not exclude other implementation methods, such as logic devices or a combination of software and hardware, etc., that is, the execution subject of the following processing flow is not limited to each logic unit, but may also be hardware or logic devices.
[0055] As shown in Figure 4, Figure 4 is a block diagram of a privacy protection device for account data in a blockchain provided by an exemplary embodiment. The device can be applied to the device shown in Figure 4 to implement the technical solution of this specification; the device includes: a determination unit 402, which is used to determine whether the target transaction involves a privacy account in response to a received target transaction; a first execution unit 404, which is used to execute the target transaction in a trusted execution environment when the target transaction involves a privacy account; wherein the account data of the privacy account is encrypted and stored in a target storage space outside the trusted execution environment.
[0056] Optionally, the determination unit 402 is specifically used for at least one of the following: executing the target transaction outside the trusted execution environment to determine the account data involved in the target transaction; when the determined account data includes encrypted account data, determining that the target transaction involves a privacy account; or, pre-executing the target transaction to obtain a pre-execution read-write set of the target transaction; determining the account data involved in the target transaction based on the pre-execution read-write set of the target transaction, and when the determined account data includes encrypted account data, determining that the target transaction involves a privacy account; or, for the target smart contract called by the target transaction, obtaining the account data involved in the target smart contract recorded in the contract account of the target smart contract; when the determined account data includes encrypted account data, determining that the target transaction involves a privacy account; or, when the target transaction is a privacy transaction, determining that the target transaction involves a privacy account.
[0057] Optionally, when the target transaction involves the privacy account, the target transaction includes: a transaction for accessing the created privacy account, or a transaction for creating the privacy account.
[0058] Optionally, when the target transaction is a transaction for accessing the created privacy account, the first execution unit 404 is specifically used to: read the encrypted account data of the privacy account into the trusted execution environment for decryption processing to obtain the plaintext account data of the privacy account; execute the target transaction in the trusted execution environment based on the obtained plaintext account data, and encrypt the obtained updated plaintext account data and store it in the target storage space to update the encrypted account data.
[0059] Optionally, the privacy account involved in the target transaction includes at least one of the following: a privacy account corresponding to the account address recorded in the field of the target transaction, a privacy account involved in the smart contract called by the target transaction, and a privacy account involved in a smart contract further directly or indirectly called by the smart contract called by the target transaction.
[0060] Optionally, when the target transaction is a transaction for creating the privacy account, the first execution unit 404 is specifically used to: create the privacy account in the trusted execution environment based on the account creation related information contained in the target transaction, and encrypt the account data of the privacy account and store it in the target storage space.
[0061] Optionally, the method further includes: a second execution unit 406, configured to execute the target transaction outside the trusted execution environment when the target transaction does not involve the privacy account.
[0062] In the 1990s, technological improvements could be clearly distinguished as either hardware improvements (for example, improvements to circuit structures like diodes, transistors, and switches) or software improvements (improvements to process flows). However, with the advancement of technology, many process flow improvements today can now be considered direct improvements to hardware circuit structures. Designers almost always create the corresponding hardware circuit structure by programming the improved process flow into the hardware circuit. Therefore, it cannot be said that a process flow improvement cannot be implemented using hardware modules. For example, a programmable logic device (PLD), such as a field programmable gate array (FPGA), is an integrated circuit whose logical function is determined by user programming. Designers can "integrate" a digital system on a PLD by programming it themselves, without having to hire a chip manufacturer to design and manufacture a dedicated integrated circuit chip. Moreover, nowadays, instead of manually fabricating integrated circuit chips, this programming is mostly done using "logic compiler" software. This is similar to the software compiler used when developing programs. Before compilation, the original code must also be written in a specific programming language, called a hardware description language (HDL). There is not just one HDL, but many, such as ABEL (Advanced Boolean Expression Language), AHDL (Altera Hardware Description Language), Confluence, CUPL (Cornell University Programming Language), HDCal, JHDL (Java Hardware Description Language), Lava, Lola, MyHDL, PALASM, RHDL (Ruby Hardware Description Language), etc. The most commonly used are VHDL (Very-High-Speed Integrated Circuit Hardware Description Language) and Verilog. Those skilled in the art will also understand that by simply programming the method flow in one of these hardware description languages and then programming it into an integrated circuit, a hardware circuit that implements the logic method flow can be easily obtained.
[0063] The controller can be implemented in any suitable manner. For example, the controller can take the form of a microprocessor or processor and a computer-readable medium storing computer-readable program code (e.g., software or firmware) executable by the (micro)processor, logic gates, switches, application-specific integrated circuits (ASICs), programmable logic controllers, and embedded microcontrollers. Examples of controllers include, but are not limited to, the following microcontrollers: ARC 625D, Atmel AT91SAM, Microchip PIC18F26K20, and Silicone Labs C8051F320. The memory controller can also be implemented as part of the control logic of the memory. Those skilled in the art will also know that in addition to implementing the controller in a purely computer-readable program code format, the controller can be implemented in the form of logic gates, switches, application-specific integrated circuits, programmable logic controllers, and embedded microcontrollers by logically programming the method steps. Therefore, such a controller can be considered a hardware component, and the devices included therein for implementing various functions can also be considered as structures within the hardware component. Or even, the devices for implementing various functions can be considered as both software modules that implement the method and structures within the hardware component.
[0064] The systems, devices, modules, or units described in the above embodiments may be implemented by computer chips or entities, or by products having certain functions. A typical implementation device is a server system. Of course, the present invention does not exclude that with the future development of computer technology, the computer that implements the functions of the above embodiments may be, for example, a personal computer, a laptop computer, an in-vehicle human-computer interaction device, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email device, a game console, a tablet computer, a wearable device, or a combination of any of these devices.
[0065] Although one or more embodiments of this specification provide method operation steps as described in the embodiments or flow charts, more or fewer operation steps may be included based on conventional or non-creative means. The order of steps listed in the embodiments is only one way of executing the order of many steps and does not represent the only execution order. When the device or terminal product in practice is executed, it can be executed in sequence or in parallel according to the method shown in the embodiments or the drawings (for example, a parallel processor or a multi-threaded processing environment, or even a distributed data processing environment). The term "comprise", "include" or any other variant thereof is intended to cover non-exclusive inclusion, so that the process, method, product or equipment including a series of elements includes not only those elements, but also includes other elements that are not clearly listed, or also includes elements inherent to such process, method, product or equipment. In the absence of more restrictions, it is not excluded that there are other identical or equivalent elements in the process, method, product or equipment including the elements. For example, if the words first, second, etc. are used to represent the name, they do not represent any particular order.
[0066] For the convenience of description, the above devices are described in terms of functions divided into various modules. Of course, when implementing one or more of the present specifications, the functions of each module can be implemented in the same or multiple software and / or hardware, or the module that implements the same function can be implemented by a combination of multiple sub-modules or sub-units, etc. The device embodiments described above are merely schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0067] The present invention is described with reference to the flowcharts and / or block diagrams of the methods, apparatus (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the functions specified in one or more processes in the flowchart and / or one or more blocks in the block diagram.
[0068] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device that implements the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0069] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the block diagram.
[0070] In a typical configuration, a computing device includes one or more processors (CPUs), input / output interfaces, network interfaces, and memory.
[0071] Memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. Memory is an example of a computer-readable medium.
[0072] Computer-readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer-readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disc read-only memory (CD-ROM), digital versatile disc (DVD) or other optical storage, magnetic cassettes, magnetic tape, magnetic disk storage, graphene storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer-readable media does not include transitory media such as modulated data signals and carrier waves.
[0073] Those skilled in the art will appreciate that one or more embodiments of this specification may be provided as a method, system, or computer program product. Thus, one or more embodiments of this specification may take the form of an entirely hardware embodiment, an entirely software embodiment, or an embodiment combining software and hardware. Furthermore, one or more embodiments of this specification may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to magnetic disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0074] One or more embodiments of this specification may be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, and the like that perform specific tasks or implement specific abstract data types. One or more embodiments of this specification may also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communications network. In distributed computing environments, program modules may be located in local and remote computer storage media, including storage devices.
[0075] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between the various embodiments can be referenced across them. Each embodiment focuses on the differences from the other embodiments. In particular, since the system embodiments are generally similar to the method embodiments, their description is relatively simple. For relevant parts, reference can be made to the description of the method embodiments. Throughout this specification, reference to the terms "one embodiment," "some embodiments," "examples," "specific examples," or "some examples" means that the specific features, structures, materials, or characteristics described in conjunction with that embodiment or example are included in at least one embodiment or example of this specification. In this specification, the schematic representations of these terms do not necessarily refer to the same embodiment or example. Furthermore, the specific features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, those skilled in the art may combine and integrate the different embodiments or examples, and features of different embodiments or examples, described in this specification, without conflict.
[0076] The foregoing description is merely one or more embodiments of this specification and is not intended to limit the one or more embodiments of this specification. It will be apparent to those skilled in the art that various modifications and variations may be made to one or more embodiments of this specification. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of this specification shall be included within the scope of the claims.
Claims
1. A method for protecting the privacy of account data in a blockchain, the method comprising: In response to the received target transaction, determining whether the target transaction involves a private account; In the case where the target transaction involves a private account, the target transaction is executed in a trusted execution environment; wherein the account data of the private account is encrypted and stored in a target storage space outside the trusted execution environment.
2. According to the method of claim 1, the determining whether the target transaction involves a private account comprises at least one of the following: Executing the target transaction outside the trusted execution environment to determine the account data involved in the target transaction; if the determined account data includes encrypted account data, determining that the target transaction involves a private account; or Pre-execute the target transaction to obtain a pre-execution read-write set of the target transaction; determine the account data involved in the target transaction according to the pre-execution read-write set of the target transaction, and determine that the target transaction involves a private account when the determined account data includes encrypted account data; or For the target smart contract called by the target transaction, obtain the account data involved in the target smart contract recorded in the contract account of the target smart contract; when the determined account data includes encrypted account data, determine that the target transaction involves a private account; or, When the target transaction is a private transaction, it is determined that the target transaction involves a private account.
3. The method according to claim 1, in the case where the target transaction involves the privacy account, the target transaction comprises: A transaction used to access the created privacy account, or a transaction used to create the privacy account.
4. The method according to claim 3, wherein when the target transaction is a transaction for accessing the created privacy account, executing the target transaction in a trusted execution environment comprises: Reading the encrypted account data of the private account into the trusted execution environment for decryption processing to obtain the plaintext account data of the private account; The target transaction is executed in the trusted execution environment according to the obtained plaintext account data, and the obtained updated plaintext account data is encrypted and stored in the target storage space to update the encrypted account data.
5. According to the method of claim 1, the privacy account involved in the target transaction includes at least one of the following: a privacy account corresponding to the account address recorded in the field contained in the target transaction, a privacy account involved in the smart contract called by the target transaction, and a privacy account involved in the smart contract further directly or indirectly called by the smart contract called by the target transaction.
6. The method according to claim 3, wherein when the target transaction is a transaction for creating the privacy account, executing the target transaction in a trusted execution environment comprises: The private account is created in the trusted execution environment according to the account creation related information contained in the target transaction, and the account data of the private account is encrypted and stored in the target storage space.
7. The method according to claim 1, further comprising: When the target transaction does not involve the privacy account, the target transaction is executed outside the trusted execution environment.
8. A privacy protection device for account data in a blockchain, the device comprising: A determination unit: in response to a received target transaction, determining whether the target transaction involves a private account; First execution unit: when the target transaction involves a private account, execute the target transaction in a trusted execution environment; wherein the account data of the private account is encrypted and stored in a target storage space outside the trusted execution environment.
9. An electronic device, comprising: processor; a memory for storing processor-executable instructions; The processor implements the method according to any one of claims 1 to 7 by running the executable instructions.
10. A computer-readable storage medium having computer instructions stored thereon, wherein the instructions are executed by a processor to implement the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Method, node and system for realizing privacy protection in block chain and storage medium
CN110060054A
Query method and device for account privacy information in blockchain
CN111008228A
Method for realizing privacy protection in blockchain, node and storage medium
CN111899017A
Privacy protection method and device for account data in block chain
CN116432235A
Performance of distributed system functions using a trusted execution environment
US20180239897A1
Cited By
Privacy protection method and device for smart contract, electronic equipment and program product
CN119272335A
Privacy protection method, device, electronic device and program product for smart contracts
CN119272335B
