Multi-user relay chain cross-chain method and device based on simulation execution

Through the multi-user relay chain cross-chain method of simulated execution and verification, the design complexity problem caused by rollback in the relay chain cross-chain technology is solved, reliable cross-chain contract execution is achieved, and cross-chain trust and contract consistency are enhanced.

CN119696760BActive Publication Date: 2025-09-30SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202510039360.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-01-10
Publication Date
2025-09-30
Estimated Expiration
2045-01-10

AI Technical Summary

Technical Problem

Existing relay chain cross-chain technology relies on a rollback mechanism when an application contract call fails, which makes the design complex and is not conducive to cross-chain gaining user trust.

Method used

A multi-user relay chain cross-chain method based on simulated execution is adopted. The cross-chain information is registered through the application chain gateway agent and the relay chain gateway agent when the cross-chain information is consistent. The application contract is executed in a simulated manner and the results are recorded. After verification and voting confirmation, the contract is finally executed.

Benefits of technology

While avoiding rollbacks, it enhances cross-chain trust, simplifies contract design, and ensures the consistency of cross-chain startup and the credibility of execution results through blockchain smart contracts.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119696760B_ABST
    Figure CN119696760B_ABST
Patent Text Reader

Abstract

The present invention provides a multi-user relay chain cross-chain method and device based on simulated execution. The present invention constructs a multi-user relay chain cross-chain solution based on simulated execution. While using the relay chain to enhance cross-chain trust, it avoids the design complexity brought to the application contract by the rollback mechanism of the traditional relay chain; secondly, in the preparation stage, the cross-chain can only be started under the condition that the cross-chain information on all user chains is consistent, and the consistency of cross-chain startup is guaranteed by the blockchain smart contract; finally, the results of the simulated execution are also recorded in the blockchain and verified and confirmed by a preset number of people through voting, thereby enhancing the credibility of the execution results of this stage.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of blockchain technology, and in particular to a multi-user relay chain cross-chain method and device based on simulation execution. Background Art

[0002] In recent years, with the development of blockchain and the emergence of various blockchains, cross-chain technologies such as hash-locked time contracts, distributed key control, intermediaries, side chains, and relay chains have been proposed to solve the problem of isolated islands that cannot communicate between blockchains. Among them, relay chain cross-chain technology is the most widely used.

[0003] At present, there are many relay chain cross-chain projects both at home and abroad. Most of them rely on the rollback mechanism to achieve cross-chain cancellation when the application contract call fails. However, the rollback mechanism not only makes the design of the application contract more complicated, but also is not conducive to cross-chain gaining the trust of shallow users.

[0004] In summary, a relay cross-chain system based on simulated execution is needed to achieve trusted relay cross-chain while avoiding rollback. Summary of the Invention

[0005] The embodiments of the present invention provide a multi-user relay chain cross-chain method and device based on simulated execution, which can achieve trusted relay cross-chain while avoiding rollback.

[0006] According to one aspect of the present invention, a multi-user relay chain cross-chain method based on simulation execution is provided, comprising:

[0007] Register the cross-chain information in the cross-chain contract on the application chain based on the cross-chain information of each cross-chain user. Register it in the relay contract through the application chain gateway agent and the relay chain gateway agent. Enable the cross-chain when the cross-chain information is consistent.

[0008] After the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, reconstructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, writes the result into the relay contract through the gateway agent, and triggers the verification gateway to verify and vote on the simulation execution result;

[0009] After the voting result is passed, the cross-chain simulation execution request is received through the application chain gateway agent, the application contract is executed, and the cross-chain execution result is determined.

[0010] Optionally, the application chain gateway agent and the relay chain gateway agent are registered in the relay contract, and cross-chain is enabled when the cross-chain information is consistent, including:

[0011] Determine the cross-chain transaction contract parameters CTX of each cross-chain user Ui. The CTX includes the specific transactions Txi of each application chain and the hash value H obtained by concatenating the hash values ​​Hi of each transaction. Each cross-chain user has the authority to execute transactions on the blockchain.

[0012] Each cross-chain user Ui calls the prepare cross-chain method of the cross-chain contract on each application chain, and the calling parameter is the CTX;

[0013] After each of the application chain gateway agents monitors that the cross-chain preparation method with the cross-chain parameter CTX is called by the user, it constructs a cross-chain preparation request through CTX and Ui and sends it to the relay chain gateway agent;

[0014] After receiving the construction preparation request, the relay chain gateway agent calls the cross-chain preparation method of the relay contract with the calling parameters CTX and Ui.

[0015] Optionally, enabling cross-chain when cross-chain information is consistent includes:

[0016] After the relay contract is called, it uses the hash value H in CTX as the key to check whether there is a value corresponding to key H in the relay contract's cross-chain transaction storage;

[0017] If there is no corresponding value, the value of H with Txi as the key is stored in the cross-chain transaction storage of the relay contract, and the value is stored in the cross-chain user storage of the relay contract with H as the key and the set S containing only the contract parameters Ui as the value;

[0018] If there is a corresponding value, compare the value TXi in the cross-chain transaction storage with Txi in the CTX to see if they are consistent: if they are consistent, use H in the CTX as the key in the relay contract's user storage to obtain the corresponding set S. If the elements in S are not the same as the contract parameter Ui, add Ui to the relay contract S and store the updated S value in the relay contract storage with H as the key;

[0019] The relay contract checks the number of elements n1 contained in the set S with the key H in each cross-chain user storage. If its number is equal to the number of transactions n2 contained in the value TXi with the key H in the cross-chain transaction storage, it calls the cross-chain simulation execution method with TXi and H as parameters, and marks the cross-chain result with the key H as preparation success.

[0020] Optionally, after the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, reconstructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, and writes the result into the relay contract through the gateway agent, including:

[0021] Get TXi and H in the call parameters, construct a cross-chain simulation execution request containing a single transaction TXi and H, and send the cross-chain simulation execution request constructed by the single transaction to the corresponding application chain gateway agent in a concurrent manner;

[0022] After receiving the cross-chain simulation execution request, the gateway agent calls the cross-chain simulation execution method of the cross-chain contract in the application chain. The cross-chain parameters are still the single transaction TXi and H;

[0023] Each cross-chain contract attempts to lock the application contract to be executed. If the application chain gateway agent receives an error returned by the application contract, it will wait for a preset time and then perform the locking operation. In the locked state, it ensures that the application contract is temporarily not executed by callers other than the cross-chain contract.

[0024] The cross-chain contract calls the data acquisition method of the application contract to obtain the data value of the current application contract;

[0025] The cross-chain contract constructs a corresponding simulation method based on the method to be executed in the application contract;

[0026] The cross-chain contract executes the simulation method, and according to the execution result of the simulation method, stores the cross-chain simulation result with H as the key in the cross-chain contract;

[0027] After the gateway agent monitors the cross-chain simulation results stored in the block, it constructs a cross-chain simulation storage request containing the cross-chain simulation results and H, and sends it to the relay chain gateway agent;

[0028] The relay chain gateway agent extracts the cross-chain result in the cross-chain simulation storage request. If the result in the cross-chain simulation storage request is failure, the cross-chain simulation result with the top-level key of the relay contract being H and the second-top-level key being Hi is marked as failed, and the cross-chain result with the relay contract key being H is also marked as simulation failure, and the process ends; otherwise, the cross-chain simulation result with the top-level key of the relay contract being H and the second-top-level key being Hi is marked as pending approval.

[0029] Optionally, trigger the verification gateway to verify and vote on the simulation execution results, including:

[0030] The relay chain gateway agent extracts the verification gateway agent information in TXi and sends the verification result to the application chain gateway agent of each verification; the application chain gateway agent of each verification queries the blockchain block. If the result in the block is consistent with the received result, it sends a cross-chain simulation approval request containing TXi and H to the relay chain gateway; otherwise, it sends a cross-chain simulation opposition request containing TXi and H.

[0031] After receiving the cross-chain simulation approval or disapproval request, the relay chain gateway records the number of cross-chain simulation approval or disapproval votes with the relay contract top-level key H and the second-top-level key Hi, plus one, and the total number of votes plus one;

[0032] After the vote count is updated, if the number of votes against exceeds the upper limit, the cross-chain simulation result with the top-level key H and the second-level key Hi in the relay contract will be marked as failed, and the cross-chain result with the key H will also be marked as simulation failure, and the process ends; otherwise, if the number of votes in favor exceeds the upper limit, the cross-chain simulation with the top-level key H and the second-level key Hi in the relay contract will be marked as successful.

[0033] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and successful cross-chain simulation, then the cross-chain result with key H is marked as simulation success, and the cross-chain execution method is called with Txi and H as parameters.

[0034] Optionally, receiving the cross-chain simulation execution request through the application chain gateway agent and executing the application contract includes:

[0035] After the relay chain gateway agent monitors the cross-chain execution method being called, it obtains TXi and H from its call parameters, constructs a cross-chain execution request containing a single transaction TXi and H, and sends the cross-chain execution request constructed by the single transaction to the corresponding application chain gateway agent;

[0036] After receiving the cross-chain execution request, the application chain gateway agent calls the execution method of the cross-chain contract on the application chain.

[0037] Optionally, determining the cross-chain execution result includes:

[0038] The cross-chain contract indirectly calls the application contract of the application chain: if the call fails, it will wait for a period of time and try again until the contract call is successful; after the call is successful, the cross-chain contract unlocks the application contract and marks the application contract call as successful with the top-level key H and the second-level key Hi;

[0039] After the gateway agent monitors that the application contract with key H is successfully called, it constructs a cross-chain confirmation success request with H and TXi and sends it to the relay chain gateway agent;

[0040] After the relay chain gateway agent receives the cross-chain confirmation success request, the relay contract on the relay chain marks the cross-chain execution result with the top-level key H and the second-top-level key Hi as successful;

[0041] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract that have successfully executed cross-chain, the relay contract marks the cross-chain result with key H as successful.

[0042] According to another aspect of the present invention, a multi-user relay chain cross-chain device based on simulation execution is provided, comprising:

[0043] The preparation unit is used to register cross-chain information in the cross-chain contract on the application chain based on the cross-chain information of each cross-chain user, register it in the relay contract through the application chain gateway agent and the relay chain gateway agent, and start the cross-chain when the cross-chain information is consistent;

[0044] The simulation execution unit is used to call the cross-chain contract, lock the given application contract, reconstruct the simulation method of the application contract and execute it after the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, write the success or failure of the simulation execution result into the cross-chain contract, write the result into the relay contract through the gateway agent, and trigger the verification gateway to verify and vote on the simulation execution result;

[0045] The confirmation execution unit is used to receive the cross-chain simulation execution request through the application chain gateway agent after the voting result is passed, execute the application contract, and determine the cross-chain execution result.

[0046] According to another aspect of the present invention, an electronic device is provided, comprising:

[0047] At least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the multi-user relay chain cross-chain method based on simulation execution described in any embodiment of the present invention.

[0048] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the multi-user relay chain cross-chain method based on simulation execution according to any embodiment of the present invention when executed.

[0049] The embodiments of the present invention provide a multi-user relay chain cross-chain method and device based on simulated execution. A multi-user relay chain cross-chain solution is constructed based on simulated execution. While using the relay chain to enhance cross-chain trust, it avoids the design complexity brought to the application contract by the rollback mechanism of the traditional relay chain. Secondly, in the preparation stage, the cross-chain can only be started under the condition that the cross-chain information on all user chains is consistent. The consistency of cross-chain startup is guaranteed by the blockchain smart contract. Finally, the results of the simulated execution are also recorded in the blockchain and verified and voted by a preset number of people, thereby enhancing the credibility of the execution results of this stage.

[0050] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0051] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.

[0052] Figure 1 This is a flowchart of a multi-user relay chain cross-chain method based on simulation execution provided by one embodiment of the present invention;

[0053] Figure 2 This is a cross-chain data infrastructure diagram provided by one embodiment of the present invention;

[0054] Figure 3 This is a schematic diagram of a contract storage provided by an embodiment of the present invention;

[0055] Figure 4 Schematic diagram of a cross-chain architecture provided by one embodiment of the present invention;

[0056] Figure 5 1 is a schematic diagram of the structure of a multi-user relay chain cross-chain device based on simulation execution provided by one embodiment of the present invention;

[0057] Figure 6 2 is a schematic diagram of the structure of an electronic device for implementing the multi-user relay chain cross-chain method based on simulation execution according to an embodiment of the present invention. DETAILED DESCRIPTION

[0058] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions 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 part of the embodiments of the present invention, not all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present invention.

[0059] It should be noted that the terms "first", "second", etc. in the description 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 numbers 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 clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0060] Blockchain: A blockchain is a distributed, shared ledger. Within a blockchain, data is stored by multiple parties, who use consensus algorithms to achieve data consistency across multiple nodes. Data in a blockchain can only be appended, not deleted or modified. New blockchains are programmable. Using smart contracts, users can encode business rules into the blockchain. Rules (code), like data, cannot be deleted or modified. Code is automatically executed upon invocation and cannot be skipped. The results of execution are also recorded on the blockchain. Because data is stored by multiple parties and cannot be tampered with, blockchain enables trusted data sharing among multiple parties.

[0061] Cross-chain technology: Cross-chain technology is a technology that enables the transfer and circulation of value between different blockchain systems through specific mechanisms, breaking the barriers that prevent traditional blockchains from communicating with each other and forming a larger blockchain network. The development of cross-chain technology will help blockchain technology be applied and implemented in more fields, thereby promoting the development and growth of the entire blockchain industry.

[0062] Figure 1 This is a flowchart of a multi-user relay chain cross-chain method based on simulation execution provided by one embodiment of the present invention. Figure 1 As shown, the method may include the following steps:

[0063] S110. Register the cross-chain information in the cross-chain contract on the application chain according to the cross-chain information of each cross-chain user, register it in the relay contract through the application chain gateway agent and the relay chain gateway agent, and start the cross-chain when the cross-chain information is consistent.

[0064] In an embodiment of the present invention, the process of registering in the relay contract through the application chain gateway agent and the relay chain gateway agent, and enabling cross-chain when the cross-chain information is consistent, includes:

[0065] Determine the cross-chain transaction contract parameters CTX of each cross-chain user Ui. The CTX includes the specific transactions Txi of each application chain and the hash value H obtained by concatenating the hash values ​​Hi of each transaction. Each cross-chain user has the authority to execute transactions on the blockchain.

[0066] Each cross-chain user Ui calls the prepare cross-chain method of the cross-chain contract on each application chain, and the calling parameter is the CTX;

[0067] After each of the application chain gateway agents monitors that the cross-chain preparation method with the cross-chain parameter CTX is called by the user, it constructs a cross-chain preparation request through CTX and Ui and sends it to the relay chain gateway agent;

[0068] After receiving the construction preparation request, the relay chain gateway agent calls the cross-chain preparation method of the relay contract with the calling parameters CTX and Ui.

[0069] In the embodiment of the present invention, the enabling of cross-chain when cross-chain information is consistent includes:

[0070] After the relay contract is called, it uses the hash value H in CTX as the key to check whether there is a value corresponding to key H in the relay contract's cross-chain transaction storage;

[0071] If there is no corresponding value, the value of H with Txi as the key is stored in the cross-chain transaction storage of the relay contract, and the value is stored in the cross-chain user storage of the relay contract with H as the key and the set S containing only the contract parameters Ui as the value;

[0072] If there is a corresponding value, compare the value TXi in the cross-chain transaction storage with Txi in the CTX to see if they are consistent: if they are consistent, use H in the CTX as the key in the relay contract's user storage to obtain the corresponding set S. If the elements in S are not the same as the contract parameter Ui, add Ui to the relay contract S and store the updated S value in the relay contract storage with H as the key;

[0073] The relay contract checks the number of elements n1 contained in the set S with the key H in each cross-chain user storage. If its number is equal to the number of transactions n2 contained in the value TXi with the key H in the cross-chain transaction storage, it calls the cross-chain simulation execution method with TXi and H as parameters, and marks the cross-chain result with the key H as preparation success.

[0074] The above is the preparatory stage for cross-chain operations. Each user {Ui (i = 1, 2, 3, 4, 5, ...)} negotiates and confirms the cross-chain transaction CTX offline. CTX contains information such as the specific transactions {TXi (i = 1, 2, 3, 4, 5, ...)} of each application chain and the concatenated hash value H of each transaction hash {Hi (i = 1, 2, 3, 4, 5, ...)}. Hi is stored in Txi. User Ui has permission to execute transaction TXi on the blockchain (i.e., it has the key required to sign the transaction). Figure 2 This is a cross-chain data infrastructure diagram provided by one embodiment of the present invention.

[0075] Figure 3 This is a schematic diagram of a contract storage provided by an embodiment of the present invention. Each user {Ui (i=1, 2, 3, 4, 5, ...)} calls the prepare cross-chain method of the cross-chain contract on each application chain, and the calling parameter is CTX.

[0076] After the gateway agent corresponding to each application chain hears that the cross-chain preparation method with the cross-chain parameter CTX is called by user Ui, it uses CTX and Ui to construct a cross-chain preparation request and sends it to the relay chain gateway agent.

[0077] After receiving the construction preparation request, the relay chain gateway agent calls the cross-chain preparation method of the relay contract with the calling parameters CTX and Ui.

[0078] After the relay contract is called, the hash value H in CTX is used as the key to check whether there is a value corresponding to key H in the cross-chain transaction storage of the relay contract.

[0079] If there is no corresponding value, the relay contract uses {TXi (i = 1, 2, 3, 4, 5, ...)} as the value of key H, and stores it in the relay contract's cross-chain transaction storage, and stores it in the relay contract's cross-chain user storage with H as the key and a set S containing only contract parameters Ui as the value;

[0080] If there is a corresponding value, compare the value {TXi (i = 1, 2, 3, 4, 5, ...)} in the cross-chain transaction storage with {TXi (i = 1, 2, 3, 4, 5, ...)} in the contract parameter CTX for consistency: If they are consistent, use H in CTX as the key in the user storage of the relay contract to obtain the corresponding set S. If the elements in S are not the same as the contract parameter Ui, add Ui to the relay S and store the updated S value in the relay contract storage with H as the key; if they are inconsistent, no processing is done.

[0081] The relay contract checks the number of elements n1 contained in the set S with key H in the user storage. If its number is equal to the number of transactions n2 contained in the value {TXi (i = 1, 2, 3, 4, 5, ...)} with key H in the cross-chain transaction storage, it calls the cross-chain simulation execution method with TXi (i = 1, 2, 3, 4, 5, ...) and H as parameters, and marks the cross-chain result with key H as prepared successfully; otherwise, the execution ends.

[0082] S120. After the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, reconstructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, writes the result into the relay contract through the gateway agent, and triggers the verification gateway to verify and vote on the simulation execution result.

[0083] In an embodiment of the present invention, after the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, reconstructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, and writes the result into the relay contract through the gateway agent, including:

[0084] Get TXi and H in the call parameters, construct a cross-chain simulation execution request containing a single transaction TXi and H, and send the cross-chain simulation execution request constructed by the single transaction to the corresponding application chain gateway agent in a concurrent manner;

[0085] After receiving the cross-chain simulation execution request, the gateway agent calls the cross-chain simulation execution method of the cross-chain contract in the application chain. The cross-chain parameters are still the single transaction TXi and H;

[0086] Each cross-chain contract attempts to lock the application contract to be executed. If the application chain gateway agent receives an error returned by the application contract, it will wait for a preset time and then perform the locking operation. In the locked state, it ensures that the application contract is temporarily not executed by callers other than the cross-chain contract.

[0087] The cross-chain contract calls the data acquisition method of the application contract to obtain the data value of the current application contract;

[0088] The cross-chain contract constructs a corresponding simulation method based on the method to be executed in the application contract;

[0089] The cross-chain contract executes the simulation method, and according to the execution result of the simulation method, stores the cross-chain simulation result with H as the key in the cross-chain contract;

[0090] After the gateway agent monitors the cross-chain simulation results stored in the block, it constructs a cross-chain simulation storage request containing the cross-chain simulation results and H, and sends it to the relay chain gateway agent;

[0091] The relay chain gateway agent extracts the cross-chain result in the cross-chain simulation storage request. If the result in the cross-chain simulation storage request is failure, the cross-chain simulation result with the top-level key of the relay contract being H and the second-top-level key being Hi is marked as failed, and the cross-chain result with the relay contract key being H is also marked as simulation failure, and the process ends; otherwise, the cross-chain simulation result with the top-level key of the relay contract being H and the second-top-level key being Hi is marked as pending approval.

[0092] In an embodiment of the present invention, triggering the verification gateway to verify and voting on the simulation execution result includes:

[0093] The relay chain gateway agent extracts the verification gateway agent information in TXi and sends the verification result to the application chain gateway agent of each verification; the application chain gateway agent of each verification queries the blockchain block. If the result in the block is consistent with the received result, it sends a cross-chain simulation approval request containing TXi and H to the relay chain gateway; otherwise, it sends a cross-chain simulation opposition request containing TXi and H.

[0094] After the relay chain gateway receives the cross-chain simulation approval or disapproval request, it records the number of cross-chain simulation approval or disapproval votes with the top-level key of the relay contract being H and the second-top-level key being Hi, plus one, and the total number of votes plus one.

[0095] After the vote count is updated, if the number of votes against exceeds the upper limit, the cross-chain simulation result with the top-level key H and the second-level key Hi in the relay contract will be marked as failed, and the cross-chain result with the key H will also be marked as simulation failure, and the process ends; otherwise, if the number of votes in favor exceeds the upper limit, the cross-chain simulation with the top-level key H and the second-level key Hi in the relay contract will be marked as successful.

[0096] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and successful cross-chain simulation, then the cross-chain result with key H is marked as simulation success, and the cross-chain execution method is called with Txi and H as parameters.

[0097] The above is the simulated execution phase of cross-chain execution. After the relay gateway agent monitors the call of the cross-chain simulated execution method of the relay chain contract, it obtains TXi (i = 1, 2, 3, 4, 5, ...) and H in its call parameters. It constructs a cross-chain simulated execution request containing a single transaction TXi and H, and sends the cross-chain simulated execution request constructed by the single transaction to the corresponding application chain gateway agent in a concurrent manner.

[0098] After receiving the cross-chain simulation execution request, the gateway agent of the application chain calls the cross-chain simulation execution method of the cross-chain contract in the application chain. The cross-chain parameters are still the single transaction TXi and H.

[0099] The cross-chain contracts of each application chain attempt to lock the application contract to be executed. If the locking fails because the application contract has been locked, the application chain gateway agent will wait for a period of time after receiving the error returned by the application contract and retry the locking operation; if the locking is successful, the application contract is temporarily not executed by callers other than the cross-chain contract.

[0100] The cross-chain contract of the application chain calls the data acquisition method of the application contract to obtain the data value of the current application contract;

[0101] The cross-chain contract of the application chain is constructed according to the method to be executed in the application contract and the corresponding simulation method (data acquisition is changed to obtain the data obtained from the above cross-chain contract, the data storage method is omitted, and the rest of the logic remains unchanged).

[0102] The cross-chain contract of the application chain executes the constructed simulation method, and based on the success / failure of the execution of the simulation method, stores the cross-chain simulation result (including TXi and success / failure) with H as the key in the cross-chain contract.

[0103] After the gateway agent of the application chain monitors the cross-chain simulation results stored in the block, it constructs a cross-chain simulation storage request containing the cross-chain simulation results and H, and sends it to the relay chain gateway agent.

[0104] The relay chain gateway agent extracts the cross-chain result in the cross-chain simulation storage request. If the result in the cross-chain simulation storage request is failure, the cross-chain simulation result with the relay contract top-level key H and the second-top-level key Hi is marked as failed, and the cross-chain result with the relay contract key H is also marked as simulation failure, and the process ends; otherwise, the cross-chain simulation result with the relay contract top-level key H and the second-top-level key Hi is marked as pending approval, and the next step is executed.

[0105] The relay chain gateway agent extracts the verification gateway agent information in TXi and sends the verification result to the application chain gateway agent of each verification; the application chain gateway agent of each verification queries the blockchain block. If the result in the block is consistent with the received result, it sends a cross-chain simulation approval request containing TXi and H to the relay chain gateway; otherwise, it sends a cross-chain simulation opposition request containing TXi and H.

[0106] After receiving a cross-chain simulation approval / disapproval request, the relay chain gateway records the number of approval / disapproval votes for the cross-chain simulation with the relay contract's top-level key H and the second-level key Hi, and increments the total number of votes by one. After the vote count is updated, if the number of disapproval votes exceeds the upper limit, the cross-chain simulation result with the top-level key H and the second-level key Hi in the relay contract is marked as failed, and the cross-chain result with key H is also marked as simulation failure, and the simulation ends. Otherwise, if the number of approval votes exceeds the upper limit, the cross-chain simulation result with the top-level key H and the second-level key Hi in the relay contract is marked as successful.

[0107] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with key H at the top level in the relay contract and the cross-chain simulation is successful, then the cross-chain result with key H is marked as simulation successful, and the cross-chain execution method is called with {TXi (i=1,2,3,4,5,…)} and H as parameters.

[0108] S130. After the voting result is passed, the cross-chain simulation execution request is received through the application chain gateway agent, the application contract is executed, and the cross-chain execution result is determined.

[0109] In an embodiment of the present invention, receiving the cross-chain simulation execution request through the application chain gateway agent and executing the application contract includes:

[0110] After the relay chain gateway agent monitors the cross-chain execution method being called, it obtains TXi and H from its call parameters, constructs a cross-chain execution request containing a single transaction TXi and H, and sends the cross-chain execution request constructed by the single transaction to the corresponding application chain gateway agent;

[0111] After receiving the cross-chain execution request, the application chain gateway agent calls the execution method of the cross-chain contract on the application chain.

[0112] In an embodiment of the present invention, determining the cross-chain execution result includes:

[0113] The cross-chain contract indirectly calls the application contract of the application chain: if the call fails, it will wait for a period of time and try again until the contract call is successful; after the call is successful, the cross-chain contract unlocks the application contract and marks the application contract call as successful with the top-level key H and the second-level key Hi;

[0114] After the gateway agent monitors that the application contract with key H is successfully called, it constructs a cross-chain confirmation success request with H and TXi and sends it to the relay chain gateway agent;

[0115] After the relay chain gateway agent receives the cross-chain confirmation success request, the relay contract on the relay chain marks the cross-chain execution result with the top-level key H and the second-top-level key Hi as successful;

[0116] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract that have successfully executed cross-chain, the relay contract marks the cross-chain result with key H as successful.

[0117] The above is the confirmation execution phase of cross-chain execution. After the relay chain gateway agent listens to the cross-chain execution method being called, it obtains TXi (i = 1, 2, 3, 4, 5, ...) and H in its call parameters. It constructs a cross-chain execution request containing a single transaction TXi and H, and sends the cross-chain execution request constructed by the single transaction to the corresponding application chain gateway agent in a concurrent manner.

[0118] After receiving the cross-chain execution request, the application chain gateway agent calls the execution method of the cross-chain contract on the application chain.

[0119] The cross-chain contract indirectly calls the application contract of the application chain: if the call fails, it will wait for a period of time and try again until the contract call is successful (since the successful simulation execution of the aforementioned application contract indicates that there is no problem with the contract call method and parameters, and the distributed nature of the blockchain also makes the probability of service unavailability extremely small, so the probability of failure here is extremely small); after the call is successful, the cross-chain contract unlocks the application contract and marks the application contract call as successful with the top-level key H and the second-top-level key Hi.

[0120] After the gateway agent of the application chain monitors that the application contract with key H is successfully called, it constructs a cross-chain confirmation success request with H and TXi and sends it to the relay chain gateway agent.

[0121] After the relay chain gateway agent receives the cross-chain confirmation success request, the relay contract on the relay chain marks the cross-chain execution result with the top-level key H and the second-top-level key Hi as successful.

[0122] If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with key H at the top level in the relay contract that have successfully executed cross-chain transactions, the relay contract marks the cross-chain result with key H as successful.

[0123] Figure 4 This is a schematic diagram of a cross-chain architecture provided by one embodiment of the present invention. This solution constructs a multi-user relay chain cross-chain solution based on simulated execution. While using the relay chain to enhance cross-chain trust, it also avoids the design complexity that the traditional relay chain rollback mechanism brings to application contracts. Secondly, during the preparation phase, cross-chain can only be initiated when cross-chain information on all user chains is consistent. Blockchain smart contracts ensure the consistency of cross-chain initiation. Finally, the results of the simulated execution are also recorded on the blockchain and verified and voted on by a preset number of people, enhancing the credibility of the execution results at this stage.

[0124] Figure 5 1 is a schematic diagram of a multi-user relay chain cross-chain device based on simulation execution provided by one embodiment of the present invention, comprising:

[0125] Preparation unit 510, used to register cross-chain information in the cross-chain contract on the application chain according to the cross-chain information of each cross-chain user, register it in the relay contract through the application chain gateway agent and the relay chain gateway agent, and start the cross-chain when the cross-chain information is consistent;

[0126] The simulation execution unit 520 is used to call the cross-chain contract, lock the given application contract, reconstruct the simulation method of the application contract and execute it after the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, write the success or failure of the simulation execution result into the cross-chain contract, write the result into the relay contract through the gateway agent, and trigger the verification gateway to verify and vote on the simulation execution result;

[0127] The confirmation execution unit 530 is used to receive the cross-chain simulation execution request through the application chain gateway agent after the voting result is passed, execute the application contract, and determine the cross-chain execution result.

[0128] It should be understood that the structure illustrated in the embodiments of the present invention does not constitute a specific limitation on the multi-user relay chain cross-chain device based on simulation execution. In other embodiments of the present invention, the multi-user relay chain cross-chain device based on simulation execution may include more or fewer components than shown in the figure, or combine or split some components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.

[0129] The information interaction, execution process, etc. between the units in the above-mentioned device are based on the same concept as the embodiment of the method of the present invention. For specific contents, please refer to the description in the embodiment of the method of the present invention and will not be repeated here.

[0130] Figure 6 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0131] like Figure 6As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0132] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0133] Processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any appropriate processor, controller, microcontroller, etc. Processor 11 executes the various methods and processes described above, such as the multi-user relay chain cross-chain method based on simulation execution.

[0134] In some embodiments, the multi-user relay chain cross-chain method based on simulated execution can be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program can be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the multi-user relay chain cross-chain method based on simulated execution described above can be performed. Alternatively, in other embodiments, the processor 11 can be configured to execute the multi-user relay chain cross-chain method based on simulated execution by any other appropriate means (for example, by means of firmware).

[0135] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0136] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when the computer program is executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer program may be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0137] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0138] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0139] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0140] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0141] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0142] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A multi-user relay chain cross-chain method based on simulation execution, characterized by: include: Register the cross-chain information in the cross-chain contract on the application chain based on the cross-chain information of each cross-chain user. Register it in the relay contract through the application chain gateway agent and the relay chain gateway agent. Enable the cross-chain when the cross-chain information is consistent. After the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, reconstructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, writes the result into the relay contract through the gateway agent, and triggers the verification gateway to verify and vote on the simulation execution result; After the voting result is passed, the cross-chain simulation execution request is received through the application chain gateway agent, the application contract is executed, and the cross-chain execution result is determined; The above mentioned steps are registered in the relay contract through the application chain gateway agent and the relay chain gateway agent, and cross-chain is enabled when the cross-chain information is consistent, including: Determine the cross-chain transaction contract parameters CTX of each cross-chain user Ui. The CTX includes the specific transactions Txi of each application chain and the hash value H obtained by concatenating the hash values ​​Hi of each transaction. Each cross-chain user has the authority to execute transactions on the blockchain. Each cross-chain user Ui calls the prepare cross-chain method of the cross-chain contract on each application chain, and the calling parameter is the CTX; After each of the application chain gateway agents monitors that the cross-chain preparation method with the cross-chain parameter CTX is called by the user, it constructs a cross-chain preparation request through CTX and Ui and sends it to the relay chain gateway agent; After receiving the construction preparation request, the relay chain gateway agent calls the cross-chain preparation method of the relay contract with the calling parameters CTX and Ui; The process of enabling cross-chain when cross-chain information is consistent includes: After the relay contract is called, it uses the hash value H in CTX as the key to check whether there is a value corresponding to key H in the relay contract's cross-chain transaction storage; If there is no corresponding value, the value of H with Txi as the key is stored in the cross-chain transaction storage of the relay contract, and the value is stored in the cross-chain user storage of the relay contract with H as the key and the set S containing only the contract parameters Ui as the value; If there is a corresponding value, compare the value TXi in the cross-chain transaction storage with Txi in the CTX to see if they are consistent: if they are consistent, use H in the CTX as the key in the user storage of the relay contract to obtain the corresponding set S. If the elements in S are not the same as the contract parameter Ui, add Ui to the set S and store the updated S value in the relay contract user storage with H as the key; The relay contract checks the number of elements n1 contained in the set S with the key H in each cross-chain user storage. If its number is equal to the number of transactions n2 contained in the value TXi with the key H in the cross-chain transaction storage, it calls the cross-chain simulation execution method with TXi and H as parameters, and marks the cross-chain result with the key H as preparation success.

2. The method according to claim 1, characterized in that After the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, it calls the cross-chain contract, locks the given application contract, reconstructs the simulation method of the application contract and executes it, writes the success or failure of the simulation execution result into the cross-chain contract, and writes the result into the relay contract through the gateway agent, including: Get TXi and H in the call parameters, construct a cross-chain simulation execution request containing a single transaction TXi and H, and send the cross-chain simulation execution request constructed by the single transaction to the corresponding application chain gateway agent in a concurrent manner; After receiving the cross-chain simulation execution request, the gateway agent calls the cross-chain simulation execution method of the cross-chain contract in the application chain. The cross-chain parameters are still the single transaction TXi and H; Each cross-chain contract attempts to lock the application contract to be executed. If the application chain gateway agent receives an error returned by the application contract, it will wait for a preset time and then perform the locking operation. In the locked state, it ensures that the application contract is temporarily not executed by callers other than the cross-chain contract. The cross-chain contract calls the data acquisition method of the application contract to obtain the data value of the current application contract; The cross-chain contract constructs a corresponding simulation method based on the method to be executed in the application contract; The cross-chain contract executes the simulation method, and according to the execution result of the simulation method, stores the cross-chain simulation result with H as the key in the cross-chain contract; After the gateway agent monitors the cross-chain simulation results stored in the block, it constructs a cross-chain simulation storage request containing the cross-chain simulation results and H, and sends it to the relay chain gateway agent; The relay chain gateway agent extracts the cross-chain result in the cross-chain simulation storage request. If the result in the cross-chain simulation storage request is failure, the cross-chain simulation result with the top-level key of the relay contract being H and the second-top-level key being Hi is marked as failed, and the cross-chain result with the relay contract key being H is also marked as simulation failure, and the process ends; otherwise, the cross-chain simulation result with the top-level key of the relay contract being H and the second-top-level key being Hi is marked as pending approval.

3. The method according to claim 2, characterized in that Triggering the verification gateway to verify and vote on simulation execution results, including: The relay chain gateway agent extracts the verification gateway agent information in TXi and sends the verification result to the application chain gateway agent of each verification; the application chain gateway agent of each verification queries the blockchain block. If the result in the block is consistent with the received result, it sends a cross-chain simulation approval request containing TXi and H to the relay chain gateway; otherwise, it sends a cross-chain simulation opposition request containing TXi and H; After receiving the cross-chain simulation approval or disapproval request, the relay chain gateway records the number of cross-chain simulation approval or disapproval votes with the relay contract top-level key H and the second-top-level key Hi, plus one, and the total number of votes plus one; After the vote count is updated, if the number of votes against exceeds the upper limit, the cross-chain simulation result with the top-level key H and the second-level key Hi in the relay contract will be marked as failed, and the cross-chain result with the key H will also be marked as simulation failure, and the process ends; otherwise, if the number of votes in favor exceeds the upper limit, the cross-chain simulation with the top-level key H and the second-level key Hi in the relay contract will be marked as successful; If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract and successful cross-chain simulation, then the cross-chain result with key H is marked as simulation success, and the cross-chain execution method is called with Txi and H as parameters.

4. The method according to claim 1, wherein The receiving the cross-chain simulation execution request through the application chain gateway agent and executing the application contract includes: After the relay chain gateway agent monitors the cross-chain execution method being called, it obtains TXi and H from its call parameters, constructs a cross-chain execution request containing a single transaction TXi and H, and sends the cross-chain execution request constructed by the single transaction to the corresponding application chain gateway agent; After receiving the cross-chain execution request, the application chain gateway agent calls the execution method of the cross-chain contract on the application chain.

5. According to the method of claim 1, determining the cross-chain execution result comprises: The cross-chain contract indirectly calls the application contract of the application chain: if the call fails, it will wait for a period of time and try again until the contract call succeeds; After the call is successful, the cross-chain contract unlocks the application contract and marks the application contract call as successful with the top-level key H and the second-level key Hi; After the gateway agent monitors that the application contract with key H is successfully called, it constructs a cross-chain confirmation success request with H and TXi and sends it to the relay chain gateway agent; After the relay chain gateway agent receives the cross-chain confirmation success request, the relay contract on the relay chain marks the cross-chain execution result with the top-level key H and the second-top-level key Hi as successful; If the number of transactions in the cross-chain transaction storage with key H in the relay contract is the same as the number of transactions with top-level key H in the relay contract that have successfully executed cross-chain, the relay contract marks the cross-chain result with key H as successful.

6. A device using the multi-user relay chain cross-chain method based on simulation execution according to claim 1, characterized in that: include: The preparation unit is used to register cross-chain information in the cross-chain contract on the application chain based on the cross-chain information of each cross-chain user, register it in the relay contract through the application chain gateway agent and the relay chain gateway agent, and start the cross-chain when the cross-chain information is consistent; The simulation execution unit is used to call the cross-chain contract, lock the given application contract, reconstruct the simulation method of the application contract and execute it after the application chain gateway agent receives the cross-chain simulation execution request constructed by the relay chain gateway, write the success or failure of the simulation execution result into the cross-chain contract, write the result into the relay contract through the gateway agent, and trigger the verification gateway to verify and vote on the simulation execution result; The confirmation execution unit is used to receive the cross-chain simulation execution request through the application chain gateway agent after the voting result is passed, execute the application contract, and determine the cross-chain execution result.

7. An electronic device, characterized in that include: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the multi-user relay chain cross-chain method based on simulation execution according to any one of claims 1 to 5.

8. A computer-readable medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the multi-user relay chain cross-chain method based on simulation execution according to any one of claims 1 to 5 when executed.

Citation Information

Patent Citations

  • Method for guaranteeing consistency of cross-blockchain transactions of blockchain

    CN112507393A

  • System and method for universal blockchain interoperability

    US20200278958A1