CN112527893B - Safe and efficient cross-chain service operation method and system based on SGX - Google Patents
Safe and efficient cross-chain service operation method and system based on SGX Download PDFInfo
- Publication number
- CN112527893B CN112527893B CN202011347882.0A CN202011347882A CN112527893B CN 112527893 B CN112527893 B CN 112527893B CN 202011347882 A CN202011347882 A CN 202011347882A CN 112527893 B CN112527893 B CN 112527893B
- Authority
- CN
- China
- Prior art keywords
- chain
- cross
- account
- transaction
- block
- Prior art date
- Legal status (The legal status 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 status listed.)
- Active
Links
- 238000000034 method Methods 0.000 title claims abstract description 21
- 239000003999 initiator Substances 0.000 claims abstract description 4
- 238000012546 transfer Methods 0.000 claims description 83
- 238000012795 verification Methods 0.000 claims description 56
- 238000010276 construction Methods 0.000 claims description 6
- 238000012545 processing Methods 0.000 claims description 3
- 238000011017 operating method Methods 0.000 claims 1
- 238000006243 chemical reaction Methods 0.000 abstract description 4
- 238000012790 confirmation Methods 0.000 description 3
- 238000010586 diagram Methods 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000002747 voluntary effect Effects 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/27—Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F21/00—Security arrangements for protecting computers, components thereof, programs or data against unauthorised activity
- G06F21/60—Protecting data
- G06F21/602—Providing cryptographic facilities or services
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION 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/00—Finance; Insurance; Tax strategies; Processing of corporate or income taxes
- G06Q40/04—Trading; Exchange, e.g. stocks, commodities, derivatives or currency exchange
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Physics & Mathematics (AREA)
- Business, Economics & Management (AREA)
- Accounting & Taxation (AREA)
- Databases & Information Systems (AREA)
- Finance (AREA)
- General Engineering & Computer Science (AREA)
- Economics (AREA)
- General Business, Economics & Management (AREA)
- Development Economics (AREA)
- Computing Systems (AREA)
- Marketing (AREA)
- Strategic Management (AREA)
- Technology Law (AREA)
- Data Mining & Analysis (AREA)
- Health & Medical Sciences (AREA)
- Bioethics (AREA)
- General Health & Medical Sciences (AREA)
- Computer Hardware Design (AREA)
- Computer Security & Cryptography (AREA)
- Software Systems (AREA)
- Financial Or Insurance-Related Operations Such As Payment And Settlement (AREA)
Abstract
The invention discloses a safe and efficient cross-chain service operation method and system based on SGX, wherein the system comprises the following steps: a first cross-chain operator completes the safety calculation of different block chain data in the SGX through a cross-chain calculation module; a plurality of cross-chain operation initiator terminals complete the exchange of digital assets on different block chains through an atomic transaction unit; and a single cross-chain operator uploads the related parameters through the broadcasting unit to complete the conversion of the digital assets on different blockchains. The invention constructs a safe and efficient cross-chain service operating system based on the SGX, realizes the conversion of digital assets of different block chains and the safe calculation and exchange of block chain data, ensures the privacy of the data, and improves the practicability and efficiency of cross-chain transaction service.
Description
Technical Field
The invention relates to the field of block chains, in particular to a safe and efficient cross-chain operation method and system based on SGX.
Background
With the rapid development of these blockchain systems, "interoperability" between chains becomes an urgent problem to be solved in the future extended blockchain application field, and the related scenarios include, but are not limited to, cross-chain transactions, cross-chain information interaction, cross-chain computation, and the like. Meanwhile, how to protect the privacy of blockchain users by calling a plurality of blockchain data during the chain interoperation is also one of the problems that needs to be solved urgently.
In order to solve the problems, the existing platforms of the cross-chain platform are used as an intermediate party, a user firstly converts part of assets and the cross-chain platform to obtain digital currency of the cross-chain platform, and then the digital currency of the cross-chain platform is used for exchanging the assets on other block chains required by the user. These cross-chain platforms may receive a profit by charging a percentage of the transaction commission. However, most of the existing platforms only meet the atomic transaction service in the cross-chain transaction, and cannot meet the further operation requirements of users.
Therefore, there is a need in the industry to develop a safe and efficient cross-chain service operating system that can provide multiple cross-chain services such as cross-chain computation and cross-chain transaction and realize privacy protection.
Disclosure of Invention
The invention aims to overcome the defects in the prior art, and provides a safe and efficient cross-chain operation method and system based on SGX, which are used for realizing multiple cross-chain services such as cross-chain calculation and cross-chain transaction and realizing privacy protection.
The invention is realized by the following scheme:
a safe and efficient cross-chain operation method based on SGX comprises the following steps:
s1, the first cross-link operator uploads the encrypted data to be calculated and the contract function for obtaining the encrypted data to each block chain by using an intelligent contract and an SGX public key through constructing a transaction, and simultaneously, transfers certain digital assets to be transacted to the transaction account of each block chain.
Prior to step S1, the data is encrypted according to equation (1):
wherein, the PKSGx is a hardware public key of the SGX, a corresponding private key of the hardware public key can only be used in the SGX, and the private key cannot be directly obtained outside; the data is data which needs to be calculated by a first cross-chain operator and is recorded in each block chain, and Enc is encryption operation.
S2, when the first cross-chain operator executes the cross-chain transaction operation, uploading the first preset parameter to the cross-chain intelligent Contract ContracttransferIn cross-chain intelligent Contract ContracttransferIn-construction transaction txid1Forwarding the digital assets with the first predetermined amount to the relay accountrelay1And will trade txid1Upload to Block chain Blockin1;
Second cross-chain operator acquisition includes transaction txid1Block id of1Constructing a transaction txid2I.e. call ContractatomThe verification function verify in (1) obtains account1′,account2', verify if it is the account number of the second cross-link operator; if the verification is successful, forwarding the digital assets with the second preset money amount to the relay accountrelay2And will construct a transaction txid2Upload to Block chain Block id2Performing the following steps; obtaining Block id1Block id2Transaction txid1And transaction txid2Verification Block id1Whether or not to include transaction txid1Verification of Block id2Whether or not to include transaction txid2If yes, relay account is addedrelay1The digital assets in (1) are transferred to the account of the second cross-chain operator1′In, account accounting of relayrelay2The digital assets in (1) are transferred to the account of the first cross-link operator2Performing the following steps; the parameters required by uploading the cross-chain task type and the operation comprise the cross-chain task type and the blockchain type blockchain of transactions1,blockchain2Corresponding account number on the block chain to be exchanged1,account2Digital asset amount value, redemption rate and account of the second cross-chain operator1′,account2′(ii) a If the cross-chain task type is atom transaction, the account of the second cross-chain operator1′,account2′Is the account number of the specified second cross-chain operator and is uploaded to the cross-chain intelligent Contract Contract by the first cross-chain operatortransferIf the cross-link task type is broadcast transaction, the account of the second cross-link operator1′,account2′Waiting for the second cross-link operator to count the account number of the second cross-link operator by the first cross-link operator1′,account2′Upload to Cross-chain Intelligent Contract Contracttransfer。
Step S2 specifically includes:
s201, obtaining a first cross-chain operationAuthor uploaded block chain type blockchain1,blockchain2Calling corresponding RPC to connect the system with each block chain; if the cross-link task type is atom transaction, go to step S202; if the cross-link task type is broadcastransaction, executing step S203;
s202, according to the account corresponding to the block chain to be exchanged1,account2Value of digital asset, exchange rate, accountrelay1And account of the second inter-chain operator1′,account2Constructing a cross-chain intelligent Contract ContracttransferAnd uploading to the blockchain in the form of transaction;
s203, waiting for the second cross-link operator to count the account number of the second cross-link operator1′,account2′After uploading, according to the account number account corresponding to the block chain to be exchanged1,account2Value of digital asset, exchange rate, accountrelay1And account of the second inter-chain operator1′,account2′Constructing a cross-chain intelligent Contract ContracttransferAnd uploading to a blockchain in a transaction form;
in which a cross-chain intelligent Contract Contract is constructedtransferThe steps are as follows:
calculating the converted digital asset amount using equation (2):
value‘=value*rate (2)
the structure belongs to block chain1Transaction tx ofid1With the first inter-chain operator account1As input address, accountrelay1Transferring the digital asset with the value amount from the input address to the output address as the output address;
at the same time, account of the first cross-chain operator2Recording the account of the first cross-link operator in the data field of the intelligent contract2As an output address for receiving a slave blockchain2Relay account ofrelay2The forwarded digital asset worth value' is.
Wherein,step S203 specifically includes: constructing transactions, i.e. to be smart contracts ContracttransferDeployment into a blockchain; second cross-chain operator calls intelligent Contract ContracttransferWill blockchain1,blockchain2Corresponding account1′,account2′Recorded into the data field of the smart contract.
S204, the first cross-chain operator broadcasts a Contract containing the intelligent Contract ContracttransferThe block chain block id';
s205, the second cross-chain operator obtains the blockchain type blockchain of the transaction uploaded by the first cross-chain operator1,blockchain2Connecting each block chain by using corresponding RPC;
s206, the second cross-chain operator obtains the block id' to verify the intelligent Contract ContracttransferWhether or not it is contained in the chunk id' and the smart Contract ContracttransferIf the content is correctly constructed, the verification process is as follows:
obtaining Block data Block according to the Block id', and inquiring the intelligent Contract ContracttransferWhether the verification exists or not is judged, and if not, the verification is terminated; and if so, continuing the subsequent verification: calling ContracttransferObtaining Contracttransfer.value′,ContracttransferValue and Contracttransfer.rate;
If the cross-chain transaction type is atom transaction, verifying whether the recorded value is correct through formula (3):
Contracttransfer.value′==Contracttransfer.value*Contracttransfer.rate;(3)
if the formula (3) is established, if not, terminating the verification; the verification passes and continues with the subsequent verification: calling ContracttransferObtaining Contracttransfer.account2′、Contracttransfer.account1′,account2′、account1′Verifying that the account used by the cross-chain operator is correct by equation (4):
(Contracttransfer.account1′==account1′)&(Contracttransfer.account2′==account2′); (4)
if the verification fails, the transaction is terminated; if the verification is passed, determining that the structure is correct;
if the cross-link transaction type is broadcast transaction, verifying whether the recorded value is correct through formula (5):
Contracttransfer.value′==Contracttransfer.value*Contracttransfer.rate;(5)
if the formula (5) is true, the verification is passed, and the step S207 is continuously executed, otherwise, the verification is terminated;
s207, utilizing different block chain accounts account uploaded by a second cross-chain operator1′,account2Invoking Intelligent Contract ContracttransferThe following operations are performed:
the structure belongs to blockchain2Transaction tx ofid2With account of the second inter-chain operator2′As input address, accountrelay2Transferring the digital asset with the value' from the input address to the output address as the output address;
at the same time, account of the second cross-chain operator2′Recorded in a data field of the smart contract as a receiving slave system-specified blockchain1Relay account ofrelay1The forwarded value is the public key address of the value's digital asset.
S208, obtaining the block id1Block id2Transaction txid1And transaction txid2To verify the transaction txid1Whether or not to be contained in blockchain1Block id of1And transaction txid2Whether or not to be contained in blockchain2Block id of2If the verification is passed, continuing the subsequent operation;
s209, constructing the block chain1Transaction tx ofid3By accountrelay1As input address, account1′Transferring value from the input address as the output addressDigital assets to output addresses;
s210, constructing and belonging to blockchain2Transaction tx ofid4With accountrelay2As input address, account2′Transferring the digital asset with the value' from the input address to the output address as the output address;
s211, transacting txid3,txid4Record to Block chain1,blockchain2After that, the atomic transaction is completed.
S3, when the chain crossing operator needs to execute the chain crossing calculation operation, uploading the second preset parameter to a chain crossing intelligent Contract ContractccomputationIn the meantime, the transaction tx is constructed by using the second preset parameter1,...,txnTo call blockchain1,...,blockchainnTo obtain encrypted data; inputting the encrypted data into SGX for operation, and inputting the operated encryption operation result into cross-chain intelligent Contract ContractcomputationTo construct a transaction txn+1To trade txn+1Uploading to a block id of a block chain; verifying if block id contains transaction tx according to block idn+1If the verification is passed, verifying the encryption calculation result by using the private key; the second preset parameter comprises a cross-chain task type of computation and a block chain type of block chain1,...,blockchainnThe account number corresponding to the block chain where the data to be calculated is located1,...,accountnA field name of the calculation, an encryption public key pk, and a calculation type.
Step S3 specifically includes:
s301, uploading a cross-chain computing type op and a block chain account to be operated by a first cross-chain operator1,account2,...,accountnData field payload recorded on intelligent contracts on different block chains to be operated1,payload2,...,payloadnTo the server;
s302, constructing cross-chain computation intelligent Contract Contract by using parameters uploaded to servercomputationThe concrete construction form is as follows:
obtaining the blockchain type blockchain of the cross-chain operator uploading transaction1,..,blockchainnConnecting each block chain by using a corresponding RPC;
constructing transactions tx1,...,txnTo do so by
payload1,payload2,...,payloadnInvoking blockchain as an input1,...,blockchainnUpper corresponding function Get (payload)i) To obtain
The server receiving the returnThen, adding C1、C1…CnAnd loading the calculation type op into the SGX;
SGX is calculated using equations (6) and (7):
Cresult=Encpk(result)(7)
obtaining a calculation result CresulAfter t, construct a transaction txn+1: recording the calculation result as input to Contractcomputation;
S303, verifying whether the block id contains the transaction tx according to the block idn+1If the verification is passed, the cross-chain operator obtains a calculation result through the formula (8):
result=DECsk(Cresult) (8)
if the verification fails, the cross-chain computation fails.
Correspondingly, the invention relates to a safe and efficient cross-chain service operating system based on SGX, which comprises: the cross-chain calculation module is used for automatically generating a cross-chain calculation intelligent contract according to a first preset parameter or a second preset parameter input by a first cross-chain operator, and the cross-chain calculation intelligent contract loads calculated data from different block chains into an SGX calculation framework of the trusted calculation module for calculation; the trusted computing module is used for acquiring the encrypted data of the cross-chain computing module, decrypting the encrypted data by using a hardware private key of the SGX, calculating the decrypted data to obtain a computing result, and returning the encrypted computing result; the cross-chain trading module is used for executing an atomic trading task or a broadcast trading task according to parameters input by a plurality of cross-chain operators, and different cross-chain operators select digital assets to be exchanged on different blockchains; the cross-chain transaction module comprises: an atomic transaction unit and a broadcast transaction unit; the system comprises an atomic transaction unit, a block chain module and a data processing unit, wherein the atomic transaction unit is used for converting parameters input by a plurality of cross-chain operators to obtain an atomic transaction intelligent contract, and interacting the atomic transaction intelligent contract with the block chain module to complete the exchange of digital assets on different block chains; the broadcast transaction unit is used for converting parameters input by a plurality of cross-chain operation initiators to obtain broadcast transaction intelligent contracts, and interacting the broadcast transaction intelligent contracts with the block chain modules to complete digital asset exchange on different block chains; and the block chain module is used for interacting with a block chain where the intelligent contract for executing the cross-chain operation is located.
Compared with the prior art, the invention has the following beneficial effects:
when the cross-chain transaction is carried out, the asset conversion can be completed under the condition that a transaction party is not determined, and the practicability and efficiency of the cross-chain transaction service are improved. Therefore, the technical scheme of the invention can provide more safe and comprehensive cross-chain computing service. When the cross-chain calculation is completed, the system can not directly read the plaintext of the calculation data, but directly loads the ciphertext data into the isolated hardware environment for calculation and returns the encrypted calculation result.
Drawings
FIG. 1 is a schematic flow chart of a method for SGX-based secure efficient cross-chain service operation according to the present invention;
fig. 2 is a schematic structural diagram of the SGX-based secure and efficient cross-chain service operating system of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
Referring to fig. 1, fig. 1 is a schematic flowchart of an embodiment of a secure and efficient SGX-based cross-chain service operation method provided in fig. 1. As shown in fig. 1, the method includes steps 101 to 103, steps 201 to 206, and steps 301 to 306, and each step is as follows:
step 101: the first cross-link operator uploads the data to be operated and the funds to be exchanged into each blockchain by constructing a transaction.
In this embodiment, the user uploads the data encrypted by using the SGX public key additionally through the wallet client corresponding to the different blockchains by constructing an intelligent contract, and transfers the digital assets to be exchanged to each blockchain account.
Step 102: uploading the cross-chain operation type and parameters required by the cross-chain operation.
In this embodiment, the scheme of the present invention may be, but is not limited to, a data operation scenario based on SGX, where a cross-chain service platform is built on a federation chain and is formed by federation nodes, and a cross-chain operation is completed through cross-chain intelligence. An individual user can connect the block chain platform through the lightweight wallet, and all users can complete the access and use of the platform through the block chain address without real-name authentication.
In this embodiment, a user connects a cross-chain service platform to upload a cross-chain task type atom transfer, a multicast or a computation, a to-be-operated block chain type, and an account corresponding to the to-be-operated block chain1,account2The digital asset amount and the exchange rate, or the calculation type of the cross-chain calculation, determine whether the operation type of uploading the cross-chain is the calculation, if not, only execute step 201, if yes, execute step 301.
Step 201: and when the cross-chain operation type is atom transaction and broadcastransaction, constructing a transaction to forward the assets to be exchanged to a specified relay account.
In this embodiment, the service platform uses the type of the to-be-operated blockchain uploaded by the user and the account count corresponding to the to-be-operated blockchain1,account2Generating intelligent Contract by using digital asset amount and exchange rate as input, and constructing cross-chain intelligent Contract ContracttransferUploading the data to a block chain in a transaction form, wherein the specific construction form is as follows:
the amount of the digital asset obtained after the conversion is calculated using the following formula: value' value rate; the structure belongs to blockchain1Transaction tx ofid1By account1As input address, accountrelay1Transferring a digital asset output address with the value of the money from the input address as an output address; at the same time, account will be taken2Recorded in a data field of the smart contract as a receiving slave system-specified blockchain2Relay account ofrelay2The public key address of the digital asset of value' forwarded.
Step 202: and verifying whether the cross-chain type is equal to atom transaction, if so, executing step 203, otherwise, executing step 204.
Step 203: if the cross-chain type is equal to atom transaction, the user needs to upload the transaction account corresponding to the second transaction user by himself1‘,account2′And if the cross-chain type is not equal to the atom transaction, waiting for the second user to upload the transaction account by himself.
In this embodiment, if the type of the cross-link selected by the user for uploading is atom transaction, the transaction account corresponding to the second transaction user needs to be uploaded at the same time1‘,account2′After step 201 is completed, the service platform will notify the second userAnd uploading the required transaction information to complete the subsequent transaction. If the selected cross-link type is broadcastransaction, after step 201 is completed, the service platform will display the transaction in the platform, and wait for another user who meets the condition and has voluntary transaction to upload information required by the transaction to complete the subsequent transaction.
Step 204: and determining whether the transaction is included in the generated block and whether the transaction requirement is met.
In this embodiment, the second transaction user connects to the service platform, and queries, through the platform, whether the transaction is included in the confirmed block and whether the constructed intelligent cross-link transaction contract is legal, where the platform verification process is as follows:
according to the Block id' input by the user, obtaining Block data Block and inquiring ContracttransferIf the verification exists, continuing subsequent verification; otherwise, returning confirmation failure to the user;
calling ContracttransferObtaining Contracttransfer.value′,ContracttransferValue and Contracttransfer.rate;
If the cross-chain transaction type is atom transaction, verifying whether the recorded value is correct through the following formula:
Contracttransfer.value′==Contracttransfer.value*Contracttransferrate; if not, terminating the verification; if the equation is true, the verification passes the subsequent verification: calling ContracttransferObtaining Contracttransfer.account2′,Contracttransfer.account2′Input account1′,account2′Contracttransfer.account2′And Contracttransfer.account2′Verifying that the account used by the cross-chain operator is correct by the following formula:
(Contracttransfer.account1′==account1′)&(Contracttransfer.account2′==account2′);
if the verification fails, returning the verification failure to the user; if the verification is passed, returning verification success to the user;
if the cross-link transaction type is broadcastransaction, verifying whether the recorded value is correct through the following formula:
Contracttransfer.value′==Contracttransfer.value*Contracttransferrate; the equation is established;
if the verification fails, returning the verification failure to the user; if the verification is passed, returning verification success to the user;
step 205: the second trader constructs a trade to forward the asset to be exchanged to the designated relay account.
In this embodiment, the account of the different blockchain accounts uploaded by the second transaction user1‘,account2As input, call intelligent Contract ContracttransferThe following operations are performed:
the structure belongs to blockchain2Transaction txid2By account2‘As input address, accountrelay2Transferring, as an output address, the digital asset whose amount is value' from the input address to the output address;
at the same time, account will be taken2‘Recorded in a data field of the smart contract as a receiving slave system-specified blockchain1Relay account ofrelay1The public key address of the forwarded value's digital asset;
step 206: and the relay account forwards the assets to be exchanged to the accounts of the two parties to complete the transaction.
In this embodiment, after the two parties complete the uploading of the transaction information, the platform automatically obtains the block id1Block id2Transaction txid1And transaction txid2As input, the transaction tx is verifiedid1Whether or not it is contained with blockchain1Block id of1And transaction txid2Whether or not to be contained in blockchain2Block id of2If the verification is passed, continuing the subsequent operation;
in this embodiment, the platform structure belongs to blockchain1Transaction tx ofid3By accountrelay1As input address, account1‘Transferring the digital asset with the value amount from the input address to the output address as the output address; the structure belongs to blockchain2Transaction tx ofid4By accountrelay2As input address, account2‘Transferring the digital asset with the value' from the input address to the output address as the output address; confirmation txid3,txid4Record to blockchain1,blockchain2After that, the atomic transaction is completed.
Step 301: constructing a transaction slave blockchain1,...,blockchainnTo obtain the data to be calculated.
In this embodiment, the user connection platform constructs a cross-chain computation intelligent Contract Contract according to the parameters uploaded in step 102 as inputcomputationThe contract reads the encrypted data recorded in the intelligent contract by constructing different transactions to call the intelligent contract on different block chains
Step 302: the encrypted data and the computation type are loaded into the Intel SGX.
In this embodiment, the platform will receive returns Then, it is mixed (C)1、C2…Cn) And loading the calculation type op into the SGX;
step 302: the Intel SGX performs calculation according to the decrypted data and the calculation type
In this embodiment, SGX is calculated using the following formula:
Cresult=Encpk(result)
step 304: and returning the calculation data encrypted by the user public key.
In this embodiment, the SGX returns the encrypted calculation result Cresult=Encpk(result) to the platform.
Step 305: and constructing a transaction, recording the calculation result into a block chain, and finishing cross-chain calculation.
In this embodiment, the platform obtains the calculation result CresultThereafter, a transaction tx is constructedn+1Recording the calculation result as input to Contractcomputation(ii) a Waiting for a transaction txn+1After confirmation, the user may obtain the encrypted calculation and obtain the calculation by the following formula:
result=DECsk(Cresult)
correspondingly, the present invention further provides a secure and efficient cross-chain service operating system based on the SGX, referring to fig. 2, fig. 2 is a schematic structural diagram of an embodiment of the secure and efficient cross-chain service operating system based on the SGX according to the present invention. As shown in fig. 2, the system includes: the system comprises a cross-chain computing module, a trusted computing module, a cross-chain transaction module and a browser module; the cross-chain transaction module comprises: an atomic transaction unit and a broadcast transaction unit; the cross-chain calculation module is used for automatically generating a cross-chain calculation intelligent contract according to a first preset parameter or a second preset parameter input by a first cross-chain operator, and the cross-chain calculation intelligent contract loads calculated data from different block chains into an SGX calculation framework of the trusted calculation module for calculation; the trusted computing module is used for acquiring the encrypted data of the cross-chain computing module, decrypting the encrypted data by using a hardware private key of the SGX, calculating the decrypted data to obtain a computing result, and returning the encrypted computing result; the cross-chain trading module is used for executing an atomic trading task or a broadcast trading task according to parameters input by a plurality of cross-chain operators, and different cross-chain operators select digital assets to be exchanged on different blockchains; the system comprises an atomic transaction unit, a block chain module and a data processing unit, wherein the atomic transaction unit is used for converting parameters input by a plurality of cross-chain operators to obtain an atomic transaction intelligent contract, and interacting the atomic transaction intelligent contract with the block chain module to complete the exchange of digital assets on different block chains; the broadcast transaction unit is used for converting parameters input by a plurality of cross-chain operation initiators to obtain broadcast transaction intelligent contracts, and interacting the broadcast transaction intelligent contracts with the blockchain module to complete digital asset exchange on different blockchains; and the blockchain module is used for interacting with a blockchain which executes the cross-chain intelligent contract and records the change of the intelligent contract state caused by the cross-chain operation.
The above-mentioned embodiments are preferred embodiments of the present invention, and the present invention is not limited thereto, and any other modifications or equivalent substitutions that do not depart from the technical spirit of the present invention are included in the scope of the present invention.
Claims (9)
1. A safe and efficient cross-chain service operation method based on SGX is characterized by comprising the following steps:
s1, uploading encrypted data to be calculated and a contract function for acquiring the encrypted data to each block chain by a first cross-link operator through constructing a transaction by using an intelligent contract and an SGX public key, and transferring digital assets to be transacted to a transaction account of each block chain;
s2, when the first cross-chain operator executes the cross-chain transaction operation, uploading the first preset parameter to the cross-chain intelligent Contract ContracttransferIn cross-chain intelligent Contract ContracttransferIn-construction transaction txid1Forwarding the digital assets with the first predetermined amount to the relay accountrelay1And will trade txid1Uploading to a Block chain blockchafn1;
Second cross-chain operator acquisition includes transaction txid1Block id of1Constructing a transaction txid2Call ContractatomThe verification function verify in (1) obtains account1′,account2′Verifying whether the account number is the account number of the second cross-link operator; if the verification is successful, forwarding the second subscription fundDigital assets of amount to relay accountrelay2And will construct a transaction txid2Upload to Block chain Block id2Performing the following steps; obtaining Block id1Block id2Transaction txid1And transaction txid2Verification of Block id1Whether or not to include transaction txid1Verification of Block id2Whether or not to include transaction txid2If yes, relay account is addedrelay1The digital assets in (1) are transferred to the account of the second cross-chain operator1′In, account accounting of relayrelay2The digital assets in (1) are transferred to the account of the first cross-link operator2Performing the following steps;
the first preset parameter comprises a cross-chain task type and a block chain type of transaction1,blockchain2Corresponding account number on the block chain to be exchanged1,account2Digital asset amount value, redemption rate and account of the second cross-chain operator1′,account2′(ii) a If the cross-chain task type is atom transaction, the account of the second cross-chain operator1′,account2′Is the account number of the specified second cross-chain operator and is uploaded to the cross-chain intelligent Contract Contract by the first cross-chain operatortransferIf the cross-link task type is broadcastransaction, the account of the second cross-link operator1′,account2′Waiting for the second cross-link operator to count the account number of the second cross-link operator by the first cross-link operator1′,account2′Upload to Cross-chain Intelligent Contract Contracttransfer;
S3, when the first cross-chain operator executes the cross-chain calculation operation, uploading the second preset parameter to the cross-chain intelligent Contract ContractcomputationIn the meantime, the transaction tx is constructed by using the second preset parameter1,...,txnTo call blockchain1,..,blockchainnTo obtain encrypted data; inputting the encrypted data into SGX for operation, and inputting the operated encryption operation result into cross-chain intelligent Contract ContractcomputationRecord function in (1)To construct a transaction txn+1To trade txn+1Uploading to a block id of a block chain; verifying whether the block id contains a transaction tx according to the block idn+1If the verification is passed, verifying the encryption calculation result by using the private key;
the second preset parameter comprises a cross-chain task type of computation and a block chain type of block chain1,..,blockchainnThe account number corresponding to the block chain where the data to be calculated is located1,...,accountnA field name of the calculation, an encryption public key pk, and a calculation type.
2. The SGX-based method for operating a secure and efficient cross-chain service according to claim 1, wherein step S1 is preceded by the steps of: data is encrypted according to equation (1):
wherein, PKSGXHardware public key of SGX; the data is data which needs to be calculated by a first cross-chain operator and is recorded in each block chain, and Enc is encryption operation.
3. The SGX-based secure and efficient cross-chain service operation method as claimed in claim 1, wherein the first preset parameter is uploaded to a cross-chain intelligent Contract Contract when a first cross-chain operator performs a cross-chain transaction operationtransferIn-chain intelligent Contract ContracttransferIn-construction transaction txid1Forwarding the digital assets with the first predetermined amount to the relay accountrelay1And will trade txid1Uploading to block chain blockchain1The method specifically comprises the following steps:
s201, obtaining a block chain type block chain uploaded by a first cross-chain operator1,blockchain2Calling corresponding RPC to connect with each block chain; if the cross-link task type is atom transaction, execute step S202; if cross-chain task classIf the type is broadcastransaction, go to step S203;
s202, according to the account corresponding to the block chain to be exchanged1,account2Digital asset value, exchange rate, accountrelay1And account of the second inter-chain operator1′,account2′Constructing a cross-chain intelligent Contract ContracttransferAnd uploading to the blockchain in the form of transaction;
s203, waiting for the second cross-link operator to count the account number of the second cross-link operator1′,account2′After uploading, according to the account number account corresponding to the block chain to be exchanged1,account2Value of digital asset, exchange rate, accountrelay1And account of the second inter-chain operator1′,account2′Constructing a cross-chain intelligent Contract ContracttransferAnd uploading to the blockchain in the form of transaction;
in which a cross-chain intelligent Contract Contract is constructedtransferThe steps are as follows:
calculating the converted digital asset amount using equation (2):
value‘=value*rate (2)
the structure belongs to block chain1Transaction tx ofid1With the first inter-chain operator account1As input address, accountrelay1Transferring the digital asset with the value amount from the input address to the output address as the output address;
at the same time, account of the first cross-chain operator2Recording the account of the first cross-link operator in the data field of the intelligent contract2As an output address for receiving a slave blockchain2Relay account ofrelay2The forwarded digital asset worth value' is.
4. The SGX-based secure and efficient cross-chain service operation method according to claim 3, wherein step S203 specifically comprises:
constructing a transaction will intelligent Contract ContracttransferDeployment into a blockchain;
second cross-chain operator calls intelligent Contract ContracttransferWill blockchain1,blockchain2Corresponding account1′,account2′Into the data field of the smart contract.
5. The SGX-based secure efficient cross-chain service operation method of claim 3, wherein the second cross-chain operator acquisition comprises a transaction txid1Block id of1Constructing a transaction txid2Call ContractatomThe verification function verify in (1) obtains account1′,account2′Verifying whether the operator is a second cross-chain operator; if the verification is successful, forwarding the digital assets with the second preset money amount to the relay accountrelay2And will construct a transaction txid2Upload to Block chain Block id2The method comprises the following specific steps:
s204, the first cross-chain operator broadcasts a Contract containing the intelligent Contract ContracttransferBlock chain block id';
s205, the second cross-chain operator obtains the blockchain type blockchain of the transaction uploaded by the first cross-chain operator1,blockchain2Connecting each block chain by using a corresponding RPC;
s206, the second cross-chain operator obtains the block id' to verify the intelligent Contract ContracttransferWhether or not it is contained in the chunk id' and the smart Contract ContracttransferWhether the content of (1) is constructed correctly;
s207, utilizing different block chain accounts account uploaded by a second cross-chain operator1‘,account2’Calling intelligent Contract ContracttransferThe following operations are performed:
the structure belongs to blockchain2Transaction tx ofid2With account of the second inter-chain operator2‘As input address, accountrelay2Transferring the digital asset with the value' from the input address to the output address as the output address;
at the same time, account of the second cross-chain operator2‘Recorded in a data field of the smart contract as a receiving slave system-specified blockchain1Relay account ofrelay1The forwarded digital asset's public key address worth value.
6. The SGX-based method for operating a secure and efficient cross-chain service according to claim 5, wherein the step S206 comprises:
obtaining Block data Block according to the Block id', and inquiring the intelligent Contract ContracttransferWhether the verification exists or not is judged, and if not, the verification is terminated; and if so, continuing the subsequent verification: calling ContracttransferObtaining Contracttransfer.value′,ContracttransferValue and Contracttransfer.rate;
If the cross-chain transaction type is atom transaction, verifying whether the recorded value is correct through formula (3):
Contracttransfer.value′==Contracttransfer.value*Contracttransfer.rate; (3)
if the formula (3) is established, if not, terminating the verification; the verification passes and continues with the subsequent verification: calling ContracttransferObtaining Contracttransfer.account2′、Contracttransfer.account1′、account2′、account1′Verifying that the account used by the cross-chain operator is correct by equation (4):
(Contracttransfer.account1′==account1′)&(Contracttransfer.account2′==account2′); (4)
if the verification fails, the transaction is terminated; if the verification is passed, determining that the structure is correct;
if the cross-link transaction type is broadcast transaction, verifying whether the recorded value is correct through formula (5):
Contracttransfer.value′==Contracttransfer.value*Contracttransfer.rate; (5)
if the formula (5) is satisfied, the verification is passed, and the step S207 is continuously executed, otherwise, the verification is terminated.
7. The SGX based secure efficient cross-chain service operation method according to claim 6, wherein block id is obtained1Block id2Transaction txid1And transaction txid2Verification of Block id1Whether or not to include transaction txid1Verification of Block id2Whether or not to include transaction txid2If yes, relay account is addedrelay1The digital assets in (1) are transferred to the account of the second cross-chain operator1′In (2), account of relayrelay2The digital assets in (1) are transferred to the account of the first cross-link operator2In the specification:
s208, obtaining the block id1Block id2Transaction txid1And transaction txid2To verify the transaction txid1Whether or not to be contained in blockchain1Block id of1And transaction txid2Whether or not to be contained in blockchain2Block id of2If the verification is passed, go to step S209;
s209, constructing the block chain1Transaction tx ofid3By accountrelay1As input address, account1‘Transferring the digital assets with the value amount from the input address to the output address as the output address;
s210, constructing and belonging to blockchain2Transaction tx ofid4With accountrelay2As input address, account2‘Transferring the digital asset with the value' from the input address to the output address as the output address;
s211, transacting txid3,txid4Record to blockchain1,blockchain2After that, the atomic transaction is completed.
8. The SGX-based secure and efficient cross-chain service operation method according to claim 1, wherein step S3 specifically comprises:
s301, uploading a cross-chain computing type op and a to-be-operated block chain account by a first cross-chain operator1,account2,...,accountnData field payload recorded on intelligent contracts on different block chains to be operated1,payload2,...,payloadnTo the server;
s302, constructing cross-chain computation intelligent Contract Contract by using parameters uploaded to servercomputationThe concrete construction form is as follows:
obtaining the blockchain type blockchain of the uploading transaction of the cross-chain operator1,..,blockchainnConnecting each block chain by using a corresponding RPC;
constructing transactions tx1,...,txnIn payload form1,payload2,...,payloadnInvoking blockchain as an input1,..,blockchainnUpper corresponding function Get (payload)i) To obtain
The server receiving the returnThen, adding C1、C1...CnAnd loading the calculation type op into the SGX;
SGX is calculated using equations (6) and (7):
Cresult=Encpk(result) (7)
obtaining a calculation result CresultThereafter, a transaction tx is constructedn+1: recording the calculation result as input to Contractcomputation;
S303, verifying whether the block id contains the transaction tx according to the block idn+1If the verification is passed, the cross-chain operator obtains a calculation result through the formula (8):
result=DECsk(Cresult) (8)
if the verification fails, the cross-chain computation fails.
9. An SGX-based secure and efficient cross-chain service operating system applied to any one of claims 1 to 8, wherein the SGX-based secure and efficient cross-chain service operating method comprises:
the cross-chain calculation module is used for automatically generating a cross-chain calculation intelligent contract according to a first preset parameter input by a first cross-chain operator, and the cross-chain calculation intelligent contract loads calculated data from different block chains into an SGX calculation frame of the trusted calculation module for calculation;
the trusted computing module is used for acquiring the encrypted data of the cross-chain computing module, decrypting the encrypted data by using a hardware private key of the SGX, calculating the decrypted data to obtain a computing result, and returning the encrypted computing result;
the cross-chain trading module is used for executing an atomic trading task or a broadcast trading task according to parameters input by a plurality of cross-chain operators, and different cross-chain operators select digital assets to be exchanged on different blockchains; the cross-chain transaction module comprises: an atomic transaction unit and a broadcast transaction unit;
the system comprises an atomic transaction unit, a block chain module and a data processing unit, wherein the atomic transaction unit is used for converting parameters input by a plurality of cross-chain operators to obtain an atomic transaction intelligent contract, and interacting the atomic transaction intelligent contract with the block chain module to complete the exchange of digital assets on different block chains;
the broadcast transaction unit is used for converting parameters input by a plurality of cross-chain operation initiators to obtain broadcast transaction intelligent contracts, and interacting the broadcast transaction intelligent contracts with the block chain modules to complete digital asset exchange on different block chains;
and the block chain module is used for interacting with a block chain where the intelligent contract for executing the cross-chain operation is located.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011347882.0A CN112527893B (en) | 2020-11-26 | 2020-11-26 | Safe and efficient cross-chain service operation method and system based on SGX |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011347882.0A CN112527893B (en) | 2020-11-26 | 2020-11-26 | Safe and efficient cross-chain service operation method and system based on SGX |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112527893A CN112527893A (en) | 2021-03-19 |
CN112527893B true CN112527893B (en) | 2022-06-07 |
Family
ID=74993673
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011347882.0A Active CN112527893B (en) | 2020-11-26 | 2020-11-26 | Safe and efficient cross-chain service operation method and system based on SGX |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112527893B (en) |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112732800B (en) * | 2021-03-30 | 2021-07-13 | 支付宝(杭州)信息技术有限公司 | Method and apparatus for providing cross-chain messages |
CN112861190B (en) * | 2021-04-23 | 2021-07-16 | 腾讯科技(深圳)有限公司 | Data cross-chain cooperation method, system and device |
CN117808470B (en) * | 2023-12-21 | 2024-06-18 | 暨南大学 | Efficient anonymous atom exchange cross-chain method and system based on threshold signature |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020164738A1 (en) * | 2019-02-15 | 2020-08-20 | Blocksettle Ab | Method and system for settling a blockchain transaction |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US11244309B2 (en) * | 2017-11-22 | 2022-02-08 | Cornell University | Real-time cryptocurrency exchange using trusted hardware |
US11481375B2 (en) * | 2019-01-31 | 2022-10-25 | Apifiny Group Inc. | Point-to-point distributed decentralized system |
CN110033271B (en) * | 2019-03-22 | 2023-12-22 | 湖南天河国云科技有限公司 | Cross-chain transaction method, system and computer readable storage medium |
CN112862612B (en) * | 2019-06-28 | 2024-04-30 | 创新先进技术有限公司 | Method and device for transmitting resources across chains |
CN111899002B (en) * | 2020-07-27 | 2024-03-22 | 浙江数秦科技有限公司 | Method for efficiently performing cross-chain information transaction interaction in blockchain |
CN111769957B (en) * | 2020-09-02 | 2020-12-15 | 百度在线网络技术(北京)有限公司 | Block chain cross-chain query method, device, equipment and storage medium |
-
2020
- 2020-11-26 CN CN202011347882.0A patent/CN112527893B/en active Active
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2020164738A1 (en) * | 2019-02-15 | 2020-08-20 | Blocksettle Ab | Method and system for settling a blockchain transaction |
Also Published As
Publication number | Publication date |
---|---|
CN112527893A (en) | 2021-03-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN112527893B (en) | Safe and efficient cross-chain service operation method and system based on SGX | |
US10922770B2 (en) | Systems and methods for database management of transaction information and payment data | |
US20120264405A1 (en) | Verification of transactional integrity | |
US11562450B2 (en) | Systems and methods for database management of transaction information and payment instruction data | |
CN103946879A (en) | Electronic payment systems and supporting methods and devices | |
CN108764868A (en) | Block chain node-agent account checking method and block reconciliation agent node | |
CN107026815A (en) | A kind of payment transaction processing method, paying server, relevant device and system | |
CN110503510B (en) | Method, device and system for processing interaction of rents based on credit | |
US9449318B2 (en) | Systems and methods for providing payment hotspots | |
Zie et al. | Extending atomic cross-chain swaps | |
CN110008716A (en) | Block chain method of commerce and device, electronic equipment, storage medium | |
JP6818034B2 (en) | Temporary consensus network within the resource transfer system | |
EP2115675A1 (en) | Method and system for securely executing a charge transaction | |
EP2523485A1 (en) | Method and service platform for implementing funds transfer using mobile terminal | |
CN110910109B (en) | Electronic resource transfer method and device based on block chain | |
CN108492071A (en) | A kind of express delivery information processing method and device based on block chain | |
CN113689211B (en) | Payment processing method and device | |
WO2021263032A1 (en) | Digital currency aggregation processing | |
CN110009323A (en) | Block chain method of commerce and device, electronic equipment, storage medium | |
CN110009492A (en) | Block chain method of commerce and device, electronic equipment, storage medium | |
CN106557920B (en) | Payment system, collection and payment method, anonymous payment client and server | |
CN108848061B (en) | User information transmission method and terminal equipment | |
US11405186B2 (en) | Using virtual blockchain protocols to implement a fair electronic exchange | |
CN111507818A (en) | Information sharing method and device based on block chain and storage medium | |
TWI684931B (en) | Token exchange system using blockchain technology and method thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |