Privacy contract deployment and calling method based on consensus mechanism and trusted execution environment
By adopting privacy contract deployment and calling methods based on consensus mechanism and trusted execution environment on the blockchain, combined with smart contract set and encryption algorithm, the problem of insufficient data privacy and security in traditional privacy protection data sharing methods is solved. It realizes secure storage and privacy protection of data.
Patent Information
- Application Number
- CN202211137535.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-19
- Publication Date
- 2024-12-27
- Estimated Expiration
- 2042-09-19
AI Technical Summary
Traditional privacy protection data sharing methods based on smart contracts cannot effectively protect private data, and the data download process is prone to leakage of important data, which cannot truly ensure data privacy and security.
Using a privacy contract deployment and calling method based on a consensus mechanism and a trusted execution environment, the encrypted storage, transmission and execution of data is realized through smart contract sets, trusted execution environments and encryption algorithms, ensuring the security of data on the blockchain. and privacy.
It realizes that data availability is invisible, source is confirmed, flow process is traceable, and security risks can be prevented, ensuring data privacy and security, and solving the problems of data leakage and insufficient privacy in traditional methods.
Smart Images

Figure CN115484106B_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of blockchain and privacy computing technology, and in particular to a privacy contract deployment and calling method based on a consensus mechanism and a trusted execution environment. Background Art
[0002] Blockchain has attracted more and more attention due to its characteristics of decentralization, anonymity, information immutability, and openness. However, blockchain accounts are completely transparent and open, which makes it impossible for blockchain to protect some private data and transactions. At the same time, as a new production factor, data faces many problems such as privacy protection during transactions. Privacy-preserving data computing is currently the only key technology that can solve the problem of "data available but invisible", and has also received widespread attention. Without privacy-preserving data computing, blockchain cannot solve the problem of privacy protection and cannot provide services for more data sources; without blockchain, privacy-preserving data computing cannot solve problems such as data rights confirmation, so multi-party data collaboration is difficult to achieve.
[0003] The current privacy-preserving data sharing method based on smart contracts is as follows: after completing the identity authentication based on the smart contract, the data buyer pays the transaction fee and deposit to the smart contract. The data buyer downloads the results from the data storage service provider and supervises them. The use of smart contracts is tamper-proof and traceable. The transaction process is fully recorded on the blockchain and data privacy protection is achieved through supervision of the data owner.
[0004] The traditional privacy-preserving data sharing method based on smart contracts is to use smart contracts for traceability and supervision. The disadvantage is that it not only cannot effectively protect private data, but also the results downloaded by data buyers from data storage service providers are prone to cause important data leakage. Summary of the invention
[0005] In order to solve the above problems, the purpose of the present invention is to provide a privacy contract deployment and calling method based on consensus mechanism and trusted execution environment.
[0006] In order to achieve the above-mentioned purpose, the privacy contract deployment and calling method based on consensus mechanism and trusted execution environment provided by the present invention includes the following steps performed in sequence:
[0007] 1) Write smart contract set SC m , and deployed to each node of the blockchain BC based on the consensus mechanism; the smart contract set SC m Including hardware public key storage contract SC savepk , Remote Proof Storage Contract SC savereport 、Privacy contract storage contract SC saveprivatesmartcontract , Privacy Data Storage Contract SC saveprivatedata, Privacy Data Execution Contract SC dealpriavtedata , Privacy contract execution result storage contract SC savepscresult ;
[0008] 2) Trusted Execution Environment Enclave m Generate a public key PK based on the hardware inherent key HWSK and encryption algorithm HWEA hw and private key SK hw , and the public key PK hw Export; then call the hardware public key storage contract SC savepk The public key PK hw By building transaction records on the blockchain BC;
[0009] 3) Validator USER verify Initiate a remote attestation request and run it in the trusted execution environment Enclave m The algorithm Func in attestion Get the current trusted execution environment Enclave m Code Metrics code , and use the signature algorithm Signature to use the trusted execution environment Enclave m The private key SK hw Metrics for code code Sign and generate a signature SIGN attestion , and then code metrics code and SIGN attestion Generate a remote proof report through serialization protocol protocol serialization attestion ; Then the verifier USER verify Run the VerifySignature algorithm to verify the signature SIGN attestion Perform legitimacy verification. If the verification fails, it indicates that the remote attestation process has failed. If the verification passes, the verifier USER verify Run the remote attestation verification algorithm VerifyAttestation for verification and check code metrics code Specific information to verify the trusted execution environment Enclave m Whether the running program in the test is as expected. If the verification fails, it indicates that the remote attestation process has failed. If the verification passes, it indicates that the remote attestation has succeeded.
[0010] 4) Call the smart contract set SC m Remote proof storage contract SC in savereport The above code contains metrics code and SIGN attestionAnd the remote proof Report generated by serialization protocol protocol attestion By building transaction records on the blockchain BC;
[0011] 5) Smart contract provider USER scprovide Initiate deployment of privacy contract request, privacy data execution contract SC dealpriavtedata Audit and scan through the audit algorithm audit. If it fails the audit scan, it proves that the privacy data executes the contract SC dealpriavtedata If there is a security risk, the deployment of the privacy contract request process ends; if the audit scan passes, the privacy data execution contract SC dealpriavtedata Send to the Trusted Execution Environment Enclave m Smart contract virtual machine VM smartcontract Initialize in the trusted execution environment Enclave m Export through the privacy contract data export algorithm privatedata Export privacy contract data smartcontract , and then the above privacy contract data Data smartcontract Enclave m The public key PK hw Encryption is performed using the encryption algorithm DEEA to generate the encrypted privacy contract data EncryptionData sc ;Finally, the encrypted privacy contract data EncryptionData sc By calling the privacy contract storage contract SC saveprivatesmartcontract Deposit the evidence in blockchain BC;
[0012] 6) Privacy data provider USER pdprovide Generate encryption key Key through encryption algorithm PDEA pd , and then encrypt the private data privatedata with the above encryption key Key pd The encryption algorithm KPEA is used to encrypt the private data to generate the ciphertext encryptiondata, and then the encryption key Key pd Enclave m The public key PK hw Encryption is performed using the encryption algorithm KEEA to generate the encrypted key EncryptionKey Pd , call the privacy data storage contract SC saveprivatedata The above private data ciphertext encryptiondata and the encrypted key EncryptionKey Pd By building transaction records on the blockchain BC;
[0013] 7) USER, the party that needs privacy data pdwanted Initiate a call to the privacy contract request and search for the encrypted privacy contract data EncryptionData required for the call to the privacy contract request from the blockchain BC sc , private data ciphertext encryptiondata and encrypted key EncryptionKey Pd , and then use the encrypted privacy contract data EncryptionData sc , private data ciphertext encryptiondata and encrypted key EncryptionKey Pd Passing to the Trusted Execution Environment Enclave m Then the encrypted key EncryptionKey Pd Enclave m The private key SK hw Call the decryption algorithm KEDA to decrypt and obtain the encryption key Key pd , encrypt the private data encrypteddata with the above encryption key Key pd Call the decryption algorithm KPDA to decrypt and obtain the private data privatedata, and then use the encrypted private contract data EncryptionData sc Enclave m The private key SK hw Call the decryption algorithm DEDA to decrypt and obtain the privacy contract data Data smartcontract , and then the privacy contract data smartcontract And private data privatedata is passed to the trusted execution environment Enclave m Smart contract virtual machine VM smartcontract Execute in and get the execution result Result psc , and use the signature algorithm Signature to use the trusted execution environment Enclave m The private key SK hw Execution Result psc Sign and generate a signature SIGN pscresult , and then call the privacy contract execution result storage contract SC savepscresult The above execution results Result psc and SIGN pscresult By building transaction records on the blockchain BC;
[0014] 8) USER, the party that needs private data pdwantedGet the above execution result from the blockchain BC psc and SIGN pscresult , run the signature verification algorithm VerifySignature on the signature SIGN pscresult Perform legality verification. If the verification fails, it indicates that the execution result is unreliable; if the verification passes, it indicates that the execution result is Result psc The execution result can be trusted.
[0015] In step 2), the public key PK hw and private key SK hw The generation formula is:
[0016] PK hw , S.K. hw =HWEA(HWSK)
[0017] The steps of constructing a transaction are:
[0018] Tx1=VM(address(SC savepk ), PK hw ).
[0019] In step 3), the algorithm Func attestion The specific logic is:
[0020] Metrics code =Func attestion (Enclave m , S.K. hw )
[0021] The specific logic of the signature algorithm Signature is:
[0022] SIGN attestion =Signature(Metrics code , S.K. hw )
[0023] The serialization protocol protocol is:
[0024] Report attestion =protocol(Metrics code , SIGN attestion )
[0025] The specific logic of the VerifySignature verification algorithm is:
[0026] Result i =VerifySignature(SIGN attestion , PKhw )
[0027] The specific logic of the remote attestation verification algorithm VerifyAttestion is:
[0028] Result j =VerifyAttestation(Metrics code , Enclave m ).
[0029] In step 4), the steps of constructing a transaction are:
[0030] Tx2=VM(address(SC savereport ), protocol(Metrics code , SIGN attestion )).
[0031] In step 5), the specific logic of the audit algorithm audit is:
[0032] Result m =audit(SC dealpriavtedata )
[0033] The privacy contract data export algorithm Export privatedata The specific logic is:
[0034] Data smartcontract =Export privatedata (SC dealpriavtedata , VM smartcontract )
[0035] The specific logic of the encryption algorithm DEEA is:
[0036] EncryptionData sc =DEEA(Data smartcontract , PK hw )
[0037] The steps of constructing a transaction are:
[0038] Tx3=VM(address(SC saveprivatesmartcontract ), EncryptionData sc ).
[0039] In step 6), the specific logic of the encryption algorithm KPEA is:
[0040] encryptiondata=KPEA(privatedata,Key pd )
[0041] The specific logic of the encryption algorithm KEEA is:
[0042] EncryptionKey Pd =KEEA(Key pd , PK hw )
[0043] The steps of constructing a transaction are:
[0044] Tx4=VM(address(SC saveprivatedata ), encryptiondata, EncryptionKey Pd ).
[0045] In step 7), the specific logic of the decryption algorithm KEDA is:
[0046] Key pd =KEDA(EncryptionKey Pd , S.K. hw )
[0047] The specific logic of the decryption algorithm KPDA is:
[0048] privatedata=KPDA(encryptiondata,Key pd )
[0049] The specific logic of the decryption algorithm DEDA is:
[0050] Data smartcontract =DEDA(EncryptionData sc , S.K. hw )
[0051] The privacy contract data smartcontract And private data privatedata is passed to the trusted execution environment Enclave m Smart contract virtual machine VM smartcontract The steps performed in are:
[0052] Result psc =Enclave m (VM smartcontract (Data smartcontract , privatedata))
[0053] The specific logic of the signature algorithm is:
[0054] SIGN pscresult=Signature(Result psc , S.K. hw )
[0055] The steps of constructing a transaction are:
[0056] Tx5=VM(address(SC savepscresult ), protocol(Result psc , SIGN pscresult ))
[0057] In step 8), the specific logic of the signature verification algorithm VerifySignature is:
[0058] Result n =VerifySignature(SIGN pscresult , PK hw )
[0059] The privacy contract deployment and calling method provided by the present invention based on consensus mechanism and trusted execution environment has the following beneficial effects: combining blockchain with the trusted execution environment in the privacy computing scheme, solving the problem that traditional privacy protection data sharing methods cannot truly guarantee data privacy, achieving data availability but not visibility, and realizing the purpose of confirming the source of data, defining the scope of use, traceable the circulation process, and preventing security risks. BRIEF DESCRIPTION OF THE DRAWINGS
[0060] Figure 1 A flow chart of the privacy contract deployment and calling method based on the consensus mechanism and trusted execution environment provided by the present invention. DETAILED DESCRIPTION
[0061] The present invention is described in detail below with reference to the accompanying drawings and specific embodiments.
[0062] like Figure 1 As shown, the privacy contract deployment and calling method based on consensus mechanism and trusted execution environment provided by the present invention includes the following steps performed in sequence:
[0063] 1) Write smart contract set SC m , and deployed to each node of the blockchain BC based on the consensus mechanism; the smart contract set SC m Including hardware public key storage contract SC savepk , Remote Proof Storage Contract SC savereport 、Privacy contract storage contract SC saveprivatesmartcontract , Privacy Data Storage Contract SC saveprivatedata , Privacy Data Execution Contract SC dealpriavtedata , Privacy contract execution result storage contract SCsavepscresult ;
[0064] 2) Trusted Execution Environment Enclave m Generate a public key PK based on the hardware inherent key HWSK and encryption algorithm HWEA hw and private key SK hw , and the public key PK hw Export; then call the hardware public key storage contract SC savepk The public key PK hw By building transaction records on the blockchain BC;
[0065] The public key PK hw and private key SK hw The generation formula is:
[0066] PK hw , S.K. hw =HWEA(HWSK)
[0067] The steps of constructing a transaction are:
[0068] Tx1=VM(address(SC savepk ), PK hw )
[0069] 3) Validator USER verify Initiate a remote attestation request and run it in the trusted execution environment Enclave m The algorithm Func in attestion Get the current trusted execution environment Enclave m Code Metrics code , and use the signature algorithm Signature to use the trusted execution environment Enclave m The private key SK hw Metrics for code code Sign and generate a signature SIGN attestion , and then code metrics code and SIGN attestion Generate a remote proof report through serialization protocol protocol serialization attestion ; Then the verifier USER verify Run the VerifySignature algorithm to verify the signature SIGN attestion Perform legitimacy verification. If the verification fails, it indicates that the remote attestation process has failed. If the verification passes, the verifier USER verify Run the remote attestation verification algorithm VerifyAttestation for verification and check code metrics codeSpecific information to verify the trusted execution environment Enclave m Whether the running program in the test is as expected. If the verification fails, it indicates that the remote attestation process has failed. If the verification passes, it indicates that the remote attestation has succeeded.
[0070] The algorithm Func attestion The specific logic is:
[0071] Metrics code =Func attestion (Enclave m , S.K. hw )
[0072] The specific logic of the signature algorithm Signature is:
[0073] SIGN attestion =Signature(Metrics code , S.K. hw )
[0074] The serialization protocol protocol is:
[0075] Report attestion =protocol(Metrics code , SIGN attestion )
[0076] The specific logic of the VerifySignature verification algorithm is:
[0077] Result i =VerifySignature(SIGN attestion , PK hw )
[0078] The specific logic of the remote attestation verification algorithm VerifyAttestion is:
[0079] Result j =VerifyAttestation(Metrics code , Enclave m )
[0080] 4) Call the smart contract set SC m Remote proof storage contract SC in savereport The above code contains metrics code and SIGN attestion And the remote proof Report generated by serialization protocol protocol attestionBy building transaction records on the blockchain BC;
[0081] The steps of constructing a transaction are:
[0082] Tx2=VM(address(SC savereport ), protocol(Metrics code , SIGN attestion ))
[0083] 5) Smart contract provider USER scprovide Initiate deployment of privacy contract request, privacy data execution contract SC dealpriavtedata Audit and scan through the audit algorithm audit. If it fails the audit scan, it proves that the privacy data executes the contract SC dealpriavtedata If there is a security risk, the deployment of the privacy contract request process ends; if the audit scan passes, the privacy data execution contract SC dealpriavtedata Send to the Trusted Execution Environment Enclave m Smart contract virtual machine VM smartcontract Initialize in the trusted execution environment Enclave m Export through the privacy contract data export algorithm privatedata Export privacy contract data smartcontract , and then the above privacy contract data Data smartcontract Enclave m The public key PK hw Encryption is performed using the encryption algorithm DEEA to generate the encrypted privacy contract data EncryptionData sc ;Finally, the encrypted privacy contract data EncryptionData sc By calling the privacy contract storage contract SC saveprivatesmartcontract Deposit the evidence in blockchain BC;
[0084] The specific logic of the audit algorithm audit is:
[0085] Result m =audit(SC dealpriavtedata )
[0086] The privacy contract data export algorithm Export privatedata The specific logic is:
[0087] Data smartcontract =Export privatedata (SC dealpriavtedata , VM smartcontract )
[0088] The specific logic of the encryption algorithm DEEA is:
[0089] EncryptionData sc =DEEA(Data smartcontract , PK hw )
[0090] The steps of constructing a transaction are:
[0091] Tx3=VM(address(SC saveprivatesmartcontract ), EncryptionData sc )
[0092] 6) Privacy data provider USER pdprovide Generate encryption key Key through encryption algorithm PDEA pd , and then encrypt the private data privatedata with the above encryption key Key pd The encryption algorithm KPEA is used to encrypt the private data to generate the ciphertext encryptiondata, and then the encryption key Key pd Enclave m The public key PK hw Encryption is performed using the encryption algorithm KEEA to generate the encrypted key EncryptionKey Pd , call the privacy data storage contract SC saveprivatedata The above private data ciphertext encryptiondata and the encrypted key EncryptionKey Pd By building transaction records on the blockchain BC;
[0093] The specific logic of the encryption algorithm KPEA is:
[0094] encryptiondata=KPEA(privatedata,Key pd )
[0095] The specific logic of the encryption algorithm KEEA is:
[0096] EncryptionKey Pd =KEEA(Key pd , PK hw )
[0097] The steps of constructing a transaction are:
[0098] Tx4=VM(address(SC saveprivatedata ), encryptiondata, EncryptionKeyPd )
[0099] 7) USER, the party that needs privacy data pdwanted Initiate a call to the privacy contract request and search for the encrypted privacy contract data EncryptionData required for the call to the privacy contract request from the blockchain BC sc , private data ciphertext encryptiondata and encrypted key EncryptionKey Pd , and then use the encrypted privacy contract data EncryptionData sc , private data ciphertext encryptiondata and encrypted key EncryptionKey Pd Passing to the Trusted Execution Environment Enclave m Then the encrypted key EncryptionKey Pd Enclave m The private key SK hw Call the decryption algorithm KEDA to decrypt and obtain the encryption key Key pd , encrypt the private data encrypteddata with the above encryption key Key pd Call the decryption algorithm KPDA to decrypt and obtain the private data privatedata, and then use the encrypted private contract data EncryptionData sc Enclave m The private key SK hw Call the decryption algorithm DEDA to decrypt and obtain the privacy contract data Data smartcontract , and then the privacy contract data smartcontract And private data privatedata is passed to the trusted execution environment Enclave m Smart contract virtual machine VM smartcontract Execute in and get the execution result Result psc , and use the signature algorithm Signature to use the trusted execution environment Enclave m The private key SK hw Execution Result psc Sign and generate a signature SIGN pscresult , and then call the privacy contract execution result storage contract SC savepscresult The above execution results Result psc and SIGN pscresult By building transaction records on the blockchain BC;
[0100] The specific logic of the decryption algorithm KEDA is:
[0101] Key pd =KEDA(EncryptionKey Pd , S.K. hw )
[0102] The specific logic of the decryption algorithm KPDA is:
[0103] privatedata=KPDA(encryptiondata,Key pd )
[0104] The specific logic of the decryption algorithm DEDA is:
[0105] Data smartcontract =DEDA(EncryptionData sc , S.K. hw )
[0106] The privacy contract data smartcontract And private data privatedata is passed to the trusted execution environment Enclave m Smart contract virtual machine VM smartcontract The steps performed in are:
[0107] Result psc =Enclave m (VM smartcontract (Data smartcontract , privatedata))
[0108] The specific logic of the signature algorithm is:
[0109] SIGN pscresult =Signature(Result psc , S.K. hw )
[0110] The steps of constructing a transaction are:
[0111] Tx5=VM(address(SC savepscresult ), protocol(Result psc , SIGN pscresult ))
[0112] 8) USER, the party that needs private data pdwanted Get the above execution result from the blockchain BC psc and SIGN pscresult , run the signature verification algorithm VerifySignature on the signature SIGNpscresult Perform legality verification. If the verification fails, it indicates that the execution result is unreliable; if the verification passes, it indicates that the execution result is Result psc The execution result can be trusted.
[0113] The specific logic of the VerifySignature verification algorithm is:
[0114] Result n =VerifySignature(SIGN pscresult , PK hw ).
Claims
1. A privacy contract deployment and calling method based on consensus mechanism and trusted execution environment, characterized by: The method comprises the following steps performed in sequence: 1) Write smart contract set SC m , and deployed to each node of the blockchain BC based on the consensus mechanism; the smart contract set SC m Including hardware public key storage contract SC savepk , Remote Proof Storage Contract SC savereport 、Privacy contract storage contract SC saveprivatesmartcontract , Privacy Data Storage Contract SC saveprivatedata , Privacy Data Execution Contract SC dealpriavtedata , Privacy contract execution result storage contract SC savepscresult ; 2) Trusted Execution Environment Enclave m Generate a public key PK based on the hardware inherent key HWSK and encryption algorithm HWEA hw and private key SK hw , and the public key PK hw Export; then call the hardware public key storage contract SC savepk The public key PK hw By building transaction records on the blockchain BC; 3) USER verify Initiate a remote attestation request and run it in the trusted execution environment Enclave m The algorithm Func in attestion Get the current trusted execution environment Enclave m Code Metrics code , and use the signature algorithm Signature to use the trusted execution environment Enclave m The private key SK hw Metrics for code code Sign and generate a signature SIGN attestion , and then code metrics code and SIGN attestion Generate a remote proof report through serialization protocol protocol serialization attestion ; Then the verifier USER verify Run the VerifySignature algorithm to verify the signature SIGN attestion Perform legitimacy verification. If the verification fails, it indicates that the remote attestation process has failed. If the verification passes, the verifier USER verify Run the remote attestation verification algorithm VerifyAttestation for verification and check code metrics code Specific information to verify the trusted execution environment Enclave m Whether the running program in the test is as expected. If the verification fails, it indicates that the remote attestation process has failed. If the verification passes, it indicates that the remote attestation has succeeded. 4) Call the smart contract set SC m Remote proof storage contract SC in savereport The above code contains metrics code and SIGN attestion And the remote proof Report generated by serialization protocol protocol attestion By building transaction records on the blockchain BC; 5) Smart contract provider USER scprovide Initiate deployment of privacy contract request, privacy data execution contract SC dealpriavtedata Audit and scan through the audit algorithm audit. If it fails the audit scan, it proves that the privacy data executes the contract SC dealpriavtedata If there is a security risk, the deployment of the privacy contract request process ends; if the audit scan passes, the privacy data execution contract SC dealpriavtedata Send to the Trusted Execution Environment Enclave m Smart contract virtual machine VM smartcontract Initialize in the trusted execution environment Enclave m Export through the privacy contract data export algorithm privatedata Export privacy contract data smartcontract , and then the above privacy contract data Data smartcontract Enclave m The public key PK hw Encryption is performed using the encryption algorithm DEEA to generate the encrypted privacy contract data EncryptionData sc ;Finally, the encrypted privacy contract data EncryptionData sc By calling the privacy contract storage contract SC saveprivatesmartcontract Deposit the evidence in blockchain BC; 6) Privacy data provider USER pdprovide Generate encryption key Key through encryption algorithm PDEA pd , and then encrypt the private data privatedata with the above encryption key Key pd The encryption algorithm KPEA is used to encrypt the private data to generate the ciphertext encryptiondata, and then the encryption key Key pd Enclave m The public key PK hw Encryption is performed using the encryption algorithm KEEA to generate the encrypted key EncryptionKey Pd , call the privacy data storage contract SC saveprivatedata The above private data ciphertext encryptiondata and the encrypted key EncryptionKey Pd By building transaction records on the blockchain BC; 7) USER, the party that needs privacy data pdwanted Initiate a call to the privacy contract request and search for the encrypted privacy contract data EncryptionData required for the call to the privacy contract request from the blockchain BC sc , private data ciphertext encryptiondata and encrypted key EncryptionKey Pd , and then use the encrypted privacy contract data EncryptionData sc , private data ciphertext encryptiondata and encrypted key EncryptionKey Pd Passing to the Trusted Execution Environment Enclave m Then the encrypted key EncryptionKey Pd Enclave m The private key SK hw Call the decryption algorithm KEDA to decrypt and obtain the encryption key Key pd , encrypt the private data encrypteddata with the above encryption key Key pd Call the decryption algorithm KPDA to decrypt and obtain the private data privatedata, and then use the encrypted private contract data EncryptionData sc Enclave m The private key SK hw Call the decryption algorithm DEDA to decrypt and obtain the privacy contract data Data smartcontract , and then the privacy contract data smartcontract And private data privatedata is passed to the trusted execution environment Enclave m Smart contract virtual machine VM smartcontract Execute in and get the execution result Result psc , and use the signature algorithm Signature to use the trusted execution environment Enclave m The private key SK hw Execution result psc Sign and generate a signature SIGN pscresult , and then call the privacy contract execution result storage contract SC savepscresult The above execution results Result psc and SIGN pscresult By building transaction records on the blockchain BC; 8) USER, the party that needs private data pdwanted Get the above execution result from the blockchain BC psc and SIGN pscresult , run the signature verification algorithm VerifySignature on the signature SIGN pscresult Perform legality verification. If the verification fails, it means that the execution result is unreliable. If the verification passes, it indicates the execution result. psc The execution result can be trusted.
2. The privacy contract deployment and calling method based on consensus mechanism and trusted execution environment according to claim 1 is characterized in that: In step 2), the public key PK hw and private key SK hw The formula for generating is: PK hw ,SK hw =HWEA(HWSK) The steps of constructing a transaction are: Tx1=VM(address(SC savepk ),PK hw )。 3. The privacy contract deployment and calling method based on consensus mechanism and trusted execution environment according to claim 1 is characterized in that: In step 3), the algorithm Func attestion The specific logic is: Metrics code =Func attestion (Enclave m ,SK hw ) The specific logic of the signature algorithm Signature is: SIGN attestion =Signature(Metrics code ,SK hw ) The serialization protocol protocol is: Report attestion =protocol(Metrics code ,SIGN attestion ) The specific logic of the VerifySignature verification algorithm is: Result i =VerifySignature(SIGN attestion ,PK hw ) The specific logic of the remote attestation verification algorithm VerifyAttestion is: Result j =VerifyAttestion(Metrics code ,Enclave m )。 4. The privacy contract deployment and calling method based on consensus mechanism and trusted execution environment according to claim 1 is characterized in that: In step 4), the steps of constructing a transaction are: Tx2=VM(address(SC savereport ),protocol(Metrics code ,SIGN attestion ))。 5. The privacy contract deployment and calling method based on consensus mechanism and trusted execution environment according to claim 1 is characterized in that: In step 5), the specific logic of the audit algorithm audit is: Result m =audit(SC dealpriavtedata ) The privacy contract data export algorithm Export privatedata The specific logic is: Data smartcontract =Export privatedata (SC dealpriavtedata ,VM smartcontract ) The specific logic of the encryption algorithm DEEA is: EncryptionData sc =DEEA(Date smartcontract ,PK hw ) The steps of constructing a transaction are: Tx s =VM(address(SC saveprivatesmartcontract ),EncryptionData sc )。 6. The privacy contract deployment and calling method based on consensus mechanism and trusted execution environment according to claim 1 is characterized in that: In step 6), the specific logic of the encryption algorithm KPEA is: encryptiondata=KPEA(privatedata,Key pd ) The specific logic of the encryption algorithm KEEA is: EncryptionKey Pd =KEEA(Key pd ,PK hw ) The steps of constructing a transaction are: Tx4=VM(address(SC saveprivatedata ),encryptiondata,EncryptionKey Pd )。 7. The privacy contract deployment and calling method based on consensus mechanism and trusted execution environment according to claim 1 is characterized in that: In step 7), the specific logic of the decryption algorithm KEDA is: Key pd =KEDA(EncryptionKey Pd ,SK hw ) The specific logic of the decryption algorithm KPDA is: privatedata=KPDA(encryptiondata,Key pd ) The specific logic of the decryption algorithm DEDA is: Data smartcontract =DEDA(EncryptionData sc ,SK hw ) The privacy contract data smartcontract And private data privatedata is passed to the trusted execution environment Enclave m Smart contract virtual machine VM smartcontract The steps performed in are: Result psc =Enclave m (VM smartcontract (Data smartcontract ,privatedata)) The specific logic of the signature algorithm is: SIGN pscresult =Signature(Result psc ,SK hw ) The steps of constructing a transaction are: Tx5=VM(address(SC savepscresult ),protocol(Result psc ,SIGN pscresult ))。 8. The privacy contract deployment and calling method based on consensus mechanism and trusted execution environment according to claim 1 is characterized by: In step 8), the specific logic of the signature verification algorithm VerifySignature is: Result n =VerifySignature(SIGN pscresult ,PK hw )。