A method and system for processing cross-chain transactions by multiple notaries
By creating smart contracts on the blockchain and using the notary competition mechanism to verify and release transaction assets, the problems of notary failure and inefficiency in blockchain cross-chain transactions are solved, and efficient and secure cross-chain transactions are achieved.
Patent Information
- Application Number
- CN202211548904.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-05
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2042-12-05
AI Technical Summary
In existing blockchain cross-chain transactions, the problem of notarization failure or excessive transaction volume leads to untimely or terminated transactions, and the problem of inefficient notarization processing.
The method of multi-notaries handling cross-chain transactions is adopted, by creating smart contracts and publishing secret keys and transaction information on the notary platform, the notary competition mechanism is used to verify and release transaction assets to ensure efficient completion of transactions.
It improves the efficiency of cross-chain transactions, avoids transaction delays and untimely processing problems caused by notary failures, and realizes the security and efficiency of cross-chain transactions.
Smart Images

Figure CN115987520B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of blockchain transaction technology, and in particular to a method and system for processing cross-chain transactions by multiple notaries. Background Art
[0002] Based on the needs of cross-chain transactions, the situation of blockchain information islands is broken, and information sharing and value exchange between different blockchains are realized, thus introducing the notary mechanism. As a commonly used cross-chain interaction mechanism, the notary mechanism uses one or a group of trusted nodes as intermediaries to coordinate the cross-chain interaction process. A cross-chain transaction is generally completed by a notary to execute the entire cross-chain transaction process.
[0003] Based on the scenario of an intermediate notary handling cross-chain transactions, each notary handles its corresponding cross-chain transactions separately. Once a notary fails or the transaction volume is too large, the transaction may not be processed in time or the transaction may be terminated. In addition, when each notary handles cross-chain transactions separately, there may be a situation where the notary is not active in handling transactions and the work efficiency is low. Summary of the invention
[0004] In order to address the deficiencies of the prior art, the present invention proposes a method and system for processing cross-chain transactions by multiple notaries. In the event of a failure of a notary, the transaction can be continued through other notaries, thereby improving the completion efficiency of cross-chain transactions.
[0005] To achieve the above objectives, the technical solutions adopted by the present invention include:
[0006] The first aspect of the present invention discloses a method for processing cross-chain transactions by multiple notaries, comprising:
[0007] The first notary creates a first cross-chain transaction smart contract on the first blockchain, and creates a second cross-chain transaction smart contract on the second blockchain;
[0008] The first blockchain sends the address of the first cross-chain transaction smart contract to the first notary, and the second blockchain sends the address of the second cross-chain transaction smart contract to the first notary;
[0009] The first notary transfers the transaction asset amount on the first blockchain to the address of the first cross-chain transaction smart contract, and transfers the transaction asset amount on the second blockchain to the address of the second cross-chain transaction smart contract;
[0010] The first notary sends the address of the first cross-chain transaction smart contract and the address of the second cross-chain transaction smart contract to the first user who initiated the cross-chain transaction request and the second user respectively;
[0011] The first notary publishes the secret keys of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract as well as the cross-chain transaction information of the first user and the second user within the notary platform.
[0012] Furthermore, before the first notary creates a first cross-chain transaction smart contract on the first blockchain and creates a second cross-chain transaction smart contract on the second blockchain, the method further includes:
[0013] The first user on the first blockchain sends a cross-chain transaction request to the first notary, requesting to conduct a transaction with the second user on the second blockchain, and the first notary is any notary on the notary platform;
[0014] The first notary queries and verifies the asset balance information of his own account. After the verification is passed, the first notary sends the account address on the first blockchain to the first user, and sends the account address on the second blockchain to the second user;
[0015] The first user transfers the transaction asset amount on the first blockchain to the account address of the first notary on the first blockchain.
[0016] Furthermore, after the first notary publishes the secret keys of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract and the cross-chain transaction information of the first user and the second user within the notary platform, the method further includes:
[0017] The second user verifies the information of the first cross-chain transaction smart contract and the information of the second cross-chain transaction smart contract respectively. After the verification is passed, the second user transfers the transaction asset amount on the second blockchain to the account address of the first notary on the second blockchain;
[0018] The notary of the notary platform queries and proofreads the account balances of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract. After the proofreading is passed, the notary uses the secret key to release the first cross-chain transaction smart contract and the second cross-chain transaction smart contract; wherein each link is completed by each notary of the notary platform in competition;
[0019] The second user obtains the transaction asset amount on the first blockchain using the account address on the first blockchain, and the first user obtains the transaction asset amount on the second blockchain using the account address on the second blockchain.
[0020] Furthermore, the method also includes a notary destroying the information of the first cross-chain transaction smart contract and the information of the second cross-chain transaction smart contract respectively.
[0021] Furthermore, the cross-chain transaction information includes the account information of the first user on the first blockchain, the transaction asset amount on the first blockchain, the account information of the first user on the second blockchain, the account information of the second user on the second blockchain, the transaction asset amount on the second blockchain, the account information of the second user on the first blockchain, and transaction ID information.
[0022] Furthermore, the first notary creates a first cross-chain transaction smart contract on the first blockchain, and creates a second cross-chain transaction smart contract on the second blockchain, including:
[0023] The first notary generates a random number S as a secret value of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract;
[0024] The first notary designs the name, variables, constant parameters, as well as the parameters and execution process of each step of deposit, query, release, contract initialization, and contract destruction.
[0025] Furthermore, the constant parameters include the secret value, a timestamp, a transaction asset amount on the first blockchain or the second blockchain, account information of the first user on the second blockchain, or account information of the second user on the first blockchain.
[0026] The second aspect of the present invention discloses a system for processing cross-chain transactions by multiple notaries, including:
[0027] Creating a smart contract module, the first notary creates a first cross-chain transaction smart contract on the first blockchain, and creates a second cross-chain transaction smart contract on the second blockchain; the first blockchain sends the address of the first cross-chain transaction smart contract to the first notary, and the second blockchain sends the address of the second cross-chain transaction smart contract to the first notary;
[0028] In the first asset transaction module, the first notary transfers the transaction asset amount on the first blockchain to the address of the first cross-chain transaction smart contract, and transfers the transaction asset amount on the second blockchain to the address of the second cross-chain transaction smart contract;
[0029] In the information transmission module, the first notary sends the address of the first cross-chain transaction smart contract and the address of the second cross-chain transaction smart contract to the first user who initiated the cross-chain transaction request and the second user respectively;
[0030] In the information disclosure module, the first notary publishes the secret keys of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract as well as the cross-chain transaction information of the first user and the second user within the notary platform.
[0031] Furthermore, the system further comprises:
[0032] An information verification module, wherein the second user verifies the information of the first cross-chain transaction smart contract and the information of the second cross-chain transaction smart contract respectively. After the verification is passed, the second user transfers the transaction asset amount on the second blockchain to the account address of the first notary on the second blockchain;
[0033] A notary competition processing module, in which the notary of the notary platform queries and proofreads the account balances of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract. After the proofreading is passed, the first cross-chain transaction smart contract and the second cross-chain transaction smart contract are released using the secret key; wherein each link is completed by the notaries of the notary platform through competition;
[0034] The second asset transaction module, the second user's account address on the first blockchain obtains the transaction asset amount on the first blockchain, and the first user's account address on the second blockchain obtains the transaction asset amount on the second blockchain.
[0035] A third aspect of the present invention discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the above method is implemented.
[0036] A fourth aspect of the present invention discloses an electronic device, comprising a processor and a memory;
[0037] The memory is used to store operation instructions;
[0038] The processor is used to execute the above method by calling the operation instruction.
[0039] The beneficial effects of the present invention are:
[0040] By adopting the method and system for processing cross-chain transactions by multiple notaries described in the present invention, in the actual cross-chain transaction process, firstly, by creating and deploying a smart contract, the smart contract is called using a secret key to lock the transaction assets to be released, and then the notary competition mechanism is started to verify the transaction assets and release the transaction assets, and finally the cross-chain transaction is completed. This method promotes competition among all notaries to improve efficiency, which can not only solve the problem of notaries not being active in processing transactions and low efficiency, but also avoid the occurrence of delays such as untimely transaction processing or inability to continue transactions due to failures of the notary responsible for the transaction, thereby achieving the security and efficiency of cross-chain transactions. BRIEF DESCRIPTION OF THE DRAWINGS
[0041] Figure 1 A schematic flow chart of a method for multiple notaries to process cross-chain transactions provided in an embodiment of the present invention.
[0042] Figure 2A schematic diagram of the system structure for processing cross-chain transactions by multiple notaries provided in an embodiment of the present invention.
[0043] Figure 3 A timing diagram of cross-chain transaction initiation-response provided for a preferred embodiment of the present invention.
[0044] Figure 4 A timing diagram of multiple notaries competing to complete a cross-chain transaction provided in a preferred embodiment of the present invention. DETAILED DESCRIPTION
[0045] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0046] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0047] The first aspect of the present invention relates to a process such as Figure 1 The method shown for multiple notaries to handle cross-chain transactions includes:
[0048] Step S1: The first notary creates a first cross-chain transaction smart contract on the first blockchain, and creates a second cross-chain transaction smart contract on the second blockchain;
[0049] Step S2: The first blockchain sends the address of the first cross-chain transaction smart contract to the first notary, and the second blockchain sends the address of the second cross-chain transaction smart contract to the first notary;
[0050] Step S3: The first notary transfers the transaction asset amount on the first blockchain to the address of the first cross-chain transaction smart contract, and transfers the transaction asset amount on the second blockchain to the address of the second cross-chain transaction smart contract;
[0051] Step S4: The first notary sends the address of the first cross-chain transaction smart contract and the address of the second cross-chain transaction smart contract to the first user who initiated the cross-chain transaction request and the second user respectively;
[0052] Step S5: The first notary publishes the secret keys of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract as well as the cross-chain transaction information of the first user and the second user within the notary platform.
[0053] In the actual cross-chain transaction process, this embodiment creates and deploys a smart contract, uses a secret key to call the smart contract to lock the transaction assets to be released, and publishes the transaction information on the notary platform to achieve the security of cross-chain transactions.
[0054] In this embodiment, before step S1, the method may further optionally include:
[0055] Step N1: The first user on the first blockchain sends a cross-chain transaction request to the first notary, requesting to conduct a transaction with the second user on the second blockchain, and the first notary is any notary on the notary platform;
[0056] Step N2: The first notary queries and verifies the asset balance information of his own account. After the verification is passed, the first notary sends the account address on the first blockchain to the first user, and sends the account address on the second blockchain to the second user;
[0057] Step N3: The first user transfers the transaction asset amount on the first blockchain to the account address of the first notary on the first blockchain.
[0058] In this embodiment, after step S5, the method may further optionally include:
[0059] Step S6: The second user verifies the information of the first cross-chain transaction smart contract and the information of the second cross-chain transaction smart contract respectively. After the verification is passed, the second user transfers the transaction asset amount on the second blockchain to the account address of the first notary on the second blockchain;
[0060] Step S7, the notary of the notary platform queries and proofreads the account balances of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract. After the proofreading is passed, the first cross-chain transaction smart contract and the second cross-chain transaction smart contract are released using the secret key; wherein each link is completed by each notary of the notary platform in competition;
[0061] Step S8: The second user obtains the transaction asset amount on the first blockchain using the account address on the first blockchain, and the first user obtains the transaction asset amount on the second blockchain using the account address on the second blockchain.
[0062] Optionally, after step S8, the method further includes:
[0063] Step S9: The notary destroys the information of the first cross-chain transaction smart contract and the information of the second cross-chain transaction smart contract respectively.
[0064] In step S1, the cross-chain transaction information preferably includes the account information of the first user on the first blockchain, the transaction asset amount on the first blockchain, the account information of the first user on the second blockchain, the account information of the second user on the second blockchain, the transaction asset amount on the second blockchain, the account information of the second user on the first blockchain, and transaction ID information.
[0065] In this embodiment, the step S1 may optionally include the following sub-steps:
[0066] Step S101: The first notary generates a random number S as a secret value of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract;
[0067] Step S102: The first notary designs the name, variables, constant parameters, and the parameters and execution process of each step of deposit, query, release, contract initialization, and contract destruction.
[0068] The constant parameters include the secret value, a timestamp, the transaction asset amount on the first blockchain or the second blockchain, the account information of the first user on the second blockchain or the account information of the second user on the first blockchain.
[0069] For example, the smart contract created by notary C1 on chain X is as follows:
[0070] Name: M C1 X
[0071] Variable: balancesX: used to record contract balance;
[0072] owner: used to record the contract owner.
[0073] Constant: Parameter MX1: represents the account of the recipient user B in the X chain, B X ;
[0074] Parameter MX2: Hash value representing the secret value, Hash(S);
[0075] Parameter MX3: timestamp, indicating the contract expiration time;
[0076] Parameter MX4: indicates the transaction asset amount AMT1.
[0077] method:
[0078] 1) Deposit
[0079] Method parameters: None
[0080] Execution process:
[0081] a: Check whether the contract caller is the owner, otherwise exit, if yes, proceed to the next step;
[0082] b: balancesY = balancesY + parameter MX4
[0083] 2) Query
[0084] Method parameters: None
[0085] Execution process:
[0086] a: Returns the asset balance balancesY
[0087] 3) Release
[0088] Method uses parameters: parameter 1.
[0089] Execution process:
[0090] a) Determine whether Hash (parameter 1) is equal to parameter MX2. If they are equal, the transaction continues, otherwise the smart contract is exited.
[0091] b) Determine whether the current time is less than parameter MX3.
[0092] If it is less than, all the contract assets will be sent to parameter MX1;
[0093] Otherwise, all the contract assets are sent to the owner.
[0094] 4) Contract initialization
[0095] Method parameters: None
[0096] Execution process:
[0097] a: owner = contract creator address
[0098] 5) Contract destruction
[0099] Method parameters: None
[0100] Execution process:
[0101] a: When called by the owner, the contract address and variables are all destroyed.
[0102] By adopting the method for processing cross-chain transactions by multiple notaries described in this embodiment, in the actual cross-chain transaction process, firstly, by creating and deploying a smart contract, the smart contract is called using a secret key to lock the transaction assets to be released, and then the notary competition mechanism is started to verify the transaction assets and release the transaction assets, and finally the cross-chain transaction is completed. This method promotes competition among all notaries to improve efficiency, which can not only solve the problem of notaries not being active in processing transactions and low efficiency, but also avoid the occurrence of delays such as untimely transaction processing or inability to continue transactions due to failures of the notary responsible for the transaction, thereby achieving the security and efficiency of cross-chain transactions.
[0103] A second aspect of the present invention relates to a Figure 2 The structure of the system shown in Figure 1, which processes cross-chain transactions with multiple notaries, includes:
[0104] Creating a smart contract module, the first notary creates a first cross-chain transaction smart contract on the first blockchain, and creates a second cross-chain transaction smart contract on the second blockchain; the first blockchain sends the address of the first cross-chain transaction smart contract to the first notary, and the second blockchain sends the address of the second cross-chain transaction smart contract to the first notary;
[0105] In the first asset transaction module, the first notary transfers the transaction asset amount on the first blockchain to the address of the first cross-chain transaction smart contract, and transfers the transaction asset amount on the second blockchain to the address of the second cross-chain transaction smart contract;
[0106] In the information transmission module, the first notary sends the address of the first cross-chain transaction smart contract and the address of the second cross-chain transaction smart contract to the first user who initiated the cross-chain transaction request and the second user respectively;
[0107] In the information disclosure module, the first notary publishes the secret keys of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract as well as the cross-chain transaction information of the first user and the second user within the notary platform.
[0108] In this embodiment, the system preferably further includes:
[0109] An information verification module, wherein the second user verifies the information of the first cross-chain transaction smart contract and the information of the second cross-chain transaction smart contract respectively. After the verification is passed, the second user transfers the transaction asset amount on the second blockchain to the account address of the first notary on the second blockchain;
[0110] A notary competition processing module, in which the notary of the notary platform queries and proofreads the account balances of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract. After the proofreading is passed, the first cross-chain transaction smart contract and the second cross-chain transaction smart contract are released using the secret key; wherein each link is completed by the notaries of the notary platform through competition;
[0111] The second asset transaction module, the second user's account address on the first blockchain obtains the transaction asset amount on the first blockchain, and the first user's account address on the second blockchain obtains the transaction asset amount on the second blockchain.
[0112] The system provided in this embodiment can support the implementation of the method steps shown in the above embodiment.
[0113] When using the above method and system to perform cross-chain transaction operations, you can refer to the following specific embodiments.
[0114] like Figure 3 , Figure 4 The cross-chain transaction operation sequence diagram shown preferably includes the following steps:
[0115] This embodiment is used to solve the cross-chain transaction between user A and user B, where user A’s account in X chain is A. X , the account in Y is: A Y ; User B’s account in X chain is B X , the account in Y is: B Y ; User A uses Xchain account A X The asset amount of AMT1 and user B in Y chain account B Y The notary selects C1 as the notary for this transaction. When the transaction is completed, A X The amount of assets of AMT1, B X The amount of assets of B is increased by AMT1; Y The amount of assets is reduced by AMT2, A Y The amount of assets increased by AMT2. The relevant account information before the transaction is shown in Table 1:
[0116] Table 1 Relevant account information before transaction
[0117] Serial number Account Address Asset balance 1 <![CDATA[X-chain account A of User A X > 1800 2 <![CDATA[Y-chain account A of User A Y > 950 3 <![CDATA[X-chain account B of User B X > 700 4 <![CDATA[User B's Y-chain account B Y > 500 5 <![CDATA[The account address C1 of notary C1 on the X chain X > 23000 6 <![CDATA[The account address C1 of user B notary C1 on the Y chain Y > 6880
[0118] like Figure 3 , Figure 4 The cross-chain transaction operation sequence diagram shown preferably includes the following steps:
[0119] (1) User A on the X chain initiates a cross-chain transaction request and selects notary C1 and user B on the Y chain to conduct the cross-chain transaction;
[0120] The transaction request content includes: transaction ID information, user A's X chain account A X , X chain transaction asset amount 100, user A's Y chain account A Y , User B’s Y chain account B Y , Y chain transaction asset amount 80, user B's X chain account B X , specifically {3030603214,A X ,100,A Y ,B Y ,80,B X}.
[0121] (2) Notary C1 obtains the cross-chain transaction request initiated by user A and parses it to obtain the request fields.
[0122] (3) After successfully parsing the request field, notary C1 goes to the Y chain to query notary C1’s account C1 on the Y chain Y Is the asset balance greater than Y chain transaction assets 80:
[0123] ① If it is greater than 80 Y chain transaction assets:
[0124] 1) Return to user A, the account address C1 of notary C1 on chain X X ;
[0125] 2) Return to user B, the account address C1 of notary C1 on chain Y Y ;
[0126] ②If it is less than, the transaction ends.
[0127] At this point, notary C1 has 6880 assets in the Y chain and can complete the transaction.
[0128] (4) Account A of X-chain user A X To account address C1 X Transfer in 100 trading assets:
[0129] Account A X Asset balance = 1800-100 = 1700
[0130] Address C1 X Asset balance = 23000 + 100 = 23100
[0131] (5) Notary C1 queries account address C1 X After the asset amount increases by 100:
[0132] Notary C1 generates a random number 55 as the secret value;
[0133] Secondly, create a cross-chain transaction smart contract M on blockchain X chain C1 X :
[0134] Name: M C1 X
[0135] Variable: balancesX: used to record contract balances
[0136] owner:C1 X
[0137] Constant: Parameter MY1: B X
[0138] Parameter MY2: Hash(55)
[0139] Parameter MY3: 20211225
[0140] Parameter MY4: 100
[0141] 1) Deposit save function:
[0142] balancesX = balancesX + parameter MY4
[0143] =balancesX+100
[0144] 2) Query get function:
[0145] Returns balancesX.
[0146] 3) Release the transfer function:
[0147] a. Calculate the hash value Hash(parameter) based on the passed parameters and determine whether it is equal to parameter MY2. If they are equal, the transaction continues; otherwise, exit the smart contract;
[0148] b. Determine whether the current time is less than or equal to the effective deadline parameter MY3 of the smart contract:
[0149] a) If it is greater than, it means that the smart contract has expired and the asset transaction amount will be returned to the notary:
[0150] The contract will send all assets to the notary public C1’s account address C1 on chain X. X ,
[0151] If the notary C1's asset balance is bal1, then after release, the balance will be bal1+100
[0152] b) If it is less than or equal to, the contract sends all assets to parameter MY1, which is the address of user B on chain X.
[0153] Create a cross-chain transaction smart contract M on blockchain Y C1 Y :
[0154] Name: M C1 Y
[0155] Variable: balancesY
[0156] owner:C1 Y
[0157] Constant: Parameter MX1: A Y
[0158] Parameter MX2: Hash(55)
[0159] Parameters MX3: 20211225
[0160] Parameters MX4: 80
[0161] 4) Deposit save function:
[0162] balancesY
[0163] =balancesY+parameterMX4
[0164] 5) Query get function:
[0165] Returns balancesY.
[0166] 6) Release the transfer function:
[0167] a. Calculate Hash(parameter) based on the passed parameters and determine whether it is equal to parameter MY2. If they are equal, the transaction continues; otherwise, exit the smart contract.
[0168] b. Determine whether the current time is less than or equal to the deadline parameter MY3:
[0169] a) If it is greater than, it means that the smart contract has expired and the asset transaction amount will be returned to the notary:
[0170] The contract will send all assets to the notary public C1’s account address C1 on the Y chain. Y ,
[0171] If the notary public C1's asset balance is bal2, then after release, the balance will be bal2+80
[0172] b) If it is less than or equal to, the contract sends all assets to parameter MY1, which is the address of user A on chain Y.
[0173] Then, deploy M on chain X C1 X Smart Contracts and Deploying M on Chain Y C1 Y Smart contracts.
[0174] (6) Blockchains X and Y return the corresponding smart contract address Z to notary C1 C1 X and Z C1 Y .
[0175] (7) After notary C1 receives the smart contract addresses of chain X and chain Y:
[0176] ①X chain to smart contract M C1 x Address Z C1 X Make a transfer
[0177] 1) Account address C1 X To address Z C1 X Transfer 100:
[0178] Account Address C1 X Asset balance = 23100-100 = 23000
[0179] 2) Notary C1 calls smart contract M C1 x The deposit save function:
[0180] balancesX = 100
[0181] ②Y chain to smart contract M C1 Y Address Z C1 Y Make a transfer
[0182] 1) Y chain to smart contract M C1 Y Address Z C1 Y Make a transfer
[0183] Notary C1 Address Z C1 Y Asset balance = 6880-80 = 6800
[0184] 2) Notary C1 calls smart contract M C1 Y The deposit save function:
[0185] balancesY=80
[0186] (8) After the transfer between chain X and chain Y is successful, notary C1 notifies user A and user B respectively that the cross-chain transaction has been created:
[0187] Notary C1 has created a smart contract M on the Y chain C1 Y Address Z C1 Y , and X chain creates smart contract M C1 X Address Z C1 X , returned to user A and user B.
[0188] (9) Notary C1 publishes the secret key M of the cross-chain transaction smart contract and the cross-chain transaction information on the notary platform: {M,3030603214,A X ,100,C1,B Y ,80,B X}.
[0189] (10) User B checks the smart contract information:
[0190] ① User B checks smart contract M on chain X C1 X information.
[0191] 1) Check parameter MX3. The current date is 20211224, which is less than the smart contract M. C1 X Effective deadline, smart contract M C1 X If the deadline is not exceeded, the transaction will continue.
[0192] 2) Determine the difference between parameter MX4 and smart contract M C1 X Account Address Z C1 X If the asset balances are consistent and both are 100, the transaction continues.
[0193] 3) Determine whether the value of the release address in the transfer method is parameter MX1 X , the transaction continues.
[0194] ② User B checks smart contract M on chain Y C1 Y information.
[0195] 1) Check parameter MX3. The current date is 20211224, which is less than the smart contract M. C1 Y Effective deadline, smart contract M C1 YIf the deadline is not exceeded, the transaction will continue.
[0196] 2) Determine the difference between parameter MX4 and smart contract M C1 Y Account Address Z C1 Y If the asset balances are consistent and both are 80, the transaction continues.
[0197] 3) If the value of the release address in the release method transfer is the parameter MX1, the transaction continues. (11) After user B verifies that it is correct, user B sends a Y Make a transfer, the transfer amount is 80:
[0198] User B account address B X To address C1 Y Transfer 80:
[0199] Address B Y Asset balance = 500-80 = 420
[0200] Address C1 Y Asset balance = 6800 + 80 = 6880
[0201] (12) Notary C2 calls smart contract M through secret key M C1 x Release the transfer function:
[0202] ① The hash value is calculated by secret key M, which is consistent with parameter MX2, and the transaction continues;
[0203] ② The current transaction date 20211224 is less than or equal to the effective deadline parameter MX3 of the smart contract, and the transaction continues;
[0204] ③Account Address Z C1 X To address B x Transfer parameters MX4:100:
[0205] Address Z C1 X Asset balance = 100-100 = 0
[0206] Address B x Asset balance = 700 + 100 = 800
[0207] (13) Notary C3 calls smart contract M through secret key M C1 Y Release the transfer function:
[0208] ① The hash value is calculated by secret key M, which is consistent with parameter MX2, and the transaction continues;
[0209] ② The current transaction date 20211224 is less than or equal to the effective deadline parameter MX3 of the smart contract, and the transaction continues;
[0210] ③Account address Z C1 Y To address A y Transfer parameters MX4;80:
[0211] Address Z C1 y Asset balance = 80-80 = 0
[0212] Address A y Asset balance = 950 + 80 = 1030
[0213] (14) The cross-chain transfer transaction is completed, and the cross-chain transaction result is fed back to user A. The relevant account information is shown in Table 2:
[0214] Table 2 Relevant account information after transaction completion
[0215]
[0216]
[0217] (15) Notary C1 calls smart contract M in his spare time C1 X The destruction function and smart contract M C1 Y The destruction function of the contract, the relevant information of the destruction contract is as follows:
[0218] Serial number Smart Contracts state 1 <![CDATA[M C1 x ]]> Destroyed 2 <![CDATA[M C1 Y ]]> Destroyed
[0219] An embodiment of the present invention also provides a computer-readable storage medium capable of implementing all the steps in the method in the above embodiment, wherein a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, all the steps in the method in the above embodiment are implemented.
[0220] An embodiment of the present invention also provides an electronic device for executing the above method. As an implementation device of the method, the electronic device has at least a processor and a memory, and in particular, the memory stores data and related computer programs required for executing the method, and the processor calls the data and programs in the memory to execute all steps of the implementation method and obtains the corresponding technical effect.
[0221] Preferably, the electronic device may include a bus architecture, the bus may include any number of interconnected buses and bridges, and the bus will include various circuits linked together by one or more processors and memories. The bus may also link together various other circuits such as peripherals, voltage regulators, and power management circuits, which are all well known in the art and are therefore not further described herein. The bus interface provides an interface between the bus and the receiver and transmitter. The receiver and transmitter may be the same component, i.e., a transceiver, providing a unit for communicating with various other systems over a transmission medium. The processor is responsible for managing the bus and general processing, while the memory may be used to store data used by the processor when performing operations.
[0222] In addition, the electronic device may further include components such as a communication module, an input unit, an audio processor, a display, and a power supply. The processor (or controller, operation control) used may include a microprocessor or other processor device and / or a logic device, which receives input and controls the operation of various components of the electronic device; the memory may be one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory, or other suitable devices, which may store the above-mentioned related data information, and may also store a program for executing related information, and the processor may execute the program stored in the memory to realize information storage or processing, etc.; the input unit is used to provide input to the processor, for example, it may be a key or a touch input device; the power supply is used to provide power to the electronic device; the display is used to display display objects such as images and text, for example, it may be an LCD display. The communication module is a transmitter / receiver that sends and receives signals via an antenna. The communication module (transmitter / receiver) is coupled to the processor to provide input signals and receive output signals, which may be the same as the case of a conventional mobile communication terminal. Based on different communication technologies, multiple communication modules may be provided in the same electronic device, such as a cellular network module, a Bluetooth module and / or a wireless local area network module, etc. The communication module (transmitter / receiver) is also coupled to a speaker and a microphone via an audio processor to provide an audio output via the speaker and receive an audio input from the microphone, thereby realizing a common telecommunication function. The audio processor may include any suitable buffer, decoder, amplifier, etc. In addition, the audio processor is also coupled to a central processor, so that recording can be performed on the machine through the microphone, and the sound stored on the machine can be played through the speaker.
[0223] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0224] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A system that specifies the functions of a box or multiple boxes.
[0225] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction system, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0226] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps of the functions specified in a box or multiple boxes. Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they know the basic creative concept. Therefore, the attached claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0227] The above is only a preferred specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.
Claims
1. A method for processing cross-chain transactions by multiple notaries, characterized in that: include: The first notary creates a first cross-chain transaction smart contract on the first blockchain, and creates a second cross-chain transaction smart contract on the second blockchain; The first blockchain sends the address of the first cross-chain transaction smart contract to the first notary, and the second blockchain sends the address of the second cross-chain transaction smart contract to the first notary; The first notary transfers the transaction asset amount on the first blockchain to the address of the first cross-chain transaction smart contract, and transfers the transaction asset amount on the second blockchain to the address of the second cross-chain transaction smart contract; The first notary sends the address of the first cross-chain transaction smart contract and the address of the second cross-chain transaction smart contract to the first user who initiated the cross-chain transaction request and the second user respectively; The first notary publishes the secret keys of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract as well as the cross-chain transaction information of the first user and the second user within the notary platform; The second user verifies the information of the first cross-chain transaction smart contract and the information of the second cross-chain transaction smart contract respectively. After the verification is passed, the second user transfers the transaction asset amount on the second blockchain to the account address of the first notary on the second blockchain; The notary of the notary platform queries and proofreads the account balances of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract. After the proofreading is passed, the notary uses the secret key to release the first cross-chain transaction smart contract and the second cross-chain transaction smart contract; wherein each link is completed by each notary of the notary platform in competition; The second user obtains the transaction asset amount on the first blockchain at the account address on the first blockchain, and the first user obtains the transaction asset amount on the second blockchain at the account address on the second blockchain; Before the first notary creates a first cross-chain transaction smart contract on the first blockchain and creates a second cross-chain transaction smart contract on the second blockchain, the method further includes: The first user on the first blockchain sends a cross-chain transaction request to the first notary, requesting to conduct a transaction with the second user on the second blockchain, and the first notary is any notary on the notary platform; The first notary queries and verifies the asset balance information of his own account. After the verification is passed, the first notary sends the account address on the first blockchain to the first user, and sends the account address on the second blockchain to the second user; The first user transfers the transaction asset amount on the first blockchain to the account address of the first notary on the first blockchain.
2. The method according to claim 1, characterized in that The method also includes a notary destroying the information of the first cross-chain transaction smart contract and the information of the second cross-chain transaction smart contract respectively.
3. The method according to claim 1, characterized in that The cross-chain transaction information includes the account information of the first user on the first blockchain, the transaction asset amount on the first blockchain, the account information of the first user on the second blockchain, the account information of the second user on the second blockchain, the transaction asset amount on the second blockchain, the account information of the second user on the first blockchain, and transaction ID information.
4. The method according to any one of claims 1 to 3, characterized in that The first notary creates a first cross-chain transaction smart contract on the first blockchain, and creates a second cross-chain transaction smart contract on the second blockchain, including: The first notary generates a random number S as a secret value of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract; The first notary designs the name, variables, constant parameters, as well as the parameters and execution process of each step of deposit, query, release, contract initialization, and contract destruction.
5. The method according to claim 4, characterized in that The constant parameters include the secret value, a timestamp, a transaction asset amount on the first blockchain or the second blockchain, account information of the first user on the second blockchain, or account information of the second user on the first blockchain.
6. A system for processing cross-chain transactions by multiple notaries, characterized in that: include: Creating a smart contract module, the first notary creates a first cross-chain transaction smart contract on the first blockchain, and creates a second cross-chain transaction smart contract on the second blockchain; The first blockchain sends the address of the first cross-chain transaction smart contract to the first notary, and the second blockchain sends the address of the second cross-chain transaction smart contract to the first notary; In the first asset transaction module, the first notary transfers the transaction asset amount on the first blockchain to the address of the first cross-chain transaction smart contract, and transfers the transaction asset amount on the second blockchain to the address of the second cross-chain transaction smart contract; In the information transmission module, the first notary sends the address of the first cross-chain transaction smart contract and the address of the second cross-chain transaction smart contract to the first user who initiated the cross-chain transaction request and the second user respectively; Information publication module: the first notary publishes the secret keys of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract as well as the cross-chain transaction information of the first user and the second user within the notary platform; An information verification module, wherein the second user verifies the information of the first cross-chain transaction smart contract and the information of the second cross-chain transaction smart contract respectively. After the verification is passed, the second user transfers the transaction asset amount on the second blockchain to the account address of the first notary on the second blockchain; A notary competition processing module, in which the notary of the notary platform queries and proofreads the account balances of the first cross-chain transaction smart contract and the second cross-chain transaction smart contract. After the proofreading is passed, the first cross-chain transaction smart contract and the second cross-chain transaction smart contract are released using the secret key; wherein each link is completed by the notaries of the notary platform through competition; The second asset transaction module, wherein the second user obtains the transaction asset amount on the first blockchain from the account address on the first blockchain, and the first user obtains the transaction asset amount on the second blockchain from the account address on the second blockchain; Before the first notary creates a first cross-chain transaction smart contract on the first blockchain and creates a second cross-chain transaction smart contract on the second blockchain, the system further includes: The first user on the first blockchain sends a cross-chain transaction request to the first notary, requesting to conduct a transaction with the second user on the second blockchain, and the first notary is any notary on the notary platform; The first notary queries and verifies the asset balance information of his own account. After the verification is passed, the first notary sends the account address on the first blockchain to the first user, and sends the account address on the second blockchain to the second user; The first user transfers the transaction asset amount on the first blockchain to the account address of the first notary on the first blockchain.
7. A computer-readable storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 5 is implemented.
8. An electronic device, characterized in that: including a processor and a memory; The memory is used to store operation instructions; The processor is used to execute the method according to any one of claims 1 to 5 by calling the operation instruction.
