WO2021184975A1 - 链上数据的链下隐私计算方法及装置 - Google Patents

链上数据的链下隐私计算方法及装置 Download PDF

Info

Publication number
WO2021184975A1
WO2021184975A1 PCT/CN2021/074245 CN2021074245W WO2021184975A1 WO 2021184975 A1 WO2021184975 A1 WO 2021184975A1 CN 2021074245 W CN2021074245 W CN 2021074245W WO 2021184975 A1 WO2021184975 A1 WO 2021184975A1
Authority
WO
WIPO (PCT)
Prior art keywords
chain
node
data
privacy
blockchain
Prior art date
Application number
PCT/CN2021/074245
Other languages
English (en)
French (fr)
Inventor
吴行行
邱鸿霖
吴因佥
Original Assignee
支付宝(杭州)信息技术有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 支付宝(杭州)信息技术有限公司 filed Critical 支付宝(杭州)信息技术有限公司
Publication of WO2021184975A1 publication Critical patent/WO2021184975A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q40/00Finance; Insurance; Tax strategies; Processing of corporate or income taxes
    • G06Q40/04Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/602Providing cryptographic facilities or services
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F21/00Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
    • G06F21/60Protecting data
    • G06F21/64Protecting data integrity, e.g. using checksums, certificates or signatures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q20/00Payment architectures, schemes or protocols
    • G06Q20/38Payment protocols; Details thereof
    • G06Q20/382Payment protocols; Details thereof insuring higher security of transaction
    • G06Q20/3829Payment protocols; Details thereof insuring higher security of transaction involving key management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/04Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks
    • H04L63/0428Network architectures or network communication protocols for network security for providing a confidential data exchange among entities communicating through data packet networks wherein the data content is protected, e.g. by encrypting or encapsulating the payload

Definitions

  • One or more embodiments of this specification relate to the field of verifiable computing technology, and in particular to an off-chain privacy calculation method and device for on-chain data.
  • Blockchain technology (also known as distributed ledger technology) is a decentralized distributed database technology. Due to the use of decentralized network structure, consensus mechanism and chain block structure, the blockchain technology has the characteristics of decentralization, openness and transparency, non-tampering, trustworthiness, etc., and is suitable for many applications with high data reliability. In the application scenario of the demand.
  • TEE Trusted Execution Environment
  • TEE can play the role of a black box in the hardware. Neither the code executed in the TEE nor the data operating system layer can be peeped, and only the pre-defined interface in the code can operate on it.
  • plaintext data is calculated in TEE instead of complex cryptographic operations in homomorphic encryption, and there is no loss in the efficiency of the calculation process. Therefore, by creating a TEE environment on the blockchain nodes, the privacy requirements in the blockchain scenario can be met to a large extent under the premise of relatively small performance loss.
  • one or more embodiments of this specification provide an off-chain privacy calculation method, device, and electronic equipment for on-chain data, which can assist blockchain nodes to safely complete computing tasks in an off-chain environment.
  • an off-chain privacy calculation method for on-chain data includes: blockchain nodes determine the on-chain data used for privacy calculations based on transactions submitted by the client The blockchain node transmits the encrypted data on the chain to the off-chain private computing node, and the off-chain private computing node is deployed at the off-chain trusted computing node for performing private computing on the on-chain data Execution environment; the blockchain node obtains the calculation result generated and encrypted by the off-chain private computing node in the off-chain trusted execution environment, and updates the blockchain ledger data according to the calculation result.
  • an off-chain privacy calculation method for on-chain data includes: an off-chain privacy computing node receives encrypted on-chain data transmitted by a blockchain node, so An off-chain trusted execution environment is deployed at the off-chain private computing node, and the on-chain data is determined by the blockchain node according to the transaction submitted by the client; the off-chain private computing node is trusted off-chain Perform privacy calculations on the on-chain data in the execution environment to generate calculation results; the off-chain privacy calculation node feeds back the encrypted calculation results to the blockchain node, and the calculation results are used to update the blockchain ledger data.
  • an off-chain privacy calculation method for on-chain data includes: a client submits a transaction to a blockchain node, so that the blockchain node can The transaction determines the on-chain data used for privacy calculation; the client, upon receiving the encrypted on-chain data sent by the blockchain node, encrypts and transmits the on-chain data to the off-chain A private computing node, where the off-chain private computing node deploys an off-chain trusted execution environment for performing private computing on the on-chain data; the client receives that the off-chain private computing node is in the In the case of a calculation result generated and encrypted for transmission in an off-chain trusted execution environment, the calculation result is sent to the blockchain node for updating the blockchain ledger data.
  • an off-chain privacy computing device for on-chain data which includes: an on-chain data determination unit that enables blockchain nodes to determine the use of data based on transactions submitted by the client.
  • Data on the chain for privacy computing the data transmission unit on the chain enables the blockchain node to transmit the encrypted data on the chain to the off-chain privacy computing node, and the off-chain privacy computing node is deployed for An off-chain trusted execution environment that performs privacy calculations on the data on the chain;
  • a calculation result obtaining unit enables the blockchain node to obtain the off-chain private computing node generated and encrypted in the off-chain trusted execution environment After feedback the calculation result, and update the blockchain ledger data according to the calculation result.
  • an off-chain privacy computing device for on-chain data including: an on-chain data receiving unit, which enables the off-chain privacy computing node to receive the data transmitted by the blockchain node Encrypted data on the chain, the off-chain trusted execution environment is deployed at the off-chain private computing node, and the on-chain data is determined by the blockchain node according to the transaction submitted by the client; the privacy computing execution unit makes all The off-chain private computing node performs a private calculation on the on-chain data in the off-chain trusted execution environment to generate a calculation result; the calculation result feedback unit enables the off-chain private computing node to feed back to the blockchain node The encrypted calculation result is used to update the blockchain ledger data.
  • an off-chain privacy computing device for on-chain data determines the on-chain data used for privacy calculation according to the transaction; the on-chain data forwarding unit enables the client to receive the encrypted on-chain data sent by the blockchain node , Encrypting and transmitting the on-chain data to the off-chain private computing node, where an off-chain trusted execution environment for performing private computing on the on-chain data is deployed at the off-chain private computing node; a calculation result forwarding unit, Enabling the client to send the calculation result to the blockchain node when receiving the calculation result generated and encrypted and transmitted by the off-chain private computing node in the off-chain trusted execution environment, Used to update the blockchain ledger data.
  • an electronic device including: a processor; a memory for storing executable instructions of the processor; wherein the processor runs the executable instructions In order to realize the method as described in the first aspect, the second aspect or the third aspect.
  • a computer-readable storage medium on which computer instructions are stored.
  • the instructions are executed by a processor, the first aspect, the second aspect, or the third aspect are implemented. The steps of the method described in the aspect.
  • this manual implements an off-chain trusted execution environment on off-chain private computing nodes, so that off-chain private computing nodes can provide a safe and reliable operating environment, so blockchain nodes can hand over on-chain data to the chain The next private computing node performs secure computing.
  • Figure 1 is a schematic diagram of the network architecture corresponding to the off-chain privacy calculation method for on-chain data.
  • Fig. 2 is a flowchart of an off-chain privacy calculation method for on-chain data on a blockchain node side according to an exemplary embodiment.
  • Fig. 3 is a flowchart of an off-chain privacy calculation method for on-chain data on the side of an off-chain privacy computing node provided by an exemplary embodiment.
  • Fig. 4 is a flowchart of a method for calculating off-chain privacy of on-chain data on the client side according to an exemplary embodiment.
  • Fig. 5 is a flow chart of interaction between devices corresponding to a method for off-chain privacy calculation of on-chain data provided by an exemplary embodiment.
  • Fig. 6 is a flowchart of interaction between devices corresponding to another off-chain privacy calculation method for on-chain data provided by an exemplary embodiment.
  • Fig. 7 is a schematic structural diagram of an electronic device according to an exemplary embodiment.
  • Fig. 8 is a block diagram of an off-chain privacy computing device for on-chain data on a blockchain node side according to an exemplary embodiment.
  • Fig. 9 is a block diagram of an off-chain privacy computing device for data on the side chain of an off-chain privacy computing node according to an exemplary embodiment.
  • Fig. 10 is a block diagram of an off-chain privacy computing device for data on a client side chain according to an exemplary embodiment.
  • the steps of the corresponding method may not be executed in the order shown and described in this specification.
  • the method may include more or fewer steps than described in this specification.
  • a single step described in this specification may be decomposed into multiple steps for description in other embodiments; and multiple steps described in this specification may also be combined into a single step in other embodiments. describe.
  • Blockchain is generally divided into three types: Public Blockchain, Private Blockchain and Consortium Blockchain.
  • the public chain is represented by Bitcoin and Ethereum. Participants who join the public chain can read the data records on the chain, participate in transactions, and compete for the accounting rights of new blocks, etc., and each participant (ie, node) can freely join and Exit the network.
  • the private chain is the opposite.
  • the network's data write permission is controlled by an organization or institution, and the data read permission is regulated by the organization; in simple terms, the private chain can be a weakly centralized system with strict restrictions and few participating nodes.
  • consortium chain is a block chain between public chain and private chain, which can realize "partial decentralization".
  • Each node in the alliance chain usually has a corresponding entity or organization, and participants are authorized to join the network and form a stakeholder alliance to jointly maintain the operation of the blockchain.
  • blockchain nodes can create on-chain TEEs and realize the on-chain TEEs as a secure execution environment for blockchain transactions.
  • TEE is a secure extension based on CPU hardware and a trusted execution environment that is completely isolated from the outside.
  • TEE was first proposed by Global Platform to solve the security isolation of resources on mobile devices, and parallel to the operating system to provide a trusted and secure execution environment for applications. At present, the industry is very concerned about TEE solutions.
  • TEE solutions such as TPM (Trusted Platform Module) in software and Intel SGX (Software Guard Extensions) in hardware. , Software Protection Extension), ARM Trustzone (trust zone) and AMD PSP (Platform Security Processor, platform security processor), etc.
  • Blockchain nodes can create enclaves (enclaves or enclaves) based on SGX technology to serve as TEEs for executing blockchain transactions.
  • the blockchain node uses the newly added processor instructions in the CPU to allocate a part of the area EPC (Enclave Page Cache, enclave page cache or enclave page cache) in the memory to reside in the above-mentioned enclave.
  • the memory area corresponding to the above EPC is encrypted by the memory encryption engine MEE (Memory Encryption Engine) inside the CPU.
  • MEE Memory Encryption Engine
  • the content in the memory area can only be decrypted in the CPU core and used for encryption and decryption.
  • the key is only generated and stored in the CPU when the EPC is started.
  • the security boundary of the enclave only includes itself and the CPU, and neither privileged or non-privileged software can access the enclave, even the operating system administrator and VMM (virtual machine monitor, or Hypervisor).
  • VMM virtual machine monitor, or Hypervisor
  • Every blockchain transaction on the blockchain needs to be executed on all blockchain nodes in the blockchain network to ensure that each blockchain node is maintained
  • the blockchain ledger data is consistent. If the transaction logic is relatively simple, such as Bitcoin as an example, the blockchain transaction is only used to realize the transfer operation. At this time, even if the blockchain transaction needs to be executed on all blockchain nodes, it will not cause excessive resource consumption. . However, if the blockchain provides the function of a smart contract, and the blockchain transaction calls the smart contract, then the situation may be quite different.
  • a smart contract on the blockchain is a contract that can be triggered by a transaction to execute on the blockchain system, and the smart contract can be defined in the form of code.
  • the off-chain TEE created on the off-chain private computing node is similar to the on-chain TEE created on the blockchain node described above, and is based on a trusted execution environment that is completely isolated from the outside and implemented by CPU hardware.
  • off-chain privacy computing nodes can implement deployment operations on off-chain contracts and call execution operations after deployment, and ensure data security and privacy protection during the operation.
  • EVM Ethereum Virtual Machine
  • Every Ethereum node can run EVM.
  • EVM is a Turing complete virtual machine, which means that various complex logic can be implemented through it.
  • Users who publish and call smart contracts in Ethereum run on the EVM.
  • virtual machine code virtual machine bytecode, hereinafter referred to as "bytecode"
  • the smart contract is divided into two stages: deployment and invocation.
  • the user sends a transaction containing information about creating a smart contract to the Ethereum network.
  • the data field of the transaction contains the code (such as bytecode) of the smart contract, and the to field of the transaction is empty.
  • Each node in the Ethereum network executes this transaction through the EVM and generates a corresponding contract instance.
  • the smart contract corresponding to the above transaction is successfully created, and a contract account corresponding to the smart contract appears on the blockchain.
  • the contract account has a specific contract address and contract code (i.e., smart contract).
  • the code) or the hash value of the contract code is stored in the contract account, and the contract code is used to control the behavior of the corresponding smart contract.
  • the user (which can be the same or different from the user who deployed the smart contract) sends a transaction for invoking the smart contract to the Ethereum network.
  • the from field of the transaction is the address of the external account corresponding to the user, and the to field is The contract address of the smart contract to be called.
  • the data field contains the method and parameters for calling the smart contract.
  • EVM is a Turing complete virtual machine; similarly, other blockchains can also use other types of virtual machines, such as WASM (WebAssembly) virtual machines.
  • WASM WebAssembly
  • this specification proposes a private computing node based on the off-chain deployment (ie, off-chain private computing node, the pre-deployed off-chain contract in the off-chain private computing node can be used on the off-chain private computing node when it is called).
  • the blockchain node encrypts the data on the chain and transmits it to the off-chain private computing node.
  • the off-chain private computing node uses the on-chain data to perform privacy calculations in the off-chain TEE, and feeds the calculated results back to the district Block chain node.
  • This method transfers the calculation operations that originally needed to be performed on all blockchain nodes to a certain off-chain private computing node for execution, so that the blockchain node only needs to transmit the data on the chain to the off-chain private computing node and obtain the latter Feedback the calculation results, and then update the blockchain ledger data based on the calculation results, which reduces the computing resource consumption of the blockchain nodes, thereby helping to improve the transaction execution efficiency of the blockchain network.
  • the off-chain privacy computing nodes can prove the authenticity of the data they obtain on the chain based on Verifiable Computation (Verifiable Computation) technology; similarly, the blockchain nodes can also prove their all based on verifiable computing technology.
  • the obtained calculation result is indeed obtained by using the on-chain data to perform the expected calculation in the off-chain TEE, thus realizing the credible authentication of the on-chain data off-chain process and the off-chain calculation result feedback process.
  • the blockchain node can execute the code of the smart contract to achieve corresponding computing requirements; similarly, the code for performing computing tasks can be deployed off-chain
  • the off-chain private computing node can execute code to achieve corresponding computing requirements.
  • the contract deployed on the blockchain node is called the on-chain contract
  • the contract deployed on the off-chain privacy computing node is called the off-chain contract; of course, whether it is an on-chain contract or an off-chain contract, Its essence is a piece of code that can be executed in a virtual machine.
  • FIG. 1 is a schematic diagram of the network architecture corresponding to the off-chain privacy calculation method for on-chain data.
  • the blockchain node forms a network connection with the off-chain private computing node through two possible ways: the client or the oracle server.
  • the client in the figure can be regarded as applications running on electronic devices such as mobile phones, tablets, PCs, PDAs (Personal Digital Assistants), and wearable terminals in the conventional business system;
  • the oracle server in the figure It can be regarded as Oracle Services and other oracle servers connected by blockchain nodes.
  • the off-chain privacy computing node in the figure can be an independent off-chain privacy computing node, or it can be a chain in an off-chain privacy computing cluster that contains multiple off-chain privacy computing nodes (as shown in the dashed box on the right side of Figure 1) Down the privacy computing node.
  • the control nodes in the off-chain privacy computing cluster are directly connected to the client and the oracle server respectively, and are responsible for transferring the received private computing tasks in the above-mentioned cluster.
  • off-chain privacy computing nodes can create off-chain TEEs, and deployment operations and invocation operations for off-chain contracts are implemented through off-chain TEEs, thereby ensuring data security and privacy protection during operations.
  • the off-chain TEE created on the off-chain private computing node is similar to the on-chain TEE created on the blockchain node described above, and is based on a trusted execution environment that is completely isolated from the outside and implemented by CPU hardware.
  • the client Before invoking the off-chain contract deployed on the off-chain privacy computing node through a call request, the client needs to securely deploy the off-chain contract to the off-chain privacy computing node, and before deploying the off-chain contract, it needs to obtain the target chain
  • the remote attestation report of the off-chain TEE created on the next private computing node verifies whether the off-chain private computing node is credible, and specifically refers to whether the off-chain TEE deployed on the off-chain private computing node is credible.
  • the remote attestation report is generated from the remote attestation process for the off-chain TEE on the off-chain private computing node.
  • the remote attestation report is generated by the authentication server after verifying the self-recommendation information generated by the off-chain private computing node, and the self-recommended information is related to the off-chain TEE created on the off-chain private computing node.
  • the off-chain private computing node generates the self-recommended information related to the off-chain TEE, and the authentication server verifies the self-recommended information to generate a remote attestation report, so that the remote attestation report can be used to indicate the off-chain TEE on the off-chain private computing node Trustworthy.
  • the off-chain TEE is an enclave created on the off-chain private computing node to realize off-chain privacy computing.
  • the remote attestation process also involves another special enclave on the off-chain private computing node, namely Quoting enclave (QE for short), QE is an architectural enclave (Architectural Enclave) provided and signed by Intel.
  • the above enclave first needs to generate a REPORT structure for local authentication, and QE verifies whether the enclave is on the same platform as itself based on the REPORT structure, and then QE encapsulates the REPORT structure into a structure QUOTE (ie Self-recommended information), and use the EPID (enhanced privacy identification) key to sign.
  • the EPID key not only represents the platform of the off-chain private computing node, but also represents the credibility of the underlying hardware of the off-chain private computing node. It can also bind information such as the version of the processor firmware, and only QE can access the EPID key. , To sign the above-mentioned structure QUOTE.
  • the above authentication server can be the IAS (Intel Attestation Service) server provided by Intel.
  • the off-chain privacy computing node sends the signed structure QUOTE to the IAS server, so that the IAS server can verify the signature and send it to the IAS server.
  • the off-chain privacy computing node returns the corresponding remote attestation report.
  • the client can initiate a challenge to the off-chain private computing node and receive the remote attestation report returned by the off-chain private computing node.
  • the client can initiate an off-chain challenge to the off-chain private computing node, that is, the process of initiating the challenge has nothing to do with the blockchain network, so that the consensus process between blockchain nodes can be skipped and the interaction between on-chain and off-chain can be reduced. , So that the client's challenge to the off-chain private computing node has a higher operational efficiency.
  • the client can take the form of an on-chain challenge.
  • the client can submit a challenge transaction to a blockchain node.
  • the challenge information contained in the challenge transaction can be transmitted by the blockchain node to the off-chain private computing node through the oracle mechanism.
  • the challenge information is used to initiate a challenge to the off-chain private computing node.
  • the client can directly initiate a challenge to the off-chain private computing node through the off-chain channel, that is, the client initiates an off-chain challenge to the off-chain private computing node.
  • the client can initiate a challenge to the off-chain private computing node through the blockchain network, that is, the client initiates an on-chain challenge to the off-chain private computing node.
  • the process of initiating a challenge on the chain can include three steps: Step 1, the client submits a transaction for initiating a challenge to the blockchain network, such as a challenge transaction, which can be determined by a certain transaction in the blockchain network A blockchain node receives and executes; step 2, the blockchain node invokes a pre-deployed oracle smart contract (oracle contract for short), which can transmit the challenge information contained in the above-mentioned challenge transaction to the off-chain
  • the oracle server for example, the oracle contract can generate events containing the challenge information, and the oracle server can obtain the above-mentioned challenge information by monitoring the events generated by the oracle contract; step 3, the oracle server passes the challenge information off-chain The channel is sent to the privacy computing node under the chain.
  • the client When the client initiates a challenge to the off-chain private computing node through the on-chain channel, it involves the data interaction between the blockchain network and the off-chain private computing node, that is, the data interaction on and off the chain.
  • the data interaction process can be determined by The oracle contract and the oracle server are implemented through the above steps 2, and the coordination mechanism between the oracle contract and the oracle server is the oracle mechanism.
  • the transaction submitted by the client to the blockchain node should directly or indirectly call the aforementioned oracle contract to trigger the oracle mechanism.
  • the contract address of the oracle contract is filled in the to field of the transaction, it indicates that the transaction directly calls the oracle contract; if the contract address of a certain chain contract is filled in the to field of the transaction, and the chain is on The contract calls the oracle contract, indicating that the transaction indirectly calls the oracle contract.
  • the contract on the chain calls the oracle contract.
  • the contract address of the oracle contract is pre-written in the bytecode of the on-chain contract.
  • the contract address of the oracle contract can be used as the call. Enter the parameters of the contract on the chain, and fill the entered parameters into the data field of the above transaction.
  • the oracle mechanism can also transfer data from the chain to the chain.
  • the oracle server can pass the data off the chain to the oracle contract, and then the oracle contract Pass the off-chain data to the data demander.
  • the off-chain data here can include remote certification reports or privacy calculation results generated by invoking an off-chain contract.
  • transferring data from the chain to the chain can be regarded as a "request” process, and transferring data from the chain to the chain can be regarded as a "response” process. These two processes usually appear in pairs. .
  • the off-chain private computing node can temporarily trigger the remote attestation process as described above and generate the corresponding remote attestation report, and then report the remote attestation Feedback to the client. Or, when the off-chain private computing node receives a challenge initiated by the client, if a pre-generated remote attestation report already exists locally, the off-chain private computing node provides the remote attestation report to the client without temporarily triggering remote attestation process. Among them, the remote attestation report of the off-chain private computing node can be triggered by the off-chain private computing node in response to the challenge of other challengers except the client.
  • the other challenger may include other clients, This manual does not limit the control node and KMS server in the off-chain privacy computing cluster where the off-chain privacy computing node is located. Therefore, after receiving the challenge initiated by the client, the off-chain private computing node can first check whether there is a previously generated remote attestation report locally, and if there is, the remote attestation report is fed back to the client, otherwise the remote attestation process is temporarily triggered. Among them, the remote attestation report can have a certain time limit, such as 30 minutes or other duration. The timed out remote attestation report can be deemed invalid by the client, and the off-chain privacy computing node can also actively clear the invalid remote attestation report to avoid feedback To the client.
  • the data interaction involved may include: data interaction between the client and the off-chain private computing node (the client initiates an off-chain challenge to the off-chain private computing node, and the off-chain private computing node (Return remote attestation report to the client), data interaction between the client and the blockchain node (the client sends a challenge transaction to the blockchain node, the blockchain node returns a remote attestation report to the client), the blockchain node Data interaction with the oracle server (the oracle server reads the challenge information from the blockchain node, and the oracle server returns a remote proof report to the blockchain node), the data between the oracle server and the off-chain privacy computing node Interaction (the oracle server sends challenge information to the off-chain private computing node, and the off-chain
  • the data transmitted between the data sender and the data receiver may leak, and the blockchain node will link the challenge transaction to the chain to cause the challenge transaction to be disclosed, so it can be passed
  • the method of encrypting data transmission avoids information leakage.
  • an on-chain challenge is initiated to the off-chain private computing nodes, so that the blockchain node can perform a consensus on the challenge transaction submitted by the client with other nodes and then upload it to the chain to record the challenge behavior of the client.
  • the client does not want its own challenge behavior to be arbitrarily known to other users, it can protect the privacy of the challenge transaction.
  • the client can encrypt the challenge transaction, and the blockchain node can receive the encrypted challenge transaction, which can ensure that the content of the challenge transaction will not be leaked during the transmission.
  • the blockchain node can create an on-chain TEE, and the blockchain node can read the encrypted challenge transaction into the on-chain TEE and decrypt it in the on-chain TEE to ensure that the decrypted challenge transaction only exists on the chain TEE will not leak out.
  • Blockchain nodes directly upload encrypted challenge transactions on the chain, and by managing the viewing rights of encrypted data, users who can view challenge transactions can be restricted, while other users can only obtain encrypted data when viewing the blockchain data directly. Challenge the transaction.
  • blockchain nodes can ensure that the data that needs privacy protection can only be decrypted into plaintext in the on-chain TEE, and once they leave the on-chain TEE, they are all in ciphertext.
  • the form of symmetric encryption or asymmetric encryption can be adopted.
  • the client and the blockchain node respectively maintain the same symmetric key.
  • the symmetric key can be used by the client and the blockchain node through DH (Diffie-Hellman) or ECDH (Elliptic Curve Diffie– Hellman) and other algorithms are negotiated or distributed by the KMS (Key Management Service) server to the client and blockchain nodes. This manual does not limit the source of the key.
  • the KMS server can determine the trustworthiness of the chain TEE at the blockchain node by remote certification, and then encrypt the key and transmit it to the chain TEE.
  • the remote certification method is the same as the above-mentioned client.
  • the remote attestation process of end-to-chain private computing nodes is similar, so I won’t go into details here.
  • the client can encrypt the challenge transaction through the above-mentioned symmetric key, and the blockchain node maintains the symmetric key in the on-chain TEE, so the encrypted challenge transaction is read into the on-chain TEE and passed through the
  • the symmetric key performs the decryption operation to obtain the above-mentioned challenge transaction.
  • the encryption algorithm used by the symmetric encryption may include, for example, the DES algorithm, the 3DES algorithm, the TDEA algorithm, the Blowfish algorithm, the RC5 algorithm, and the IDEA algorithm.
  • the blockchain node When asymmetric encryption is used, the blockchain node maintains a private key with an asymmetric key, such as the identity private key of the blockchain node, and the client can obtain the zone that matches the identity private key of the blockchain node.
  • the asymmetric key can be generated by the blockchain node in the TEE on the chain, or distributed to the blockchain node by the KMS server. This manual does not limit the source of the key.
  • the KMS server can determine that the on-chain TEE at the blockchain node is trustworthy by means of remote certification, and then encrypt the key and transmit it to the on-chain TEE.
  • the client can encrypt the challenge transaction through the blockchain node identity public key, and the blockchain node maintains the blockchain node identity private key in the on-chain TEE, thus reading the encrypted challenge transaction into the chain In the TEE, the decryption operation is performed through the private key of the identity of the blockchain node to obtain the above-mentioned challenge transaction.
  • the asymmetric encryption algorithm used in the asymmetric encryption may include, for example, RSA, Elgamal, knapsack algorithm, Rabin, D-H, ECC (elliptic curve encryption algorithm), etc.
  • a combination of symmetric encryption and asymmetric encryption can also be used.
  • the client can maintain a symmetric key.
  • the symmetric key can be randomly generated by the client, and the client can obtain the public key of the identity of the blockchain node in the asymmetric key.
  • the client can encrypt the challenge transaction with the symmetric key, obtain the encrypted challenge transaction, and encrypt the symmetric key with the asymmetric key to obtain the encrypted key, and then the client simultaneously encrypts the encrypted challenge transaction and the encrypted password.
  • the key is transmitted to the blockchain node.
  • the blockchain node reads the encrypted challenge transaction and the encrypted key into the TEE on the chain, first uses the blockchain node identity private key to decrypt the encrypted key to obtain the symmetric key, and then uses the symmetric key After the key pair is encrypted, the challenge transaction is decrypted.
  • the encryption and decryption efficiency of symmetric encryption is higher, but the security is relatively low, while the encryption and decryption efficiency of asymmetric encryption is relatively low, but the security is relatively higher. Therefore, it is based on the combination of symmetric encryption and asymmetric encryption.
  • the form of encryption and decryption can take into account the efficiency and security of encryption and decryption.
  • the data sender and the data receiver maintain the same symmetric key, or the data sender maintains the public key of the asymmetric key, and the data receiver maintains the non-symmetric key.
  • the private key of the symmetric key, or the combination of symmetric encryption and asymmetric encryption can realize the encrypted transmission of data between any data sender and data receiver, which will not be repeated here.
  • An off-chain private computing node may belong to an off-chain private computing cluster, and the off-chain private computing cluster includes multiple off-chain private computing nodes. If the privacy computing nodes under each chain are completely independent, then the interaction process between the client and a single privacy computing node under the chain can refer to the above-mentioned embodiments.
  • the off-chain privacy computing cluster may include a control node, and the control node will uniformly manage all off-chain privacy computing nodes in the cluster. For example, the client can initiate a challenge to the control node, and receive the remote certification report of the off-chain privacy computing node returned by the control node.
  • the client can initiate an off-chain challenge to the control node, or the client can submit a challenge transaction to the blockchain node, and the challenge information contained in the challenge transaction is transmitted by the blockchain node through the oracle mechanism To the control node, the control node returns the remote certification report of the off-chain privacy computing node to the client.
  • the client can directly initiate a challenge to the control node through an off-chain channel, that is, the client initiates an off-chain challenge to the control node.
  • the client can initiate a challenge to the control node through the blockchain network, that is, the client initiates an on-chain challenge to the control node.
  • the process of initiating a challenge on the chain can include three steps: Step 1, the client submits a transaction for initiating a challenge to the blockchain network, such as a challenge transaction, which can be determined by a certain transaction in the blockchain network One node receives and executes; step 2, the blockchain node calls the pre-deployed oracle smart contract (referred to as the oracle contract), which can transmit the challenge information contained in the above-mentioned challenge exchange to the oracle server under the chain
  • the oracle contract can generate events containing the challenge information, and the oracle server can obtain the above-mentioned challenge information by listening to the events generated by the oracle contract; step 3, the oracle server sends the challenge information to the off-chain channel Control node.
  • the challenge target can be set to a certain off-chain private computing node in the cluster where the control node is located, such as off-chain private computing node n, then the control node will respond to the challenge received
  • the client returns the remote attestation report corresponding to the off-chain privacy computing node n.
  • the client does not need to set the challenge target.
  • the control node selects from the off-chain privacy computing cluster. For example, when the off-chain privacy computing node n is selected, the off-chain privacy is returned to the client Compute the remote attestation report corresponding to node n.
  • the control node after receiving the challenge initiated by the client, the control node can forward the challenge to the off-chain private computing node n, so that the off-chain private computing node n temporarily triggers the remote attestation process to generate the corresponding remote attestation report, and then pass the The control node feeds back to the client.
  • the control node after the control node receives the challenge initiated by the client, it can forward the challenge to the off-chain private computing node n, and if there is already a pre-generated remote attestation report on the off-chain private computing node n, then the off-chain privacy computing Node n returns the remote certification report to the control node, and the control node provides it to the client without temporarily triggering the remote certification process.
  • the off-chain private computing node n provides the remote attestation report to the client , Without the need to forward the challenge to the off-chain private computing node n, and without the off-chain private computing node n, thus temporarily triggering the remote attestation process.
  • the remote attestation report that exists locally on the off-chain private computing node n can be triggered by the off-chain private computing node n in response to challenges from other challengers other than the client.
  • the other challengers may include other customers.
  • the control node can cache the received remote certification report. Therefore, after receiving the challenge initiated by the client, the control node can first check whether there is a previously obtained remote attestation report locally, and if there is, the remote attestation report will be fed back to the client, otherwise the challenge will be forwarded to the off-chain privacy computing node n; and, after receiving the challenge, the off-chain privacy computing node n can first check whether there is a previously obtained remote certification report locally, and if it exists, the remote certification report will be fed back to the control node, otherwise the remote certification process will be triggered temporarily.
  • the remote attestation report can have a certain time limit, such as 30 minutes or other duration.
  • the timed out remote attestation report can be deemed invalid by the client, and the control node or the off-chain privacy computing node n can also actively clear the invalid remote attestation. Report to avoid feeding it back to the client.
  • the client verifies that the off-chain private computing node is trusted by obtaining the remote attestation report for the off-chain TEE created on the off-chain private computing node, that is, the off-chain TEE deployed on the off-chain private computing node is credible ,
  • the off-chain contract can be deployed in the off-chain privacy computing node, that is, the bytecode of the off-chain contract can be deployed in the off-chain privacy computing node.
  • the deployment process is as follows:
  • the client can encrypt and transmit the bytecode of the off-chain contract to the off-chain private computing node through the off-chain channel, or the client can transfer the bytecode of the off-chain contract through the on-chain channel. Encrypted transmission to the off-chain private computing node.
  • the client generates an off-chain contract deployment transaction.
  • the off-chain contract deployment transaction contains the bytecode ciphertext obtained by encrypting the bytecode, and the client encrypts the off-chain contract deployment transaction.
  • the encrypted off-chain contract deployment transaction can be decrypted in the on-chain TEE created at the blockchain node to obtain the bytecode ciphertext, and then the blockchain node will use the oracle mechanism to convert The bytecode ciphertext is transmitted to the privacy computing node under the chain.
  • the off-chain privacy computing node When the off-chain privacy computing node decrypts the plaintext bytecode in the off-chain TEE, it can re-encrypt the bytecode in the off-chain TEE and store it in a storage space outside the off-chain TEE, such as off-chain In the hard disk of the privacy computing node, the deployment of the off-chain contract is completed.
  • the off-chain privacy computing node usually uses a symmetric key to encrypt and store the bytecode through symmetric encryption, so that when the bytecode is subsequently called, it is compared to the form of asymmetric encryption. , The decryption operation can be completed faster.
  • the symmetric key can be generated by the off-chain private computing node in the off-chain TEE, or distributed to the off-chain private computing node by other objects through encrypted transmission.
  • the KMS server can initiate a challenge to the off-chain private computing node, and in the case of verifying the trustworthiness of the off-chain private computing node through remote certification, the above-mentioned symmetric key is distributed to the off-chain private computing node.
  • the off-chain privacy computing node can use the symmetric key distributed by the KMS server as the root key, and apply the derived key derived from the root key to the encrypted storage of the bytecode.
  • the above symmetric key can be the RSK (Root Seal Key) key burned in the e-fuses storage circuit in the CPU of the private computing node under the chain, or a derivative derived from the RSK key Key (ie Seal Key).
  • RSK Room Seal Key
  • the off-chain privacy computing node can also use asymmetric encryption or a combination of symmetric encryption and asymmetric encryption to encrypt and store the bytecode, which is not limited in this specification.
  • the off-chain privacy computing nodes can be invoked to perform off-chain privacy calculations based on the data on the chain.
  • the blockchain node transmits the data on the chain to the off-chain private computing node (independent off-chain private computing node or one of the off-chain private computing clusters) through the client or oracle mechanism.
  • the off-chain private computing node uses the data on the chain to execute the pre-deployed off-chain contract in the off-chain TEE, and then feeds back the calculation result to the blockchain node, so that the blockchain node can verify the calculation result In the case of credibility, update the blockchain ledger data according to the calculation results.
  • Fig. 2 is a flowchart of an off-chain privacy calculation method for on-chain data on a blockchain node side according to an exemplary embodiment. As shown in FIG. 2, the method may include step 202 to step 206.
  • step 202 the blockchain node determines the on-chain data used for privacy calculation according to the transaction submitted by the client.
  • the client submits the transaction to the blockchain node.
  • the transaction can be transmitted to the blockchain node in the form of clear text, or can be transmitted using the encrypted data transmission scheme described above, including symmetric encryption, asymmetric encryption or a combination of the two, to ensure that the transaction is submitted during the submission process
  • the privacy in, I won’t go into details here.
  • the blockchain node can read the encrypted transaction submitted by the client into the on-chain TEE, and perform the decryption operation with the corresponding secret key to obtain the above-mentioned transaction, and then execute the transaction in the on-chain TEE .
  • the transaction generated by the client can directly include the encrypted call request, then the blockchain node can decrypt the transaction in the on-chain TEE and obtain the ciphertext of the call request, and then the blockchain node can encrypt the call request through the oracle mechanism.
  • the text is transmitted to the private computing node under the chain.
  • the above call request also includes call information, which can be generated by the client and carried in the above transaction and sent to the blockchain node, or it can be generated after the blockchain node receives the above call request. This is not limited.
  • the client can directly add the identification information to the transaction, then the blockchain node can decrypt the transaction in the on-chain TEE and obtain the identification information; or, the exchange generated by the client
  • the called on-chain contract defines the identification information of the off-chain contract.
  • the blockchain node After receiving the transaction, the blockchain node can execute the called on-chain contract in the on-chain TEE to obtain the identification information.
  • the transaction generated by the client can directly include the input parameter data, then the blockchain node can decrypt the transaction in the on-chain TEE and obtain the input parameter data. Then, the called on-chain contract is executed by the virtual machine deployed in the on-chain TEE. After the on-chain contract is executed, the above identification information and input parameter data can be packaged into a call request and the call request can be encrypted.
  • the transaction generated by the client can contain the description information of the input parameter data, for example, the description information can be a storage address, etc., then the blockchain node can query the corresponding input parameter data by executing the on-chain contract, and the on-chain contract is After execution, the above identification information and input data can be packaged into a call request and the call request can be encrypted.
  • the transaction generated by the client can include initial data, then the blockchain node can process the initial data by executing the on-chain contract to obtain the corresponding input data. After the on-chain contract is executed, the above identification information can be added to the input data.
  • the parameter data is packaged into a call request and the call request is encrypted.
  • the transaction generated by the client can contain description information of the initial data, for example, the description information can be a storage address, etc.
  • the blockchain node can query the corresponding initial data by executing the contract on the chain, and the contract on the chain The initial data is processed.
  • the above identification information and input data can be packaged into a call request and the call request can be encrypted, so the client may not directly add the identification information or input data to the transaction.
  • the client is transparent to the process of invoking the off-chain contract to perform off-chain privacy calculations. The client only needs to obtain the calculation results fed back by the off-chain privacy computing node, and does not need to pay attention to the identification information or input of the invoked off-chain contract. Parameter information, etc.
  • the data on the chain can be the input parameter data carried by the above transaction, such as the data located in the data field of the above transaction; it can also be the data specified by the above transaction, such as the called chain when the above transaction calls the contract on the chain.
  • the contract queries the corresponding on-chain data based on the transaction information specified in the data field of the above transaction; it can also be the intermediate value or final result of the on-chain contract that will be called when the above-mentioned transaction calls the on-chain contract.
  • the above-mentioned intermediate value or final result is generated by the on-chain contract processing the data carried by the above-mentioned transaction or the on-chain data queried according to its designated information.
  • the data on the chain determined by the blockchain node may have multiple types, such as the blockchain data located on the blockchain, the state data maintained by the blockchain node, or the receipt data maintained by the blockchain node. The instructions do not limit this.
  • Step 204 The blockchain node transmits the encrypted on-chain data to the off-chain privacy computing node, and the off-chain privacy computing node is deployed at the off-chain privacy computing node for performing privacy calculations on the on-chain data. Trusted execution environment.
  • the data on the chain is provided by the client, for example, the data on the chain is the input data carried by the above transaction, then the data on the chain may have been encrypted by the client without the need for encryption by the blockchain node.
  • the blockchain node should encrypt the data on the chain in the on-chain TEE; among them, if the blockchain node queried the data
  • the data on the chain itself is in an encrypted state, so the blockchain node needs to decrypt the plaintext data on the chain in the on-chain TEE, and then re-encrypt it with other keys to ensure that the off-chain private computing node can decrypt it smoothly.
  • the client can also transmit the data on the chain to the blockchain node, and then the blockchain node will encrypt it in the on-chain TEE.
  • the process of encrypting the data on the chain can be carried out using the above-mentioned symmetric encryption, asymmetric encryption, or a digital envelope combining the two, and the specific encryption process will not be repeated one by one.
  • Blockchain nodes can also use the identity private key of the blockchain node to sign the data on the chain; among them, the successful signature verification is used by the client or oracle server as the means for transmitting the encrypted data on the chain to the off-chain private computing node. Prerequisites.
  • the client or oracle server After the client or oracle server receives the data on the chain sent by the blockchain node, it uses the pre-obtained public key of the identity of the blockchain node to verify the signature of the data on the chain (signature verification process), and only the data on the chain passes After verifying the signature, the client or oracle server can confirm that the data on the chain is indeed sent by the blockchain node, and no data is lost or tampered with during the transmission process, and then the data on the chain is transmitted to the private computing node under the chain .
  • the public key of the asymmetric key pair of the involved device is referred to as the public key for short
  • the private key of the matching asymmetric key pair is referred to as the private key for short to describe the above situation.
  • the blockchain node can first use the private key of the blockchain node to sign the data on the plaintext, and then sign the data on the plaintext.
  • the data on the chain is encrypted; the blockchain node can also encrypt the data on the plaintext chain first, and then use the private key of the blockchain node to sign the data on the ciphertext chain.
  • the blockchain node When the data on the chain has been encrypted by the client, if the client uses the public key of the client, oracle server or off-chain privacy computing node to encrypt the data on the chain, the blockchain node directly encrypts the encrypted chain The data on the chain is signed; if the client uses the public key of the blockchain node to encrypt the data on the chain, the blockchain node decrypts the on-chain TEE to obtain the plaintext on-chain data, and then can first perform the plaintext on-chain data Encryption, and then use the private key of the blockchain node to sign the ciphertext on-chain data. You can also first use the blockchain node’s private key to sign the plaintext on-chain data, and then the plaintext on-chain data encryption.
  • the data on the chain may be in an encrypted state.
  • the blockchain node can directly encrypt The subsequent on-chain data is signed;
  • the blockchain node can decrypt the plaintext on-chain data in the on-chain TEE, and then can first The data on the plaintext is encrypted, and then the private key of the blockchain node is used to sign the data on the ciphertext, or the private key of the blockchain node is used to sign the data on the plaintext, and then the data The data on the chain is encrypted.
  • the blockchain node can first encrypt the data on the plaintext, and then use the private key of the blockchain node to encrypt the chain of the ciphertext. Sign the above data, or first use the private key of the blockchain node to sign the plaintext on-chain data, and then encrypt the plaintext on-chain data.
  • the public key of the client, the oracle server or the off-chain privacy computing node can be used.
  • the subsequent blockchain node transmits the encrypted and signed data on the chain to the off-chain privacy computing node through the client; if the public key of the oracle server is used for encryption, the subsequent blockchain node will pass the oracle server to the private computing node.
  • the encrypted and signed data on the chain is transmitted to the off-chain private computing node; if the public key of the off-chain private computing node is used for encryption, the subsequent blockchain nodes can pass through the client or the oracle server to encrypt and sign the chain
  • the upper data is transmitted to the off-chain privacy computing node.
  • the invocation information used to call the pre-deployed off-chain contract in the off-chain privacy computing node can be associated with the on-chain data and transmitted to the off-chain privacy computing node, and the invocation information is used to indicate off-chain privacy
  • the computing node executes the above-mentioned off-chain contract in the off-chain TEE to achieve the purpose of using on-chain data for privacy calculations.
  • the blockchain node can specify the off-chain contract in the off-chain privacy computing node to use the on-chain data to perform privacy calculations in the off-chain TEE.
  • the above calculation process can execute functions in the off-chain contract.
  • the invocation information of the off-chain contract is associated with the above-mentioned on-chain data and transmitted to the off-chain privacy computing node.
  • the above-mentioned invocation information may include the contract ID of the invoked off-chain contract. It may also include the contract ID of the called off-chain contract and the function name of at least one function in the off-chain contract. It is understandable that in the case that the blockchain node or client specifies the above-mentioned invocation information, before the invocation information and the data on the chain are associated and transmitted, the encryption and signature operations similar to the above-mentioned data on the chain can be performed on the invocation information.
  • the above-mentioned associated transmission represents the logical association between the two, such as the association between the two through the preset transmission interval length or the associated identification information such as the contract ID, and the two can be connected in actual transmission.
  • Adjacent and sequential transmission, or non-adjacent transmission this specification does not limit the specific transmission timing of the call information and the data on the chain. The following only takes the transmission of the data on the chain as an example for description.
  • Blockchain nodes can transmit the encrypted data on the chain to the off-chain privacy computing nodes through the oracle mechanism, that is, the transaction executed by the blockchain node calls the oracle contract, or the on-chain contract called by the transaction further calls the oracle.
  • Contract the oracle contract generates contract events for on-chain data
  • the oracle server reads the above-mentioned on-chain data by monitoring the contract events generated by the oracle contract, and then transmits the on-chain data to the off-chain privacy computing node.
  • the blockchain node can transmit the encrypted data on the chain to the off-chain privacy computing node through the off-chain privacy computing invocation component pre-deployed at the client; the off-chain privacy computing invocation component can be pre-deployed in the client.
  • the block chain node sends the encrypted data on the chain to the client, and the off-chain privacy computing invocation component in the client calls the off-chain privacy computing node, and transmits the encrypted data on the chain to the off-chain privacy computing node.
  • the blockchain node can directly transmit the data on the chain to the off-chain privacy computing node through the aforementioned oracle mechanism or invoking the off-chain privacy computing invocation component at the client.
  • the off-chain private computing node belongs to the off-chain private computing cluster
  • the blockchain node can also directly transmit the data on the chain to the off-chain private computing node, it usually transmits the data on the chain first to the off-chain
  • the control node of the privacy computing cluster for example, transmits the data on the chain to the control node through the above-mentioned oracle mechanism or the off-chain privacy calculation invocation component at the client, and the control node forwards the data on the chain to the off-chain that performs the privacy calculation Privacy computing node.
  • the method for the control node to forward the data on the chain may be: the client or the oracle server associates the designated information (such as node ID) of the private computing node under the chain and the data on the chain and sends it to the control node, and the control node receives the designated information and After the data on the chain, the off-chain privacy computing node that matches the above specified information is determined, and then the data on the chain is sent to the node; or, after the control node receives the above data, it will be based on the current load value of each node in the cluster (such as the current computing).
  • the target node is determined, such as the node with the smallest current load value as the target node, and the current load value is less than a certain load value threshold. Any one of all the nodes in is determined as the target node, etc.; then the data on the chain is sent to the above-mentioned target node, so that the above-mentioned target node uses the on-chain data to perform privacy calculations.
  • the blockchain node After the blockchain node encrypts (or encrypts and signs) the data on the chain, the ciphered data on the chain is transmitted to the private computing node off the chain through the client or oracle server.
  • the client or oracle server can directly forward the encrypted data on the chain to the off-chain privacy Computing node; if only the client (or oracle server) owns the symmetric secret key, the client (or oracle server) decrypts it in the off-chain TEE of the client (or oracle server) to obtain the plaintext on the chain
  • other secret keys negotiated with the off-chain private computing node are used to encrypt the data on the chain and sent to the off-chain private computing node.
  • the client (or oracle server) can The above-mentioned encrypted data on the chain is directly forwarded to the off-chain privacy computing node; if only the client (or oracle server) has a private key that matches the public key of the asymmetric secret key, the client (or oracle) The server) can decrypt the plaintext data on the chain in the off-chain TEE of the client (or oracle server), and then use other secret keys negotiated with the off-chain privacy computing node to encrypt the data on the chain and send it to the off-chain Privacy computing node.
  • the client or oracle server
  • the client can encrypt the above-mentioned digital envelope.
  • the data on the chain is directly sent to the off-chain private computing node, or the above-mentioned encrypted data on the chain is re-encrypted using the secret key negotiated with the off-chain private computing node and then sent to the off-chain private computing node; if the client (or predicts) Server) owns the private key of the asymmetric secret key, the client (or oracle server) can decrypt it in the off-chain TEE of the client (or oracle server) to obtain the symmetric secret key, and use it with the off-chain
  • the secret key negotiated by the private computing node encrypts the symmetric key and then sends it to the private computing node off-chain; the client (or oracle server) can also decrypt it in the off-chain TEE of the client (or oracle server).
  • the digital envelope constructed by the node encryption public key of the off-chain private computing node is used to re-encrypt the data on the chain and then sent to the off-chain private computing node.
  • the client or oracle server is usually directly connected to the off-chain private computing node.
  • the off-chain private computing node receives the on-chain data encrypted by the client or oracle server using the off-chain private computing node’s node encryption public key, it can first use it in the pre-created off-chain TEE that matches the above-mentioned node encryption public key
  • the node encryption private key of the node decrypts the ciphertext data on the chain, and then uses the blockchain node identity public key of the blockchain node to verify the plaintext data on the chain, and uses the data on the chain after the verification is passed.
  • the node encryption private key corresponding to the node encryption public key of the data on the encrypted chain can only be maintained by the off-chain private computing node, or the off-chain private computing cluster All off-chain privacy computing nodes in the chain are jointly maintained, or only maintained by the control node of the off-chain privacy computing cluster.
  • the off-chain private computing node In the case that the above-mentioned node encryption private key is only maintained by the off-chain private computing node, only the ultimate destination of the data on the chain (that is, the off-chain private computing node) can successfully decrypt and obtain the above-mentioned data on the chain, and other devices Even if the encrypted data on the chain is obtained, it cannot be decrypted, thereby ensuring the privacy of the data on the chain during transmission.
  • the control node of the cluster to which the off-chain private computing node belongs will verify the trust of any node through remote certification when it joins the cluster, so as to ensure that all off-chain private computing nodes in the cluster are trusted, so
  • the above-mentioned node encryption private key is maintained by all the off-chain privacy computing nodes in the off-chain privacy computing cluster
  • the control node after the control node receives the data on the chain encrypted by the blockchain node using the node encryption private key, it can It is directly forwarded to any determined target node and decrypted by the latter, without the need for the control node to perform decryption and secondary encryption operations, thereby shortening the forwarding time of the control node and improving the forwarding efficiency;
  • the off-chain private computing cluster can be regarded as a device, so there is no need to save the public key of each node, reducing the number of
  • the control node receives the ciphertext data on the chain, it corresponds to the operation sequence of the signature and encryption of the data on the chain.
  • the control node can first use the node encryption public key of the blockchain node to verify the ciphertext on-chain data, and after the verification is passed, the ciphertext on-chain data in the off-chain TEE pre-deployed in the control node Decryption; you can also decrypt the ciphertext on-chain data in the off-chain TEE pre-created in the control node to obtain the plaintext on-chain data, and then use the node encryption public key of the blockchain node to encrypt the plaintext on the chain The data is verified.
  • the data on the plaintext chain can be re-encrypted and sent to the target node using the secret key pre-negotiated with the target node, so that the target node can use the above chain after decryption Data is calculated for privacy.
  • the verification device off-chain privacy computing node or control node
  • the verification device can discard the above-mentioned data on the chain; it can also extract the data information of the data on the chain to generate a data verification log, and The data verification log is saved locally or fed back to the blockchain node; it can also return error information or warning information to the blockchain node or other preset objects, and this manual does not limit this.
  • Off-chain privacy computing nodes use the on-chain data that has passed the verification to execute pre-deployed off-chain contracts in the created off-chain TEE, that is, perform privacy calculations.
  • the off-chain private computing node can decrypt the off-chain contract invocation request associated with the data on the chain to obtain the identification information, and then the off-chain private computing node can call the bytecode of the pre-deployed off-chain contract based on the identification information.
  • the off-chain private computing node can determine the corresponding execution engine based on the bytecode, and execute the above bytecode through the determined execution engine to perform data processing on the chain. Off-chain privacy calculations.
  • the off-chain privacy computing node can also specify the execution engine for executing the bytecode to the off-chain private computing node.
  • the off-chain privacy computing node can receive the execution engine designation information associated with the bytecode of the off-chain contract sent by the client or the blockchain node, and set the corresponding execution engine for the bytecode according to the execution engine designation information.
  • off-chain privacy computing nodes can perform off-chain privacy calculations on the data on the chain according to the determined execution engine in the off-chain TEE. It is worth noting that the above-mentioned designated information may be included in the above-mentioned call request.
  • the off-chain private computing node can use the on-chain data to implement any user-defined computing logic.
  • off-chain privacy computing nodes can verify whether the amount of encrypted order data stored on the blockchain is correct through off-chain contracts, and feed back the verification results to the chain; for another example, off-chain privacy computing nodes can use off-chain contracts based on The preset algorithm performs safe calculations on multi-party data, that is, safe multi-party calculations, and feeds back the calculation results to the chain, etc., which will not be repeated here.
  • Step 206 The blockchain node obtains the calculation result generated and encrypted by the off-chain privacy computing node in the off-chain trusted execution environment, and then updates the blockchain ledger data according to the calculation result.
  • the off-chain privacy computing node performs calculations in the off-chain TEE to obtain the off-chain privacy calculation result, which can include at least one of the following: response code, response information, return value of contract invocation, process output of contract invocation, and off-chain privacy computing node can According to the call request, the corresponding off-chain privacy calculation result is returned, which is not restricted in this specification.
  • the off-chain privacy computing node can first encrypt the calculation results in the off-chain TEE, and then feed back the encrypted calculation results to the blockchain node.
  • the blockchain node can obtain the calculation result generated and encrypted by the off-chain private computing node in the off-chain trusted execution environment through the oracle mechanism, that is, the above-mentioned calculation result is fed back as the response of the called oracle contract Blockchain node.
  • the blockchain node can also use the off-chain privacy computing invocation component pre-deployed at the client to obtain the calculation result generated and encrypted by the off-chain private computing node in the off-chain trusted execution environment, that is, the above-mentioned calculation result is used as the The response of the called off-chain privacy computing invocation component is fed back to the client, and then the client sends the calculation result to the blockchain node to realize the feedback of the calculation result.
  • the off-chain private computing node can sign the calculation result through the node signature private key of the off-chain private computing node, or can use the contract signature private key of the called off-chain contract to sign the calculation result, or use the node at the same time
  • the signature private key and the contract signature private key sign the off-chain privacy calculation result, which is not restricted in this manual.
  • the client or blockchain node can verify the signature through the node signature public key or the contract signature public key to determine that the off-chain privacy calculation result is indeed generated by the off-chain privacy computing node calling the corresponding off-chain contract, and the transmission process No data loss or tampering occurred in.
  • node signature private key used by the off-chain private computing node to sign the calculation result and the node encryption public key used by the above-mentioned blockchain node, client or oracle server to encrypt the data on the chain can be It is a pair of asymmetric keys that match each other, or it can be asymmetric keys that do not match. This specification does not limit this.
  • the off-chain privacy computing node can use the identity public key to encrypt the calculation result, so that only the identity private key corresponding to the above identity public key is maintained Only the specified object of the chain can decrypt the off-chain privacy calculation result, which can limit users who can view the calculation result, while other users can only obtain the encrypted calculation result when directly viewing the off-chain privacy calculation result, thus realizing the calculation result privacy protection.
  • the off-chain privacy computing node can first use the blockchain node identity public key of the blockchain node to encrypt the calculation result in the off-chain TEE, and then use the contract signature private key of the off-chain contract that performs the privacy calculation or the private computing node’s private key.
  • the node signature private key signs the calculation result of the ciphertext; you can also first use the contract signature private key or the node signature private key to sign the calculation result of the plaintext, and then use the above-mentioned blockchain node identity public key to sign the ciphertext
  • the calculation data is encrypted.
  • the above signature and ciphertext calculation results are associated with the client or oracle server and transmitted to the blockchain node. After the latter receives it, it decrypts it in the on-chain TEE and then verifies the signature or a priori. Decrypt after signing to get the calculation result.
  • the off-chain privacy computing node can also use the public key of the client (or oracle server) to encrypt the calculation result in the off-chain TEE, and then use the contract signature private key of the off-chain contract that performs the privacy calculation or the private computing node’s private key.
  • the node signature private key signs the calculation result of the ciphertext; you can also first use the contract signature private key or the node signature private key to sign the calculation result of the plaintext, and then use the public key pair of the client (or oracle server)
  • the calculation result of the plaintext is encrypted; after the encryption and signature are completed, the client (or oracle server) transmits the calculation result of the above signature and ciphertext to the blockchain node, and the latter receives it in the TEE on the chain. Perform decryption before signing or decryption after signing to obtain the calculation result.
  • the off-chain private computing node belongs to the off-chain private computing cluster
  • the off-chain private computing node has passed the trusted authentication of the cluster control node before using the on-chain data for privacy computing
  • the off-chain private computing node After calculating the above calculation results, you can first use the contract signature private key of the off-chain contract that performs the privacy calculation or the node signature private key of the off-chain privacy computing node to sign the calculation result, and then send the signed calculation result to the control
  • the node is encrypted by the control node using the node identity public key of the blockchain node; or first use the contract signature private key or the node signature private key to sign the calculation result, and then use the node identity public key pair of the blockchain node It is encrypted and sent to the control node, and finally the control node transmits the above-mentioned encrypted and signed calculation result to the blockchain node through the client or the oracle server.
  • the off-chain privacy computing node or control node in the above embodiment can also use the public key of the client (or oracle server) to encrypt the data on the chain, and then the control node sends it to the client (or oracle server), The client (or oracle server) receives it and decrypts it in the off-chain TEE, and then uses the blockchain node identity public key of the blockchain node for secondary encryption and sends it to the blockchain node.
  • the blockchain node After the blockchain node receives the signed calculation result fed back by the off-chain privacy computing node, it verifies the signature.
  • the blockchain node determines that the signature for the calculation result matches the above-mentioned contract signature private key or node signature private key. In the case of a key, it is determined that the above calculation result is credible, and the credibility of the calculation result is a prerequisite for the blockchain node to update the ledger data.
  • the blockchain node uses the pre-obtained contract signature public key or node signature public key that matches the above-mentioned contract signature private key or node signature private key to verify the above signature to determine whether the above calculation result is credible; in the case where the verification is passed Next, it is determined that the above calculation result is credible, that is, the calculation result is indeed generated by using the data on the chain to execute the specified off-chain contract in the TEE of the designated off-chain privacy computing node, and no data loss or tampering occurred during transmission. Therefore, the blockchain node uses the above-mentioned signature verification as a prerequisite for using the calculation result to update the ledger data.
  • the verification process of the calculation result of the blockchain node is carried out Description: First, use the blockchain node encryption private key corresponding to the above-mentioned blockchain node identity public key to decrypt the above signature to obtain the first hash value; then use the node encryption public key corresponding to the above-mentioned node encryption private key to decrypt the above ciphertext Then calculate the second hash value of the calculation result of the plaintext obtained after decryption, and compare the first hash value with the second hash value: if the first hash value is equal to the second hash value, then It means that the above-mentioned packaged data is indeed sent by the blockchain node, and no data is lost or tampered with during transmission, the verification is successful; otherwise, if the above-mentioned first hash value is not equal to the second hash
  • the blockchain node can update the blockchain ledger data according to the calculation result, solidify the calculation result, and support the later verification of the calculation result.
  • the calculation result generated based on the off-chain contract is relatively shorter. Therefore, when the calculation result is uploaded to the chain, it is helpful to save Storage space on the chain. Otherwise, if the verification fails, the client can discard the above-mentioned data on the chain; it can also extract the data information of the data on the chain to generate a data verification log, and save the data verification log locally or feed it back to the block Chain node; it can also return error information or alarm information to the blockchain node or other preset objects.
  • the off-chain privacy computing node feeds back the calculation result to the blockchain node through the oracle mechanism
  • the blockchain node can also send the calculation result of the above ciphertext to the client , Or re-encrypt the calculation result of the above plaintext and send it to the client; it is understandable that in the process of sending the calculation result to the client, the transaction related to the above calculation result can also be related to the transaction submitted by the client. The information is associated and sent to the client, so that the client knows the relevant calculation results of the submitted transaction.
  • the blockchain node updates the blockchain ledger data according to the calculation result, or it is called uploading the calculation result to the chain.
  • the method can include: generating a blockchain transaction and adding the calculation result to the data field of the transaction. After the block chain transaction has passed the consensus, it can be added by each block chain node to the block body of the latest block, thereby realizing the update of the block chain ledger data, that is, completing the chaining of the calculation result; or,
  • the blockchain node updates the state of the related account according to the calculation result.
  • the related account can be, for example, the external account corresponding to the user or the contract account corresponding to the contract on the chain.
  • the status update of the related account will cause the state tree to be updated.
  • the value of the root of the tree changes, and the root of the state tree will be included in the block header of the latest block, thereby realizing the update of the blockchain ledger data, which is equivalent to uploading the calculation result to the chain.
  • this specification also proposes other aspects of the off-chain privacy node side and client side.
  • the description involved in the blockchain node side embodiment can also be applied to The embodiments on these sides will not be described in detail below.
  • Fig. 3 is a flowchart of an off-chain privacy calculation method for on-chain data on the side of an off-chain privacy computing node provided by an exemplary embodiment. As shown in FIG. 3, the method may include step 302 to step 306.
  • the off-chain private computing node receives the encrypted on-chain data transmitted by the blockchain node.
  • the off-chain trusted execution environment is deployed at the off-chain private computing node, and the on-chain data is controlled by the blockchain.
  • the node is determined according to the transaction submitted by the client.
  • the off-chain private computing node can receive the encrypted on-chain data transmitted by the blockchain node through the oracle mechanism; or, the off-chain private computing node can receive the blockchain node through the chain pre-deployed at the client.
  • the encrypted data on the chain transmitted by the next privacy calculation call component can be received.
  • the on-chain data received by the off-chain private computing node can be signed by the blockchain node using the private key of the identity of the blockchain node.
  • the successful signature verification is used by the client or the oracle server as a prerequisite for transmitting the encrypted data on the chain to the off-chain private computing node.
  • the data on the chain can be transmitted to the off-chain private computing node after being encrypted by the node encryption public key, and the off-chain private computing node maintains the node encryption private key corresponding to the node encryption public key.
  • the above-mentioned node encryption private key is only maintained by the off-chain private computing node, or the above-mentioned node encryption private key is maintained by the off-chain private computing cluster. All off-chain privacy computing nodes are jointly maintained.
  • the off-chain private computing node receives the on-chain data transmitted by the blockchain node and is encrypted by the blockchain node using the node encryption public key; or, the off-chain private computing node receives the client used node transmitted by the client Encrypt the data on the chain encrypted by the public key, where the data on the chain is encrypted by the above-mentioned blockchain node and transmitted to the above-mentioned client.
  • the off-chain private computing node can directly receive the on-chain data sent by the blockchain node; or, when the off-chain private computing node belongs to the off-chain private computing cluster, the off-chain private computing node can receive the block The on-chain data forwarded by the chain node through the control node of the off-chain privacy computing cluster.
  • step 304 the off-chain privacy computing node executes a privacy calculation on the on-chain data in the off-chain trusted execution environment to generate a calculation result.
  • the invocation information of the off-chain contract is received by the off-chain private computing node and the on-chain data.
  • the above invocation information is used to instruct the off-chain private computing node to execute the above-mentioned off-chain contract pair in the off-chain trusted execution environment.
  • the data on the chain realizes privacy calculation; where the calling information includes: the contract ID of the above-mentioned off-chain contract, or the contract ID of the above-mentioned off-chain contract and the function name of at least one function in the off-chain contract.
  • Step 306 The off-chain privacy computing node feeds back the encrypted calculation result to the blockchain node, and the calculation result is used to update the blockchain ledger data.
  • the off-chain private computing node can feed back the encrypted calculation result to the blockchain node through the oracle mechanism; or, the off-chain private computing node can use the off-chain privacy computing call component pre-deployed at the client to send the data to the district.
  • the block chain node feeds back the encrypted calculation result.
  • the off-chain private computing node executes the pre-deployed off-chain contract in the off-chain trusted execution environment to realize the private calculation of the on-chain data, and the off-chain private computing node maintains the contract signature corresponding to the above-mentioned off-chain contract.
  • Private key the off-chain private computing node can use the contract signature private key to sign the calculation result, where the blockchain node determines that the calculation result is trustworthy if the signature for the calculation result matches the contract signature private key , And the credibility of the calculation result is used as a prerequisite for the blockchain node to update the ledger data.
  • Fig. 4 is a flowchart of a method for calculating off-chain privacy of on-chain data on the client side according to an exemplary embodiment. As shown in FIG. 4, the method may include steps 402 to 406.
  • step 402 the client submits a transaction to a blockchain node, so that the blockchain node determines the on-chain data used for privacy calculation according to the transaction.
  • step 404 the client, upon receiving the encrypted data on the chain sent by the blockchain node, encrypts the data on the chain to the off-chain privacy computing node, and the off-chain privacy
  • An off-chain trusted execution environment for performing private calculations on the on-chain data is deployed at the computing node.
  • the data on the chain received by the client can be signed by the blockchain node using the private key of the identity of the blockchain node; among them, the successful signature verification is used by the client as the encrypted data on the chain to be transmitted to the off-chain Prerequisites for privacy computing nodes.
  • the off-chain private computing node maintains the node encryption private key corresponding to the node encryption public key, and the client can use the above-mentioned node encryption public key to encrypt the data on the chain and send it to the off-chain private computing node.
  • the off-chain privacy computing invocation component is pre-deployed at the client, and the client can invoke the off-chain privacy computing invocation component to encrypt and transmit the on-chain data to the off-chain privacy computing node.
  • Step 406 The client sends the calculation result to the blockchain after receiving the calculation result generated and encrypted and transmitted by the off-chain private computing node in the off-chain trusted execution environment.
  • the node is used to update the blockchain ledger data.
  • the off-chain privacy calculation invocation component is pre-deployed at the client, and the client can invoke the off-chain privacy calculation invocation component to send the calculation result to the blockchain node.
  • Fig. 5 is a flow chart of interaction between devices corresponding to a method for off-chain privacy calculation of on-chain data provided by an exemplary embodiment. As shown in Figure 5, the client submits a transaction to the blockchain node for privacy calculation. The method may include the following steps.
  • step 502 the client sends a transaction to the blockchain node.
  • the client sends the corresponding transaction to the blockchain node.
  • the above trigger conditions can be the preset operation performed by the user, the preset function of the application running on the client is turned on, and the preset time is reached. Wait.
  • the preset operations performed by the above-mentioned user can take many forms, such as submitting a transaction request, executing transaction deployment, or feeding back a transaction response, etc.; correspondingly, the above-mentioned transaction can specifically be transfer, receiving transfer, querying historical transaction information, etc., this manual There is no restriction on this.
  • step 504 the blockchain node determines the data on the chain and sends the data on the chain to the client.
  • Blockchain nodes can determine the on-chain data used for off-chain privacy calculations based on the received transactions before or during transaction execution.
  • the data on the chain can be the input parameter data carried by the above transaction, such as the data located in the data field of the above transaction; it can also be the data specified by the above transaction, such as the called chain when the above transaction calls the contract on the chain.
  • the contract queries the corresponding on-chain data based on the transaction information specified in the data field of the above transaction; it can also be the intermediate value or final result of the on-chain contract that will be called when the above-mentioned transaction calls the on-chain contract.
  • the above-mentioned intermediate value or final result is generated by the on-chain contract processing the data carried by the above-mentioned transaction or the on-chain data queried according to its designated information.
  • the data on the chain determined by the blockchain node may have multiple types, such as the blockchain data located on the blockchain, the state data maintained by the blockchain node, or the receipt data maintained by the blockchain node. The instructions do not limit this.
  • the blockchain node After the blockchain node has determined the data on the chain, it can first use the node encryption public key of the off-chain private computing node to encrypt the data on the chain, and then use the blockchain node identity private key of the blockchain node to encrypt the encrypted data.
  • the data on the chain is signed, and finally the above-mentioned signature and the encrypted data on the chain are associated and sent to the client or packaged and sent to the client.
  • the blockchain node in addition to transmitting the data on the chain to the off-chain private computing node, the blockchain node can also transmit the off-chain contract call request associated with the above-mentioned on-chain data to the off-chain private computing node to encrypt the call request.
  • the sum signature can be performed in association with the above-mentioned data on the chain, and the operation mode and sequence of the encryption and signature for the call request can be the same as the above-mentioned processing procedure of the calculation result, which will not be repeated here.
  • step 506 the client terminal forwards the on-chain data to the off-chain privacy computing node after passing the verification.
  • the client After the client receives the above-mentioned packaged data, it first verifies the on-chain data in it, and then forwards the on-chain data to the off-chain privacy computing node if the verification is successful.
  • the client when the client receives the associated signature and encrypted data on the chain, or splits the received packaged file to obtain the signed and encrypted data on the chain
  • the node encryption public key of the blockchain node is used to decrypt the above signature to obtain the first hash value.
  • the second hash value of the encrypted data on the chain can be directly calculated, or the client's The encryption private key decrypts the encrypted data on the chain to obtain the data on the chain in plaintext, and then calculates the second hash value of the data on the chain.
  • the client receives the encrypted package file, and the package file contains the signature and non-encrypted data on the chain
  • the client can first use the client's encrypted private key to decrypt the above package file to obtain the above signature
  • the node encryption public key of the blockchain node is used to decompress the above-mentioned signature to obtain the first hash value corresponding to the data on the chain, and on the other hand, the second hash value of the data on the chain is calculated.
  • the signature verification After obtaining the above-mentioned first hash value and the second hash value, compare the two: if the above-mentioned first hash value and the second hash value are equal, it means that the above-mentioned packaged data is indeed sent by the blockchain node , And has not been tampered with by other devices, the signature verification is successful; otherwise, if the above-mentioned first hash value is not equal to the second hash value, the signature verification fails.
  • the off-chain privacy computing node is an independent off-chain privacy computing node.
  • the client forwards the above-mentioned on-chain data to the off-chain privacy computing node.
  • the client can directly forward the above-mentioned on-chain data encrypted using the node encryption public key of the off-chain private computing node to the off-chain private computing node.
  • the client can also first use the node encryption public key of the off-chain private computing node to encrypt the above-mentioned data on the chain, and then forward the ciphertext on-chain data to the off-chain private computing node.
  • the client can discard the above-mentioned data on the chain; it can also extract the data information of the data on the chain to generate a data verification log, and save the data verification log in Locally or feedback to the blockchain node; it can also return error information or alarm information to the blockchain node or other preset objects.
  • the node encryption private key is maintained in the independent off-chain private computing node, and the client can directly send the encrypted data on the chain to the off-chain private computing node, and the off-chain private computing node uses its maintenance
  • the node encryption private key decrypts the ciphertext on-chain data in the pre-created off-chain TEE.
  • step 508 the off-chain privacy computing node performs privacy calculation.
  • Off-chain privacy computing nodes use the on-chain data that has passed the verification to execute pre-deployed off-chain contracts in the created off-chain TEE, that is, perform privacy calculations.
  • the off-chain private computing node can decrypt the off-chain contract call request associated with the on-chain data to obtain identification information and other information, and then the off-chain private computing node can call the bytecode of the pre-deployed off-chain contract based on the identification information.
  • the off-chain private computing node can determine the corresponding execution engine according to the bytecode, and execute the bytecode through the determined execution engine to perform the chain Upload data for off-chain privacy calculations.
  • the off-chain privacy computing node can also specify the execution engine for executing the bytecode to the off-chain private computing node.
  • the off-chain privacy computing node can receive the execution engine designation information associated with the bytecode of the off-chain contract sent by the client or the blockchain node, and set the corresponding execution engine for the bytecode according to the execution engine designation information. Therefore, off-chain privacy computing nodes can perform off-chain privacy calculations on the data on the chain according to the determined execution engine in the off-chain TEE.
  • the off-chain private computing node can use the on-chain data to implement any user-defined computing logic.
  • off-chain privacy computing nodes can verify whether the amount of encrypted order data stored on the blockchain is correct through off-chain contracts, and feed back the verification results to the chain; for another example, off-chain privacy computing nodes can use off-chain contracts based on The preset algorithm performs secure calculations on multi-party data, that is, secure multi-party calculations, and feeds back the calculation results to the blockchain nodes, etc., which will not be repeated here.
  • the execution result of the bytecode in the above-mentioned off-chain contract is the calculation result of the off-chain privacy calculation.
  • the off-chain private computing node can use the client's encryption public key to encrypt the calculation result, or the blockchain node's node encryption public key to encrypt the calculation result.
  • the calculation result can also be signed using the contract signature private key of the contract under the called chain or the node signature private key of the private computing node under the chain.
  • step 510 the client forwards the calculation result to the blockchain node.
  • the client forwards the data on the chain to the off-chain privacy computing node.
  • the client can forward the calculation result to the blockchain node.
  • the off-chain privacy computing node that uses the on-chain data for privacy calculations is an independent off-chain privacy computing node
  • the off-chain privacy computing node directly sends the above-mentioned calculation results to the client.
  • the off-chain privacy computing node that uses the on-chain data for privacy calculation belongs to the off-chain privacy computing cluster
  • the off-chain privacy computing node forwards the calculation result to the client through the control node of the cluster. After the client receives the calculation result sent by the off-chain privacy computing node or control node, it forwards the above settlement result to the blockchain node.
  • the off-chain privacy computing node can also perform a hash operation on the call request associated with the above-mentioned on-chain data to obtain the third hash value.
  • the privacy calculation node associates the third hash value with the above-mentioned off-chain privacy calculation result for feedback.
  • the client or the blockchain node compares the received three hash values with the fourth hash value of the generated call request, and determines whether the off-chain privacy calculation result is reliable according to the comparison result.
  • the comparison result between the third hash value and the fourth hash value is inconsistent, it indicates that the off-chain privacy calculation result associated with the third hash value is unreliable; if the third hash value is different from the fourth hash value If the comparison results are consistent, it is necessary to further verify other reference information such as the signature of the off-chain privacy computing node or the called contract. Only when the reference information is correct can the off-chain privacy calculation result be determined to be reliable.
  • step 512 the blockchain node verifies the signature and uploads the calculation result to the chain.
  • the blockchain node After the blockchain node receives the calculation result of the aforementioned privacy calculation, it first verifies the signature of the calculation result.
  • the specific method of on-chain can include: generating a blockchain transaction, adding the calculation result to the data field of the transaction, and when the blockchain transaction passes the consensus, it can be added to the latest block area by each blockchain node In the block, the update of the blockchain ledger data is realized, that is, the calculation result is completed on the chain; or the blockchain node updates the status of the relevant account according to the calculation result.
  • the relevant account can be, for example, For the external account corresponding to the user or the contract account corresponding to the contract on the chain, the status update of the related account will cause the value of the root of the state tree to change, and the root of the state tree will be included in the latest block The block header of the block chain, so as to realize the update of the block chain ledger data, which is equivalent to linking the calculation result to the chain.
  • the blockchain node can discard the above calculation results; it can also extract the data information of the calculation results to generate a result verification log, and save the result verification log locally, It is also possible to return error information or warning information to other preset objects.
  • Fig. 6 is a flowchart of interaction between devices corresponding to another off-chain privacy calculation method for on-chain data provided by an exemplary embodiment.
  • the on-chain contract running in the blockchain node actively calls on-chain data for off-chain privacy calculations.
  • This process is actually the process of invoking off-chain privacy calculations through the oracle mechanism.
  • the method can include the following step.
  • step 602 the on-chain contract actively invokes the off-chain privacy calculation.
  • the on-chain contract pre-deployed in the blockchain node When the on-chain contract pre-deployed in the blockchain node is running, it can actively call the off-chain privacy calculation.
  • the off-chain privacy computing node, off-chain contract, and/or on-chain data that need to be called can be specified by the on-chain contract, or the oracle contract can be called by the on-chain contract, and then the oracle contract can determine the off-chain to be called Private computing nodes, off-chain contracts and/or on-chain data.
  • the data on the chain can be the data carried by the above transaction, such as the data located in the data field of the above transaction; it can also be the data specified by the above transaction, for example, in the case of the above transaction calling the contract on the chain, the called chain
  • the contract queries the corresponding on-chain data based on the transaction information specified in the data field of the above transaction; it can also be the intermediate value or final result of the on-chain contract that will be called when the above-mentioned transaction calls the on-chain contract.
  • the above-mentioned on-chain data the above-mentioned intermediate value or final result is generated by the on-chain contract processing the data carried by the above-mentioned transaction or the on-chain data queried according to its designated information.
  • the data on the chain determined by the blockchain node may have multiple types, such as blockchain data located on the blockchain, state data maintained by the blockchain node, or receipt data maintained by the blockchain node.
  • step 604 the oracle contract preprocesses the data on the chain.
  • the oracle contract preprocesses it. Specifically, when the on-chain contract is in an encrypted state, the above-mentioned encrypted on-chain data is preprocessed such as packaging. When the on-chain contract is in a non-encrypted state, first encrypt the above-mentioned unencrypted on-chain data. You can use the node encryption public key of the above-mentioned designated off-chain privacy computing node to encrypt, or you can use the above-mentioned designated off-chain The encryption public key of the control node of the privacy computing cluster under the chain to which the privacy computing node belongs is encrypted, and then the node encryption private key of the blockchain node is used to sign the encrypted data on the chain. Finally, the encrypted data on the chain and the corresponding signature can also be packaged.
  • the aforementioned packaging operation performed by the oracle contract will trigger a preset blockchain event and be monitored by the oracle server, and then the blockchain node will send the pre-processed packaged data to the oracle server in an encrypted manner.
  • the oracle server monitors the blockchain event, it can send an on-chain data acquisition request to the block link node and receive the encrypted on-chain data returned by the blockchain node.
  • the specific encryption method for the data on the chain can be symmetric secret key encryption, asymmetric secret key encryption or digital envelope encryption, etc., which can be referred to above and will not be repeated here.
  • step 606 the oracle server verifies the signature and forwards the data on the chain.
  • the oracle server verifies the received on-chain data, and sends the ciphertext on-chain data to the control node of the off-chain privacy computing cluster if the verification is successful.
  • the specific method of verifying the data on the chain please refer to the record of the above step 506, which will not be repeated here.
  • control node of the off-chain privacy computing cluster receives the on-chain data and distributes it to the target node.
  • the off-chain privacy computing cluster includes a control node, and the control node uniformly manages all off-chain privacy computing nodes in the cluster.
  • the control node After receiving the data on the chain, the control node first determines from the cluster a certain off-chain privacy computing node as the node (denoted as the target node) that uses the on-chain data for privacy calculations, and then sends the above-mentioned on-chain data to the target node .
  • the control node In the case of receiving designated information such as the node ID or node number of the off-chain private computing node sent in association with the above-mentioned on-chain data, the control node will determine the off-chain private computing node that matches the above-mentioned designated information as the target node; In the case of not receiving the specified information associated with the above-mentioned data on the chain, the control node will follow the current load value of each node in the cluster (such as the current calculation amount, the expected calculation amount in the preset time period from the current moment, the current calculation task Number, etc.) Determine the target node, such as determining the node with the smallest current load value as the target node, and determining any node among all the nodes whose current load value is less than a certain load value threshold as the target node.
  • the current load value of each node in the cluster such as the current calculation amount, the expected calculation amount in the preset time period from the current moment, the current calculation task Number, etc.
  • the control node After determining the target node, the control node sends the data on the chain to the target node.
  • the control node directly forwards the above-mentioned data on the chain to the target node.
  • the control node first uses the above node encryption private key in its own chain TEE to decrypt the ciphertext on-chain data , And then use the secret key pre-negotiated with the target node in the off-chain TEE to encrypt the plaintext on-chain data again and send it to the target node.
  • Step 610 the off-chain privacy computing node performs privacy calculation.
  • step 508 For the specific method for the off-chain privacy computing node to use the received on-chain data to perform the privacy calculation, please refer to the record of step 508 above, which will not be repeated here.
  • Step 612 the control node receives the calculation result and sends it to the oracle server.
  • the calculation result received by the control node is usually encrypted by the target node, and the control node first needs to perform different processing according to the secret key used for encryption of the calculation result.
  • the control node directly forwards the calculation result to the oracle server.
  • the control node When the calculation result is encrypted by the target node using the public key of the control node, the control node first uses the private key corresponding to the public key to decrypt the calculation result of the ciphertext in its own off-chain TEE, and then uses it in the off-chain TEE.
  • the public key of the oracle server or the blockchain node identity public key of the blockchain node re-encrypts the data on the chain in plaintext and sends it to the oracle server.
  • step 614 the oracle server forwards the calculation result.
  • the oracle server After the oracle server receives the calculation result of the encryption state sent by the control node, it performs different processing according to the different key used for encryption of the calculation result.
  • the oracle server directly forwards the calculation result to the blockchain node.
  • the oracle server When the calculation result is encrypted by the public key maintained by the control node, the oracle server first decrypts the calculation result of the ciphertext in its own chain TEE using the private key corresponding to the above public key, and then uses it in the chain TEE
  • the blockchain node identity public key of the blockchain node re-encrypts the data on the chain in plaintext and sends it to the blockchain node.
  • step 616 the blockchain node verifies the signature and uploads the calculation result to the chain.
  • the blockchain node After the blockchain node receives the calculation result, it first verifies the calculation result, and then updates the blockchain ledger data according to the calculation result if the verification is passed, and the calculation result is about to be uploaded to the chain.
  • the specific process of winding up please refer to the record of step 512 above, which will not be repeated here.
  • Fig. 7 is a schematic structural diagram of an electronic device shown in an exemplary embodiment of this specification. Please refer to FIG. 7.
  • the electronic device includes a processor 702, an internal bus 704, a network interface 706, a memory 708, and a non-volatile memory 710, and of course, may also include hardware required for other services.
  • the processor 702 reads the corresponding computer program from the non-volatile memory 710 to the memory 708 and runs it to form an off-chain privacy computing device for on-chain data on a logical level.
  • this specification does not exclude other implementations, such as logic devices or a combination of software and hardware, etc. That is to say, the execution body of the following processing flow is not limited to each logic unit, and can also be Hardware or logic device.
  • the off-chain privacy computing device for the data on the chain may include: an on-chain data determining unit 801, which enables the blockchain node to determine according to the transaction submitted by the client Data on the chain for privacy computing; the data transmission unit 802 on the chain enables the blockchain node to transmit the encrypted data on the chain to the off-chain privacy computing node, where the off-chain privacy computing node is deployed An off-chain trusted execution environment for performing privacy calculations on the on-chain data; the calculation result obtaining unit 803 enables the blockchain node to obtain that the off-chain private computing node is in the off-chain trusted execution environment Generate and encrypt the feedback calculation result, and update the blockchain ledger data according to the calculation result.
  • an on-chain data determining unit 801 which enables the blockchain node to determine according to the transaction submitted by the client Data on the chain for privacy computing
  • the data transmission unit 802 on the chain enables the blockchain node to transmit the encrypted data on the chain to the off-chain privacy computing node, where the off-chain privacy computing node is deployed
  • the on-chain data transmission unit 802 is specifically configured to: enable the blockchain node to transmit the encrypted on-chain data to the off-chain privacy computing node through an oracle mechanism; or, enable the block The blockchain node transmits the encrypted on-chain data to the off-chain privacy computing node through the off-chain privacy computing invocation component pre-deployed at the client.
  • an on-chain data signing unit 804 which enables the blockchain node to use the blockchain node identity private key to sign the on-chain data; wherein the successful signature verification is predicted by the client or the client
  • the machine server serves as a prerequisite for transmitting the encrypted data on the chain to the privacy computing node off the chain.
  • the data on the chain is encrypted by the node encryption public key and then transmitted to the off-chain private computing node, and the off-chain private computing node maintains the node encryption private key corresponding to the node encryption public key.
  • the node encryption private key is only maintained by the off-chain privacy computing node, or the node encryption private key is All off-chain privacy computing nodes in the off-chain privacy computing cluster are jointly maintained.
  • the on-chain data transmission unit 802 is specifically configured to: enable the blockchain node to use the node encryption public key to encrypt the on-chain data, and transmit the encrypted on-chain data to all The off-chain privacy computing node; or, the blockchain node is made to encrypt the data on the chain and send it to the client, and the data on the chain is encrypted by the client using the node encryption public key It is transmitted to the privacy computing node under the chain.
  • the on-chain data transmission unit 802 is specifically configured to: enable the blockchain node to directly send the on-chain data to the off-chain privacy computing node; or, in the off-chain privacy computing node In the case of belonging to an off-chain privacy computing cluster, the blockchain node is caused to forward the on-chain data to the off-chain privacy computing node through the control node of the off-chain privacy computing cluster.
  • the calculation result obtaining unit 803 is specifically configured to: enable the blockchain node to obtain, through an oracle mechanism, the off-chain private computing node generated and encrypted feedback in the off-chain trusted execution environment. Calculation result; or, enable the blockchain node to obtain the off-chain private computing node generated and encrypted feedback in the off-chain trusted execution environment through the off-chain privacy computing invocation component pre-deployed at the client The result of the calculation.
  • the on-chain data is calculated by the off-chain privacy computing node executing a pre-deployed off-chain contract in an off-chain trusted execution environment to achieve privacy calculation, and the off-chain privacy computing node maintains a data corresponding to the The contract signature private key of the off-chain contract; further comprising: a calculation result verification unit 805, which enables the blockchain node to determine that the calculation result is credible if the signature for the calculation result matches the contract signature private key , And the credible calculation result is a prerequisite for the blockchain node to update the ledger data.
  • the off-chain privacy computing device for the data on the chain may include: an on-chain data receiving unit 901 to enable the off-chain privacy computing node to receive blockchain node transmissions
  • the encrypted data on the chain, the off-chain trusted execution environment is deployed at the off-chain private computing node, and the on-chain data is determined by the blockchain node according to the transaction submitted by the client;
  • the privacy calculation execution unit 902 Enabling the off-chain private computing node to perform privacy calculations on the on-chain data in the off-chain trusted execution environment to generate a calculation result;
  • the calculation result feedback unit 903 causes the off-chain private computing node to report to the district
  • the blockchain node feeds back the encrypted calculation result, and the calculation result is used to update the blockchain ledger data.
  • the on-chain data receiving unit 901 is specifically configured to: enable the off-chain private computing node to receive the encrypted on-chain data transmitted by the blockchain node through the oracle mechanism; or, enable the off-chain private computing node to receive the area The encrypted on-chain data transmitted by the blockchain node through the off-chain privacy computing call component pre-deployed at the client.
  • the on-chain data received by the off-chain privacy calculation unit is signed by the blockchain node using a blockchain node identity private key; wherein the successful signature verification is verified by the client or the oracle server As a prerequisite for transmitting the encrypted data on the chain to the privacy computing node off the chain.
  • the data on the chain is encrypted by the node encryption public key and then transmitted to the off-chain private computing node, and the off-chain private computing node maintains the node encryption private key corresponding to the node encryption public key.
  • the node encryption private key is only maintained by the off-chain private computing node, or the node encryption private key is All off-chain privacy computing nodes in the off-chain privacy computing cluster are jointly maintained.
  • the on-chain data receiving unit 901 is specifically configured to: enable the off-chain privacy computing node to receive all data transmitted by the blockchain node and encrypted by the blockchain node using the node encryption public key. Data on the chain; or,
  • the on-chain data receiving unit 901 is specifically configured to: enable the off-chain privacy computing node to directly receive the on-chain data sent by the blockchain node; or, in the off-chain privacy computing node In the case of belonging to an off-chain privacy computing cluster, the off-chain privacy computing node is caused to receive the on-chain data forwarded by the blockchain node through the control node.
  • the calculation result feedback unit 903 is specifically configured to: enable the off-chain privacy computing node to feed back the encrypted calculation result to the blockchain node through an oracle mechanism; or, enable the off-chain The privacy computing node feeds back the encrypted calculation result to the blockchain node through the off-chain privacy computing invocation component pre-deployed at the client.
  • the on-chain data is calculated by the off-chain privacy computing node executing a pre-deployed off-chain contract in an off-chain trusted execution environment to achieve privacy calculation, and the off-chain privacy computing node maintains a data corresponding to the The contract signature private key of the off-chain contract; further comprising: a calculation result signing unit 904, which enables the off-chain private computing node to use the contract signature private key to sign the calculation result, wherein the blockchain node is When it is determined that the signature for the calculation result matches the private key of the contract signature, it is determined that the calculation result is credible, and the credibility of the calculation result is used as a prerequisite for the blockchain node to update the ledger data.
  • the invocation information of the off-chain contract is received by the off-chain private computing node in association with the on-chain data, and the invocation information is used to instruct the off-chain private computing node to pass the off-chain trusted execution environment Execute the off-chain contract to implement privacy calculations on on-chain data; wherein, the call information includes: the contract ID of the off-chain contract, or the contract ID of the off-chain contract and at least one function in the off-chain contract The name of the function.
  • the off-chain privacy computing device for the data on the chain may include: a transaction submission unit 1001, which enables the client to submit a transaction to a blockchain node so that the block The chain node determines the on-chain data used for privacy calculations according to the transaction; the on-chain data forwarding unit 1002 enables the client to receive the encrypted on-chain data sent by the blockchain node , Encrypting and transmitting the on-chain data to the off-chain private computing node, where an off-chain trusted execution environment for performing private computing on the on-chain data is deployed at the off-chain private computing node; the calculation result forwarding unit 1003 , Enabling the client to send the calculation result to the blockchain node when receiving the calculation result generated and encrypted and transmitted by the off-chain private computing node in the off-chain trusted execution environment , Used to update the blockchain ledger data.
  • a transaction submission unit 1001 which enables the client to submit a transaction to a blockchain node so that the block The chain node determines the on-chain data used for privacy calculations according to the
  • an on-chain data verification unit 1004 which enables the client to use the blockchain node public key to perform signature verification on the received on-chain data, and the signature verification is successful by the client
  • the data on the chain is signed by the blockchain node using the identity private key of the blockchain node.
  • the off-chain privacy computing node maintains a node encryption private key corresponding to the node encryption public key
  • the on-chain data forwarding unit 1002 is specifically configured to: enable the client to use the node encryption public key to transfer all The data on the chain is encrypted and sent to the privacy computing node off the chain.
  • an off-chain privacy calculation invocation component is pre-deployed at the client, and the on-chain data forwarding unit 1002 is specifically configured to: enable the client to invoke the off-chain privacy calculation invocation component to upload the on-chain privacy calculation invocation component.
  • the data is encrypted and transmitted to the private computing node under the chain.
  • an off-chain privacy calculation invocation component is pre-deployed at the client, and the calculation result forwarding unit 1003 is specifically configured to: enable the client to invoke the off-chain privacy calculation invocation component to send the calculation result To the blockchain node.
  • a typical implementation device is a computer.
  • the specific form of the computer can be a personal computer, a laptop computer, a cellular phone, a camera phone, a smart phone, a personal digital assistant, a media player, a navigation device, an email receiving and sending device, and a game control A console, a tablet computer, a wearable device, or a combination of any of these devices.
  • the electronic device includes one or more processors (CPU), input/output interfaces, network interfaces, and memory.
  • processors CPU
  • input/output interfaces network interfaces
  • memory volatile and non-volatile memory
  • the memory may include non-permanent memory in a computer readable medium, random access memory (RAM) and/or non-volatile memory, such as read-only memory (ROM) or flash memory (flash RAM). Memory is an example of computer readable media.
  • RAM random access memory
  • ROM read-only memory
  • flash RAM flash memory
  • Computer-readable media include permanent and non-permanent, removable and non-removable media, and information storage can be realized by any method or technology.
  • the 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, CD-ROM, digital versatile disc (DVD) or other optical storage, Magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media can be used to store information that can be accessed by computing devices. According to the definition in this article, computer-readable media does not include transitory media, such as modulated data signals and carrier waves.
  • the device embodiment since it basically corresponds to the method embodiment, reference may be made to the part of the description of the method embodiment for related parts.
  • the device embodiments described above are merely illustrative.
  • 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 it can be distributed to multiple network units.
  • Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution in this specification. Those of ordinary skill in the art can understand and implement without creative work.
  • first, second, third, etc. may be used to describe various information in one or more embodiments of this specification, the information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other.
  • the first hash value may also be referred to as the second hash value, and similarly, the second hash value may also be referred to as the first hash value. Hope value.
  • the word “if” as used herein can be interpreted as "when” or "when” or "in response to determination”.

Abstract

一种链上数据的链下隐私计算方法及装置,该方法包括:区块链节点根据客户端提交的交易,确定用于隐私计算的链上数据(202);上述区块链节点将经过加密的链上数据传输至链下隐私计算节点,该链下隐私计算节点处部署了用于对上述链上数据执行隐私计算的链下可信执行环境(204);上述区块链节点获取上述链下隐私计算节点在链下可信执行环境内生成并加密后反馈的计算结果,并根据该计算结果更新区块链账本数据(206)。该方法可以在链下隐私计算的过程中实现隐私保护。

Description

链上数据的链下隐私计算方法及装置 技术领域
本说明书一个或多个实施例涉及可验证计算技术领域,尤其涉及一种链上数据的链下隐私计算方法及装置。
背景技术
区块链技术(也被称为,分布式账本技术)是一种去中心化的分布式数据库技术。由于采用去中心化的网络结构、共识机制和链式区块结构,使得区块链技术具有去中心化、公开透明、不可篡改、可信任等多种特点,适用于诸多对数据可靠性具有高需求的应用场景中。
针对区块链场景下的隐私需求,在相关技术中,通过同态加密(Homomorphic encryption)和零知识证明(Zero-knowledge proof)等加密技术实现该场景下的隐私保护,但也随之带来了严重的性能损失。可信执行环境(Trusted Execution Environment,TEE)是另一种解决方式。TEE可以起到硬件中的黑箱作用,在TEE中执行的代码和数据操作系统层都无法偷窥,只有代码中预先定义的接口才能对其进行操作。在效率方面,由于TEE的黑箱性质,在TEE中进行运算的是明文数据,而不是同态加密中的复杂密码学运算,计算过程效率没有损失。因此,通过在区块链节点上创建TEE环境,可以在性能损失相对较小的前提下很大程度上满足区块链场景下的隐私需求。
因此,通过在区块链节点上预先创建的TEE环境内调用并执行代码,可以在减少单个区块链节点的资源消耗的前提下加快代码的执行效率。
发明内容
有鉴于此,本说明书一个或多个实施例提供一种链上数据的链下隐私计算方法、装置及电子设备,能够在链下环境内协助区块链节点安全地完成计算任务。
根据本说明书一个或多个实施例的第一方面,提出了一种链上数据的链下隐私计算方法,包括:区块链节点根据客户端提交的交易,确定用于隐私计算的链上数据;所述区块链节点将经过加密的所述链上数据传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境;所述区块链节点获取所述链下隐私计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果,并根据所述计算结果更新区块链账本数据。
根据本说明书一个或多个实施例的第二方面,提出了一种链上数据的链下隐私计算方法,包括:链下隐私计算节点接收区块链节点传输的经过加密的链上数据,所述链下隐私计算节点处部署了链下可信执行环境,所述链上数据由所述区块链节点根据客户端提交的交易确定;所述链下隐私计算节点在所述链下可信执行环境内对所述链上数据执行隐私计算生成计算结果;所述链下隐私计算节点向所述区块链节点反馈加密后的所述计算结果,所述计算结果用于更新区块链账本数据。
根据本说明书一个或多个实施例的第三方面,提出了一种链上数据的链下隐私计算方法,包括:客户端向区块链节点提交交易,以由所述区块链节点根据所述交易确定用于隐私计算的链上数据;所述客户端在接收到所述区块链节点发送的经过加密的所述链上数据的情况下,将所述链上数据加密传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境;所述客户端在接收到所述链下隐私计算节点在所述链下可信执行环境中生成并加密传输的计算结果的情况下,将所述计算结果发送给所述区块链节点用于更新区块链账本数据。
根据本说明书一个或多个实施例的第四方面,提出了一种链上数据的链下隐私计算装置,包括:链上数据确定单元,使区块链节点根据客户端提交的交易,确定用于隐私计算的链上数据;链上数据传输单元,使所述区块链节点将经过加密的所述链上数据传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境;计算结果获取单元,使所述区块链节点获取所述链下隐私 计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果,并根据所述计算结果更新区块链账本数据。
根据本说明书一个或多个实施例的第五方面,提出了一种链上数据的链下隐私计算装置,包括:链上数据接收单元,使链下隐私计算节点接收区块链节点传输的经过加密的链上数据,所述链下隐私计算节点处部署了链下可信执行环境,所述链上数据由所述区块链节点根据客户端提交的交易确定;隐私计算执行单元,使所述链下隐私计算节点在所述链下可信执行环境内对所述链上数据执行隐私计算生成计算结果;计算结果反馈单元,使所述链下隐私计算节点向所述区块链节点反馈加密后的所述计算结果,所述计算结果用于更新区块链账本数据。
根据本说明书一个或多个实施例的第六方面,提出了一种链上数据的链下隐私计算装置,包括:交易提交单元,使客户端向区块链节点提交交易,以由所述区块链节点根据所述交易确定用于隐私计算的链上数据;链上数据转发单元,使所述客户端在接收到所述区块链节点发送的经过加密的所述链上数据的情况下,将所述链上数据加密传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境;计算结果转发单元,使所述客户端在接收到所述链下隐私计算节点在所述链下可信执行环境中生成并加密传输的计算结果的情况下,将所述计算结果发送给所述区块链节点,用于更新区块链账本数据。
根据本说明书一个或多个实施例的第七方面,提出了一种电子设备,包括:处理器;用于存储处理器可执行指令的存储器;其中,所述处理器通过运行所述可执行指令以实现如第一方面、第二方面或第三方面所述的方法。
根据本说明书一个或多个实施例的第八方面,提出了一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如第一方面、第二方面或第三方面所述方法的步骤。
综上所述,本说明书通过在链下隐私计算节点上实现链下可信执行环境,使得链下隐私计算节点可以提供安全可靠的运行环境,因而区块链节点可以将链上数据交由链下隐私计算节点进行安全计算。
附图说明
图1是链上数据的链下隐私计算方法所对应网络架构的示意图。
图2是一示例性实施例提供的一种区块链节点侧的链上数据的链下隐私计算方法的流程图。
图3是一示例性实施例提供的一种链下隐私计算节点侧的链上数据的链下隐私计算方法的流程图。
图4是一示例性实施例提供的一种客户端侧的链上数据的链下隐私计算方法的流程图。
图5是一示例性实施例提供的一种链上数据的链下隐私计算方法对应的各设备之间的交互流程图。
图6是一示例性实施例提供的另一种链上数据的链下隐私计算方法对应的各设备之间的交互流程图。
图7是一示例性实施例示出的一种电子设备的结构示意图。
图8是一示例性实施例示出的一种区块链节点侧的链上数据的链下隐私计算装置的框图。
图9是一示例性实施例示出的一种链下隐私计算节点侧链上数据的链下隐私计算装置的框图。
图10是一示例性实施例示出的一种客户端侧链上数据的链下隐私计算装置的框图。
具体实施方式
这里将详细地对示例性实施例进行说明,其示例表示在附图中。下面的描述涉及 附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本说明书一个或多个实施例相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本说明书一个或多个实施例的一些方面相一致的装置和方法的例子。
需要说明的是:在其他实施例中并不一定按照本说明书示出和描述的顺序来执行相应方法的步骤。在一些其他实施例中,其方法所包括的步骤可以比本说明书所描述的更多或更少。此外,本说明书中所描述的单个步骤,在其他实施例中可能被分解为多个步骤进行描述;而本说明书中所描述的多个步骤,在其他实施例中也可能被合并为单个步骤进行描述。
区块链一般被划分为三种类型:公有链(Public Blockchain),私有链(Private Blockchain)和联盟链(Consortium Blockchain)。此外,还有多种类型的结合,比如私有链+联盟链、联盟链+公有链等不同组合形式。其中去中心化程度最高的是公有链。公有链以比特币、以太坊为代表,加入公有链的参与者可以读取链上的数据记录、参与交易以及竞争新区块的记账权等,且各参与者(即节点)可自由加入以及退出网络。私有链则相反,该网络的数据写入权限由某个组织或者机构控制,数据读取权限受组织规定;简单来说,私有链可以为一个弱中心化系统,参与节点具有严格限制且少,因而私有链更适合于特定机构内部使用。联盟链则是介于公有链以及私有链之间的区块链,可实现“部分去中心化”。联盟链中各个节点通常有与之相对应的实体机构或者组织,参与者通过授权加入网络并组成利益相关联盟,共同维护区块链运行。
在区块链网络中,通过向区块链节点提交相应的区块链交易(简称交易),并由区块链节点执行区块链交易,以实现相应的操作目的。对于上述任何类型的区块链而言,区块链节点均可以通过创建链上TEE,并将链上TEE实现为区块链交易的安全执行环境。TEE是基于CPU硬件的安全扩展,且与外部完全隔离的可信执行环境。TEE最早是由Global Platform提出的概念,用于解决移动设备上资源的安全隔离,平行于操作系统为应用程序提供可信安全的执行环境。目前工业界十分关注TEE的方案,几乎所有主流的芯片和软件联盟都有自己的TEE解决方案,比如软件方面的TPM(Trusted Platform Module,可信赖平台模块)以及硬件方面的Intel SGX(Software Guard Extensions,软件保护扩展)、ARM Trustzone(信任区)和AMD PSP(Platform Security Processor,平台安全处理器)等。
以Intel SGX(以下简称SGX)技术为例。区块链节点可以基于SGX技术创建enclave(围圈或飞地),以作为用于执行区块链交易的TEE。其中,区块链节点利用CPU中新增的处理器指令,在内存中可以分配一部分区域EPC(Enclave Page Cache,围圈页面缓存或飞地页面缓存),以用于驻留上述的enclave。上述EPC对应的内存区域被CPU内部的内存加密引擎MEE(Memory Encryption Engine)加密,该内存区域中的内容(enclave中的代码和数据)只有在CPU内核中才能够被解密,且用于加解密的密钥只有在EPC启动时生成并存储在CPU中。可见,enclave的安全边界只包含其自身和CPU,无论是特权或非特权软件都无法访问enclave,即便是操作系统管理员和VMM(virtual machine monitor,虚拟机监视器;或称为,Hypervisor)也无法影响enclave中的代码和数据,因而具有极高的安全性,并且在上述安全性保障的前提下,CPU能够在enclave中对明文形式的区块链交易进行处理,具有极高的运算效率,从而兼顾了数据安全性和计算效率。
基于区块链网络的去中心化架构,使得区块链上的每笔区块链交易都需要在区块链网络内的所有区块链节点上执行,以确保每个区块链节点所维护的区块链账本数据一致。如果交易逻辑较为简单,比如以比特币为例,区块链交易仅用于实现转账操作,此时即便区块链交易需要在所有区块链节点都执行,也不会导致过多的资源消耗。但是,如果区块链提供了智能合约的功能,而区块链交易调用了智能合约,那么情况可能大不 相同。区块链上的智能合约是在区块链系统上可以被交易触发执行的合约,智能合约可以通过代码的形式定义。
在链下隐私计算节点上创建的链下TEE,与前文所述的区块链节点上创建的链上TEE相似,都是基于CPU硬件实现的与外部完全隔离的可信执行环境。链下隐私计算节点通过创建链下TEE,可以实现对链下合约的部署操作以及部署后的调用执行操作,并确保操作过程中的数据安全和隐私保护。
以以太坊为例,支持用户在以太坊网络中创建并调用一些复杂的逻辑,这是以太坊区别于比特币区块链技术的最大挑战。以太坊作为一个可编程区块链的核心是以太坊虚拟机(EVM),每个以太坊节点都可以运行EVM。EVM是一个图灵完备的虚拟机,这意味着可以通过它实现各种复杂的逻辑。用户在以太坊中发布和调用智能合约就是在EVM上运行的。实际上,虚拟机直接运行的是虚拟机代码(虚拟机字节码,以下简称“字节码”)。智能合约分为部署和调用两个阶段。
在部署阶段,用户将一个包含创建智能合约信息的交易发送至以太坊网络,该交易的data字段包含智能合约的代码(如字节码),该交易的to字段为空。以太坊网络中的各个节点分别通过EVM执行这个交易,并生成对应的合约实例。在节点间通过共识机制达成一致后,上述交易对应的智能合约创建成功,区块链上出现一个与该智能合约对应的合约账户,该合约账户拥有一个特定的合约地址,合约代码(即智能合约的代码)或合约代码的哈希值保存在该合约账户中,该合约代码用于控制相应的智能合约的行为。
在调用阶段,用户(可以与部署智能合约的用户相同或不同)将一个用于调用智能合约的交易发送到以太坊网络,该交易的from字段是该用户对应的外部账户的地址,to字段是所需调用的智能合约的合约地址,data字段包含调用智能合约的方法和参数。在节点间通过共识机制达成一致后,上述交易声明调用的智能合约以规定的方式在以太坊网络的每个节点上独立执行,所有执行记录和数据都保存在区块链上,所以当交易完成后,区块链上就保存了无法篡改、不会丢失的交易凭证。
如前所述,EVM是一个图灵完备的虚拟机;类似地,其他区块链也可以采用其他类型的虚拟机,比如WASM(WebAssembly)虚拟机等。总之,当交易调用的智能合约用于实现相对复杂的逻辑时,节点通过虚拟机执行该智能合约的代码的过程会消耗相对较多的计算资源,而且由于区块链网络内的所有节点都需要执行该智能合约的代码,因此随着节点数量的增加会导致计算资源消耗量的成倍增长,从而整体上降低了区块链网络的交易执行效率。
为此,本说明书提出了基于在链下部署的隐私计算节点(即链下隐私计算节点,该链下隐私计算节点中预部署的链下合约在被调用时可以在链下隐私计算节点的链下TEE中执行),区块链节点将链上数据加密传输至链下隐私计算节点,由链下隐私计算节点使用链上数据在链下TEE中进行隐私计算,并将所得计算结果反馈至区块链节点。本方法将原本需要在所有区块链节点上执行的计算操作转移至某一链下隐私计算节点处执行,使得区块链节点只需要将链上数据传输至链下隐私计算节点并获取后者反馈的计算结果,然后基于该计算结果更新区块链账本数据即可,降低了区块链节点的计算资源消耗,从而有利于提高区块链网络的交易执行效率。并且在本方法中,链下隐私计算节点可以基于可验证计算(Verifiable Computation)技术证明其所获取链上数据的真实可信;同样的,区块链节点也可以基于可验证计算技术证明其所获取的计算结果确实是在链下TEE中使用链上数据执行预期计算得到的,从而实现了链上数据下链过程和链下计算结果反馈过程的可信认证。
如前所述,通过在区块链节点部署智能合约,使得区块链节点可以执行该智能合约的代码以实现相应的计算需求;类似地,可以将用于执行计算任务的代码部署在链下隐私计算节点处,使得链下隐私计算节点可以执行代码以实现相应的计算需求。为了便 于理解,本说明书中将部署于区块链节点的合约称为链上合约、将部署于链下隐私计算节点的合约称为链下合约;当然,无论是链上合约还是链下合约,其本质都是一段可以在虚拟机内执行的代码。
图1是链上数据的链下隐私计算方法所对应网络架构的示意图。如图1所示,区块链节点通过客户端或预言机服务器两种可能的方式与链下隐私计算节点形成网络连接。其中,图中客户端可视为常规业务系统中的手机、平板电脑、PC机、掌上电脑(PDAs,Personal Digital Assistants)、可穿戴式终端等电子设备上运行的应用程序;图中预言机服务器可视为区块链节点连接的Oracle Servies等预言机服务器。图中链下隐私计算节点可以为独立的链下隐私计算节点,也可以为包含多个链下隐私计算节点的链下隐私计算集群(如图1右侧虚线框所示)中的某一链下隐私计算节点。在链下隐私计算节点归属于链下隐私计算集群的情况下,链下隐私计算集群中的控制节点分别与客户端及预言机服务器直接连接,负责将接收到的隐私计算任务在上述集群中的多个节点之间进行合理分配,以实现各节点的负载均衡。可以理解的是,虽然图中客户端和预言机服务器均连接至区块链网络中的某一区块链节点,但实际上二者可以分别连接同区块链网络中的不同区块链节点;而且,虽然将链下隐私计算节点(独立或集群)、预言机服务器和区块链节点分别绘制为不同的设备,但实际上三者可以位于相同或不同的物理实体中,本说明书对此并不进行限制。
如前所述,链下隐私计算节点可以创建链下TEE,而针对链下合约的部署操作和调用操作均通过该链下TEE实现,从而确保操作过程中的数据安全和隐私保护。在链下隐私计算节点上创建的链下TEE,与前文所述的区块链节点上创建的链上TEE相似,都是基于CPU硬件实现的与外部完全隔离的可信执行环境。在通过调用请求来调用链下隐私计算节点上部署的链下合约之前,客户端需要将链下合约安全部署至该链下隐私计算节点处,而在部署链下合约之前,需要通过获取针对链下隐私计算节点上创建的链下TEE的远程证明报告,验证该链下隐私计算节点是否可信,具体指该链下隐私计算节点上部署的链下TEE是否可信。
远程证明报告产生于针对链下隐私计算节点上的链下TEE的远程证明过程。远程证明报告由认证服务器对链下隐私计算节点产生的自荐信息进行验证后生成,该自荐信息与链下隐私计算节点上创建的链下TEE相关。链下隐私计算节点通过产生与链下TEE相关的自荐信息,并由认证服务器对该自荐信息进行验证后产生远程证明报告,使得远程证明报告可以用于表明链下隐私计算节点上的链下TEE可信任。例如,以Intel SGX技术为例,链下TEE为链下隐私计算节点上创建的用于实现链下隐私计算的enclave,远程证明过程还涉及到链下隐私计算节点上另一个特殊的enclave,即quoting enclave(简称QE),QE是由英特尔提供并签名的架构型enclave(Architectural Enclave)。上述enclave首先需要生成一用于本地认证的REPORT(报告)结构,并由QE基于该REPORT结构验证该enclave是否与自身处于同一平台上,而后由QE将该REPORT结构封装为一结构体QUOTE(即自荐信息),并使用EPID(enhanced privacy identification)密钥进行签名。EPID密钥不仅代表链下隐私计算节点这一平台,还代表链下隐私计算节点的底层硬件的可信度,还可以绑定处理器固件的版本等信息,并且只有QE才能访问到EPID密钥,以用于对上述的结构体QUOTE进行签名。在SGX技术中,上述认证服务器可以为英特尔公司提供的IAS(Intel Attestation Service)服务器,链下隐私计算节点向IAS服务器发送经过签名的上述结构体QUOTE,使得IAS服务器可以对签名进行验证,并向链下隐私计算节点返回相应的远程证明报告。
客户端可以向链下隐私计算节点发起挑战,并接收链下隐私计算节点返回的远程证明报告。例如,客户端可以向链下隐私计算节点发起链下挑战,即发起挑战的过程与区块链网络无关,这样可以跳过区块链节点之间的共识过程、减少链上链下的交互操作,使得客户端向链下隐私计算节点的挑战具有更高的操作效率。再例如,客户端可以采用 链上挑战的形式,比如客户端可以向区块链节点提交挑战交易,该挑战交易所含的挑战信息可由区块链节点通过预言机机制传输至链下隐私计算节点,且该挑战信息用于向链下隐私计算节点发起挑战。
对应于图1所示的场景,一种情况下,客户端可以通过链下渠道直接向链下隐私计算节点发起挑战,即客户端向链下隐私计算节点发起链下挑战。另一种情况下,客户端可以通过区块链网络向链下隐私计算节点发起挑战,即客户端向链下隐私计算节点发起链上挑战。链上挑战的发起过程可以包括三个步骤:步骤①,客户端向区块链网络提交一笔用于发起挑战的交易,比如称之为挑战交易,该挑战交易可由区块链网络内的某一区块链节点接收和执行;步骤②,区块链节点调用预先部署的预言机智能合约(简称预言机合约),该预言机合约可以将上述挑战交易所含的挑战信息传递至链下的预言机服务器,比如预言机合约可以产生包含该挑战信息的事件,而预言机服务器可以通过监听预言机合约产生的事件,从而获取上述的挑战信息;步骤③,预言机服务器将挑战信息通过链下渠道发送至链下隐私计算节点。
客户端通过链上渠道向链下隐私计算节点发起挑战时,涉及到区块链网络与链下隐私计算节点之间的数据交互,即链上、链下的数据交互,该数据交互过程可以由预言机合约与预言机服务器通过上述步骤②配合实现,该预言机合约与预言机服务器之间的配合机制即为预言机机制。其中,客户端向区块链节点提交的交易应当直接或间接调用上述的预言机合约,以触发预言机机制。其中,如果将预言机合约的合约地址填入该交易的to字段,表明该交易直接调用了预言机合约;如果将某一链上合约的合约地址填入该交易的to字段,且该链上合约调用了预言机合约,表明该交易间接调用了预言机合约。链上合约调用预言机合约,一种情况下可以是在链上合约的字节码中预先写入了预言机合约的合约地址,另一种情况下可以是将预言机合约的合约地址作为调用该链上合约时的入参,并将该入参填入上述交易的data字段。除了将挑战信息或其他数据从链上传递至链下,预言机机制还可以将数据从链下传递至链上,具体可由预言机服务器将链下数据传递至预言机合约,然后由预言机合约将链下数据传递至数据需求方,比如这里的链下数据可以包括远程证明报告或者调用链下合约所产生的隐私计算结果等。在上述的预言机机制中,将数据从链上传递至链下可以视为“请求”过程,将数据从链下传递至链上可以视为“响应”过程,这两个过程通常成对出现。
无论是链下挑战或链上挑战,链下隐私计算节点在收到客户端发起的挑战后,均可以临时触发如前文所述的远程证明过程并产生相应的远程证明报告,然后将远程证明报告反馈至客户端。或者,链下隐私计算节点在收到客户端发起的挑战时,如果本地已经存在预先生成的远程证明报告,那么链下隐私计算节点将该远程证明报告提供至客户端,而无需临时触发远程证明过程。其中,链下隐私计算节点本地存在的远程证明报告,可以是该链下隐私计算节点响应于除客户端之外的其他挑战者的挑战而触发产生,比如该其他挑战者可以包括其他客户端、链下隐私计算节点所处的链下隐私计算集群中的控制节点、KMS服务器等,本说明书并不对此进行限制。因此,链下隐私计算节点在收到客户端发起的挑战后,可以首先查看本地是否存在先前生成的远程证明报告,如果存在则将该远程证明报告反馈至客户端,否则临时触发远程证明过程。其中,远程证明报告可以具有一定的时限性,比如30分钟或其他时长,超时的远程证明报告可以被客户端认定为失效,链下隐私计算节点也可以主动清除已失效的远程证明报告以避免反馈至客户端。
客户端向链下隐私计算节点发起挑战的过程中,或者链下隐私计算节点向客户端反馈远程证明报告的过程中,涉及到设备之间的数据交互。以图1所示的场景为例,所涉及的数据交互可以包括:客户端与链下隐私计算节点之间的数据交互(客户端向链下隐私计算节点发起链下挑战,链下隐私计算节点向客户端返回远程证明报告)、客户端与区块链节点之间的数据交互(客户端向区块链节点发送挑战交易、区块链节点向客户 端返回远程证明报告)、区块链节点与预言机服务器之间的数据交互(预言机服务器从区块链节点读取挑战信息、预言机服务器向区块链节点反馈远程证明报告)、预言机服务器与链下隐私计算节点之间的数据交互(预言机服务器向链下隐私计算节点发送挑战信息、链下隐私计算节点向预言机服务器返回远程证明报告)等。在实现上述任一数据交互的过程中,数据发送方与数据接收方之间传输的数据存在泄漏的可能性,并且区块链节点会将挑战交易上链导致该挑战交易被公开,因此可以通过对数据进行加密传输的方式,避免造成信息泄露。
以客户端向区块链节点提交挑战交易为例。通过挑战交易向链下隐私计算节点发起链上挑战,使得区块链节点可以将客户端提交的挑战交易与其他节点进行共识后上链,对客户端的挑战行为进行存证。但是,如果客户端并不希望自己的挑战行为被其他用户随意获知,可以对挑战交易进行隐私保护。客户端可以对挑战交易进行加密,而区块链节点可以接收经过加密的挑战交易,这样可以确保传输过程中不会造成挑战交易的内容泄露。区块链节点处可以创建链上TEE,并且区块链节点可以将经过加密的挑战交易读入该链上TEE后,在链上TEE内解密,可以确保解密得到的挑战交易仅存在于链上TEE内、不会外泄。区块链节点直接将经过加密的挑战交易上链,并且通过对加密数据的查看权限进行管理,可以限制能够查看挑战交易的用户,而其他用户直接查看区块链数据时仅能够获得加密后的挑战交易。实际上,区块链节点可以确保需要隐私保护的数据仅在链上TEE内能够被解密为明文形式,一旦离开链上TEE均采用密文形式。
针对挑战交易的加密传输,可以采用对称加密或非对称加密的形式。当采用对称加密时,客户端和区块链节点分别维护有相同的对称密钥,比如该对称密钥可由客户端与区块链节点通过诸如DH(Diffie-Hellman)或ECDH(Elliptic Curve Diffie–Hellman)等算法协商得到,或者由KMS(Key Management Service,密钥管理服务)服务器分发至客户端和区块链节点,本说明书并不限制密钥来源。当密钥由KMS服务器分发时,KMS服务器可以通过远程证明的方式确定区块链节点处的链上TEE可信,然后将密钥加密传输至该链上TEE内,远程证明的方式与上述客户端对链下隐私计算节点的远程证明过程类似,此处暂不赘述。那么,客户端可以通过上述的对称密钥对挑战交易进行加密,而区块链节点将对称密钥维护于链上TEE中,因而将经过加密的挑战交易读入链上TEE内,并通过该对称密钥执行解密操作得到上述的挑战交易。对称加密采用的加密算法,例如可以包括DES算法,3DES算法,TDEA算法,Blowfish算法,RC5算法,IDEA算法等。
当采用非对称加密时,区块链节点维护有非对称密钥的私钥,比如称之为区块链节点身份私钥,而客户端可以获得该区块链节点身份私钥相匹配的区块链节点身份公钥。非对称密钥可由区块链节点在链上TEE内生成,或者由KMS服务器分发至该区块链节点,本说明书并不限制密钥来源。类似地,当密钥由KMS服务器分发时,KMS服务器可以通过远程证明的方式确定区块链节点处的链上TEE可信,然后将密钥加密传输至该链上TEE内。那么,客户端可以通过区块链节点身份公钥对挑战交易进行加密,而区块链节点将区块链节点身份私钥维护于链上TEE中,因而将经过加密的挑战交易读入链上TEE内,并通过区块链节点身份私钥执行解密操作得到上述的挑战交易。非对称加密采用的非对称加密算法,例如可以包括RSA、Elgamal、背包算法、Rabin、D-H、ECC(椭圆曲线加密算法)等。
针对挑战交易的加密传输,还可以采用对称加密与非对称加密相结合的形式。客户端可以维护一对称密钥,比如该对称密钥可由客户端随机生成,且客户端可以获得上述非对称密钥中的区块链节点身份公钥。客户端可以通过对称密钥对挑战交易进行加密、得到加密后挑战交易,并通过非对称密钥加密该对称密钥、得到加密后密钥,然后客户端同时将加密后挑战交易与加密后密钥传输至区块链节点。相应的,区块链节点将加密后挑战交易与加密后密钥读入链上TEE内,首先使用区块链节点身份私钥对加密后密 钥进行解密、得到对称密钥,然后使用对称密钥对加密后挑战交易进行解密。相比较而言,对称加密的加解密效率更高、但安全性相对较低,而非对称加密的加解密效率相对较低、但安全性相对更高,因此基于对称加密与非对称加密相结合的形式,可以兼顾加解密效率与安全性。
类似地,在其他数据交互的过程中,通过使得数据发送方与数据接收方之间维护相同的对称密钥,或者使得数据发送方维护有非对称密钥的公钥、数据接收方维护有非对称密钥的私钥,或者结合对称加密与非对称加密的形式,可以实现任意的数据发送方与数据接收方之间的数据加密传输,此处不再赘述。
链下隐私计算节点可能属于链下隐私计算集群,该链下隐私计算集群包含多个链下隐私计算节点。如果各个链下隐私计算节点之间完全独立,那么客户端与单个链下隐私计算节点之间的交互过程可以参考上文所述的实施例。而另一种方式下,链下隐私计算集群可以包含一控制节点,并由该控制节点对集群内的所有链下隐私计算节点进行统一管理。比如,客户端可以向控制节点发起挑战,并接收控制节点返回的上述链下隐私计算节点的远程证明报告。与前述实施例相类似的,客户端可以向控制节点发起链下挑战,或者客户端可以向区块链节点提交挑战交易,该挑战交易所含的挑战信息由区块链节点通过预言机机制传输至控制节点,使得控制节点向客户端返回链下隐私计算节点的远程证明报告。
仍以如图1所示的场景为例。一种情况下,客户端可以通过链下渠道直接向控制节点发起挑战,即客户端向控制节点发起链下挑战。另一种情况下,客户端可以通过区块链网络向控制节点发起挑战,即客户端向控制节点发起链上挑战。链上挑战的发起过程可以包括三个步骤:步骤①,客户端向区块链网络提交一笔用于发起挑战的交易,比如称之为挑战交易,该挑战交易可由区块链网络内的某一节点接收和执行;步骤②,区块链节点调用预先部署的预言机智能合约(简称预言机合约),该预言机合约可以将上述挑战交易所含的挑战信息传递至链下的预言机服务器,比如预言机合约可以产生包含该挑战信息的事件,而预言机服务器可以通过监听预言机合约产生的事件,从而获取上述的挑战信息;步骤③,预言机服务器将挑战信息通过链下渠道发送至控制节点。
客户端向控制节点发起挑战时,可以将挑战目标设定为控制节点所处集群内的某一链下隐私计算节点,比如链下隐私计算节点n,那么控制节点会根据收到的挑战,向客户端返回链下隐私计算节点n对应的远程证明报告。客户端也可以不设定挑战目标,那么控制节点收到挑战后,从链下隐私计算集群中进行选择,比如在选取了链下隐私计算节点n的情况下,向客户端返回该链下隐私计算节点n对应的远程证明报告。
其中,控制节点在收到客户端发起的挑战后,可以将该挑战转发至链下隐私计算节点n,使得链下隐私计算节点n临时触发远程证明过程,以产生相应的远程证明报告,然后通过控制节点反馈至客户端。或者,控制节点在收到客户端发起的挑战后,可以将该挑战转发至链下隐私计算节点n,而如果链下隐私计算节点n上已经存在预先生成的远程证明报告,那么链下隐私计算节点n将该远程证明报告返回控制节点,由控制节点提供至客户端,而无需临时触发远程证明过程。或者,控制节点在收到客户端发起的挑战后,如果本地已经存在预先生成的对应于链下隐私计算节点n的远程证明报告,那么链下隐私计算节点n将该远程证明报告提供至客户端,而无需向链下隐私计算节点n转发挑战,也无需链下隐私计算节点n因此临时触发远程证明过程。其中,链下隐私计算节点n本地存在的远程证明报告,可以是该链下隐私计算节点n响应于除客户端之外的其他挑战者的挑战而触发产生,比如该其他挑战者可以包括其他客户端、控制节点、KMS服务器等,本说明书并不对此进行限制。而链下隐私计算节点n通过控制节点将远程证明报告提供至上述的其他挑战者时,控制节点可以对收到的远程证明报告进行缓存。因此,控制节点在收到客户端发起的挑战后,可以首先查看本地是否存在先前获得的远程证明报告,如果存在则将该远程证明报告反馈至客户端,否则将挑战转发至链下隐私计 算节点n;以及,链下隐私计算节点n在收到挑战后,可以首先查看本地是否存在先前获得的远程证明报告,如果存在则将该远程证明报告反馈至控制节点,否则临时触发远程证明过程。其中,远程证明报告可以具有一定的时限性,比如30分钟或其他时长,超时的远程证明报告可以被客户端认定为失效,控制节点或链下隐私计算节点n也可以主动清除已失效的远程证明报告以避免将其反馈至客户端。
在图1所示的场景中,客户端与控制节点之间、控制节点与链下隐私计算节点n之间、客户端与链下隐私计算节点n之间、链下隐私计算节点n与预言机服务器之间、预言机服务器与控制节点之间等,均可能产生数据交互。对于任意的数据交互过程,均可以采用如前文所述的加密数据传输方案,包括对称加密、非对称加密或两者结合的形式,此处不再赘述。
客户端通过获取针对链下隐私计算节点上创建的链下TEE的远程证明报告,在验证该链下隐私计算节点可信,即该链下隐私计算节点上部署的链下TEE可信的情况下,可以在链下隐私计算节点中部署链下合约,也就是在链下隐私计算节点中部署链下合约的字节码,部署过程如下:
与前述的挑战过程相类似的,客户端可以通过链下途径将链下合约的字节码加密传输至链下隐私计算节点,或者,客户端可以通过链上途径将链下合约的字节码加密传输至链下隐私计算节点,比如客户端生成链下合约部署交易,该链下合约部署交易中包含对字节码进行加密得到的字节码密文,客户端将链下合约部署交易加密后提交至区块链节点,加密后的链下合约部署交易可在区块链节点处创建的链上TEE内被解密、得到字节码密文,然后由区块链节点通过预言机机制将该字节码密文传输至链下隐私计算节点。
链下隐私计算节点在链下TEE中解密得到明文的字节码的情况下,可以在链下TEE中对字节码进行重新加密后,存储至链下TEE之外的存储空间,比如链下隐私计算节点的硬盘中,从而完成对链下合约的部署。此处,链下隐私计算节点通常采用一对称密钥,通过对称加密的方式对字节码进行加密并存储,这样在后续调用该字节码时,相比于采用非对称加密的形式而言,可以更快地完成解密操作。该对称密钥可由链下隐私计算节点在链下TEE中生成,或者由其他对象通过加密传输的方式分发至链下隐私计算节点。例如,可由KMS服务器对链下隐私计算节点发起挑战,并通过远程证明验证该链下隐私计算节点可信的情况下,向该链下隐私计算节点分发上述的对称密钥。链下隐私计算节点可以将KMS服务器分发的对称密钥作为根密钥,并将基于该根密钥派生得到的衍生密钥应用于针对字节码的加密存储。再例如,基于Intel SGX技术,上述对称密钥可以为烧录于链下隐私计算节点的CPU内e-fuses存储电路中的RSK(Root Seal Key)密钥,或者该RSK密钥派生得到的衍生密钥(即Seal Key)。当然,链下隐私计算节点也可以采用非对称加密或者对称加密与非对称加密结合的方式,对字节码进行加密存储,本说明书并不对此进行限制。
通过上述方式完成针对链下隐私计算节点的远程证明以及链下合约的部署之后,即可以通过调用链下隐私计算节点基于链上数据进行链下隐私计算。在图1所示场景下,区块链节点将链上数据通过客户端或预言机机制传输给链下隐私计算节点(独立的链下隐私计算节点或链下隐私计算集群中的某一链下隐私计算节点),以由链下隐私计算节点使用链上数据在链下TEE中执行预部署的链下合约,然后再将计算结果反馈至区块链节点,使得区块链节点在计算结果验证可信的情况下按照计算结果更新区块链账本数据。
图2是一示例性实施例提供的一种区块链节点侧的链上数据的链下隐私计算方法的流程图。如图2所示,该方法可以包括步骤202~步骤206。
步骤202,区块链节点根据客户端提交的交易,确定用于隐私计算的链上数据。
客户端向区块链节点提交交易。该交易可以以明文的形式传输给区块链节点,也 可以采用如前文所述的加密数据传输方案进行传输,包括对称加密、非对称加密或两者结合的形式,以保证该交易在提交过程中的私密性,此处不再赘述。在加密传输的情况下,区块链节点可以将客户端提交的加密后的交易读入链上TEE内,并通过相应秘钥执行解密操作得到上述的交易,然后在链上TEE中执行该交易。
客户端生成的交易中可以直接包含经过加密的调用请求,那么区块链节点可以在链上TEE内解密交易、得到调用请求密文,然后区块链节点可以通过预言机机制将该调用请求密文传输至链下隐私计算节点。通常,上述调用请求中还包括调用信息,该调用信息可以由客户端生成后携带在上述交易中发送给区块链节点,也可以在区块链节点接收到上述调用请求后生成,本说明书对此并不进行限制。
针对调用请求中链下合约的标识信息,客户端可以直接将该标识信息添加在交易中,那么区块链节点可以在链上TEE内解密交易、得到标识信息;或者,客户端生成的交易所调用的链上合约中定义了链下合约的标识信息,那么区块链节点在接收到该交易后,可以在链上TEE内执行被调用的链上合约,从而获得该标识信息。
针对调用请求中入参数据的信息,客户端生成的交易中可以直接包含入参数据,那么区块链节点可以在链上TEE内解密交易、得到入参数据。然后通过链上TEE内部署的虚拟机执行被调用的链上合约,链上合约被执行后可以将上述标识信息和入参数据打包为调用请求并对该调用请求进行加密。或者,客户端生成的交易中可以包含入参数据的描述信息,比如该描述信息可以为存储地址等,那么区块链节点可以通过执行链上合约查询到相应的入参数据,链上合约被执行后可以将上述标识信息和入参数据打包为调用请求并对该调用请求进行加密。或者,客户端生成的交易中可以包含初始数据,那么区块链节点可以通过执行链上合约对初始数据进行处理以获得相应的入参数据,链上合约被执行后可以将上述标识信息和入参数据打包为调用请求并对该调用请求进行加密。或者,客户端生成的交易中可以包含初始数据的描述信息,比如该描述信息可以为存储地址等,那么区块链节点可以通过执行链上合约查询到相应的初始数据,并由链上合约对初始数据进行处理,链上合约被执行后可以将上述标识信息和入参数据打包为调用请求并对该调用请求进行加密,因而客户端可以不直接将标识信息或者入参数据添加在交易中,客户端对于调用链下合约执行链下隐私计算的过程是透明的,客户端只需要获得链下隐私计算节点所反馈的计算结果即可,而不需要关注调用的链下合约的标识信息或者入参数据的信息等。
在上述交易执行前或执行过程中,需要利用某些链上数据进行链下隐私计算,因此需要根据上述交易确定相应的链上数据。链上数据可以是上述交易携带的入参数据,如位于上述交易的data字段中的数据;也可以是上述交易指定的数据,如在上述交易调用链上合约的情况下,被调用的链上合约基于上述交易在其data字段中指定的交易信息查询相应的链上数据;还可以在上述交易调用链上合约的情况下,将被调用的链上合约在执行过程中的中间值或最终结果作为上述的链上数据,上述中间值或最终结果是由链上合约对上述交易携带的数据或者按照其指定信息查询到的链上数据进行处理而生成的。另外,区块链节点确定出的链上数据可能具有多种类型,如位于区块链上的区块链数据、区块链节点维护的状态数据或区块链节点维护的收据数据等,本说明书对此并不进行限制。
步骤204,所述区块链节点将经过加密的所述链上数据传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境。
为保证链上数据在传输过程中的私密性,需要对链上数据进行加密。如果链上数据由客户端提供,比如该链上数据是上述交易携带的入参数据,那么该链上数据可能已经被客户端加密,而无需区块链节点进行加密。而如果链上数据由区块链节点查询得到或通过链上合约计算生成,那么应当由区块链节点在链上TEE内对该链上数据进行加 密;其中,如果区块链节点查询到的链上数据本身就处于加密状态,那么区块链节点需要在链上TEE内解密得到明文的链上数据,然后重新采用其他的密钥进行加密,以确保链下隐私计算节点能够顺利解密。当然,即便链上数据由客户端提供,客户端也可以将链上数据传输至区块链节点后,由区块链节点在链上TEE内进行加密。针对链上数据进行加密的过程可以使用上述的对称加密、非对称加密或两者结合的数字信封等方式进行,具体的加密过程不再一一赘述。
区块链节点还可以使用区块链节点身份私钥对链上数据进行签名;其中,签名验证成功被客户端或预言机服务器作为将经过加密的上述链上数据传输至链下隐私计算节点的前提条件。客户端或预言机服务器在接收到区块链节点发送的链上数据后,使用预先获取的区块链节点身份公钥对链上数据的签名进行验证(验签过程),只有链上数据通过验签,客户端或预言机服务器才能够确定链上数据确实是由区块链节点发送的,且传输过程中未发生数据丢失或被篡改,进而将该链上数据传输至链下隐私计算节点。
针对链上数据的不同来源和原始加密情况,区块链节点对链上数据进行加密和签名的操作顺序可以存在多种情况。下面以非对称加密场景为例,将所涉及设备的非对称密钥对的公钥简称为公钥,与之匹配的非对称密钥对的私钥简称为私钥,对上述情况进行说明。
如果链上数据由客户端提供,则在链上数据未被客户端加密的情况下,区块链节点可以先使用区块链节点的私钥对明文的链上数据进行签名,再对明文的链上数据进行加密;区块链节点也可以先对明文的链上数据进行加密,再使用区块链节点的私钥对密文的链上数据进行签名。在链上数据已经被客户端加密的情况下,若客户端使用客户端、预言机服务器或链下隐私计算节点的公钥对链上数据进行加密,则区块链节点直接对加密后的链上数据进行签名;若客户端使用区块链节点的公钥对链上数据进行加密,则区块链节点在链上TEE中解密得到明文的链上数据,然后可以先对明文的链上数据进行加密,再使用区块链节点的私钥对密文的链上数据进行签名,也可以先使用区块链节点的私钥对明文的链上数据进行签名,再对明文的链上数据进行加密。如果链上数据由区块链节点查询得到,则链上数据本身可能就处于加密状态,在链上数据被客户端或预言机服务器的公钥加密的情况下,区块链节点可以直接对加密后的链上数据进行签名;在链上数据被链上合约或其他交易的公钥进行加密的情况下,区块链节点可以在链上TEE中解密得到明文的链上数据,然后可以先对明文的链上数据进行加密,再使用区块链节点的私钥对密文的链上数据进行签名,或者先使用区块链节点的私钥对明文的链上数据进行签名,再对明文的链上数据进行加密。如果链上数据通过链上合约计算生成,则通常链上数据尚未被加密,此时区块链节点可以先对明文的链上数据进行加密,再使用区块链节点的私钥对密文的链上数据进行签名,或者先使用区块链节点的私钥对明文的链上数据进行签名,再对明文的链上数据进行加密。
在上述各实施例中,对签名前或签名后的明文的链上数据进行加密,可以使用客户端、预言机服务器或链下隐私计算节点的公钥,相应的,若使用客户端的公钥进行加密,则后续区块链节点经过客户端将加密和签名后的链上数据传输给链下隐私计算节点;若使用预言机服务器的公钥进行加密,则后续区块链节点经过预言机服务器将加密和签名后的链上数据传输给链下隐私计算节点;若使用链下隐私计算节点的公钥进行加密,则后续区块链节点可以经过客户端或预言机服务器将加密和签名后的链上数据传输给链下隐私计算节点。
在上述链上数据传输过程中,用于调用链下隐私计算节点中预部署的链下合约的调用信息可以与链上数据关联传输至链下隐私计算节点,该调用信息用于指示链下隐私计算节点在链下TEE内执行上述链下合约,以实现利用链上数据进行隐私计算的目的。具体的,区块链节点可以指定链下隐私计算节点中的链下合约使用链上数据在链下TEE中进行隐私计算。上述计算过程可以执行链下合约中的函数,该链下合约的调用信息被 与上述链上数据关联传输至链下隐私计算节点中,上述调用信息中可以包括所调用链下合约的合约ID,也可以包括所调用链下合约的合约ID和该链下合约内至少一个函数的函数名。可以理解的是,在区块链节点或客户端指定上述调用信息的情况下,调用信息与链上数据关联传输前,可以针对调用信息执行与上述针对链上数据相似的加密与签名操作,具体方式不再赘述;而且,上述关联传输表示的是二者之间的逻辑关联,如通过预设的传输间隔时长或合约ID等关联标识信息将二者进行关联,而实际传输时可以将二者相邻并先后传输,也可以不相邻传输,本说明书对调用信息和链上数据的具体传输时序并不进行限制,下文仅以链上数据的传输为对象进行示例性说明。
区块链节点可以通过预言机机制将经过加密的链上数据传输至链下隐私计算节点,即区块链节点所执行的交易调用预言机合约,或者该交易调用的链上合约进一步调用预言机合约,预言机合约针对链上数据产生合约事件,而预言机服务器通过监听预言机合约产生的合约事件读取上述的链上数据,并进而将该链上数据传输至链下隐私计算节点。或者,区块链节点可以通过客户端处预部署的链下隐私计算调用组件,将经过加密的链上数据传输至链下隐私计算节点;客户端中可以预部署链下隐私计算调用组件,区块链节点将加密的链上数据发送给客户端,由客户端中的链下隐私计算调用组件调用链下隐私计算节点,并将加密后的链上数据传输至链下隐私计算节点。
在链下隐私计算节点为独立节点的情况下,区块链节点可以通过前述的预言机机制或者调用客户端处的链下隐私计算调用组件,将链上数据直接传输给链下隐私计算节点。而在链下隐私计算节点属于链下隐私计算集群的情况下,区块链节点虽然也可以直接将链上数据传输至该链下隐私计算节点,但通常会将链上数据首先传输至链下隐私计算集群的控制节点,比如通过上述的预言机机制或者客户端处的链下隐私计算调用组件将链上数据传输至控制节点,进而由控制节点将链上数据转发给执行隐私计算的链下隐私计算节点。其中,控制节点转发链上数据的方式可以为:客户端或预言机服务器将链下隐私计算节点的指定信息(如节点ID)与链上数据关联发送至控制节点,控制节点接收上述指定信息与链上数据后,确定与上述指定信息匹配的链下隐私计算节点,然后将链上数据发送给该节点;或者,控制节点接收上述数据后,按照集群内各节点的当前负载值(如当前运算量、当前时刻起预设时间段内的预期运算量、当前计算任务的个数等)确定目标节点,如将当前负载值最小的节点确定为目标节点、将当前负载值小于某一负载值阈值的所有节点中的任一节点确定为目标节点等;然后将链上数据发送给上述目标节点,以由上述目标节点使用链上数据执行隐私计算。
区块链节点对链上数据进行加密(或进行加密和签名)后,将密文的链上数据经过客户端或预言机服务器传输至链下隐私计算节点。具体的,在链上数据被使用对称秘钥加密的情况下,若链下隐私计算节点拥有该对称秘钥,则客户端或预言机服务器可以直接将加密后的链上数据转发给链下隐私计算节点;若仅客户端(或预言机服务器)拥有该对称秘钥,则客户端(或预言机服务器)将其在客户端(或预言机服务器)的链下TEE中解密得到明文的链上数据后,再使用与链下隐私计算节点协商的其他秘钥加密链上数据并发送给链下隐私计算节点。在链上数据被使用非对称秘钥的公钥加密的情况下,若链下隐私计算节点拥有与上述非对称秘钥的公钥相匹配的私钥,则客户端(或预言机服务器)可以将上述加密后的链上数据直接转发给链下隐私计算节点;若仅客户端(或预言机服务器)拥有与上述非对称秘钥的公钥相匹配的私钥,则客户端(或预言机服务器)可以将其在客户端(或预言机服务器)的链下TEE中解密得到明文的链上数据后,再使用与链下隐私计算节点协商的其他秘钥加密链上数据并发送给链下隐私计算节点。在链上数据被使用上述数字信封加密的情况下,若链下隐私计算节点拥有该数字信封中非对称秘钥的私钥,则客户端(或预言机服务器)可以将上述数字信封加密后的链上数据直接发送给链下隐私计算节点,或者使用与链下隐私计算节点协商的秘钥将上述加密后的链上数据二次加密后发送给链下隐私计算节点;若客户端(或预言机服务器)拥有 该非对称秘钥的私钥,则客户端(或预言机服务器)可以将其在客户端(或预言机服务器)的链下TEE中解密得到对称秘钥后,使用与链下隐私计算节点协商的秘钥加密该对称秘钥后再发送给链下隐私计算节点;客户端(或预言机服务器)也可以将其在客户端(或预言机服务器)的链下TEE中解密得到链上数据后,再使用链下隐私计算节点的节点加密公钥构建的数字信封重新对链上数据进行加密后发送给链下隐私计算节点。
在链下隐私计算节点为独立节点的情况下,客户端或预言机服务器通常直接与链下隐私计算节点相连。链下隐私计算节点接收到客户端或预言机服务器使用链下隐私计算节点的节点加密公钥加密的链上数据后,可以先在预创建的链下TEE中使用与上述节点加密公钥相匹配的节点加密私钥对密文的链上数据进行解密,再使用区块链节点的区块链节点身份公钥对明文的链上数据进行验签,并在验签通过后使用链上数据进行隐私计算;也可以先使用区块链节点的区块链节点身份公钥对接收到的密文的链上数据进行验签,再在验签通过后使用区块链节点身份公钥相匹配的区块链节点身份私钥对密文的链上数据进行解密,并使用链上数据进行隐私计算。
在链下隐私计算节点属于链下隐私计算集群的情况下,与加密链上数据的节点加密公钥对应的节点加密私钥可以仅被链下隐私计算节点所维护,也可以链下隐私计算集群内的所有链下隐私计算节点共同维护,或者仅被该链下隐私计算集群的控制节点所维护。在上述节点加密私钥仅被链下隐私计算节点所维护的情况下,仅有链上数据的最终目的方(即该链下隐私计算节点)能够成功解密并获取上述链上数据,而其他设备即便获取加密后的该链上数据也无法对其进行解密,从而保证了链上数据在传输过程中的私密性。因为链下隐私计算节点所归属集群的控制节点会在任一节点加入集群时即通过远程证明对该节点进行可信验证,从而保证该集群中的所有链下隐私计算节点都是可信的,所以在上述节点加密私钥被链下隐私计算集群内的所有链下隐私计算节点所维护的情况下,一方面,控制节点接收到区块链节点使用节点加密私钥加密的链上数据后,可以直接将其转发给所确定的任一目标节点并由后者进行解密,而不需要控制节点进行解密和二次加密操作,从而缩短了控制节点的转发时间,提高了转发效率;另一方面,由于所有链下隐私计算节点均维护有上述节点加密私钥,对于客户端来说,链下隐私计算集群可视为一个设备,因此不需要保存各节点的公钥,减少了公钥的维护数量,一定程度上减轻了客户端的数据维护负担。而在节点加密私钥仅被该链下隐私计算集群的控制节点所维护的情况下,控制节点接收到密文的链上数据后,与上述链上数据的签名和加密的操作顺序相对应,控制节点可以先使用区块链节点的节点加密公钥对密文的链上数据进行验签,在验签通过后,再在控制节点中预部署的链下TEE中对密文的链上数据进行解密;也可以先在控制节点中预创建的链下TEE中对密文的链上数据进行解密以得到明文的链上数据,再使用区块链节点的节点加密公钥对明文的链上数据进行验签。在上述验签并加密(或验签)通过后,可以使用与目标节点预协商的秘钥将明文的链上数据进行再次加密后发送给目标节点,以使目标节点在解密后使用上述链上数据进行隐私计算。在上述过程中验签失败的情况下,进行验签的设备(链下隐私计算节点或控制节点)可以将上述链上数据丢弃;也可以提取链上数据的数据信息生成数据验签日志,并将该数据验签日志保存在本地或反馈给区块链节点;还可以向区块链节点或其他预设对象返回错误信息或告警信息等,本说明书对此并不进行限制。
链下隐私计算节点利用验签通过的链上数据在创建的链下TEE中执行预部署的链下合约,即进行隐私计算。具体的,链下隐私计算节点可以解密与链上数据相关联的链下合约调用请求得到标识信息,然后链下隐私计算节点可以根据标识信息调用预先部署的链下合约的字节码,而在链下可信执行环境中部署有若干执行引擎的情况下,链下隐私计算节点可以根据字节码确定对应的执行引擎,并且通过确定出的执行引擎执行上述字节码以对链上数据进行链下隐私计算。
在链下隐私计算节点处创建的链下TEE中,可以部署有若干执行引擎,比如EVM、 WASM虚拟机等中的一个或多个,在同时部署了多种执行引擎的情况下,客户端或区块链节点除了在链下隐私计算节点处安全存储链下合约的字节码之外,还可以向链下隐私计算节点指明用于执行该字节码的执行引擎。链下隐私计算节点可以接收客户端或区块链节点发送的与链下合约的字节码相关联的执行引擎指定信息,并根据执行引擎指定信息为字节码设定相应的执行引擎。因而链下隐私计算节点可以在链下TEE中根据确定出的执行引擎对链上数据进行链下隐私计算。值得说明的是,上述指定信息可以包含在上述调用请求中。
本说明书中链下隐私计算节点可以使用链上数据实现用户定义的任何计算逻辑。例如,链下隐私计算节点可以通过链下合约验证区块链上存储的加密订单数据的金额是否正确,并将验证结果反馈至链上;再例如,链下隐私计算节点可以通过链下合约根据预设算法对多方数据进行安全计算,即安全多方计算,并将计算结果反馈至链上等,此处不再一一赘述。
步骤206,所述区块链节点获取所述链下隐私计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果,并根据所述计算结果更新区块链账本数据。
链下隐私计算节点在链下TEE中执行计算得到链下隐私计算结果,可以包括以下至少之一:响应码、响应信息、合约调用的返回值、合约调用的过程输出,链下隐私计算节点可以根据调用请求返回相应的链下隐私计算结果,本说明书中并不对此进行限制。对于上述计算结果,链下隐私计算节点可以先在链下TEE中对计算结果进行加密,然后将加密后的计算结果反馈至区块链节点。具体的,区块链节点可以通过预言机机制获取链下隐私计算节点在链下可信执行环境内生成并加密后反馈的计算结果,即上述计算结果作为被调用的预言机合约的响应反馈给区块链节点。或者,区块链节点也可以通过客户端处预部署的链下隐私计算调用组件获取链下隐私计算节点在链下可信执行环境内生成并加密后反馈的计算结果,即上述计算结果作为被调用的链下隐私计算调用组件的响应反馈给客户端,然后由客户端将计算结果发送给区块链节点以实现计算结果的反馈。
相应的,链下隐私计算节点可以通过链下隐私计算节点的节点签名私钥对计算结果进行签名或者可以采用被调用的链下合约的合约签名私钥对计算结果进行签名,也可以同时采用节点签名私钥和合约签名私钥对链下隐私计算结果进行签名,本说明书中并不对此进行限制。客户端或者区块链节点可以通过节点签名公钥或者合约签名公钥进行验签,从而确定该链下隐私计算结果确实是由链下隐私计算节点调用相应的链下合约所产生,并且传输过程中未发生数据丢失或被篡改。值得说明的是,链下隐私计算节点对计算结果进行签名所使用的节点签名私钥,与上述区块链节点、客户端或预言机服务器对链上数据进行加密使用的节点加密公钥,可以是一对相互匹配的非对称秘钥,也可以是不相匹配的非对称秘钥,本说明书对此并不进行限制。在调用请求中还包括指定对象的身份公钥的信息的情况下,链下隐私计算节点可以采用该身份公钥对计算结果进行加密,使得只有维护有与上述身份公钥相对应的身份私钥的指定对象才能对该链下隐私计算结果进行解密,可以限制能够查看计算结果的用户,而其他用户直接查看链下隐私计算结果时仅能够获得加密后的计算结果,从而实现了对计算结果的隐私保护。
链下隐私计算节点针对计算结果的加密和签名的操作顺序可以存在多种情况。链下隐私计算节点可以在链下TEE中先使用区块链节点的区块链节点身份公钥对计算结果进行加密,再使用执行隐私计算的链下合约的合约签名私钥或隐私计算节点的节点签名私钥对密文的计算结果进行签名;也可以先使用上述合约签名私钥或上述节点签名私钥对明文的计算结果进行签名,再使用上述区块链节点身份公钥对密文的计算数据进行加密。在加密和签名完后,将上述签名和密文计算结果通过客户端或预言机服务器关联传输至区块链节点,后者接收之后在链上TEE中对其进行先解密后验签或先验签后解密以获取计算结果。链下隐私计算节点也可以在链下TEE中先使用客户端(或预言机 服务器)的公钥对计算结果进行加密,再使用执行隐私计算的链下合约的合约签名私钥或隐私计算节点的节点签名私钥对密文的计算结果进行签名;也可以先使用上述合约签名私钥或上述节点签名私钥对明文的计算结果进行签名,再使用客户端(或预言机服务器)的公钥对明文的计算结果进行加密;在加密和签名完后,由客户端(或预言机服务器)将上述签名和密文的计算结果传输至区块链节点,后者接收之后在链上TEE中对其进行先解密后验签或先验签后解密以获取计算结果。
在链下隐私计算节点属于链下隐私计算集群的情况下,因为链下隐私计算节点在使用链上数据进行隐私计算前已经通过了该集群控制接节点的可信认证,因此链下隐私计算节点可以在计算得到上述计算结果后,先使用执行隐私计算的链下合约的合约签名私钥或链下隐私计算节点的节点签名私钥对计算结果进行签名,然后将签名后的计算结果发送至控制节点,由控制节点使用区块链节点的节点身份公钥进行加密;或者先使用上述合约签名私钥或上述节点签名私钥对计算结果进行签名,再使用区块链节点的节点身份公钥对其进行加密后发送给控制节点,最后由控制节点将上述加密和签名后的计算结果通过客户端或预言机服务器传输至区块链节点。当然,上述实施例中链下隐私计算节点或控制节点也可以使用客户端(或预言机服务器)的公钥对链上数据进行加密,然后由控制节点发送给客户端(或预言机服务器),客户端(或预言机服务器)接收后在链下TEE中解密,然后再使用区块链节点的区块链节点身份公钥进行二次加密后发送给区块链节点。
区块链节点在接收到链下隐私计算节点反馈的被签名的计算结果后,对该签名进行验签,区块链节点在确定针对计算结果的签名匹配于上述合约签名私钥或节点签名私钥的情况下,判定上述计算结果可信,且计算结果可信为区块链节点更新账本数据的前提条件。区块链节点使用预先获取的匹配于上述合约签名私钥或节点签名私钥的合约签名公钥或节点签名公钥对上述签名进行验证,以确定上述计算结果是否可信;在验证通过的情况下,判定上述计算结果可信,即该计算结果确实是在指定的链下隐私计算节点的TEE中使用链上数据执行指定的链下合约生成的,并且传输过程中未发生数据丢失或被篡改,因此区块链节点将上述签名验证通过作为使用计算结果更新账本数据的前提条件。
以区块链节点接收到的计算结果被链下隐私计算结果先使用区块链节点身份公钥加密,再使用节点加密私钥签名为例,对区块链节点针对计算结果的验签过程进行说明:首先使用与上述块链节点身份公钥对应的区块链节点加密私钥解密上述签名,获得第一哈希值;然后使用与上述节点加密私钥对应的节点加密公钥解密上述密文的计算结果,再计算解密后所得明文的计算结果的第二哈希值,比较上述第一哈希值和第二哈希值:若上述第一哈希值与第二哈希值相等,则说明上述打包数据确实为区块链节点发送的,并且传输过程中未发生数据丢失或被篡改,验签成功;否则,若上述第一哈希值与第二哈希值不相等,则验签失败。
在验签成功的情况下,区块链节点可以根据计算结果对区块链账本数据进行更新,可以对计算结果进行固化存证,而且可以支持针对该计算结果的后期验证。同时,相比于区块链节点在执行链上合约后所产生的上链数据而言,基于链下合约产生的计算结果本身相对更加简短,因而将该计算结果上链时,有助于节省链上存储空间。否则,在验签失败的情况下,客户端可以将上述链上数据丢弃;也可以提取链上数据的数据信息生成数据验签日志,并将该数据验签日志保存在本地或反馈给区块链节点;还可以向区块链节点或其他预设对象返回错误信息或告警信息等。
特殊的,在链下隐私计算节点通过预言机机制将计算结果反馈至区块链节点之后,在区块链节点对计算结果验签通过之后,还可以将上述密文的计算结果发送给客户端,或者将上述明文的计算结果重新加密后发送给客户端;可以理解的是,将上述计算结果发送给客户端的过程中,还可以将与上述计算结果相关的被客户端所提交的交易的相关 信息关联发送至客户端,以使客户端获知其所提交交易的相关计算结果。
区块链节点根据计算结果更新区块链账本数据,或者称为对计算结果进行上链,其方式可以包括:生成一笔区块链交易,将计算结果添加至交易的data字段,当该区块链交易通过共识后,可被各个区块链节点添加至最新区块的区块体中,从而实现了区块链账本数据的更新,亦即完成了对该计算结果的上链;或者,区块链节点根据计算结果对相关账户的状态进行更新,该相关账户譬如可以为用户对应的外部账户或者链上合约对应的合约账户,该相关账户的状态更新会导致状态树(state tree)的树根取值发生变化,而该状态树的树根会被包含于最新区块的区块头,从而实现区块链账本数据的更新,亦即相当于将该计算结果上链。
对应于上述区块链节点侧的实施例,本说明书还提出了链下隐私节点侧和客户端侧等其他方面的实施例,在区块链节点侧实施例中所涉及的描述同样可以适用于这些侧的实施例,下文中不再对此进行赘述。
图3是一示例性实施例提供的一种链下隐私计算节点侧的链上数据的链下隐私计算方法的流程图。如图3所示,该方法可以包括步骤302~步骤306。
步骤302,链下隐私计算节点接收区块链节点传输的经过加密的链上数据,所述链下隐私计算节点处部署了链下可信执行环境,所述链上数据由所述区块链节点根据客户端提交的交易确定。
如前所述,链下隐私计算节点可以通过预言机机制接收区块链节点传输的经过加密的链上数据;或者,链下隐私计算节点可以接收区块链节点通过客户端处预部署的链下隐私计算调用组件传输的经过加密的链上数据。
如前所述,链下隐私计算节点接收的链上数据可以被区块链节点使用区块链节点身份私钥进行签名。其中,签名验证成功被客户端或预言机服务器作为将经过加密的上述链上数据传输至链下隐私计算节点的前提条件。
如前所述,链上数据可以在被节点加密公钥加密后传输至链下隐私计算节点,且链下隐私计算节点维护有上述节点加密公钥对应的节点加密私钥。
如前所述,在链下隐私计算节点属于链下隐私计算集群的情况下,上述节点加密私钥仅被链下隐私计算节点所维护,或者上述节点加密私钥被链下隐私计算集群内的所有链下隐私计算节点共同维护。
如前所述,链下隐私计算节点接收区块链节点传输的被区块链节点使用节点加密公钥加密的链上数据;或者,链下隐私计算节点接收客户端传输的被客户端使用节点加密公钥加密的链上数据,其中链上数据是被上述区块链节点加密后传输给上述客户端的。
如前所述,链下隐私计算节点可以直接接收区块链节点发送的链上数据;或者,在链下隐私计算节点属于链下隐私计算集群的情况下,链下隐私计算节点可以接收区块链节点经过链下隐私计算集群的控制节点转发的链上数据。
步骤304,所述链下隐私计算节点在所述链下可信执行环境内对所述链上数据执行隐私计算生成计算结果。
如前所述,链下合约的调用信息被链下隐私计算节点与链上数据关联接收,上述调用信息用于指示链下隐私计算节点通过在链下可信执行环境内执行上述链下合约对链上数据实现隐私计算;其中,调用信息包括:上述链下合约的合约ID,或者上述链下合约的合约ID和链下合约内至少一个函数的函数名。
步骤306,所述链下隐私计算节点向所述区块链节点反馈加密后的所述计算结果,所述计算结果用于更新区块链账本数据。
如前所述,链下隐私计算节点可以通过预言机机制向区块链节点反馈加密后的计算结果;或者,链下隐私计算节点可以通过客户端处预部署的链下隐私计算调用组件向区块链节点反馈加密后的计算结果。
如前所述,链上数据由链下隐私计算节点在链下可信执行环境内执行预先部署的 链下合约实现隐私计算,且链下隐私计算节点维护有对应于上述链下合约的合约签名私钥;链下隐私计算节点可以使用上述合约签名私钥对计算结果进行签名,其中,区块链节点在确定针对计算结果的签名匹配于合约签名私钥的情况下,判定该计算结果可信,且将计算结果可信作为区块链节点更新账本数据的前提条件。
图4是一示例性实施例提供的一种客户端侧的链上数据的链下隐私计算方法的流程图。如图4所示,该方法可以包括步骤402~步骤406。
步骤402,客户端向区块链节点提交交易,以由所述区块链节点根据所述交易确定用于隐私计算的链上数据。
步骤404,所述客户端在接收到所述区块链节点发送的经过加密的所述链上数据的情况下,将所述链上数据加密传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境。
如前所述,客户端接收到的链上数据可以被区块链节点使用区块链节点身份私钥进行签名;其中,签名验证成功被客户端作为将经过加密的链上数据传输至链下隐私计算节点的前提条件。
如前所述,链下隐私计算节点维护有节点加密公钥对应的节点加密私钥,客户端可以使用上述节点加密公钥将链上数据加密后发送给链下隐私计算节点。
如前所述,客户端处预部署了链下隐私计算调用组件,客户端可以调用链下隐私计算调用组件将所述链上数据加密传输至链下隐私计算节点。
步骤406,所述客户端在接收到所述链下隐私计算节点在所述链下可信执行环境中生成并加密传输的计算结果的情况下,将所述计算结果发送给所述区块链节点用于更新区块链账本数据。
如前所述,客户端处预部署了链下隐私计算调用组件,客户端可以调用所述链下隐私计算调用组件将所述计算结果发送给所述区块链节点。
至此,链上数据下链参与链下隐私计算和链下隐私计算的计算结果上链的完整过程说明完毕。下面结合图5和图6所示的两个具体实施例对上述方法进行进一步说明。
图5是一示例性实施例提供的一种链上数据的链下隐私计算方法对应的各设备之间的交互流程图。如图5所示,由客户端向区块链节点提交交易以进行隐私计算,该方法可以包括以下步骤。
步骤502,客户端向区块链节点发送交易。
在满足相应的触发条件后,客户端将对应的交易发送至区块链节点,上述触发条件可以为用户执行的预设操作、客户端上运行的应用程序的预设功能开启、预设时刻达到等。其中,上述用户执行的预设操作可以有多种形式,如提交交易请求、执行交易部署或反馈交易响应等;相应的,上述交易具体可以为转账、接收转账、查询历史交易信息等,本说明书对此并不进行限制。
步骤504,区块链节点确定链上数据并将链上数据发送给客户端。
区块链节点可以在交易执行前或交易执行过程中根据接收到的交易确定用于链下隐私计算的链上数据。链上数据可以是上述交易携带的入参数据,如位于上述交易的data字段中的数据;也可以是上述交易指定的数据,如在上述交易调用链上合约的情况下,被调用的链上合约基于上述交易在其data字段中指定的交易信息查询相应的链上数据;还可以在上述交易调用链上合约的情况下,将被调用的链上合约在执行过程中的中间值或最终结果作为上述的链上数据,上述中间值或最终结果是由链上合约对上述交易携带的数据或者按照其指定信息查询到的链上数据进行处理而生成的。另外,区块链节点确定出的链上数据可能具有多种类型,如位于区块链上的区块链数据、区块链节点维护的状态数据或区块链节点维护的收据数据等,本说明书对此并不进行限制。
区块链节点在确定了链上数据后,可以先使用链下隐私计算节点的节点加密公钥对链上数据进行加密,然后使用区块链节点的区块链节点身份私钥对加密后的链上数据 进行签名,最后将上述签名和加密后的链上数据关联发送给客户端或打包后发送给客户端。也可以先使用区块链节点的节点加密私钥对链上数据进行签名,然后使用客户端的加密公钥对链上数据进行加密,最后将上述签名和加密后的链上数据关联发送给客户端或打包后发送给客户端。还可以先使用区块链节点的节点加密私钥对链上数据进行签名,然后将上述签名和明文的链上数据打包后使用客户端的加密公钥进行加密,最后将加密后的打包文件发送给客户端。另外,区块链节点除了向链下隐私计算节点结果传输链上数据之外,还可以将与上述链上数据相关联的链下合约调用请求传输给链下隐私计算节点,针对调用请求的加密和签名可以与上述链上数据关联进行,针对调用请求的加密和签名的操作方式及顺序可以针对计算结果的上述处理过程相同,对此不再赘述。
步骤506,客户端验签通过后将链上数据转发给链下隐私计算节点。
客户端接收到上述打包数据后,首先对其中的链上数据进行验签,然后在验签成功的情况下将链上数据转发给链下隐私计算节点。对应于上述步骤504中的实施例,在客户端接收到关联发送的签名和加密后的链上数据的情况下,或者对接收到的打包文件进行拆分得到签名和加密后的链上数据后,一方面使用区块链节点的节点加密公钥对上述签名进行解密得到第一哈希值,另一方面,可以直接计算加密后的链上数据的第二哈希值,也可以使用客户端的加密私钥对加密后的链上数据进行解密以获取明文的链上数据,然后计算链上数据的第二哈希值。在客户端接收到加密的打包文件,且该打包文件中包含签名和非加密的链上数据的情况下,客户端可以首先使用客户端的加密私钥对上述打包文件进行解密,以得到上述签名和链上数据,然后一方面使用区块链节点的节点加密公钥解压上述签名获得链上数据对应的第一哈希值,另一方面计算链上数据的第二哈希值。在获得上述第一哈希值和第二哈希值后,将二者进行比较:若上述第一哈希值与第二哈希值相等,则说明上述打包数据确实为区块链节点发送的,且并未被其他设备篡改,验签成功;否则,若上述第一哈希值与第二哈希值不相等,则验签失败。
该实施例中,链下隐私计算节点是独立的链下隐私计算节点,在验签成功的情况下,客户端将上述链上数据转发给链下隐私计算节点。对应于上述实施例,客户端可以直接将使用链下隐私计算节点的节点加密公钥进行加密的上述链上数据转发给链下隐私计算节点。客户端也可以先使用链下隐私计算节点的节点加密公钥对上述链上数据进行加密,然后将密文的链上数据转发给链下隐私计算节点。否则,在验签失败的情况下(图中未标注),客户端可以将上述链上数据丢弃;也可以提取链上数据的数据信息生成数据验签日志,并将该数据验签日志保存在本地或反馈给区块链节点;还可以向区块链节点或其他预设对象返回错误信息或告警信息等。
该实施例中,独立的链下隐私计算节点中维护有节点加密私钥,客户端可以直接将加密后的链上数据发送给该链下隐私计算节点,由该链下隐私计算节点使用其维护的节点加密私钥在预创建的链下TEE中解密密文的链上数据。
步骤508,链下隐私计算节点执行隐私计算。
链下隐私计算节点利用验签通过的链上数据在创建的链下TEE中执行预部署的链下合约,即进行隐私计算。具体的,链下隐私计算节点可以解密与链上数据相关联的链下合约调用请求得到标识信息等信息,然后链下隐私计算节点可以根据标识信息调用预先部署的链下合约的字节码,而在链下可信执行环境中部署有若干执行引擎的情况下,链下隐私计算节点可以根据字节码确定对应的执行引擎,并且通过确定出的执行引擎执行所述字节码以对链上数据进行链下隐私计算。
在链下隐私计算节点处创建的链下TEE中,可以部署有若干执行引擎,比如EVM、WASM虚拟机等中的一个或多个,在同时部署了多种执行引擎的情况下,客户端或区块链节点除了在链下隐私计算节点处安全存储链下合约的字节码之外,还可以向链下隐私计算节点指明用于执行该字节码的执行引擎。链下隐私计算节点可以接收客户端或区块链节点发送的与链下合约的字节码相关联的执行引擎指定信息,并根据执行引擎指定 信息为字节码设定相应的执行引擎。因而链下隐私计算节点可以在链下TEE中根据确定出的执行引擎对链上数据进行链下隐私计算。
本说明书中链下隐私计算节点可以使用链上数据实现用户定义的任何计算逻辑。例如,链下隐私计算节点可以通过链下合约验证区块链上存储的加密订单数据的金额是否正确,并将验证结果反馈至链上;再例如,链下隐私计算节点可以通过链下合约根据预设算法对多方数据进行安全计算,即安全多方计算,并将计算结果反馈至区块链节点等,此处不再一一赘述。
上述链下合约中字节码的执行结果即为链下隐私计算的计算结果。如前所述,上述隐私计算是在链下TEE中进行的,相应的,上述计算结果在出链下TEE之前也需要进行加密。链下隐私计算节点可以使用客户端的加密公钥对计算结果进行加密,也可以使用区块链节点的节点加密公钥对计算结果进行加密。当然,计算结果也可以使用被调用链下合约的合约签名私钥或该链下隐私计算节点的节点签名私钥对计算结果进行签名,具体的加密和签名的操作顺序可以有多种可能,具体方式可参见上述实施例,此处不再一一赘述。
步骤510,客户端将计算结果转发给区块链节点。
对应于前述由客户端将链上数据转发给链下隐私计算节点,在链下隐私计算节点完成隐私计算后,可以由客户端将计算结果转发给区块链节点。在使用链上数据进行隐私计算的链下隐私计算节点为独立的链下隐私计算节点的情况下,链下隐私计算节点直接将上述计算结果发送给客户端。在使用链上数据进行隐私计算的链下隐私计算节点归属于链下隐私计算集群的情况下,链下隐私计算节点将计算结果经过上述集群的控制节点转发给客户端。客户端接收到链下隐私计算节点或控制节点发送的计算结果后,将上述结算结果转发给区块链节点。
链下隐私计算节点除了对链下隐私计算结果进行反馈之外,链下隐私计算节点还可以对接收到与上述链上数据相关联的调用请求进行哈希运算得到第三哈希值,链下隐私计算节点将第三哈希值与上述链下隐私计算结果进行关联反馈。客户端或者区块链节点将接收到的三哈希值与生成的调用请求的第四哈希值进行比较,根据比较结果确定链下隐私计算结果是否可靠。
若第三哈希值与第四哈希值的比较结果不一致,则表明与该第三哈希值关联反馈的链下隐私计算结果不可靠;若第三哈希值与第四哈希值的比较结果一致,则需要进一步验证链下隐私计算节点或者被调用合约的签名等其他参考信息,在参考信息均正确的情况下,才能确定该链下隐私计算结果可靠。
步骤512,区块链节点验签并将计算结果上链。
区块链节点接收到上述隐私计算的计算结果后,首先对该计算结果的签名进行可信验证。
在验签成功的情况下将计算结果上链。上链的具体方式可以包括:生成一笔区块链交易,将计算结果添加至交易的data字段,当该区块链交易通过共识后,可被各个区块链节点添加至最新区块的区块体中,从而实现了区块链账本数据的更新,亦即完成了对该计算结果的上链;或者,区块链节点根据计算结果对相关账户的状态进行更新,该相关账户譬如可以为用户对应的外部账户或者链上合约对应的合约账户,该相关账户的状态更新会导致状态树(state tree)的树根取值发生变化,而该状态树的树根会被包含于最新区块的区块头,从而实现区块链账本数据的更新,亦即相当于将该计算结果上链。
在验签失败的情况下(图中未标注),区块链节点可以将上述计算结果丢弃;也可以提取计算结果的数据信息生成结果验签日志,并将该结果验签日志保存在本地,也可以向其他预设对象返回错误信息或告警信息等。
图6是一示例性实施例提供的另一种链上数据的链下隐私计算方法对应的各设备之间的交互流程图。如图6所示,由区块链节点内运行的链上合约主动调用链上数据进 行链下隐私计算,该过程实际上为通过预言机机制调用链下隐私计算的过程,该方法可以包括以下步骤。
步骤602,链上合约主动调用链下隐私计算。
预部署在区块链节点中的链上合约在运行时,可以主动调用链下隐私计算。具体的,可以由链上合约指定需要调用的链下隐私计算节点、链下合约和/或链上数据,也可以由链上合约调用预言机合约,然后由预言机合约确定需要调用的链下隐私计算节点、链下合约和/或链上数据。其中,链上数据可以是上述交易携带的数据,如位于上述交易的data字段中的数据;也可以是上述交易指定的数据,如在上述交易调用链上合约的情况下,被调用的链上合约基于上述交易在其data字段中指定的交易信息查询相应的链上数据;还可以在上述交易调用链上合约的情况下,将被调用的链上合约在执行过程中的中间值或最终结果作为上述的链上数据,上述中间值或最终结果是由链上合约对上述交易携带的数据或者按照其指定信息查询到的链上数据进行处理而生成的。另外,区块链节点确定出的链上数据可能具有多种类型,如位于区块链上的区块链数据、区块链节点维护的状态数据或区块链节点维护的收据数据等。
步骤604,预言机合约预处理链上数据。
针对确定的链上数据,预言机合约对其进行预处理,具体的,在链上合约处于加密状态的情况下,对上述加密的链上数据进行打包等预处理。在链上合约处于非加密状态的情况下,首先对上述未加密的链上数据进行加密,可以使用上述指定的链下隐私计算节点的节点加密公钥进行加密,也可以使用上述指定的链下隐私计算节点所归属链下隐私计算集群的控制节点的加密公钥进行加密,然后使用区块链节点的节点加密私钥对加密后的链上数据进行签名。最后,还可以对上述加密后的链上数据和对应的签名进行打包处理。
预言机合约进行的上述打包操作会触发预设的区块链事件,并被预言机服务器监听到,然后由区块链节点将经过上述预处理的打包数据以加密的方式发送给预言机服务器。该过程中,可以在预言机服务器监听到区块链事件后,向区块链接节点发送链上数据获取请求并接收区块链节点返回的处于加密状态的链上数据。其中,对链上数据的具体加密方式可以为对称秘钥加密、非对称秘钥加密或数字信封加密等,可参见上文此处不再赘述。
步骤606,预言机服务器验签并转发链上数据。
预言机服务器对接收到的链上数据进行验签,并在验签成功的情况下将密文的链上数据发送给链下隐私计算集群的控制节点。对链上数据进行验签的具体方法,请参见上述步骤506的记载,此处不再赘述。
步骤608,链下隐私计算集群的控制节点接收链上数据并分配至目标节点。
该实施例中,链下隐私计算集群包含一控制节点,并由该控制节点对集群内的所有链下隐私计算节点进行统一管理。在接收到链上数据后,控制节点首先从集群中确定某一链下隐私计算节点作为使用链上数据进行隐私计算的节点(记为目标节点),然后将上述链上数据发送至该目标节点。
在接收到与上述链上数据关联发送的链下隐私计算节点的节点ID或节点编号等指定信息的情况下,控制节点将与上述指定信息确定相匹配的链下隐私计算节点作为目标节点;在未接收到与上述链上数据相关联的指定信息的情况下,控制节点按照集群内各节点的当前负载值(如当前运算量、当前时刻起预设时间段内的预期计算量、当前计算任务个数等)确定目标节点,如将当前负载值最小的节点确定为目标节点、将当前负载值小于某一负载值阈值的所有节点中的任一节点确定为目标节点等。
在确定了目标节点后,控制节点将链上数据发送至目标节点。在目标节点维护有加密链上数据所使用的节点加密公钥对应的节点加密私钥的情况下,控制节点直接将上述链上数据转发至目标节点。在目标节点并未维护加密链上数据所使用的节点加密公钥 对应的节点加密私钥的情况下,控制节点首先在自身的链下TEE中使用上述节点加密私钥解密密文的链上数据,然后在链下TEE中使用与目标节点预协商的秘钥将明文的链上数据再次加密后发送给目标节点。
步骤610,链下隐私计算节点执行隐私计算。
链下隐私计算节点使用接收到的链上数据执行隐私计算的具体方法,请参见上述步骤508的记载,此处不再赘述。
步骤612,控制节点接收计算结果并将其发送至预言机服务器。
控制节点接收到的计算结果通常已经被目标节点所加密,控制节点首先需要根据该计算结果加密使用的秘钥不同进行不同的处理。在计算结果被目标节点使用区块链节点身份公钥或预言机服务器的公钥加密的情况下,控制节点直接将该计算结果转发给预言机服务器。在计算结果被目标节点使用控制节点的公钥加密的情况下,控制节点首先在自身的链下TEE中使用与上述公钥对应的私钥解密密文的计算结果,然后在链下TEE中使用预言机服务器的公钥或区块链节点的区块链节点身份公钥将明文的链上数据再次加密后发送给预言机服务器。
步骤614,预言机服务器转发计算结果。
预言机服务器接收到控制节点发送的加密状态的计算结果后,根据该计算结果加密使用的秘钥不同进行不同的处理。在计算结果被目标节点或控制节点使用区块链节点身份公钥加密的情况下,预言机服务器直接将该计算结果转发给区块链节点。在计算结果被控制节点所维护的公钥加密的情况下,预言机服务器首先在自身的链下TEE中使用与上述公钥对应的私钥解密密文的计算结果,然后在链下TEE中使用区块链节点的区块链节点身份公钥将明文的链上数据再次加密后发送给区块链节点。
步骤616,区块链节点验签并将计算结果上链。
区块链节点接收计算结果后,首先对计算结果进行验签,然后在验签通过的情况下根据计算结果更新区块链账本数据,即将计算结果上链。上链的具体过程请参见上述步骤512的记载,此处不再赘述。
图7是本说明书一示例性实施例示出的一种电子设备的结构示意图。请参考图7,在硬件层面,该电子设备包括处理器702、内部总线704、网络接口706、内存708以及非易失性存储器710,当然还可能包括其他业务所需要的硬件。处理器702从非易失性存储器710中读取对应的计算机程序到内存708中并运行,在逻辑层面上形成链上数据的链下隐私计算装置。当然,除了软件实现方式之外,本说明书并不排除其他实现方式,比如逻辑器件抑或软硬件结合的方式等等,也就是说以下处理流程的执行主体并不限定于各个逻辑单元,也可以是硬件或逻辑器件。
请参考图8,在区块链节点侧的软件实施方式中,该链上数据的链下隐私计算装置可以包括:链上数据确定单元801,使区块链节点根据客户端提交的交易,确定用于隐私计算的链上数据;链上数据传输单元802,使所述区块链节点将经过加密的所述链上数据传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境;计算结果获取单元803,使所述区块链节点获取所述链下隐私计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果,并根据所述计算结果更新区块链账本数据。
可选的,所述链上数据传输单元802具体用于:使所述区块链节点通过预言机机制将经过加密的所述链上数据传输至链下隐私计算节点;或者,使所述区块链节点通过所述客户端处预部署的链下隐私计算调用组件,将经过加密的所述链上数据传输至所述链下隐私计算节点。
可选的,还包括:链上数据签名单元804,使所述区块链节点使用区块链节点身份私钥对所述链上数据进行签名;其中,签名验证成功被所述客户端或预言机服务器作为将经过加密的所述链上数据传输至所述链下隐私计算节点的前提条件。
可选的,所述链上数据被节点加密公钥加密后传输至所述链下隐私计算节点,且所述链下隐私计算节点维护有所述节点加密公钥对应的节点加密私钥。
可选的,在所述链下隐私计算节点属于链下隐私计算集群的情况下,所述节点加密私钥仅被所述链下隐私计算节点所维护,或者所述节点加密私钥被所述链下隐私计算集群内的所有链下隐私计算节点共同维护。
可选的,所述链上数据传输单元802具体用于:使所述区块链节点使用所述节点加密公钥加密所述链上数据,并将经过加密的所述链上数据传输至所述链下隐私计算节点;或者,使所述区块链节点将所述链上数据加密后发送给所述客户端,所述链上数据由所述客户端使用所述节点加密公钥加密后传输至所述链下隐私计算节点。
可选的,所述链上数据传输单元802具体用于:使所述区块链节点将所述链上数据直接发送给所述链下隐私计算节点;或者,在所述链下隐私计算节点属于链下隐私计算集群的情况下,使所述区块链节点将所述链上数据经过所述链下隐私计算集群的控制节点转发给所述链下隐私计算节点。
可选的,所述计算结果获取单元803具体用于:使所述区块链节点通过预言机机制获取所述链下隐私计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果;或者,使所述区块链节点通过所述客户端处预部署的链下隐私计算调用组件获取所述链下隐私计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果。
可选的,所述链上数据由所述链下隐私计算节点在链下可信执行环境内执行预先部署的链下合约实现隐私计算,且所述链下隐私计算节点维护有对应于所述链下合约的合约签名私钥;还包括:计算结果验签单元805,使所述区块链节点在确定针对计算结果的签名匹配于合约签名私钥的情况下,判定所述计算结果可信,且计算结果可信为区块链节点更新账本数据的前提条件。
请参考图9,在链下隐私计算节点侧的软件实施方式中,该链上数据的链下隐私计算装置可以包括:链上数据接收单元901,使链下隐私计算节点接收区块链节点传输的经过加密的链上数据,所述链下隐私计算节点处部署了链下可信执行环境,所述链上数据由所述区块链节点根据客户端提交的交易确定;隐私计算执行单元902,使所述链下隐私计算节点在所述链下可信执行环境内对所述链上数据执行隐私计算生成计算结果;计算结果反馈单元903,使所述链下隐私计算节点向所述区块链节点反馈加密后的所述计算结果,所述计算结果用于更新区块链账本数据。
可选的,所述链上数据接收单元901具体用于:使链下隐私计算节点通过预言机机制接收区块链节点传输的经过加密的链上数据;或者,使链下隐私计算节点接收区块链节点通过客户端处预部署的链下隐私计算调用组件传输的经过加密的链上数据。
可选的,所述链下隐私计算单元接收的所述链上数据被所述区块链节点使用区块链节点身份私钥进行签名;其中,签名验证成功被所述客户端或预言机服务器作为将经过加密的所述链上数据传输至所述链下隐私计算节点的前提条件。
可选的,所述链上数据被节点加密公钥加密后传输至所述链下隐私计算节点,且所述链下隐私计算节点维护有所述节点加密公钥对应的节点加密私钥。
可选上,所述在所述链下隐私计算节点属于链下隐私计算集群的情况下,所述节点加密私钥仅被所述链下隐私计算节点所维护,或者所述节点加密私钥被所述链下隐私计算集群内的所有链下隐私计算节点共同维护。
可选的,所述链上数据接收单元901具体用于:使所述链下隐私计算节点接收所述区块链节点传输的被所述区块链节点使用所述节点加密公钥加密的所述链上数据;或者,
使所述链下隐私计算节点接收所述客户端传输的被所述客户端使用所述节点加密公钥加密的所述链上数据,其中所述链上数据是被所述区块链节点加密后传输给所述客户端的。
可选的,所述链上数据接收单元901具体用于:使所述链下隐私计算节点直接接收所述区块链节点发送的所述链上数据;或者,在所述链下隐私计算节点属于链下隐私计算集群的情况下,使所述链下隐私计算节点接收所述区块链节点经过所述控制节点转发的所述链上数据。
可选的,所述计算结果反馈单元903具体用于:使所述链下隐私计算节点通过预言机机制向所述区块链节点反馈加密后的所述计算结果;或者,使所述链下隐私计算节点通过所述客户端处预部署的链下隐私计算调用组件向所述区块链节点反馈加密后的所述计算结果。
可选的,所述链上数据由所述链下隐私计算节点在链下可信执行环境内执行预先部署的链下合约实现隐私计算,且所述链下隐私计算节点维护有对应于所述链下合约的合约签名私钥;还包括:计算结果签名单元904,使所述链下隐私计算节点使用所述合约签名私钥对所述计算结果进行签名,其中,所述区块链节点在确定针对计算结果的签名匹配于合约签名私钥的情况下,判定所述计算结果可信,且将计算结果可信作为区块链节点更新账本数据的前提条件。
可选的,所述链下合约的调用信息被所述链下隐私计算节点与所述链上数据关联接收,所述调用信息用于指示链下隐私计算节点通过在链下可信执行环境内执行所述链下合约对链上数据实现隐私计算;其中,所述调用信息包括:所述链下合约的合约ID,或者所述链下合约的合约ID和所述链下合约内至少一个函数的函数名。
请参考图10,在客户端侧的软件实施方式中,该链上数据的链下隐私计算装置可以包括:交易提交单元1001,使客户端向区块链节点提交交易,以由所述区块链节点根据所述交易确定用于隐私计算的链上数据;链上数据转发单元1002,使所述客户端在接收到所述区块链节点发送的经过加密的所述链上数据的情况下,将所述链上数据加密传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境;计算结果转发单元1003,使所述客户端在接收到所述链下隐私计算节点在所述链下可信执行环境中生成并加密传输的计算结果的情况下,将所述计算结果发送给所述区块链节点,用于更新区块链账本数据。
可选的,还包括:链上数据验签单元1004,使所述客户端使用所述区块链节点公钥对接收到的所述链上数据进行签名验证,签名验证成功被所述客户端作为将经过加密的所述链上数据传输至所述链下隐私计算节点的前提条件,其中,所述链上数据被所述区块链节点使用区块链节点身份私钥进行签名。
可选的,所述链下隐私计算节点维护有节点加密公钥对应的节点加密私钥,所述链上数据转发单元1002具体用于:使所述客户端使用所述节点加密公钥将所述链上数据加密后发送给所述链下隐私计算节点。
可选的,所述客户端处预部署了链下隐私计算调用组件,所述链上数据转发单元1002具体用于:使所述客户端调用所述链下隐私计算调用组件将所述链上数据加密传输至链下隐私计算节点。
可选的,所述客户端处预部署了链下隐私计算调用组件,所述计算结果转发单元1003具体用于:使所述客户端调用所述链下隐私计算调用组件将所述计算结果发送给所述区块链节点。
上述装置中各个单元的功能和作用的实现过程详见上述方法中对应步骤的实现过程,在此不再赘述。
上述实施例阐明的系统、装置、模块或单元,具体可以由计算机芯片或实体实现,或者由具有某种功能的产品来实现。一种典型的实现设备为计算机,计算机的具体形式可以是个人计算机、膝上型计算机、蜂窝电话、相机电话、智能电话、个人数字助理、媒体播放器、导航设备、电子邮件收发设备、游戏控制台、平板计算机、可穿戴设备或者这些设备中的任意几种设备的组合。
在一个典型的配置中,电子设备包括一个或多个处理器(CPU)、输入/输出接口、网络接口和内存。
内存可能包括计算机可读介质中的非永久性存储器,随机存取存储器(RAM)和/或非易失性内存等形式,如只读存储器(ROM)或闪存(flash RAM)。内存是计算机可读介质的示例。
计算机可读介质包括永久性和非永久性、可移动和非可移动媒体可以由任何方法或技术来实现信息存储。信息可以是计算机可读指令、数据结构、程序的模块或其他数据。计算机的存储介质的例子包括,但不限于相变内存(PRAM)、静态随机存取存储器(SRAM)、动态随机存取存储器(DRAM)、其他类型的随机存取存储器(RAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、快闪记忆体或其他内存技术、只读光盘只读存储器(CD-ROM)、数字多功能光盘(DVD)或其他光学存储、磁盒式磁带,磁带磁盘存储或其他磁性存储设备或任何其他非传输介质,可用于存储可以被计算设备访问的信息。按照本文中的界定,计算机可读介质不包括暂存电脑可读媒体(transitory media),如调制的数据信号和载波。
对于上述装置实施例而言,由于其基本对应于方法实施例,所以相关之处参见方法实施例的部分说明即可。以上所描述的装置实施例仅仅是示意性的,其中所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部模块来实现本说明书方案的目的。本领域普通技术人员在不付出创造性劳动的情况下,即可以理解并实施。
应当理解,尽管在本说明书一个或多个实施例可能采用术语第一、第二、第三等来描述各种信息,但这些信息不应限于这些术语。这些术语仅用来将同一类型的信息彼此区分开。例如,在不脱离本说明书一个或多个实施例范围的情况下,第一哈希值也可以被称为第二哈希值,类似地,第二哈希值也可以被称为第一哈希值。取决于语境,如在此所使用的词语“如果”可以被解释成为“在……时”或“当……时”或“响应于确定”。
以上所述仅为本说明书的较佳实施例而已,并不用以限制本说明书,凡在本说明书的精神和原则之内,所做的任何修改、等同替换、改进等,均应包含在本说明书保护的范围之内。

Claims (30)

  1. 一种链上数据的链下隐私计算方法,包括:
    区块链节点根据客户端提交的交易,确定用于隐私计算的链上数据;
    所述区块链节点将经过加密的所述链上数据传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境;
    所述区块链节点获取所述链下隐私计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果,并根据所述计算结果更新区块链账本数据。
  2. 根据权利要求1所述的方法,所述区块链节点将经过加密的所述链上数据传输至链下隐私计算节点,包括:
    所述区块链节点通过预言机机制将经过加密的所述链上数据传输至链下隐私计算节点;或者,
    所述区块链节点通过所述客户端处预部署的链下隐私计算调用组件,将经过加密的所述链上数据传输至所述链下隐私计算节点。
  3. 根据权利要求2所述的方法,还包括:
    所述区块链节点使用区块链节点身份私钥对所述链上数据进行签名;
    其中,签名验证成功被所述客户端或预言机服务器作为将经过加密的所述链上数据传输至所述链下隐私计算节点的前提条件。
  4. 根据权利要求1所述的方法,所述链上数据被节点加密公钥加密后传输至所述链下隐私计算节点,且所述链下隐私计算节点维护有所述节点加密公钥对应的节点加密私钥。
  5. 根据权利要求4所述的方法,在所述链下隐私计算节点属于链下隐私计算集群的情况下,所述节点加密私钥仅被所述链下隐私计算节点所维护,或者所述节点加密私钥被所述链下隐私计算集群内的所有链下隐私计算节点共同维护。
  6. 根据权利要求4所述的方法,所述区块链节点将经过加密的所述链上数据传输至链下隐私计算节点,包括:
    所述区块链节点使用所述节点加密公钥加密所述链上数据,并将经过加密的所述链上数据传输至所述链下隐私计算节点;或者,
    所述区块链节点将所述链上数据加密后发送给所述客户端,所述链上数据由所述客户端使用所述节点加密公钥加密后传输至所述链下隐私计算节点。
  7. 根据权利要求1所述的方法,所述区块链节点将经过加密的所述链上数据传输至链下隐私计算节点,包括:
    所述区块链节点将所述链上数据直接发送给所述链下隐私计算节点;或者,
    在所述链下隐私计算节点属于链下隐私计算集群的情况下,所述区块链节点将所述链上数据经过所述链下隐私计算集群的控制节点转发给所述链下隐私计算节点。
  8. 根据权利要求1所述的方法,所述区块链节点获取所述链下隐私计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果,包括:
    所述区块链节点通过预言机机制获取所述链下隐私计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果;或者,
    所述区块链节点通过所述客户端处预部署的链下隐私计算调用组件获取所述链下隐私计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果。
  9. 根据权利要求1所述的方法,所述链上数据由所述链下隐私计算节点在链下可信执行环境内执行预先部署的链下合约实现隐私计算,且所述链下隐私计算节点维护有对应于所述链下合约的合约签名私钥;所述方法还包括:
    所述区块链节点在确定针对计算结果的签名匹配于合约签名私钥的情况下,判定所述计算结果可信,且计算结果可信为区块链节点更新账本数据的前提条件。
  10. 根据权利要求9所述的方法,所述链下合约的调用信息被与所述链上数据关联 传输至链下隐私计算节点,所述调用信息用于指示链下隐私计算节点通过在链下可信执行环境内执行所述链下合约对链上数据实现隐私计算;其中,所述调用信息包括:所述链下合约的合约ID,或者所述链下合约的合约ID和所述链下合约内至少一个函数的函数名。
  11. 一种链上数据的链下隐私计算方法,包括:
    链下隐私计算节点接收区块链节点传输的经过加密的链上数据,所述链下隐私计算节点处部署了链下可信执行环境,所述链上数据由所述区块链节点根据客户端提交的交易确定;
    所述链下隐私计算节点在所述链下可信执行环境内对所述链上数据执行隐私计算生成计算结果;
    所述链下隐私计算节点向所述区块链节点反馈加密后的所述计算结果,所述计算结果用于更新区块链账本数据。
  12. 根据权利要求11所述的方法,所述链下隐私计算节点接收区块链节点传输的经过加密的链上数据,包括:
    链下隐私计算节点通过预言机机制接收区块链节点传输的经过加密的链上数据;或者,
    链下隐私计算节点接收区块链节点通过客户端处预部署的链下隐私计算调用组件传输的经过加密的链上数据。
  13. 根据权利要求12所述的方法,还包括:
    所述链下隐私计算节点接收的所述链上数据被所述区块链节点使用区块链节点身份私钥进行签名;
    其中,签名验证成功被所述客户端或预言机服务器作为将经过加密的所述链上数据传输至所述链下隐私计算节点的前提条件。
  14. 根据权利要求11所述的方法,所述链上数据被节点加密公钥加密后传输至所述链下隐私计算节点,且所述链下隐私计算节点维护有所述节点加密公钥对应的节点加密私钥。
  15. 根据权利要求14所述的方法,在所述链下隐私计算节点属于链下隐私计算集群的情况下,所述节点加密私钥仅被所述链下隐私计算节点所维护,或者所述节点加密私钥被所述链下隐私计算集群内的所有链下隐私计算节点共同维护。
  16. 根据权利要求14所述的方法,所述链下隐私计算节点接收区块链节点传输的经过加密的链上数据,包括:
    所述链下隐私计算节点接收所述区块链节点传输的被所述区块链节点使用所述节点加密公钥加密的所述链上数据;或者,
    所述链下隐私计算节点接收所述客户端传输的被所述客户端使用所述节点加密公钥加密的所述链上数据,其中所述链上数据是被所述区块链节点加密后传输给所述客户端的。
  17. 根据权利要求11所述的方法,所述链下隐私计算节点接收区块链节点传输的经过加密的链上数据,包括:
    所述链下隐私计算节点直接接收所述区块链节点发送的所述链上数据;或者,
    在所述链下隐私计算节点属于链下隐私计算集群的情况下,所述链下隐私计算节点接收所述区块链节点经过所述链下隐私计算集群的控制节点转发的所述链上数据。
  18. 根据权利要求11所述的方法,所述链下隐私计算节点向所述区块链节点反馈加密后的所述计算结果,包括:
    所述链下隐私计算节点通过预言机机制向所述区块链节点反馈加密后的所述计算结果;或者,
    所述链下隐私计算节点通过所述客户端处预部署的链下隐私计算调用组件向所述 区块链节点反馈加密后的所述计算结果。
  19. 根据权利要求11所述的方法,所述链上数据由所述链下隐私计算节点在链下可信执行环境内执行预先部署的链下合约实现隐私计算,且所述链下隐私计算节点维护有对应于所述链下合约的合约签名私钥;所述方法还包括:
    所述链下隐私计算节点使用所述合约签名私钥对所述计算结果进行签名,其中,所述区块链节点在确定针对计算结果的签名匹配于合约签名私钥的情况下,判定所述计算结果可信,且将计算结果可信作为区块链节点更新账本数据的前提条件。
  20. 根据权利要求19所述的方法,所述链下合约的调用信息被所述链下隐私计算节点与所述链上数据关联接收,所述调用信息用于指示链下隐私计算节点通过在链下可信执行环境内执行所述链下合约对链上数据实现隐私计算;其中,所述调用信息包括:所述链下合约的合约ID,或者所述链下合约的合约ID和所述链下合约内至少一个函数的函数名。
  21. 一种链上数据的链下隐私计算方法,包括:
    客户端向区块链节点提交交易,以由所述区块链节点根据所述交易确定用于隐私计算的链上数据;
    所述客户端在接收到所述区块链节点发送的经过加密的所述链上数据的情况下,将所述链上数据加密传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境;
    所述客户端在接收到所述链下隐私计算节点在所述链下可信执行环境中生成并加密传输的计算结果的情况下,将所述计算结果发送给所述区块链节点用于更新区块链账本数据。
  22. 根据权利要求21所述的方法,还包括:
    所述客户端接收到的所述链上数据被所述区块链节点使用区块链节点身份私钥进行签名;
    其中,签名验证成功被所述客户端作为将经过加密的所述链上数据传输至所述链下隐私计算节点的前提条件。
  23. 根据权利要求21所述的方法,所述链下隐私计算节点维护有节点加密公钥对应的节点加密私钥,所述将所述链上数据加密传输至链下隐私计算节点,包括:
    所述客户端使用所述节点加密公钥将所述链上数据加密后发送给所述链下隐私计算节点。
  24. 根据权利要求21所述的方法,所述客户端处预部署了链下隐私计算调用组件,所述将所述链上数据加密传输至链下隐私计算节点,包括:
    调用所述链下隐私计算调用组件将所述链上数据加密传输至链下隐私计算节点。
  25. 根据权利要求21所述的方法,所述客户端处预部署了链下隐私计算调用组件,所述将所述计算结果发送给所述区块链节点,包括:
    调用所述链下隐私计算调用组件将所述计算结果发送给所述区块链节点。
  26. 一种链上数据的链下隐私计算装置,包括:
    链上数据确定单元,使区块链节点根据客户端提交的交易,确定用于隐私计算的链上数据;
    链上数据传输单元,使所述区块链节点将经过加密的所述链上数据传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境;
    计算结果获取单元,使所述区块链节点获取所述链下隐私计算节点在所述链下可信执行环境内生成并加密后反馈的计算结果,并根据所述计算结果更新区块链账本数据。
  27. 一种链上数据的链下隐私计算装置,包括:
    链上数据接收单元,使链下隐私计算节点接收区块链节点传输的经过加密的链上数 据,所述链下隐私计算节点处部署了链下可信执行环境,所述链上数据由所述区块链节点根据客户端提交的交易确定;
    隐私计算执行单元,使所述链下隐私计算节点在所述链下可信执行环境内对所述链上数据执行隐私计算生成计算结果;
    计算结果反馈单元,使所述链下隐私计算节点向所述区块链节点反馈加密后的所述计算结果,所述计算结果用于更新区块链账本数据。
  28. 一种链上数据的链下隐私计算装置,包括:
    交易提交单元,使客户端向区块链节点提交交易,以由所述区块链节点根据所述交易确定用于隐私计算的链上数据;
    链上数据转发单元,使所述客户端在接收到所述区块链节点发送的经过加密的所述链上数据的情况下,将所述链上数据加密传输至链下隐私计算节点,所述链下隐私计算节点处部署了用于对所述链上数据执行隐私计算的链下可信执行环境;
    计算结果转发单元,使所述客户端在接收到所述链下隐私计算节点在所述链下可信执行环境中生成并加密传输的计算结果的情况下,将所述计算结果发送给所述区块链节点,用于更新区块链账本数据。
  29. 一种电子设备,包括:
    处理器;
    用于存储处理器可执行指令的存储器;
    其中,所述处理器被配置为实现如权利要求1-25中任一项所述的方法。
  30. 一种计算机可读存储介质,其上存储有计算机指令,该指令被处理器执行时实现如权利要求1-25中任一项所述方法的步骤。
PCT/CN2021/074245 2020-03-18 2021-01-28 链上数据的链下隐私计算方法及装置 WO2021184975A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202010190874.3 2020-03-18
CN202010190874.3A CN111047450A (zh) 2020-03-18 2020-03-18 链上数据的链下隐私计算方法及装置

Publications (1)

Publication Number Publication Date
WO2021184975A1 true WO2021184975A1 (zh) 2021-09-23

Family

ID=70230874

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/074245 WO2021184975A1 (zh) 2020-03-18 2021-01-28 链上数据的链下隐私计算方法及装置

Country Status (2)

Country Link
CN (1) CN111047450A (zh)
WO (1) WO2021184975A1 (zh)

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113852687A (zh) * 2021-09-24 2021-12-28 成都质数斯达克科技有限公司 一种区块链节点间文件传输方法
CN114338667A (zh) * 2021-12-06 2022-04-12 南京理工大学 辅助工业区块链智能合约的数据预言机架构及其运行方法
CN114422147A (zh) * 2022-01-26 2022-04-29 盟浪可持续数字科技(深圳)有限责任公司 基于区块链的多方安全计算方法
CN114584293A (zh) * 2022-02-28 2022-06-03 同济大学 一种基于TrustZone的区块链智能合约执行系统及方法
CN114679270A (zh) * 2022-05-25 2022-06-28 南湖实验室 一种基于隐私计算的数据跨域加解密方法
CN114826686A (zh) * 2022-03-31 2022-07-29 浙江数秦科技有限公司 基于智能合约的限时加解密方法
CN115065487A (zh) * 2022-08-17 2022-09-16 北京锘崴信息科技有限公司 隐私保护云计算方法、保护金融隐私数据的云计算方法
CN115580414A (zh) * 2022-12-08 2023-01-06 太极计算机股份有限公司 基于隐私计算的数据开放系统及方法
CN116049322A (zh) * 2023-04-03 2023-05-02 安羚科技(杭州)有限公司 基于隐私计算的数据共享平台和方法
WO2023116349A1 (zh) * 2021-12-23 2023-06-29 华为技术有限公司 一种可信证明方法及通信装置
WO2023185044A1 (zh) * 2022-03-31 2023-10-05 蚂蚁区块链科技(上海)有限公司 一种数据处理方法、装置、电子设备和存储介质

Families Citing this family (25)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111047450A (zh) * 2020-03-18 2020-04-21 支付宝(杭州)信息技术有限公司 链上数据的链下隐私计算方法及装置
CN111585994A (zh) * 2020-04-27 2020-08-25 中国银行股份有限公司 一种数据处理方法及系统
CN114268437A (zh) * 2020-09-15 2022-04-01 中国电信股份有限公司 数据处理方法、区块链节点、系统和计算机可读存储介质
CN112272208B (zh) * 2020-09-22 2023-03-31 国网上海市电力公司 安全多方计算方法、电子设备及存储介质
CN112422500B (zh) * 2020-09-25 2023-05-16 北京熠智科技有限公司 跨平台数据传输方法以及装置、存储介质、电子装置
CN111930523A (zh) * 2020-09-28 2020-11-13 支付宝(杭州)信息技术有限公司 一种用于服务集群的负载均衡方法和系统
CN112148801B (zh) * 2020-11-24 2021-02-12 支付宝(杭州)信息技术有限公司 保护数据隐私的多方联合进行业务对象预测的方法及装置
CN112685769A (zh) * 2020-12-25 2021-04-20 联想(北京)有限公司 区块链的数据处理方法、装置及电子设备
CN112765631B (zh) * 2021-01-26 2022-05-24 天津理工大学 一种基于区块链的安全多方计算方法
CN113055376A (zh) * 2021-03-10 2021-06-29 电子科技大学 一种区块链数据保护系统
CN112738280B (zh) * 2021-03-30 2021-07-23 支付宝(杭州)信息技术有限公司 一种用于区块链与链下设备之间的通信方法和装置
CN113221166A (zh) * 2021-05-11 2021-08-06 支付宝(杭州)信息技术有限公司 一种获取区块链数据的方法、装置、电子设备及存储介质
CN113688394B (zh) * 2021-06-07 2023-08-25 重庆大学 安全可信执行环境下的基于区块链的外包计算系统及方法
CN113689296B (zh) * 2021-08-30 2023-11-17 北京泛融科技有限公司 一种异步可信计算的合约调度方法、装置和电子设备
CN113781245B (zh) * 2021-09-10 2023-10-13 杭州宇链科技有限公司 赋能安全生产保险的隐私计算系统及方法
CN113965370B (zh) * 2021-10-19 2023-03-31 深圳市电子商务安全证书管理有限公司 一种数据传输方法、装置、计算机设备及可读存储介质
CN113742764B (zh) * 2021-11-08 2022-04-19 北京中科金财科技股份有限公司 基于区块链的可信数据安全存储方法、检索方法及设备
CN114172958B (zh) * 2021-11-19 2023-10-20 云从科技集团股份有限公司 隐私计算节点、系统、方法、装置以及存储介质
CN114240657A (zh) * 2021-12-15 2022-03-25 杭州趣链科技有限公司 数据处理方法、区块链、终端设备及存储介质
CN114301675A (zh) * 2021-12-28 2022-04-08 杭州趣链科技有限公司 隐私数据交易方法、系统、计算机设备和存储介质
CN115941230A (zh) * 2022-01-11 2023-04-07 浪潮云信息技术股份公司 一种基于区块链保护隐私的监管方法及系统
CN114553436B (zh) * 2022-02-23 2022-11-04 山东省计算中心(国家超级计算济南中心) 用于智能医学工程的数据安全共享与隐私保护方法及系统
CN114710492B (zh) * 2022-03-31 2023-12-22 蚂蚁区块链科技(上海)有限公司 直连通道的建立方法、装置、电子设备和存储介质
CN115277259B (zh) * 2022-09-27 2023-02-28 南湖实验室 一种支持隐私计算持久化数据大规模跨平台迁徙的方法
CN115297119B (zh) * 2022-10-09 2023-02-03 江西信惠链科技有限公司 基于区块链和验证计算的联合征信方法及系统

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109670335A (zh) * 2018-12-20 2019-04-23 众安信息技术服务有限公司 用于在区块链与链外数据之间进行交互的方法及装置
CN110033368A (zh) * 2018-11-30 2019-07-19 阿里巴巴集团控股有限公司 区块链中实现隐私保护的方法
WO2019182219A1 (ko) * 2018-03-21 2019-09-26 (주)유미테크 블록체인기반의 신뢰 네트워크 시스템
CN110520884A (zh) * 2018-12-13 2019-11-29 阿里巴巴集团控股有限公司 基于可信执行环境的链外智能合约服务
CN110851870A (zh) * 2019-11-14 2020-02-28 中国人民解放军国防科技大学 基于可信执行环境的区块链隐私保护方法、系统及介质
CN111047450A (zh) * 2020-03-18 2020-04-21 支付宝(杭州)信息技术有限公司 链上数据的链下隐私计算方法及装置

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CA3061265C (en) * 2019-04-03 2022-03-08 Alibaba Group Holding Limited Processing and storing blockchain data under a trusted execution environment
CN110096551A (zh) * 2019-04-23 2019-08-06 浙江泰链科技有限公司 基于区块链的信用数据存储方法、装置、设备及介质
CN110474903B (zh) * 2019-08-15 2022-04-01 广州蚁比特区块链科技有限公司 可信数据获取方法、装置及区块链节点
CN110619523B (zh) * 2019-09-26 2023-02-14 成都链安科技有限公司 一种区块链智能合约防火墙防护方法及系统
CN110781153B (zh) * 2019-10-30 2020-08-04 中道新职坊科技发展有限公司 基于区块链的跨应用信息共享方法及系统

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2019182219A1 (ko) * 2018-03-21 2019-09-26 (주)유미테크 블록체인기반의 신뢰 네트워크 시스템
CN110033368A (zh) * 2018-11-30 2019-07-19 阿里巴巴集团控股有限公司 区块链中实现隐私保护的方法
CN110520884A (zh) * 2018-12-13 2019-11-29 阿里巴巴集团控股有限公司 基于可信执行环境的链外智能合约服务
CN109670335A (zh) * 2018-12-20 2019-04-23 众安信息技术服务有限公司 用于在区块链与链外数据之间进行交互的方法及装置
CN110851870A (zh) * 2019-11-14 2020-02-28 中国人民解放军国防科技大学 基于可信执行环境的区块链隐私保护方法、系统及介质
CN111047450A (zh) * 2020-03-18 2020-04-21 支付宝(杭州)信息技术有限公司 链上数据的链下隐私计算方法及装置

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113852687A (zh) * 2021-09-24 2021-12-28 成都质数斯达克科技有限公司 一种区块链节点间文件传输方法
CN113852687B (zh) * 2021-09-24 2023-12-01 成都质数斯达克科技有限公司 一种区块链节点间文件传输方法
CN114338667A (zh) * 2021-12-06 2022-04-12 南京理工大学 辅助工业区块链智能合约的数据预言机架构及其运行方法
WO2023116349A1 (zh) * 2021-12-23 2023-06-29 华为技术有限公司 一种可信证明方法及通信装置
CN114422147A (zh) * 2022-01-26 2022-04-29 盟浪可持续数字科技(深圳)有限责任公司 基于区块链的多方安全计算方法
CN114422147B (zh) * 2022-01-26 2022-09-23 盟浪可持续数字科技(深圳)有限责任公司 基于区块链的多方安全计算方法
CN114584293A (zh) * 2022-02-28 2022-06-03 同济大学 一种基于TrustZone的区块链智能合约执行系统及方法
CN114584293B (zh) * 2022-02-28 2024-03-26 同济大学 一种基于TrustZone的区块链智能合约执行系统及方法
CN114826686A (zh) * 2022-03-31 2022-07-29 浙江数秦科技有限公司 基于智能合约的限时加解密方法
CN114826686B (zh) * 2022-03-31 2024-04-05 浙江数秦科技有限公司 基于智能合约的限时加解密方法
WO2023185044A1 (zh) * 2022-03-31 2023-10-05 蚂蚁区块链科技(上海)有限公司 一种数据处理方法、装置、电子设备和存储介质
CN114679270A (zh) * 2022-05-25 2022-06-28 南湖实验室 一种基于隐私计算的数据跨域加解密方法
CN115065487B (zh) * 2022-08-17 2022-12-09 北京锘崴信息科技有限公司 隐私保护云计算方法、保护金融隐私数据的云计算方法
CN115065487A (zh) * 2022-08-17 2022-09-16 北京锘崴信息科技有限公司 隐私保护云计算方法、保护金融隐私数据的云计算方法
CN115580414A (zh) * 2022-12-08 2023-01-06 太极计算机股份有限公司 基于隐私计算的数据开放系统及方法
CN116049322A (zh) * 2023-04-03 2023-05-02 安羚科技(杭州)有限公司 基于隐私计算的数据共享平台和方法

Also Published As

Publication number Publication date
CN111047450A (zh) 2020-04-21

Similar Documents

Publication Publication Date Title
WO2021184975A1 (zh) 链上数据的链下隐私计算方法及装置
WO2021184961A1 (zh) 部署合约的方法及装置
WO2021184970A1 (zh) 调用合约的方法及装置
WO2021184968A1 (zh) 共享集群密钥的方法及装置
WO2021184962A1 (zh) 生成共享合约密钥的方法及装置
WO2021184882A1 (zh) 验证合约的方法及装置
WO2021184973A1 (zh) 访问外部数据的方法及装置
WO2021184963A1 (zh) 调用合约的方法及装置
CN110580418B (zh) 基于区块链账户的隐私数据查询方法及装置
CN110580414B (zh) 基于区块链账户的隐私数据查询方法及装置
WO2021088536A1 (zh) 基于链下授权的隐私数据查询方法及装置
WO2021088548A1 (zh) 基于智能合约的隐私数据查询方法及装置
WO2021103794A1 (zh) 在区块链中实现隐私保护的高效交易方法及装置
CN110580412B (zh) 基于链代码的权限查询配置方法及装置
TWI701929B (zh) 密碼運算、創建工作密鑰的方法、密碼服務平台及設備
CN110580245B (zh) 隐私数据的共享方法及装置
WO2021088535A1 (zh) 基于智能合约的隐私数据查询方法及装置
WO2021088543A1 (zh) 基于智能合约的权限查询配置方法及装置
TW202011712A (zh) 密碼運算、創建工作密鑰的方法、密碼服務平台及設備

Legal Events

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

Ref document number: 21771225

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 21771225

Country of ref document: EP

Kind code of ref document: A1